diff options
Diffstat (limited to 'doc/gen_manual.lua')
-rw-r--r-- | doc/gen_manual.lua | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/doc/gen_manual.lua b/doc/gen_manual.lua index fcdf0b14..47c1bb8c 100644 --- a/doc/gen_manual.lua +++ b/doc/gen_manual.lua @@ -5,7 +5,7 @@ local HTML = [[ <html> <head> <title>%(title)</title> - <link rel="stylesheet" href="../style.css" type="text/css" /> + <link rel="stylesheet" href="style.css" type="text/css" /> <meta charset="utf-8" /> </head> <body> @@ -36,13 +36,13 @@ local template = {} -- Get manual pages. local pages = {} local lfs = require 'lfs' -for file in lfs.dir('manual/') do +for file in lfs.dir('.') do if file:find('^%d+_.-%.md$') then pages[#pages + 1] = file end end table.sort(pages) -pages[#pages + 1] = '../../README.md' -pages[#pages + 1] = '../../CHANGELOG.md' -pages[#pages + 1] = '../../THANKS.md' +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') @@ -53,7 +53,7 @@ template.footer = p:read('*all') p:close() -- Create the navigation list. -local navfile = 'manual/.nav.md' +local navfile = '.nav.md' local f = io.open(navfile, 'wb') for _, page in ipairs(pages) do local name = page:match('^%A+(.-)%.md$'):gsub('(%l)(%u)', '%1 %2') @@ -61,7 +61,7 @@ for _, page in ipairs(pages) do f:write('* [', name, '](', page:gsub('%.md$', '.html'), ')\n') end f:close() -p = io.popen('markdown "'..navfile..'"') +p = io.popen('markdown '..navfile) template.nav = p:read('*all') p:close() @@ -69,11 +69,11 @@ p:close() for _, page in ipairs(pages) do local name = page:match('^%A+(.-)%.md$'):gsub('(%l)(%u)', '%1 %2') template.title = name..' - Textadept Manual' - p = io.popen('markdown -f toc -T "manual/'..page..'"') + p = io.popen('markdown -f toc -T '..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') + f = io.open(page:gsub('%.md$', '.html'), 'wb') local html = HTML:gsub('%%%(([^)]+)%)', template) f:write(html) f:close() |