https://wiki.seshstation.com/index.php?title=Module:Parameter_names_example&feed=atom&action=history
Module:Parameter names example - Revision history
2024-03-28T23:39:25Z
Revision history for this page on the wiki
MediaWiki 1.36.1
https://wiki.seshstation.com/index.php?title=Module:Parameter_names_example&diff=259&oldid=prev
SESHstation: 1 revision imported
2021-11-21T11:00:29Z
<p>1 revision imported</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<tr class="diff-title" lang="en">
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 11:00, 21 November 2021</td>
</tr><tr><td colspan="2" class="diff-notice" lang="en"><div class="mw-diff-empty">(No difference)</div>
</td></tr></table>
SESHstation
https://wiki.seshstation.com/index.php?title=Module:Parameter_names_example&diff=258&oldid=prev
tmpl>Andrybak: add popular variants of demonstration purposes parameters: nocat=yes, categories=no, and demo=yes
2020-03-26T04:07:47Z
<p>add popular variants of demonstration purposes parameters: nocat=yes, categories=no, and demo=yes</p>
<p><b>New page</b></p><div>-- This module implements {{parameter names example}}.<br />
<br />
local p = {}<br />
<br />
local function makeParam(s)<br />
local lb = '&#123;'<br />
local rb = '&#125;'<br />
return lb:rep(3) .. s .. rb:rep(3)<br />
end<br />
<br />
local function italicize(s)<br />
return "''" .. s .. "''"<br />
end<br />
<br />
local function plain(s)<br />
return s<br />
end<br />
<br />
function p._main(args, frame)<br />
-- Find how we want to format the arguments to the template.<br />
local formatFunc<br />
if args._display == 'italics' or args._display == 'italic' then<br />
formatFunc = italicize<br />
elseif args._display == 'plain' then<br />
formatFunc = plain<br />
else<br />
formatFunc = makeParam<br />
end<br />
<br />
-- Build the table of template arguments.<br />
local targs = {}<br />
for k, v in pairs(args) do<br />
if type(k) == 'number' then<br />
targs[v] = formatFunc(v)<br />
elseif not k:find('^_') then<br />
targs[k] = v<br />
end<br />
end<br />
targs['nocat'] = 'yes';<br />
targs['categories'] = 'no';<br />
targs['demo'] = 'yes';<br />
<br />
-- Find the template name.<br />
local template<br />
if args._template then<br />
template = args._template<br />
else<br />
local currentTitle = mw.title.getCurrentTitle()<br />
if currentTitle.prefixedText:find('/sandbox$') then<br />
template = currentTitle.prefixedText<br />
else<br />
template = currentTitle.basePageTitle.prefixedText<br />
end<br />
end<br />
<br />
-- Call the template with the arguments.<br />
frame = frame or mw.getCurrentFrame()<br />
local success, result = pcall(<br />
frame.expandTemplate,<br />
frame,<br />
{title = template, args = targs}<br />
)<br />
if success then<br />
return result<br />
else<br />
return ''<br />
end<br />
end<br />
<br />
function p.main(frame)<br />
local args = require('Module:Arguments').getArgs(frame, {<br />
wrappers = 'Template:Parameter names example'<br />
})<br />
return p._main(args, frame)<br />
end<br />
<br />
return p</div>
tmpl>Andrybak