aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/gen_doc.lua
blob: 1d317935bc562359033b8fe7a4365fe2bf229236 (plain)
1
2
3
4
5
6
7
8
9
10
11
#!/usr/bin/lua
-- Part of a pipeline that fills in simple {{ variable }} templates when
-- generating documentation offline.
-- cat file.md | markdown | gen_doc > file.html

local html = io.read('*a')
local f = io.open('../docs/_layouts/default.html')
io.write(
  f:read('*a'):gsub('{{ page.title }}', html:match('<h%d>([^<]+)')):
    gsub('{{ content }}', (html:gsub('%%', '%%%%'))))
f:close()