Module:Module introspection: Difference between revisions
mNo edit summary |
mNo edit summary |
||
| Line 170: | Line 170: | ||
-- Helper function | -- Helper function | ||
-- Lists module's own functions | -- Lists module's own functions; requires module name to produce links to each | ||
function p.make_function_table(module_functions) | -- function. | ||
function p.make_function_table(module_name, module_functions) | |||
-- Collapse table if it's larger than 20 lines | -- Collapse table if it's larger than 20 lines | ||
| Line 221: | Line 222: | ||
-- Get module's functions, then build a table using that information | -- Get module's functions, then build a table using that information | ||
local module_functions = p.find_functions(preprocessed_content) | local module_functions = p.find_functions(preprocessed_content) | ||
local func_lines = p.make_function_table(module_functions) | local func_lines = p.make_function_table(module_name, module_functions) | ||
-- Return the tables as strings | -- Return the tables as strings | ||
local summary = string.format("Introspection summary: Module:%s requires %d module(s) and provides %d functions(s).", module_name, #deps, #module_functions) | local summary = string.format("'''Introspection summary:''' Module:%s requires %d module(s) and provides %d functions(s).", module_name, #deps, #module_functions) | ||
return summary .. "\n" .. table.concat(dep_lines, "\n") .. "\n" .. table.concat(func_lines, "\n") | return summary .. "\n" .. table.concat(dep_lines, "\n") .. "\n" .. table.concat(func_lines, "\n") | ||
end | end | ||