Difference between revisions of "Module:Documentation"
Jump to navigation
Jump to search
simplify the start box code and attempt to get some more output if the env table contains errors
>Mr. Stradivarius (use "ugsub" rather than "gsub" as the abbreviation for mw.ustring.gsub, to make it clearer that it isn't the regular string.gsub) |
>Mr. Stradivarius (simplify the start box code and attempt to get some more output if the env table contains errors) |
||
Line 375: | Line 375: | ||
-- No need to include the links if the documentation is on the template page itself. | -- No need to include the links if the documentation is on the template page itself. | ||
local linksData = p.makeStartBoxLinksData(args, env) | local linksData = p.makeStartBoxLinksData(args, env) | ||
if | if linksData then | ||
links = p.renderStartBoxLinks(linksData) | links = p.renderStartBoxLinks(linksData) | ||
end | end | ||
end | end | ||
-- Generate the start box html. | -- Generate the start box html. | ||
local data = p.makeStartBoxData(args, env, links) | local data = p.makeStartBoxData(args, env, links) | ||
if | if data then | ||
return p.renderStartBox(data) | return p.renderStartBox(data) | ||
else | else | ||
-- User specified no heading. | -- User specified no heading. | ||
Line 446: | Line 440: | ||
local subjectSpace = env.subjectSpace | local subjectSpace = env.subjectSpace | ||
if not subjectSpace then | if not subjectSpace then | ||
-- Default to an "other namespaces" namespace, so that we get at least some output | |||
-- if an error occurs. | |||
subjectSpace = 2 | |||
end | end | ||
local data = {} | local data = {} |