new-style modules may have @alias to indicate an internal shorthand for the module
This commit is contained in:
parent
f3406df40d
commit
a31d590e50
8
doc.lua
8
doc.lua
|
@ -16,8 +16,8 @@ local split_dotted_name = tools.split_dotted_name
|
|||
-- - tags which represent a type, like 'function' (TAG_TYPE)
|
||||
local known_tags = {
|
||||
param = 'M', see = 'M', usage = 'M', ['return'] = 'M', field = 'M', author='M';
|
||||
class = 'id', name = 'id', pragma = 'id';
|
||||
copyright = 'S', description = 'S', release = 'S';
|
||||
class = 'id', name = 'id', pragma = 'id', alias = 'id';
|
||||
copyright = 'S', summary = 'S', description = 'S', release = 'S';
|
||||
module = 'T', script = 'T',['function'] = 'T', table = 'T'
|
||||
}
|
||||
known_tags._alias = {}
|
||||
|
@ -108,6 +108,10 @@ function File:finish()
|
|||
if not mod and not this_mod.old_style and item.inferred then
|
||||
--item:warning(item.name .. ' is declared in global scope')
|
||||
end
|
||||
-- the function may be qualified with a module alias...
|
||||
if this_mod.tags.alias and mod == this_mod.tags.alias then
|
||||
mod = this_mod.mod_name
|
||||
end
|
||||
-- if that's the mod_name, then we want to only use 'foo'
|
||||
if mod == this_mod.mod_name and this_mod.tags.pragma ~= 'nostrip' then
|
||||
item.name = fname
|
||||
|
|
3
ldoc.lua
3
ldoc.lua
|
@ -125,9 +125,8 @@ local function extract_tags (s)
|
|||
local preamble,tag_items = parse_tags(s)
|
||||
|
||||
local strip = tools.strip
|
||||
local summary,description = preamble:match('^(.-)[%.?]%s(.+)')
|
||||
local summary,description = preamble:match('^(.-[%.?])%s(.+)')
|
||||
if not summary then summary = preamble end
|
||||
summary = summary .. '.'
|
||||
local tags = {summary=summary and strip(summary),description=description and strip(description)}
|
||||
for _,item in ipairs(tag_items) do
|
||||
local tag,value = item[1],item[2]
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
------------
|
||||
-- A new-style module.
|
||||
-- Shows how @alias can be used to tell ldoc that a given name
|
||||
-- is a shorthand for the full module name
|
||||
-- @alias M
|
||||
|
||||
local simple_alias = {}
|
||||
local M = simple_alias
|
||||
|
||||
--- return the answer. And complete the description
|
||||
function M.answer()
|
||||
return 42
|
||||
end
|
||||
|
||||
return simple_alias
|
||||
|
Loading…
Reference in New Issue