a --dump debug flag is available; useful for testing

This commit is contained in:
steve donovan 2011-04-13 18:45:41 +02:00
parent daaa2d1208
commit 8aabee8cd2
2 changed files with 19 additions and 5 deletions

16
doc.lua
View File

@ -298,10 +298,16 @@ end
-- Primarily intended as a debugging tool. -- Primarily intended as a debugging tool.
function File:dump(verbose) function File:dump(verbose)
for mod in self.modules:iter() do for mod in self.modules:iter() do
print('Module:',mod.name,mod.summary,mod.description) mod:dump(verbose)
for item in mod.items:iter() do end
item:dump(verbose) end
end
function Module:dump(verbose)
print '----'
print(self.type..':',self.name,self.summary)
if self.description then print(self.description) end
for item in self.items:iter() do
item:dump(verbose)
end end
end end
@ -313,7 +319,7 @@ function Item:dump(verbose)
end end
if verbose then if verbose then
print(self.type,name,self.summary) print(self.type,name,self.summary)
print(self.description) if self.description then print(self.description) end
for p in self.params:iter() do for p in self.params:iter() do
print(p,self.params[p]) print(p,self.params[p])
end end

View File

@ -25,6 +25,7 @@ ldoc, a Lua documentation generator, vs 0.1 Beta
-t,--title (default Reference) page title -t,--title (default Reference) page title
-f,--format (default plain) formatting - can be markdown -f,--format (default plain) formatting - can be markdown
-b,--package (default '') top-level package basename (needed for module(...)) -b,--package (default '') top-level package basename (needed for module(...))
--dump debug output dump
<file> (string) source file or directory containing source <file> (string) source file or directory containing source
]] ]]
@ -429,6 +430,13 @@ if args.module then
return return
end end
if args.dump then
for mod in module_list:iter() do
mod:dump(true)
end
os.exit()
end
local css, templ = 'ldoc.css','ldoc.ltp' local css, templ = 'ldoc.css','ldoc.ltp'
-- the style directory for template and stylesheet can be specified -- the style directory for template and stylesheet can be specified