initial implementation of -all flag; default is to hide local functions from documentation

This commit is contained in:
steve donovan 2011-06-15 16:33:13 +02:00
parent c57c364335
commit 7c02820692
2 changed files with 22 additions and 7 deletions

View File

@ -21,6 +21,7 @@ ldoc, a documentation generator for Lua, vs 0.3 Beta
-d,--dir (default docs) output directory -d,--dir (default docs) output directory
-o,--output (default 'index') output name -o,--output (default 'index') output name
-v,--verbose verbose -v,--verbose verbose
-a,--all show local functions, etc, in docs
-q,--quiet suppress output -q,--quiet suppress output
-m,--module module docs as text -m,--module module docs as text
-s,--style (default !) directory for style sheet (ldoc.css) -s,--style (default !) directory for style sheet (ldoc.css)
@ -558,6 +559,13 @@ for mod in module_list:iter() do
project:add(mod,module_list) project:add(mod,module_list)
end end
-- the default is not to show local functions in the documentation.
if not args.all then
for mod in module_list:iter() do
mod:mask_locals()
end
end
table.sort(module_list,function(m1,m2) table.sort(module_list,function(m1,m2)
return m1.name < m2.name return m1.name < m2.name
end) end)

View File

@ -350,13 +350,11 @@ function Module:resolve_references(modules)
end end
end end
-- make a text dump of the contents of this File object. -- suppress the display of local functions.
-- The level of detail is controlled by the 'verbose' parameter. -- This is just a placeholder hack until we have a more general scheme
-- Primarily intended as a debugging tool. -- for indicating 'private' content of a module.
function File:dump(verbose) function Module:mask_locals ()
for mod in self.modules:iter() do self.kinds['Local Functions'] = nil
mod:dump(verbose)
end
end end
function Module:dump(verbose) function Module:dump(verbose)
@ -368,6 +366,15 @@ function Module:dump(verbose)
end end
end end
-- make a text dump of the contents of this File object.
-- The level of detail is controlled by the 'verbose' parameter.
-- Primarily intended as a debugging tool.
function File:dump(verbose)
for mod in self.modules:iter() do
mod:dump(verbose)
end
end
function Item:dump(verbose) function Item:dump(verbose)
local tags = self.tags local tags = self.tags
local name = self.name local name = self.name