diff --git a/ldoc/builtin/globals.lua b/ldoc/builtin/globals.lua index ed51f02..deb0c45 100644 --- a/ldoc/builtin/globals.lua +++ b/ldoc/builtin/globals.lua @@ -83,11 +83,17 @@ local function function_ref (name,tbl) local href - tbl = tbl or '' - if tables[tbl] then + if not tbl then -- can only be a standard Lua global function + if globals.functions[name] then + return {href = fun_ref..name, label = name} + else + return nil + end + end + if tables[tbl] then -- function inside standard Lua table name = tbl..'.'..name href = fun_ref..name - elseif xlibs[tbl] then + elseif xlibs[tbl] then -- in external libs, use LDoc style href = xlib_url..xlibs[tbl]..'#'..name name = tbl..'.'..name else @@ -98,9 +104,9 @@ local function module_ref (tbl) local href - if tables[tbl] ~= nil then + if tables[tbl] ~= nil then -- standard Lua table href = manual..tables[tbl] - elseif xlibs[tbl] then + elseif xlibs[tbl] then -- external lib href = xlib_url..xlibs[tbl] else return nil diff --git a/ldoc/doc.lua b/ldoc/doc.lua index 290aee0..220f210 100644 --- a/ldoc/doc.lua +++ b/ldoc/doc.lua @@ -556,6 +556,9 @@ self.modifiers = extract_tag_modifiers(tags) self.usage = read_del(tags,'usage') tags.see = read_del(tags,'see') + if tags.see then + tags.see = tools.identifier_list(tags.see) + end if doc.project_level(self.type) then -- we are a module, so become one! self.items = List() diff --git a/ldoc/tools.lua b/ldoc/tools.lua index de7480a..9aeb0b9 100644 --- a/ldoc/tools.lua +++ b/ldoc/tools.lua @@ -170,6 +170,19 @@ function M.extract_identifier (value) return value:match('([%.:%-_%w]+)(.*)$') +end + +function M.identifier_list (ls) + local ns = List() + if type(ls) == 'string' then ls = List{ns} end + for s in ls:iter() do + if s:match ',' then + ns:extend(List.split(s,'[,%s]+')) + else + ns:append(s) + end + end + return ns end function M.strip (s)