Module:Dochead: Difference between revisions

Ganaram inukshuk (talk | contribs)
m bugfix invocation_exist input
Ganaram inukshuk (talk | contribs)
add invocation hatnote
Line 59: Line 59:
table.insert(calls, string.format("'''%s''' from %s", call.func, module_link))
table.insert(calls, string.format("'''%s''' from %s", call.func, module_link))
end
end
return string.format(":''%s %s''", hatnote, table.concat(calls, ", "))
return string.format("%s %s", hatnote, table.concat(calls, ", "))
end
end
end
end
Line 66: Line 66:
function p.make_module_hatnote(header, pagename, corr_template)
function p.make_module_hatnote(header, pagename, corr_template)
-- Check whether corresponding template exists
-- Check whether corresponding template exists
-- Then check whether it invokes the module
-- Then check whether that template invokes the module
local has_template = iutils.page_exists("Template:" .. corr_template)
local has_template = iutils.page_exists("Template:" .. corr_template)
if has_template then
if has_template then
Line 212: Line 212:
end
end
if result == "" then
if result == "" and invocation_hatnote == "" then
return ""
return ""
elseif result == "" and invocation_hatnote ~= "" then
return string.format(":''%s''", invocation_hatnote)
elseif result ~= "" and invocation_hatnote == "" then
return string.format(":''%s''", result)
else
else
return string.format(":''%s''", result)
return string.format(":''%s''\n:''%s''", result, invocation_hatnote)
end
end
end
end