Merge branch 'master' of github.com:stevedonovan/LDoc
This commit is contained in:
commit
16981eeb3e
|
@ -21,7 +21,7 @@ local TAG_MULTI,TAG_ID,TAG_SINGLE,TAG_TYPE,TAG_FLAG,TAG_MULTI_LINE = 'M','id','S
|
||||||
-- - 'N' tags which have no associated value, like 'local` (TAG_FLAG)
|
-- - 'N' tags which have no associated value, like 'local` (TAG_FLAG)
|
||||||
-- - 'T' tags which represent a type, like 'function' (TAG_TYPE)
|
-- - 'T' tags which represent a type, like 'function' (TAG_TYPE)
|
||||||
local known_tags = {
|
local known_tags = {
|
||||||
param = 'M', see = 'M', usage = 'ML', ['return'] = 'M', field = 'M', author='M';
|
param = 'M', see = 'M', usage = 'ML', ['return'] = 'M', field = 'M', author='M',set='M';
|
||||||
class = 'id', name = 'id', pragma = 'id', alias = 'id', within = 'id',
|
class = 'id', name = 'id', pragma = 'id', alias = 'id', within = 'id',
|
||||||
copyright = 'S', summary = 'S', description = 'S', release = 'S', license = 'S',
|
copyright = 'S', summary = 'S', description = 'S', release = 'S', license = 'S',
|
||||||
fixme = 'S', todo = 'S', warning = 'S', raise = 'S', charset = 'S',
|
fixme = 'S', todo = 'S', warning = 'S', raise = 'S', charset = 'S',
|
||||||
|
@ -626,6 +626,9 @@ function Item:finish()
|
||||||
local names = List()
|
local names = List()
|
||||||
self.subparams = {}
|
self.subparams = {}
|
||||||
for i,name in ipairs(original_names) do
|
for i,name in ipairs(original_names) do
|
||||||
|
if type(name) ~= 'string' then
|
||||||
|
self:error("declared table cannot have array entries")
|
||||||
|
end
|
||||||
local pname,field = split_iden(name)
|
local pname,field = split_iden(name)
|
||||||
if field then
|
if field then
|
||||||
if not fields then
|
if not fields then
|
||||||
|
|
|
@ -18,6 +18,7 @@ local utils = require 'pl.utils'
|
||||||
local path = require 'pl.path'
|
local path = require 'pl.path'
|
||||||
local stringx = require 'pl.stringx'
|
local stringx = require 'pl.stringx'
|
||||||
local template = require 'pl.template'
|
local template = require 'pl.template'
|
||||||
|
local tablex = require 'pl.tablex'
|
||||||
local tools = require 'ldoc.tools'
|
local tools = require 'ldoc.tools'
|
||||||
local markup = require 'ldoc.markup'
|
local markup = require 'ldoc.markup'
|
||||||
local prettify = require 'ldoc.prettify'
|
local prettify = require 'ldoc.prettify'
|
||||||
|
@ -55,6 +56,19 @@ local escape_table = { ["'"] = "'", ["\""] = """, ["<"] = "<", [">"
|
||||||
|
|
||||||
function html.generate_output(ldoc, args, project)
|
function html.generate_output(ldoc, args, project)
|
||||||
local check_directory, check_file, writefile = tools.check_directory, tools.check_file, tools.writefile
|
local check_directory, check_file, writefile = tools.check_directory, tools.check_file, tools.writefile
|
||||||
|
local original_ldoc
|
||||||
|
|
||||||
|
local function save_ldoc ()
|
||||||
|
if not original_ldoc then
|
||||||
|
original_ldoc = tablex.copy(ldoc)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function restore_ldoc ()
|
||||||
|
if original_ldoc then
|
||||||
|
ldoc = original_ldoc
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function ldoc.escape(str)
|
function ldoc.escape(str)
|
||||||
return (str:gsub("['&<>\"]", escape_table))
|
return (str:gsub("['&<>\"]", escape_table))
|
||||||
|
@ -236,6 +250,14 @@ function html.generate_output(ldoc, args, project)
|
||||||
for m in modules() do
|
for m in modules() do
|
||||||
ldoc.module = m
|
ldoc.module = m
|
||||||
ldoc.body = m.body
|
ldoc.body = m.body
|
||||||
|
if m.tags.set then
|
||||||
|
save_ldoc()
|
||||||
|
for s in m.tags.set:iter() do
|
||||||
|
local var,val = s:match('([^=]+)=(.+)')
|
||||||
|
print('setting',var,val)
|
||||||
|
ldoc[var] = val
|
||||||
|
end
|
||||||
|
end
|
||||||
set_charset(ldoc)
|
set_charset(ldoc)
|
||||||
m.info = get_module_info(m)
|
m.info = get_module_info(m)
|
||||||
if ldoc.body and m.postprocess then
|
if ldoc.body and m.postprocess then
|
||||||
|
@ -251,6 +273,7 @@ function html.generate_output(ldoc, args, project)
|
||||||
out = cleanup_whitespaces(out)
|
out = cleanup_whitespaces(out)
|
||||||
writefile(args.dir..lkind..'/'..m.name..args.ext,out)
|
writefile(args.dir..lkind..'/'..m.name..args.ext,out)
|
||||||
end
|
end
|
||||||
|
restore_ldoc()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not args.quiet then print('output written to '..tools.abspath(args.dir)) end
|
if not args.quiet then print('output written to '..tools.abspath(args.dir)) end
|
||||||
|
|
Loading…
Reference in New Issue