Codebase list lua-ldoc / 16981ee
Merge branch 'master' of github.com:stevedonovan/LDoc Steve Donovan 10 years ago
2 changed file(s) with 27 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
2020 -- - 'N' tags which have no associated value, like 'local` (TAG_FLAG)
2121 -- - 'T' tags which represent a type, like 'function' (TAG_TYPE)
2222 local known_tags = {
23 param = 'M', see = 'M', usage = 'ML', ['return'] = 'M', field = 'M', author='M';
23 param = 'M', see = 'M', usage = 'ML', ['return'] = 'M', field = 'M', author='M',set='M';
2424 class = 'id', name = 'id', pragma = 'id', alias = 'id', within = 'id',
2525 copyright = 'S', summary = 'S', description = 'S', release = 'S', license = 'S',
2626 fixme = 'S', todo = 'S', warning = 'S', raise = 'S', charset = 'S',
625625 local names = List()
626626 self.subparams = {}
627627 for i,name in ipairs(original_names) do
628 if type(name) ~= 'string' then
629 self:error("declared table cannot have array entries")
630 end
628631 local pname,field = split_iden(name)
629632 if field then
630633 if not fields then
1717 local path = require 'pl.path'
1818 local stringx = require 'pl.stringx'
1919 local template = require 'pl.template'
20 local tablex = require 'pl.tablex'
2021 local tools = require 'ldoc.tools'
2122 local markup = require 'ldoc.markup'
2223 local prettify = require 'ldoc.prettify'
5455
5556 function html.generate_output(ldoc, args, project)
5657 local check_directory, check_file, writefile = tools.check_directory, tools.check_file, tools.writefile
58 local original_ldoc
59
60 local function save_ldoc ()
61 if not original_ldoc then
62 original_ldoc = tablex.copy(ldoc)
63 end
64 end
65
66 local function restore_ldoc ()
67 if original_ldoc then
68 ldoc = original_ldoc
69 end
70 end
5771
5872 function ldoc.escape(str)
5973 return (str:gsub("['&<>\"]", escape_table))
235249 for m in modules() do
236250 ldoc.module = m
237251 ldoc.body = m.body
252 if m.tags.set then
253 save_ldoc()
254 for s in m.tags.set:iter() do
255 local var,val = s:match('([^=]+)=(.+)')
256 print('setting',var,val)
257 ldoc[var] = val
258 end
259 end
238260 set_charset(ldoc)
239261 m.info = get_module_info(m)
240262 if ldoc.body and m.postprocess then
250272 out = cleanup_whitespaces(out)
251273 writefile(args.dir..lkind..'/'..m.name..args.ext,out)
252274 end
275 restore_ldoc()
253276 end
254277 end
255278 if not args.quiet then print('output written to '..tools.abspath(args.dir)) end