new flag --tags and some more builtin tags. So --tag fixme will show all occurances of @fixme in a project

This commit is contained in:
steve donovan 2011-08-26 15:34:42 +02:00
parent daaf451a7e
commit 8d22dc7b2c
2 changed files with 25 additions and 1 deletions

View File

@ -32,6 +32,7 @@ ldoc, a documentation generator for Lua, vs 0.6
-c,--config (default config.ld) configuration name
--dump debug output dump
--filter (default none) filter output as Lua data (e.g pl.pretty.dump)
--tags (default none) show all references to a given tag
<file> (string) source file or directory containing source
]]
@ -409,6 +410,13 @@ if args.dump then
end
os.exit()
end
if args.tags then
local taglist = {[args.tags] = true}
for mod in module_list:iter() do
mod:dump_tags(taglist)
end
os.exit()
end
-- ldoc --filter mod.name will load the module `mod` and pass the object graph
-- to the function `name`. As a special case --filter dump will use pl.pretty.dump.

View File

@ -17,7 +17,8 @@ local split_dotted_name = tools.split_dotted_name
local known_tags = {
param = 'M', see = 'M', usage = 'M', ['return'] = 'M', field = 'M', author='M';
class = 'id', name = 'id', pragma = 'id', alias = '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';
module = 'T', script = 'T', example = 'T', topic = 'T', -- project-level
['function'] = 'T', lfunction = 'T', table = 'T', section = 'T', type = 'T'; -- module-level
['local'] = 'N';
@ -408,6 +409,21 @@ function Module:mask_locals ()
self.kinds['Local Functions'] = nil
end
function Item:dump_tags (taglist)
for tag, value in pairs(self.tags) do
if not taglist or taglist[tag] then
Item.warning(self,self.name..' '..tag..' '..tostring(value))
end
end
end
function Module:dump_tags (taglist)
Item.dump_tags(self,taglist)
for item in self.items:iter() do
item:dump_tags(taglist)
end
end
--------- dumping out modules and items -------------
function Module:dump(verbose)