From 6be63601ba1c2cd76aa1eca2ee349492f3360aa4 Mon Sep 17 00:00:00 2001
From: dvs1
Date: Fri, 14 Mar 2025 21:34:10 +1000
Subject: Make the TOC actually work.
---
notYetAnotherWiki.lua | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
(limited to 'notYetAnotherWiki.lua')
diff --git a/notYetAnotherWiki.lua b/notYetAnotherWiki.lua
index f124eeb..3590af7 100755
--- a/notYetAnotherWiki.lua
+++ b/notYetAnotherWiki.lua
@@ -710,6 +710,10 @@ local lunaLinky = function(url) -- Fix up the links.
return url
end
+function Writer.header(s, level)
+ local text = table.concat(s)
+ return '
' .. title .. '
' for j, g in ipairs(file.headers) do - g = RE.gsub(g, '{[#]}', ' ') - g = RE.gsub(g, '{[ ]}', ' ') - local beg, en = RE.find(g, [['{']]) + 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(g, 1, beg - 7) + 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 .. '' .. g .. '
' + metadata.menu = metadata.menu .. '' .. string.rep(' ', l) .. '' .. h .. '
' end else if nil ~= url then metadata.menu = metadata.menu .. '' -- cgit v1.1