diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/fill_layout.lua | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/scripts/fill_layout.lua b/scripts/fill_layout.lua index 94a0cd94..c0ecf890 100755 --- a/scripts/fill_layout.lua +++ b/scripts/fill_layout.lua @@ -7,6 +7,10 @@ -- anchors, but ignore the actual TOC. local p = io.popen('markdown -f toc -T ' .. arg[1]) local html = p:read('*a'):match('^.-\n</ul>\n(.+)$') +html = html:gsub('<h(%d) id="([^"]+)"', function(n, id) + id = id:gsub('%p+', '-'):gsub('%-$', ''):lower() + return string.format('<h%d id="%s"', n, id) +end) p:close() -- Fill in HTML layout (stdin) with markdown output and print the result. |