diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/gen_doc.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/gen_doc.lua b/scripts/gen_doc.lua new file mode 100755 index 00000000..1d317935 --- /dev/null +++ b/scripts/gen_doc.lua @@ -0,0 +1,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() |