aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/notYetAnotherWiki.lua
diff options
context:
space:
mode:
authordvs12025-03-14 22:22:00 +1000
committerdvs12025-03-14 22:22:00 +1000
commitbbbab8880f7ffdbe22db008ea069ae8dd6d1a22e (patch)
treeaf751ec174fb588db33b2c9ab0ae1a2b3dcc679f /notYetAnotherWiki.lua
parentMake the last commit actually work. (diff)
downloadnotYetAnotherWiki-bbbab8880f7ffdbe22db008ea069ae8dd6d1a22e.zip
notYetAnotherWiki-bbbab8880f7ffdbe22db008ea069ae8dd6d1a22e.tar.gz
notYetAnotherWiki-bbbab8880f7ffdbe22db008ea069ae8dd6d1a22e.tar.bz2
notYetAnotherWiki-bbbab8880f7ffdbe22db008ea069ae8dd6d1a22e.tar.xz
Add a top link to headings.
Diffstat (limited to 'notYetAnotherWiki.lua')
-rwxr-xr-xnotYetAnotherWiki.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/notYetAnotherWiki.lua b/notYetAnotherWiki.lua
index 7d79304..974fde6 100755
--- a/notYetAnotherWiki.lua
+++ b/notYetAnotherWiki.lua
@@ -712,7 +712,7 @@ end
712 712
713function Writer.header(s, level) 713function Writer.header(s, level)
714 local text = Lunamark.util.rope_to_string(s) 714 local text = Lunamark.util.rope_to_string(s)
715 return '<h' .. level .. ' id="' .. RE.gsub(text, '{[ ]}', '_') .. '">' .. text .. '</h' .. level .. '>' 715 return '<h' .. level .. ' id="' .. RE.gsub(text, '{[ ]}', '_') .. '">' .. text .. ' <a style="font-size: 0.42em;" href="#top">👆</a></h' .. level .. '>'
716end 716end
717local OgWriterLink = Writer.link -- So we can call the original from within mine, we are just changing the URL. 717local OgWriterLink = Writer.link -- So we can call the original from within mine, we are just changing the URL.
718function Writer.link(lab, url, tit) 718function Writer.link(lab, url, tit)
@@ -780,14 +780,14 @@ for name, file in pairs(Files) do
780 if bit == f then 780 if bit == f then
781 metadata.menu = metadata.menu .. '<p>' .. title .. '</p>' 781 metadata.menu = metadata.menu .. '<p>' .. title .. '</p>'
782 for j, g in ipairs(file.headers) do 782 for j, g in ipairs(file.headers) do
783 local beg, en = RE.find(g, [['{']])
784 if nil ~= beg then
785 g = string.sub(g, 1, beg - 2)
786 end
783 local h = string.sub(RE.gsub(g, '{[#]}', ''), 2) 787 local h = string.sub(RE.gsub(g, '{[#]}', ''), 2)
784 local l = string.len(g) - string.len(h) 788 local l = string.len(g) - string.len(h)
785 g = h 789 g = h
786 h = RE.gsub(h, '{[ ]}', '&nbsp;') 790 h = RE.gsub(h, '{[ ]}', '&nbsp;')
787 local beg, en = RE.find(h, [['{']])
788 if nil ~= beg then
789 g = string.sub(h, 1, beg - 7)
790 end
791-- FIXME - if it's a linky, strip off the URL part. The Wiki audit has such things. 791-- FIXME - if it's a linky, strip off the URL part. The Wiki audit has such things.
792 metadata.menu = metadata.menu .. '<p>' .. string.rep('&nbsp;', l) .. '<a style="font-size: 0.80em;" href="#' .. RE.gsub(g, '{[ ]}', '_') .. '">' .. h .. '</a></p>' 792 metadata.menu = metadata.menu .. '<p>' .. string.rep('&nbsp;', l) .. '<a style="font-size: 0.80em;" href="#' .. RE.gsub(g, '{[ ]}', '_') .. '">' .. h .. '</a></p>'
793 end 793 end