diff options
author | 2012-03-08 10:04:53 -0500 | |
---|---|---|
committer | 2012-03-08 10:04:53 -0500 | |
commit | 20662bc83a232c31ce27b6341bcad3a23a0a94c1 (patch) | |
tree | 190da463aa4b539ccc8b3ab874cd741afb4ba829 /doc/gen_manual.lua | |
parent | 4d762249e7306c40a04b08cb180c26a88c8ff455 (diff) | |
download | textadept-20662bc83a232c31ce27b6341bcad3a23a0a94c1.tar.gz textadept-20662bc83a232c31ce27b6341bcad3a23a0a94c1.zip |
Added header and footer to Manual and LuaDoc.
Diffstat (limited to 'doc/gen_manual.lua')
-rw-r--r-- | doc/gen_manual.lua | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/doc/gen_manual.lua b/doc/gen_manual.lua index 5fa06bfe..fcdf0b14 100644 --- a/doc/gen_manual.lua +++ b/doc/gen_manual.lua @@ -10,6 +10,9 @@ local HTML = [[ </head> <body> <div id="content"> + <div id="header"> + %(header) + </div> <div id="nav"> <h2>Manual</h2> %(nav) @@ -21,10 +24,14 @@ local HTML = [[ <div id="main"> %(main) </div> + <div id="footer"> + %(footer) + </div> </div> </body> </html> ]] +local template = {} -- Get manual pages. local pages = {} @@ -37,6 +44,14 @@ pages[#pages + 1] = '../../README.md' pages[#pages + 1] = '../../CHANGELOG.md' pages[#pages + 1] = '../../THANKS.md' +-- Create the header and footer. +local p = io.popen('markdown header.md') +template.header = p:read('*all') +p:close() +p = io.popen('markdown footer.md') +template.footer = p:read('*all') +p:close() + -- Create the navigation list. local navfile = 'manual/.nav.md' local f = io.open(navfile, 'wb') @@ -46,21 +61,20 @@ for _, page in ipairs(pages) do f:write('* [', name, '](', page:gsub('%.md$', '.html'), ')\n') end f:close() -local p = io.popen('markdown "'..navfile..'"') -local nav = p:read('*all') +p = io.popen('markdown "'..navfile..'"') +template.nav = p:read('*all') p:close() -- Write HTML. for _, page in ipairs(pages) do local name = page:match('^%A+(.-)%.md$'):gsub('(%l)(%u)', '%1 %2') - local p = io.popen('markdown -f toc -T "manual/'..page..'"') - local toc, main = p:read('*all'):match('^(.-\n</ul>\n)(.+)$') + template.title = name..' - Textadept Manual' + p = io.popen('markdown -f toc -T "manual/'..page..'"') + template.toc, template.main = p:read('*all'):match('^(.-\n</ul>\n)(.+)$') p:close() if page:find('^%.%./') then page = page:match('^%A+(.+)$') end f = io.open('manual/'..page:gsub('%.md$', '.html'), 'wb') - local html = HTML:gsub('%%%(([^)]+)%)', { - title = name..' - Textadept Manual', nav = nav, toc = toc, main = main - }) + local html = HTML:gsub('%%%(([^)]+)%)', template) f:write(html) f:close() end |