diff options
author | 2021-04-11 09:34:17 -0400 | |
---|---|---|
committer | 2021-04-11 09:34:17 -0400 | |
commit | de3a745e1af2e441de868c2aa4849102d376acb5 (patch) | |
tree | c2d7767600dc519b2613ddecaf7e53fb5e8867a2 /scripts/fill_layout.lua | |
parent | 03fab17277fee7387fd93a9c2774b1ebf3f80fe4 (diff) | |
download | textadept-de3a745e1af2e441de868c2aa4849102d376acb5.tar.gz textadept-de3a745e1af2e441de868c2aa4849102d376acb5.zip |
Initial pass reformatting all code.
Use clang-format, LuaFormatter, and 100 character limit on lines.
Diffstat (limited to 'scripts/fill_layout.lua')
-rwxr-xr-x | scripts/fill_layout.lua | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/scripts/fill_layout.lua b/scripts/fill_layout.lua index a60584dc..a1b236cd 100755 --- a/scripts/fill_layout.lua +++ b/scripts/fill_layout.lua @@ -1,10 +1,9 @@ #!/usr/bin/lua --- Filters the given file through markdown, inserts it into the template --- specified by stdin by replacing simple {{ variable }} tags, and outputs the --- result to stdout. +-- Filters the given file through markdown, inserts it into the template specified by stdin by +-- replacing simple {{ variable }} tags, and outputs the result to stdout. --- Filter the file through markdown using TOC generation in order to get header --- anchors, but ignore the actual TOC. +-- Filter the file through markdown using TOC generation in order to get header 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) @@ -14,8 +13,5 @@ end) p:close() -- Fill in HTML layout (stdin) with markdown output and print the result. -local tags = { - ['page.title'] = html:match('<h%d.->([^<]+)'), - content = html:gsub('%%', '%%%%') -} -io.write(io.stdin:read('*a'):gsub('{{ (%S+) }}', tags)) +local tags = {['page.title'] = html:match('<h%d.->([^<]+)'), content = html} +io.write((io.stdin:read('*a'):gsub('{{ (%S+) }}', tags))) |