Module:Module introspection: Difference between revisions

Ganaram inukshuk (talk | contribs)
No edit summary
Ganaram inukshuk (talk | contribs)
comments regarding bug; add links to dependencies
Line 20: Line 20:
-- CURRENT BUGS:
-- CURRENT BUGS:
-- If strings contain actual code, they will be treated as part of the code.
-- If strings contain actual code, they will be treated as part of the code.
-- This should be a non-issue as long as no module adds any actual code.
-- This should be a non-issue as long as no module adds any actual code, or if
-- it does, it's broken into enough pieces that it won't be detected as proper
-- code. This is currently a non-issue since no modules (currently) have code
-- in strings.


-- Helper function
-- Helper function
Line 130: Line 133:
-- Table header
-- Table header
table.insert(lines, '{| class="wikitable sortable left-1 left-2"')
table.insert(lines, '{| class="wikitable sortable left-1 left-2"')
table.insert(lines, '! Variable')
table.insert(lines, "! Variable")
table.insert(lines, '! Module')
table.insert(lines, "! Module")
table.insert(lines, '! Functions used')
table.insert(lines, "! Functions used")


for var, info in pairs(deps) do
for var, info in pairs(deps) do
Line 139: Line 142:
funcs_text = "''dependency not used''"
funcs_text = "''dependency not used''"
else
else
funcs_text = table.concat(info.funcs, '<br />')
funcs_text = table.concat(info.funcs, "<br />")
end
end


table.insert(lines, '|-')
table.insert(lines, "|-")
table.insert(lines, '| ' .. var)
table.insert(lines, "| " .. var)
table.insert(lines, '| ' .. info.dep)
table.insert(lines, "| [[" .. info.dep .. "]]")
table.insert(lines, '| ' .. funcs_text)
table.insert(lines, "| " .. funcs_text)
end
end


-- Table footer
-- Table footer
table.insert(lines, '|}')
table.insert(lines, "|}")


-- Join all lines into a single string
-- Join all lines into a single string
return table.concat(lines, '\n')
return table.concat(lines, "\n")
end
end