1,535
edits
(allow custom display values) |
m (11 revisions imported from templatewiki:Module:Parameter_names_example) |
||
(9 intermediate revisions by 6 users not shown) | |||
Line 11:
local function italicize(s)
return "''" .. s .. "''"
end
local function plain(s)
return s
end
Line 18 ⟶ 22:
if args._display == 'italics' or args._display == 'italic' then
formatFunc = italicize
elseif args._display == 'plain' then
formatFunc = plain
else
formatFunc = makeParam
Line 32 ⟶ 38:
end
-- Find the template name
local template
local template = args._template or mw.title.getCurrentTitle().basePageTitle.text▼
if args._template then
template = args._template
else
if currentTitle.prefixedText:find('/sandbox$') then
template = currentTitle.prefixedText
else
template = currentTitle.basePageTitle.prefixedText
end
end
-- Call the template with the arguments.
frame = frame or mw.getCurrentFrame()
local success, result = pcall(
return frame:expandTemplate{title = template, args = targs}▼
frame.expandTemplate,
frame,
)
if success then
return result
else
return ''
end
end
|