aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2012-03-08 10:04:53 -0500
committermitchell <70453897+667e-11@users.noreply.github.com>2012-03-08 10:04:53 -0500
commit20662bc83a232c31ce27b6341bcad3a23a0a94c1 (patch)
tree190da463aa4b539ccc8b3ab874cd741afb4ba829 /doc
parent4d762249e7306c40a04b08cb180c26a88c8ff455 (diff)
downloadtextadept-20662bc83a232c31ce27b6341bcad3a23a0a94c1.tar.gz
textadept-20662bc83a232c31ce27b6341bcad3a23a0a94c1.zip
Added header and footer to Manual and LuaDoc.
Diffstat (limited to 'doc')
-rw-r--r--doc/footer.md1
-rw-r--r--doc/gen_manual.lua28
-rw-r--r--doc/header.md9
-rw-r--r--doc/manual/images/icon.pngbin8030 -> 2548 bytes
-rw-r--r--doc/markdowndoc.lua45
-rw-r--r--doc/style.css39
6 files changed, 93 insertions, 29 deletions
diff --git a/doc/footer.md b/doc/footer.md
new file mode 100644
index 00000000..1920715b
--- /dev/null
+++ b/doc/footer.md
@@ -0,0 +1 @@
+-> (c) 2012 Mitchell mitchell.att.foicica.com <-
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
diff --git a/doc/header.md b/doc/header.md
new file mode 100644
index 00000000..3ff4f97b
--- /dev/null
+++ b/doc/header.md
@@ -0,0 +1,9 @@
+# ![](images/icon.png) Textadept
+
+* [Home](http://foicica.com/textadept) |
+* [Download](http://foicica.com/textadept/download) |
+* [Manual](http://foicica.com/textadept/manual) |
+* [Lua API](http://foicica.com/textadept/api) |
+* [Source](http://foicica.com/hg/textadept) |
+* [Language Modules](http://foicica.com/hg) |
+* [Mailing List](http://foicica.com/lists)
diff --git a/doc/manual/images/icon.png b/doc/manual/images/icon.png
index bd796ec8..c9457dfe 100644
--- a/doc/manual/images/icon.png
+++ b/doc/manual/images/icon.png
Binary files differ
diff --git a/doc/markdowndoc.lua b/doc/markdowndoc.lua
index 3dade210..a93c97c6 100644
--- a/doc/markdowndoc.lua
+++ b/doc/markdowndoc.lua
@@ -32,6 +32,9 @@ local HTML = [[
</head>
<body>
<div id="content">
+ <div id="header">
+ %(header)
+ </div>
<div id="nav">
<h2>Modules</h2>
%(nav)
@@ -43,6 +46,9 @@ local HTML = [[
<div id="main">
%(main)
</div>
+ <div id="footer">
+ %(footer)
+ </div>
</div>
</body>
</html>
@@ -106,8 +112,22 @@ end
-- Called by LuaDoc to process a doc object.
-- @param doc The LuaDoc doc object.
function M.start(doc)
+ local template = {
+ title = 'Textadept API', header = '', toc = '', main = '', footer = ''
+ }
local modules, files = doc.modules, doc.files
+ -- Create the header and footer, if given a template.
+ local header, footer = '', ''
+ if M.options.template_dir ~= 'luadoc/doclet/html/' then
+ local p = io.popen('markdown "'..M.options.template_dir..'header.md"')
+ template.header = p:read('*all')
+ p:close()
+ p = io.popen('markdown "'..M.options.template_dir..'footer.md"')
+ template.footer = p:read('*all')
+ p:close()
+ end
+
-- Create the navigation list.
local hierarchy = {}
for _, name in ipairs(modules) do
@@ -125,9 +145,15 @@ function M.start(doc)
write_nav(f, hierarchy)
f:close()
local p = io_popen('markdown "'..navfile..'"')
- local nav = p:read('*all')
+ template.nav = p:read('*all')
p:close()
+ -- Write index.html.
+ f = io_open(M.options.output_dir..'/api/index.html', 'wb')
+ local html = HTML:gsub('%%%(([^)]+)%)', template)
+ f:write(html)
+ f:close()
+
-- Create a map of doc objects to file names so their Markdown doc comments
-- can be extracted.
local filedocs = {}
@@ -207,25 +233,16 @@ function M.start(doc)
f:close()
-- Write HTML.
+ template.title = name..' - Textadept API'
local p = io_popen('markdown -f toc -T "'..mdfile..'"')
- local toc, main = p:read('*all'):match('^(.-\n</ul>\n)(.+)$')
+ template.toc, template.main = p:read('*all'):match('^(.-\n</ul>\n)(.+)$')
p:close()
- toc = toc:gsub('(<a.-)%b()(</a>)', '%1%2') -- strip function parameters
+ template.toc = template.toc:gsub('(<a.-)%b()(</a>)', '%1%2') -- strip params
f = io_open(M.options.output_dir..'/api/'..name..'.html', 'wb')
- local html = HTML:gsub('%%%(([^)]+)%)', {
- title = name..' - Textadept API', nav = nav, toc = toc, main = main
- })
+ local html = HTML:gsub('%%%(([^)]+)%)', template)
f:write(html)
f:close()
end
-
- -- Write index.html.
- f = io_open(M.options.output_dir..'/api/index.html', 'wb')
- local html = HTML:gsub('%%%(([^)]+)%)', {
- title = 'Textadept API', nav = nav, toc = '', main = ''
- })
- f:write(html)
- f:close()
end
return M
diff --git a/doc/style.css b/doc/style.css
index aadfee60..3ef27ea3 100644
--- a/doc/style.css
+++ b/doc/style.css
@@ -1,7 +1,7 @@
/* Copyright 2012 Mitchell mitchell.att.foicica.com. */
* {
- border: 0;
+ border: 0 solid #999999;
margin: 0;
padding: 0;
}
@@ -45,7 +45,7 @@ pre {
}
table, th, td {
- border: 1px solid #999999;
+ border-width: 1px;
border-collapse: collapse;
margin-left: 1em;
padding: 0.25em;
@@ -53,14 +53,29 @@ table, th, td {
ul { list-style-type: disc; }
-#content {
- font-size: 1.2em;
- margin: 0.5em;
+#content { font-size: 1.2em; }
+
+#header h1 {
+ background-color: #cccccc;
+ border-width: 0 0 1px 0;
+ padding: 0.25em;
+ margin: 0;
+}
+#header ul {
+ border-width: 0 0 1px 0;
+ list-style: none;
+ margin-bottom: 1.5em;
+ padding: 0.25em;
+}
+#header li {
+ color: #808080;
+ display: inline;
}
#nav {
- border: 1px solid #999999;
+ border-width: 1px 1px 1px 0;
float: left;
+ margin-bottom: 1.5em;
width: 10em;
}
#nav ul {
@@ -70,7 +85,7 @@ ul { list-style-type: disc; }
#nav ul ul { margin: 0 0.25em 0 1em; }
#toc {
- border: 1px solid #999999;
+ border-width: 1px 0 1px 1px;
float: right;
margin: 0 0 1em 1em;
}
@@ -81,7 +96,7 @@ ul { list-style-type: disc; }
#toc ul ul { margin: 0 0.25em 0 1em; }
#nav h2, #toc h2 {
- border-bottom: 1px solid #999999;
+ border-width: 0 0 1px 0;
background-color: #cccccc;
font-size: 1em;
font-weight: normal;
@@ -93,3 +108,11 @@ ul { list-style-type: disc; }
#main p { margin: 1em; }
#main ol, #main ul { margin-left: 2.5em; }
#main ol p, #main ul p { margin-left: 0; }
+
+#footer {
+ background-color: #cccccc;
+ border-width: 1px 0 0 0;
+ clear: both;
+ padding: 0.25em;
+ margin-top: 1.5em;
+}