diff --git a/ldoc.lua b/ldoc.lua index b791c52..cd270a4 100644 --- a/ldoc.lua +++ b/ldoc.lua @@ -430,7 +430,9 @@ for F in file_list:iter() do end for mod in module_list:iter() do - mod:resolve_references(module_list) + 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 diff --git a/ldoc/doc.lua b/ldoc/doc.lua index 801cdfc..26313c8 100644 --- a/ldoc/doc.lua +++ b/ldoc/doc.lua @@ -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,12 +641,27 @@ 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 - for tag, value in pairs(self.tags) do - print(tag,value) + 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) diff --git a/tests/types.lua b/tests/types.lua index 88b9e52..7555608 100644 --- a/tests/types.lua +++ b/tests/types.lua @@ -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 = {