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:
parent
daaf451a7e
commit
8d22dc7b2c
8
ldoc.lua
8
ldoc.lua
|
@ -32,6 +32,7 @@ ldoc, a documentation generator for Lua, vs 0.6
|
||||||
-c,--config (default config.ld) configuration name
|
-c,--config (default config.ld) configuration name
|
||||||
--dump debug output dump
|
--dump debug output dump
|
||||||
--filter (default none) filter output as Lua data (e.g pl.pretty.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
|
<file> (string) source file or directory containing source
|
||||||
]]
|
]]
|
||||||
|
|
||||||
|
@ -409,6 +410,13 @@ if args.dump then
|
||||||
end
|
end
|
||||||
os.exit()
|
os.exit()
|
||||||
end
|
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
|
-- 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.
|
-- to the function `name`. As a special case --filter dump will use pl.pretty.dump.
|
||||||
|
|
18
ldoc/doc.lua
18
ldoc/doc.lua
|
@ -17,7 +17,8 @@ local split_dotted_name = tools.split_dotted_name
|
||||||
local known_tags = {
|
local known_tags = {
|
||||||
param = 'M', see = 'M', usage = 'M', ['return'] = 'M', field = 'M', author='M';
|
param = 'M', see = 'M', usage = 'M', ['return'] = 'M', field = 'M', author='M';
|
||||||
class = 'id', name = 'id', pragma = 'id', alias = 'id';
|
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
|
module = 'T', script = 'T', example = 'T', topic = 'T', -- project-level
|
||||||
['function'] = 'T', lfunction = 'T', table = 'T', section = 'T', type = 'T'; -- module-level
|
['function'] = 'T', lfunction = 'T', table = 'T', section = 'T', type = 'T'; -- module-level
|
||||||
['local'] = 'N';
|
['local'] = 'N';
|
||||||
|
@ -408,6 +409,21 @@ function Module:mask_locals ()
|
||||||
self.kinds['Local Functions'] = nil
|
self.kinds['Local Functions'] = nil
|
||||||
end
|
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 -------------
|
--------- dumping out modules and items -------------
|
||||||
|
|
||||||
function Module:dump(verbose)
|
function Module:dump(verbose)
|
||||||
|
|
Loading…
Reference in New Issue