Textadept API Documentation
+Modules
+ %(toc) +%(main)
From 03b0b8932ea1c41854a487f9fa6555def9b59462 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Mon, 30 Jun 2014 13:06:25 -0400 Subject: Condensed manual and API documentation into single files. --- doc/markdowndoc.lua | 199 ++++++++++++++++++++-------------------------------- 1 file changed, 77 insertions(+), 122 deletions(-) (limited to 'doc/markdowndoc.lua') diff --git a/doc/markdowndoc.lua b/doc/markdowndoc.lua index dbc15864..1a8d5c5d 100644 --- a/doc/markdowndoc.lua +++ b/doc/markdowndoc.lua @@ -10,27 +10,26 @@ local table_concat = table.concat -- @usage luadoc -d [output_path] -doclet path/to/markdowndoc [file(s)] local M = {} -local NAVFILE = '%s* [%s](%s)\n' +local NAVFILE = '1. [%s](%s)\n' +local MODULE = '\n# The `%s` Module\n\n' local FIELD = '\n### `%s` %s\n\n' local FUNCTION = '\n### `%s`(*%s*)\n\n' local FUNCTION_NO_PARAMS = '\n### `%s`()\n\n' ---local FUNCTION = '### `%s` (%s)\n\n' local DESCRIPTION = '%s\n\n' local LIST_TITLE = '%s:\n\n' local PARAM = '* *`%s`*: %s\n' local USAGE = '* `%s`\n' local RETURN = '* %s\n' -local SEE = '* [`%s`](%s)\n' +local SEE = '* [`%s`](#%s)\n' local TABLE = '\n### `%s`\n\n' ---local TABLE = '### `%s`\n\n' -local TFIELD = '* `%s`: %s\n ' +local TFIELD = '* `%s`: %s\n' local HTML = [[
Modules
+ %(toc) +([^<]+)
', '%1') -- sans serif
- :gsub('>CASEINSEN[%w_]+', '>')
- :gsub('>FOLDFLAG_[%w_]+', '>')
- :gsub('>WRAPVISUAL[%w_]+', '>')
- :gsub('>rectangular_[%w_]+', '>')
- :gsub('>_G.(events.[%w_]+)',
- '>%1')
- f = io_open(M.options.output_dir..'/api/'..name..'.html', 'wb')
- local html = HTML:gsub('%%%(([^)]+)%)', template)
- f:write(html)
- f:close()
+ f:write('- - -\n\n')
end
+
+ -- Write HTML.
+ template.title = 'Textadept API'
+ template.toc = toc
+ local p = io_popen('markdown "'..mdfile..'"')
+ template.main = p:read('*a')
+ p:close()
+ f = io_open(M.options.output_dir..'/api.html', 'wb')
+ local html = HTML:gsub('%%%(([^)]+)%)', template)
+ f:write(html)
+ f:close()
end
return M
--
cgit v1.2.3