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:
parent
5b4fc640de
commit
27fcd4d5fc
2
ldoc.lua
2
ldoc.lua
|
@ -430,7 +430,9 @@ for F in file_list:iter() do
|
||||||
end
|
end
|
||||||
|
|
||||||
for mod in module_list:iter() do
|
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)
|
mod:resolve_references(module_list)
|
||||||
|
end
|
||||||
project:add(mod,module_list)
|
project:add(mod,module_list)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
24
ldoc/doc.lua
24
ldoc/doc.lua
|
@ -286,7 +286,7 @@ function Item.check_tag(tags,tag, value, modifiers)
|
||||||
for m,v in pairs(amod) do
|
for m,v in pairs(amod) do
|
||||||
local idx = v:match('^%$(%d+)')
|
local idx = v:match('^%$(%d+)')
|
||||||
if idx then
|
if idx then
|
||||||
v, value = value:match('(%S+)%s+(.+)')
|
v, value = value:match('(%S+)(.*)')
|
||||||
end
|
end
|
||||||
modifiers[m] = v
|
modifiers[m] = v
|
||||||
end
|
end
|
||||||
|
@ -613,6 +613,7 @@ end
|
||||||
--------- dumping out modules and items -------------
|
--------- dumping out modules and items -------------
|
||||||
|
|
||||||
function Module:dump(verbose)
|
function Module:dump(verbose)
|
||||||
|
if self.type ~= 'module' then return end
|
||||||
print '----'
|
print '----'
|
||||||
print(self.type..':',self.name,self.summary)
|
print(self.type..':',self.name,self.summary)
|
||||||
if self.description then print(self.description) end
|
if self.description then print(self.description) end
|
||||||
|
@ -640,13 +641,28 @@ function Item:dump(verbose)
|
||||||
print()
|
print()
|
||||||
print(self.type,name)
|
print(self.type,name)
|
||||||
print(self.summary)
|
print(self.summary)
|
||||||
if self.description then print(self.description) end
|
if self.description and self.description:match '%S' then
|
||||||
for _,p in ipairs(self.params) do
|
print 'description:'
|
||||||
print(p,self.params[p])
|
print(self.description)
|
||||||
end
|
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
|
for tag, value in pairs(self.tags) do
|
||||||
print(tag,value)
|
print(tag,value)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
else
|
else
|
||||||
print('* '..name..' - '..self.summary)
|
print('* '..name..' - '..self.summary)
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,11 +10,18 @@
|
||||||
-- A reference to `mydata`.
|
-- A reference to `mydata`.
|
||||||
-- @string name
|
-- @string name
|
||||||
-- @int age
|
-- @int age
|
||||||
-- @treturn mydata result
|
-- @treturn mydata
|
||||||
function _M.first (name,age)
|
function _M.first (name,age)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- simple function returning something
|
||||||
|
-- @return bonzo dog!
|
||||||
|
function _M.simple()
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- a table of this module.
|
--- a table of this module.
|
||||||
-- @table mydata
|
-- @table mydata
|
||||||
_M.mydata = {
|
_M.mydata = {
|
||||||
|
|
Loading…
Reference in New Issue