diff --git a/ldoc/parse.lua b/ldoc/parse.lua index a1ef58d..89e47d3 100644 --- a/ldoc/parse.lua +++ b/ldoc/parse.lua @@ -292,18 +292,21 @@ end if item_follows or comment_contains_tags(comment,args) then tags = extract_tags(comment,args) + -- explicitly named @module (which is recommended) if doc.project_level(tags.class) then module_found = tags.name -- might be a module returning a single function! if tags.param or tags['return'] then local parms, ret, summ = tags.param, tags['return'],tags.summary + local name = tags.name tags.param = nil tags['return'] = nil - tags.summary = nil - add_module(tags,tags.name,false) + tags['class'] = nil + tags['name'] = nil + add_module(tags,name,false) tags = { - summary = summ, + summary = '', name = 'returns...', class = 'function', ['return'] = ret, diff --git a/tests/funmod.lua b/tests/funmod.lua new file mode 100644 index 0000000..f9eaef2 --- /dev/null +++ b/tests/funmod.lua @@ -0,0 +1,13 @@ +------- +-- Summing values. +-- Returns a single function. +-- @param a first +-- @param b second +-- @param c third +-- @return sum of parameters +-- @module funmod + +return function(a,b,c) + return a + b + c +end +