From bbbab8880f7ffdbe22db008ea069ae8dd6d1a22e Mon Sep 17 00:00:00 2001 From: dvs1 Date: Fri, 14 Mar 2025 22:22:00 +1000 Subject: Add a top link to headings. --- notYetAnotherWiki.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'notYetAnotherWiki.lua') diff --git a/notYetAnotherWiki.lua b/notYetAnotherWiki.lua index 7d79304..974fde6 100755 --- a/notYetAnotherWiki.lua +++ b/notYetAnotherWiki.lua @@ -712,7 +712,7 @@ end function Writer.header(s, level) local text = Lunamark.util.rope_to_string(s) - return '' .. text .. '' + return '' .. text .. ' 👆' end local OgWriterLink = Writer.link -- So we can call the original from within mine, we are just changing the URL. function Writer.link(lab, url, tit) @@ -780,14 +780,14 @@ for name, file in pairs(Files) do if bit == f then metadata.menu = metadata.menu .. '

' .. title .. '

' for j, g in ipairs(file.headers) do + local beg, en = RE.find(g, [['{']]) + if nil ~= beg then + g = string.sub(g, 1, beg - 2) + end local h = string.sub(RE.gsub(g, '{[#]}', ''), 2) local l = string.len(g) - string.len(h) g = h h = RE.gsub(h, '{[ ]}', ' ') - local beg, en = RE.find(h, [['{']]) - if nil ~= beg then - g = string.sub(h, 1, beg - 7) - end -- FIXME - if it's a linky, strip off the URL part. The Wiki audit has such things. metadata.menu = metadata.menu .. '

' .. string.rep(' ', l) .. '' .. h .. '

' end -- cgit v1.1