Module:Template introspection: Difference between revisions

Ganaram inukshuk (talk | contribs)
change output to display functions but link to modules
Ganaram inukshuk (talk | contribs)
mNo edit summary
 
(2 intermediate revisions by the same user not shown)
Line 35: Line 35:
:gsub("%s+", " ")
:gsub("%s+", " ")
:match("^%s*(.-)%s*$")
:match("^%s*(.-)%s*$")
-- Normalize more by removing subst, safesubst, and any extra curly brackets
normalized = normalized
:gsub("{{{|safesubst:}}}", "")  -- Remove {{{{|safesubst:}}} if used
:gsub("{{{|subst:}}}", "")      -- Remove {{{{|subst:}}} if used
:gsub("{{{{", "{{")            -- Collapse excessive curly brackets
:gsub("}}}}", "}}")            -- Collapse excessive curly brackets


return normalized
return normalized
Line 64: Line 71:
local calls = {}
local calls = {}
for _, call in ipairs(invokes) do
for _, call in ipairs(invokes) do
table.insert(calls, string.format("[[Module:%s | %s]]", call.module, call.func))
table.insert(calls, string.format("'''%s''' from [[Module:%s]]", call.func, call.module))
end
end
return string.format(":''%s %s''\n", hatnote, table.concat(calls, ", "))
return string.format(":''%s %s''\n", hatnote, table.concat(calls, ", "))