Package list lua-ldoc / a162c4b
a list of comma-separated items can appear after a see tag; fixed problem with references to Lua global functions from last commit Steve Donovan 8 years ago
3 changed file(s) with 27 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
8282
8383 local function function_ref (name,tbl)
8484 local href
85 tbl = tbl or ''
86 if tables[tbl] then
85 if not tbl then -- can only be a standard Lua global function
86 if globals.functions[name] then
87 return {href = fun_ref..name, label = name}
88 else
89 return nil
90 end
91 end
92 if tables[tbl] then -- function inside standard Lua table
8793 name = tbl..'.'..name
8894 href = fun_ref..name
89 elseif xlibs[tbl] then
95 elseif xlibs[tbl] then -- in external libs, use LDoc style
9096 href = xlib_url..xlibs[tbl]..'#'..name
9197 name = tbl..'.'..name
9298 else
97103
98104 local function module_ref (tbl)
99105 local href
100 if tables[tbl] ~= nil then
106 if tables[tbl] ~= nil then -- standard Lua table
101107 href = manual..tables[tbl]
102 elseif xlibs[tbl] then
108 elseif xlibs[tbl] then -- external lib
103109 href = xlib_url..xlibs[tbl]
104110 else
105111 return nil
555555 self.modifiers = extract_tag_modifiers(tags)
556556 self.usage = read_del(tags,'usage')
557557 tags.see = read_del(tags,'see')
558 if tags.see then
559 tags.see = tools.identifier_list(tags.see)
560 end
558561 if doc.project_level(self.type) then
559562 -- we are a module, so become one!
560563 self.items = List()
169169
170170 function M.extract_identifier (value)
171171 return value:match('([%.:%-_%w]+)(.*)$')
172 end
173
174 function M.identifier_list (ls)
175 local ns = List()
176 if type(ls) == 'string' then ls = List{ns} end
177 for s in ls:iter() do
178 if s:match ',' then
179 ns:extend(List.split(s,'[,%s]+'))
180 else
181 ns:append(s)
182 end
183 end
184 return ns
172185 end
173186
174187 function M.strip (s)