Do not resolve references when using -m. Can now use @treturn just with a type (pattern fix). Default dump more structured.

This commit is contained in:
steve donovan 2012-03-17 12:17:22 +02:00
parent 5b4fc640de
commit 27fcd4d5fc
3 changed files with 33 additions and 8 deletions

View File

@ -430,7 +430,9 @@ for F in file_list:iter() do
end
for mod in module_list:iter() do
if not args.module then -- no point if we're just showing docs on the console
mod:resolve_references(module_list)
end
project:add(mod,module_list)
end

View File

@ -286,7 +286,7 @@ function Item.check_tag(tags,tag, value, modifiers)
for m,v in pairs(amod) do
local idx = v:match('^%$(%d+)')
if idx then
v, value = value:match('(%S+)%s+(.+)')
v, value = value:match('(%S+)(.*)')
end
modifiers[m] = v
end
@ -613,6 +613,7 @@ end
--------- dumping out modules and items -------------
function Module:dump(verbose)
if self.type ~= 'module' then return end
print '----'
print(self.type..':',self.name,self.summary)
if self.description then print(self.description) end
@ -640,13 +641,28 @@ function Item:dump(verbose)
print()
print(self.type,name)
print(self.summary)
if self.description then print(self.description) end
for _,p in ipairs(self.params) do
print(p,self.params[p])
if self.description and self.description:match '%S' then
print 'description:'
print(self.description)
end
if #self.params > 0 then
print 'parameters:'
for _,p in ipairs(self.params) do
print('',p,self.params[p])
end
end
if self.ret and #self.ret > 0 then
print 'returns:'
for _,r in ipairs(self.ret) do
print('',r)
end
end
if next(self.tags) then
print 'tags:'
for tag, value in pairs(self.tags) do
print(tag,value)
end
end
else
print('* '..name..' - '..self.summary)
end

View File

@ -10,11 +10,18 @@
-- A reference to `mydata`.
-- @string name
-- @int age
-- @treturn mydata result
-- @treturn mydata
function _M.first (name,age)
end
--- simple function returning something
-- @return bonzo dog!
function _M.simple()
end
--- a table of this module.
-- @table mydata
_M.mydata = {