https://wiki.seshstation.com/index.php?title=Module:Infobox&feed=atom&action=history
Module:Infobox - Revision history
2024-03-28T13:13:13Z
Revision history for this page on the wiki
MediaWiki 1.36.1
https://wiki.seshstation.com/index.php?title=Module:Infobox&diff=239&oldid=prev
SESHstation: 1 revision imported
2021-11-21T11:00:28Z
<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:Infobox&diff=238&oldid=prev
tmpl>Fayenatic london: spacing
2021-11-16T10:29:48Z
<p>spacing</p>
<p><b>New page</b></p><div>local p = {}<br />
local args = {}<br />
local origArgs = {}<br />
local root<br />
local empty_row_categories = {}<br />
local category_in_empty_row_pattern = '%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*]]'<br />
local has_rows = false<br />
<br />
local function fixChildBoxes(sval, tt)<br />
local function notempty( s ) return s and s:match( '%S' ) end<br />
<br />
if notempty(sval) then<br />
local marker = '<span class=special_infobox_marker>'<br />
local s = sval<br />
-- start moving templatestyles and categories inside of table rows<br />
local slast = ''<br />
while slast ~= s do<br />
slast = s<br />
s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*%]%])', '%2%1')<br />
s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(\127[^\127]*UNIQ%-%-templatestyles%-%x+%-QINU[^\127]*\127)', '%2%1')<br />
end<br />
-- end moving templatestyles and categories inside of table rows<br />
s = mw.ustring.gsub(s, '(<%s*[Tt][Rr])', marker .. '%1')<br />
s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>)', '%1' .. marker)<br />
if s:match(marker) then<br />
s = mw.ustring.gsub(s, marker .. '%s*' .. marker, '')<br />
s = mw.ustring.gsub(s, '([\r\n]|-[^\r\n]*[\r\n])%s*' .. marker, '%1')<br />
s = mw.ustring.gsub(s, marker .. '%s*([\r\n]|-)', '%1')<br />
s = mw.ustring.gsub(s, '(</[Cc][Aa][Pp][Tt][Ii][Oo][Nn]%s*>%s*)' .. marker, '%1')<br />
s = mw.ustring.gsub(s, '(<%s*[Tt][Aa][Bb][Ll][Ee][^<>]*>%s*)' .. marker, '%1')<br />
s = mw.ustring.gsub(s, '^(%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1')<br />
s = mw.ustring.gsub(s, '([\r\n]%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1')<br />
s = mw.ustring.gsub(s, marker .. '(%s*</[Tt][Aa][Bb][Ll][Ee]%s*>)', '%1')<br />
s = mw.ustring.gsub(s, marker .. '(%s*\n|%})', '%1')<br />
end<br />
if s:match(marker) then<br />
local subcells = mw.text.split(s, marker)<br />
s = ''<br />
for k = 1, #subcells do<br />
if k == 1 then<br />
s = s .. subcells[k] .. '</' .. tt .. '></tr>'<br />
elseif k == #subcells then<br />
local rowstyle = ' style="display:none"'<br />
if notempty(subcells[k]) then rowstyle = '' end<br />
s = s .. '<tr' .. rowstyle ..'><' .. tt .. ' colspan=2>\n' ..<br />
subcells[k]<br />
elseif notempty(subcells[k]) then<br />
if (k % 2) == 0 then<br />
s = s .. subcells[k]<br />
else<br />
s = s .. '<tr><' .. tt .. ' colspan=2>\n' ..<br />
subcells[k] .. '</' .. tt .. '></tr>'<br />
end<br />
end<br />
end<br />
end<br />
-- the next two lines add a newline at the end of lists for the PHP parser<br />
-- [[Special:Diff/849054481]]<br />
-- remove when [[:phab:T191516]] is fixed or OBE<br />
s = mw.ustring.gsub(s, '([\r\n][%*#;:][^\r\n]*)$', '%1\n')<br />
s = mw.ustring.gsub(s, '^([%*#;:][^\r\n]*)$', '%1\n')<br />
s = mw.ustring.gsub(s, '^([%*#;:])', '\n%1')<br />
s = mw.ustring.gsub(s, '^(%{%|)', '\n%1')<br />
return s<br />
else<br />
return sval<br />
end<br />
end<br />
<br />
-- Cleans empty tables<br />
local function cleanInfobox()<br />
root = tostring(root)<br />
if has_rows == false then<br />
root = mw.ustring.gsub(root, '<table[^<>]*>%s*</table>', '')<br />
end<br />
end<br />
<br />
-- Returns the union of the values of two tables, as a sequence.<br />
local function union(t1, t2)<br />
<br />
local vals = {}<br />
for k, v in pairs(t1) do<br />
vals[v] = true<br />
end<br />
for k, v in pairs(t2) do<br />
vals[v] = true<br />
end<br />
local ret = {}<br />
for k, v in pairs(vals) do<br />
table.insert(ret, k)<br />
end<br />
return ret<br />
end<br />
<br />
-- Returns a table containing the numbers of the arguments that exist<br />
-- for the specified prefix. For example, if the prefix was 'data', and<br />
-- 'data1', 'data2', and 'data5' exist, it would return {1, 2, 5}.<br />
local function getArgNums(prefix)<br />
local nums = {}<br />
for k, v in pairs(args) do<br />
local num = tostring(k):match('^' .. prefix .. '([1-9]%d*)$')<br />
if num then table.insert(nums, tonumber(num)) end<br />
end<br />
table.sort(nums)<br />
return nums<br />
end<br />
<br />
-- Adds a row to the infobox, with either a header cell<br />
-- or a label/data cell combination.<br />
local function addRow(rowArgs)<br />
<br />
if rowArgs.header and rowArgs.header ~= '_BLANK_' then<br />
has_rows = true<br />
root<br />
:tag('tr')<br />
:addClass(rowArgs.rowclass)<br />
:cssText(rowArgs.rowstyle)<br />
:tag('th')<br />
:attr('colspan', '2')<br />
:addClass('infobox-header')<br />
:addClass(rowArgs.class)<br />
:addClass(args.headerclass)<br />
-- @deprecated next; target .infobox-<name> .infobox-header<br />
:cssText(args.headerstyle)<br />
:cssText(rowArgs.rowcellstyle)<br />
:wikitext(fixChildBoxes(rowArgs.header, 'th'))<br />
if rowArgs.data then<br />
root:wikitext(<br />
'[[Category:Pages using infobox templates with ignored data cells]]'<br />
)<br />
end<br />
elseif rowArgs.data and rowArgs.data:gsub(<br />
category_in_empty_row_pattern, ''<br />
):match('^%S') then<br />
has_rows = true<br />
local row = root:tag('tr')<br />
row:addClass(rowArgs.rowclass)<br />
row:cssText(rowArgs.rowstyle)<br />
if rowArgs.label then<br />
row<br />
:tag('th')<br />
:attr('scope', 'row')<br />
:addClass('infobox-label')<br />
-- @deprecated next; target .infobox-<name> .infobox-label<br />
:cssText(args.labelstyle)<br />
:cssText(rowArgs.rowcellstyle)<br />
:wikitext(rowArgs.label)<br />
:done()<br />
end<br />
<br />
local dataCell = row:tag('td')<br />
dataCell<br />
:attr('colspan', not rowArgs.label and '2' or nil)<br />
:addClass(not rowArgs.label and 'infobox-full-data' or 'infobox-data')<br />
:addClass(rowArgs.class)<br />
-- @deprecated next; target .infobox-<name> .infobox(-full)-data<br />
:cssText(rowArgs.datastyle)<br />
:cssText(rowArgs.rowcellstyle)<br />
:wikitext(fixChildBoxes(rowArgs.data, 'td'))<br />
else<br />
table.insert(empty_row_categories, rowArgs.data or '')<br />
end<br />
end<br />
<br />
local function renderTitle()<br />
if not args.title then return end<br />
<br />
has_rows = true<br />
root<br />
:tag('caption')<br />
:addClass('infobox-title')<br />
:addClass(args.titleclass)<br />
-- @deprecated next; target .infobox-<name> .infobox-title<br />
:cssText(args.titlestyle)<br />
:wikitext(args.title)<br />
end<br />
<br />
local function renderAboveRow()<br />
if not args.above then return end<br />
<br />
has_rows = true<br />
root<br />
:tag('tr')<br />
:tag('th')<br />
:attr('colspan', '2')<br />
:addClass('infobox-above')<br />
:addClass(args.aboveclass)<br />
-- @deprecated next; target .infobox-<name> .infobox-above<br />
:cssText(args.abovestyle)<br />
:wikitext(fixChildBoxes(args.above,'th'))<br />
end<br />
<br />
local function renderBelowRow()<br />
if not args.below then return end<br />
<br />
has_rows = true<br />
root<br />
:tag('tr')<br />
:tag('td')<br />
:attr('colspan', '2')<br />
:addClass('infobox-below')<br />
:addClass(args.belowclass)<br />
-- @deprecated next; target .infobox-<name> .infobox-below<br />
:cssText(args.belowstyle)<br />
:wikitext(fixChildBoxes(args.below,'td'))<br />
end<br />
<br />
local function addSubheaderRow(subheaderArgs)<br />
if subheaderArgs.data and<br />
subheaderArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then<br />
has_rows = true<br />
local row = root:tag('tr')<br />
row:addClass(subheaderArgs.rowclass)<br />
<br />
local dataCell = row:tag('td')<br />
dataCell<br />
:attr('colspan', '2')<br />
:addClass('infobox-subheader')<br />
:addClass(subheaderArgs.class)<br />
:cssText(subheaderArgs.datastyle)<br />
:cssText(subheaderArgs.rowcellstyle)<br />
:wikitext(fixChildBoxes(subheaderArgs.data, 'td'))<br />
else<br />
table.insert(empty_row_categories, subheaderArgs.data or '')<br />
end<br />
end<br />
<br />
local function renderSubheaders()<br />
if args.subheader then<br />
args.subheader1 = args.subheader<br />
end<br />
if args.subheaderrowclass then<br />
args.subheaderrowclass1 = args.subheaderrowclass<br />
end<br />
local subheadernums = getArgNums('subheader')<br />
for k, num in ipairs(subheadernums) do<br />
addSubheaderRow({<br />
data = args['subheader' .. tostring(num)],<br />
-- @deprecated next; target .infobox-<name> .infobox-subheader<br />
datastyle = args.subheaderstyle,<br />
rowcellstyle = args['subheaderstyle' .. tostring(num)],<br />
class = args.subheaderclass,<br />
rowclass = args['subheaderrowclass' .. tostring(num)]<br />
})<br />
end<br />
end<br />
<br />
local function addImageRow(imageArgs)<br />
<br />
if imageArgs.data and<br />
imageArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then<br />
<br />
has_rows = true<br />
local row = root:tag('tr')<br />
row:addClass(imageArgs.rowclass)<br />
<br />
local dataCell = row:tag('td')<br />
dataCell<br />
:attr('colspan', '2')<br />
:addClass('infobox-image')<br />
:addClass(imageArgs.class)<br />
:cssText(imageArgs.datastyle)<br />
:wikitext(fixChildBoxes(imageArgs.data, 'td'))<br />
else<br />
table.insert(empty_row_categories, imageArgs.data or '')<br />
end<br />
end<br />
<br />
local function renderImages()<br />
if args.image then<br />
args.image1 = args.image<br />
end<br />
if args.caption then<br />
args.caption1 = args.caption<br />
end<br />
local imagenums = getArgNums('image')<br />
for k, num in ipairs(imagenums) do<br />
local caption = args['caption' .. tostring(num)]<br />
local data = mw.html.create():wikitext(args['image' .. tostring(num)])<br />
if caption then<br />
data<br />
:tag('div')<br />
:addClass('infobox-caption')<br />
-- @deprecated next; target .infobox-<name> .infobox-caption<br />
:cssText(args.captionstyle)<br />
:wikitext(caption)<br />
end<br />
addImageRow({<br />
data = tostring(data),<br />
-- @deprecated next; target .infobox-<name> .infobox-image<br />
datastyle = args.imagestyle,<br />
class = args.imageclass,<br />
rowclass = args['imagerowclass' .. tostring(num)]<br />
})<br />
end<br />
end<br />
<br />
-- When autoheaders are turned on, preprocesses the rows<br />
local function preprocessRows()<br />
if not args.autoheaders then return end<br />
<br />
local rownums = union(getArgNums('header'), getArgNums('data'))<br />
table.sort(rownums)<br />
local lastheader<br />
for k, num in ipairs(rownums) do<br />
if args['header' .. tostring(num)] then<br />
if lastheader then<br />
args['header' .. tostring(lastheader)] = nil<br />
end<br />
lastheader = num<br />
elseif args['data' .. tostring(num)] and<br />
args['data' .. tostring(num)]:gsub(<br />
category_in_empty_row_pattern, ''<br />
):match('^%S') then<br />
local data = args['data' .. tostring(num)]<br />
if data:gsub(category_in_empty_row_pattern, ''):match('%S') then<br />
lastheader = nil<br />
end<br />
end<br />
end<br />
if lastheader then<br />
args['header' .. tostring(lastheader)] = nil<br />
end<br />
end<br />
<br />
-- Gets the union of the header and data argument numbers,<br />
-- and renders them all in order<br />
local function renderRows()<br />
<br />
local rownums = union(getArgNums('header'), getArgNums('data'))<br />
table.sort(rownums)<br />
for k, num in ipairs(rownums) do<br />
addRow({<br />
header = args['header' .. tostring(num)],<br />
label = args['label' .. tostring(num)],<br />
data = args['data' .. tostring(num)],<br />
datastyle = args.datastyle,<br />
class = args['class' .. tostring(num)],<br />
rowclass = args['rowclass' .. tostring(num)],<br />
-- @deprecated next; target .infobox-<name> rowclass<br />
rowstyle = args['rowstyle' .. tostring(num)],<br />
rowcellstyle = args['rowcellstyle' .. tostring(num)]<br />
})<br />
end<br />
end<br />
<br />
local function renderNavBar()<br />
if not args.name then return end<br />
<br />
has_rows = true<br />
root<br />
:tag('tr')<br />
:tag('td')<br />
:attr('colspan', '2')<br />
:addClass('infobox-navbar')<br />
:wikitext(require('Module:Navbar')._navbar{<br />
args.name,<br />
mini = 1,<br />
})<br />
end<br />
<br />
local function renderItalicTitle()<br />
local italicTitle = args['italic title'] and mw.ustring.lower(args['italic title'])<br />
if italicTitle == '' or italicTitle == 'force' or italicTitle == 'yes' then<br />
root:wikitext(mw.getCurrentFrame():expandTemplate({title = 'italic title'}))<br />
end<br />
end<br />
<br />
-- Categories in otherwise empty rows are collected in empty_row_categories.<br />
-- This function adds them to the module output. It is not affected by<br />
-- args.decat because this module should not prevent module-external categories<br />
-- from rendering.<br />
local function renderEmptyRowCategories()<br />
for _, s in ipairs(empty_row_categories) do<br />
root:wikitext(s)<br />
end<br />
end<br />
<br />
-- Render tracking categories. args.decat == turns off tracking categories.<br />
local function renderTrackingCategories()<br />
if args.decat == 'yes' then return end<br />
if args.child == 'yes' then<br />
if args.title then<br />
root:wikitext(<br />
'[[Category:Pages using embedded infobox templates with the title parameter]]'<br />
)<br />
end<br />
elseif #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then<br />
root:wikitext('[[Category:Articles using infobox templates with no data rows]]')<br />
end<br />
end<br />
<br />
--[=[<br />
Loads the templatestyles for the infobox.<br />
<br />
TODO: FINISH loading base templatestyles here rather than in<br />
MediaWiki:Common.css. There are 4-5000 pages with 'raw' infobox tables.<br />
See [[Mediawiki_talk:Common.css/to_do#Infobox]] and/or come help :).<br />
When we do this we should clean up the inline CSS below too.<br />
Will have to do some bizarre conversion category like with sidebar.<br />
<br />
]=]<br />
local function loadTemplateStyles()<br />
local frame = mw.getCurrentFrame()<br />
<br />
-- See function description<br />
local base_templatestyles = frame:extensionTag{<br />
name = 'templatestyles', args = { src = 'Module:Infobox/styles.css' }<br />
}<br />
<br />
local templatestyles = ''<br />
if args['templatestyles'] then templatestyles = frame:extensionTag{<br />
name = 'templatestyles', args = { src = args['templatestyles'] }<br />
}<br />
end<br />
<br />
local child_templatestyles = ''<br />
if args['child templatestyles'] then child_templatestyles = frame:extensionTag{<br />
name = 'templatestyles', args = { src = args['child templatestyles'] }<br />
}<br />
end<br />
<br />
local grandchild_templatestyles = ''<br />
if args['grandchild templatestyles'] then grandchild_templatestyles = frame:extensionTag{<br />
name = 'templatestyles', args = { src = args['grandchild templatestyles'] }<br />
}<br />
end<br />
<br />
return table.concat({<br />
base_templatestyles, -- see function description<br />
templatestyles,<br />
child_templatestyles,<br />
grandchild_templatestyles<br />
})<br />
end<br />
<br />
-- common functions between the child and non child cases<br />
local function structure_infobox_common()<br />
renderSubheaders()<br />
renderImages()<br />
preprocessRows()<br />
renderRows()<br />
renderBelowRow()<br />
renderNavBar()<br />
renderItalicTitle()<br />
renderEmptyRowCategories()<br />
renderTrackingCategories()<br />
cleanInfobox()<br />
end<br />
<br />
-- Specify the overall layout of the infobox, with special settings if the<br />
-- infobox is used as a 'child' inside another infobox.<br />
local function _infobox()<br />
if args.child ~= 'yes' then<br />
root = mw.html.create('table')<br />
<br />
root<br />
:addClass(args.subbox == 'yes' and 'infobox-subbox' or 'infobox')<br />
:addClass(args.bodyclass)<br />
-- @deprecated next; target .infobox-<name><br />
:cssText(args.bodystyle)<br />
<br />
renderTitle()<br />
renderAboveRow()<br />
else<br />
root = mw.html.create()<br />
<br />
root<br />
:wikitext(args.title)<br />
end<br />
structure_infobox_common()<br />
<br />
return loadTemplateStyles() .. root<br />
end<br />
<br />
-- If the argument exists and isn't blank, add it to the argument table.<br />
-- Blank arguments are treated as nil to match the behaviour of ParserFunctions.<br />
local function preprocessSingleArg(argName)<br />
if origArgs[argName] and origArgs[argName] ~= '' then<br />
args[argName] = origArgs[argName]<br />
end<br />
end<br />
<br />
-- Assign the parameters with the given prefixes to the args table, in order, in<br />
-- batches of the step size specified. This is to prevent references etc. from<br />
-- appearing in the wrong order. The prefixTable should be an array containing<br />
-- tables, each of which has two possible fields, a "prefix" string and a<br />
-- "depend" table. The function always parses parameters containing the "prefix"<br />
-- string, but only parses parameters in the "depend" table if the prefix<br />
-- parameter is present and non-blank.<br />
local function preprocessArgs(prefixTable, step)<br />
if type(prefixTable) ~= 'table' then<br />
error("Non-table value detected for the prefix table", 2)<br />
end<br />
if type(step) ~= 'number' then<br />
error("Invalid step value detected", 2)<br />
end<br />
<br />
-- Get arguments without a number suffix, and check for bad input.<br />
for i,v in ipairs(prefixTable) do<br />
if type(v) ~= 'table' or type(v.prefix) ~= "string" or<br />
(v.depend and type(v.depend) ~= 'table') then<br />
error('Invalid input detected to preprocessArgs prefix table', 2)<br />
end<br />
preprocessSingleArg(v.prefix)<br />
-- Only parse the depend parameter if the prefix parameter is present<br />
-- and not blank.<br />
if args[v.prefix] and v.depend then<br />
for j, dependValue in ipairs(v.depend) do<br />
if type(dependValue) ~= 'string' then<br />
error('Invalid "depend" parameter value detected in preprocessArgs')<br />
end<br />
preprocessSingleArg(dependValue)<br />
end<br />
end<br />
end<br />
<br />
-- Get arguments with number suffixes.<br />
local a = 1 -- Counter variable.<br />
local moreArgumentsExist = true<br />
while moreArgumentsExist == true do<br />
moreArgumentsExist = false<br />
for i = a, a + step - 1 do<br />
for j,v in ipairs(prefixTable) do<br />
local prefixArgName = v.prefix .. tostring(i)<br />
if origArgs[prefixArgName] then<br />
-- Do another loop if any arguments are found, even blank ones.<br />
moreArgumentsExist = true<br />
preprocessSingleArg(prefixArgName)<br />
end<br />
-- Process the depend table if the prefix argument is present<br />
-- and not blank, or we are processing "prefix1" and "prefix" is<br />
-- present and not blank, and if the depend table is present.<br />
if v.depend and (args[prefixArgName] or (i == 1 and args[v.prefix])) then<br />
for j,dependValue in ipairs(v.depend) do<br />
local dependArgName = dependValue .. tostring(i)<br />
preprocessSingleArg(dependArgName)<br />
end<br />
end<br />
end<br />
end<br />
a = a + step<br />
end<br />
end<br />
<br />
-- Parse the data parameters in the same order that the old {{infobox}} did, so<br />
-- that references etc. will display in the expected places. Parameters that<br />
-- depend on another parameter are only processed if that parameter is present,<br />
-- to avoid phantom references appearing in article reference lists.<br />
local function parseDataParameters()<br />
<br />
preprocessSingleArg('autoheaders')<br />
preprocessSingleArg('child')<br />
preprocessSingleArg('bodyclass')<br />
preprocessSingleArg('subbox')<br />
preprocessSingleArg('bodystyle')<br />
preprocessSingleArg('title')<br />
preprocessSingleArg('titleclass')<br />
preprocessSingleArg('titlestyle')<br />
preprocessSingleArg('above')<br />
preprocessSingleArg('aboveclass')<br />
preprocessSingleArg('abovestyle')<br />
preprocessArgs({<br />
{prefix = 'subheader', depend = {'subheaderstyle', 'subheaderrowclass'}}<br />
}, 10)<br />
preprocessSingleArg('subheaderstyle')<br />
preprocessSingleArg('subheaderclass')<br />
preprocessArgs({<br />
{prefix = 'image', depend = {'caption', 'imagerowclass'}}<br />
}, 10)<br />
preprocessSingleArg('captionstyle')<br />
preprocessSingleArg('imagestyle')<br />
preprocessSingleArg('imageclass')<br />
preprocessArgs({<br />
{prefix = 'header'},<br />
{prefix = 'data', depend = {'label'}},<br />
{prefix = 'rowclass'},<br />
{prefix = 'rowstyle'},<br />
{prefix = 'rowcellstyle'},<br />
{prefix = 'class'}<br />
}, 50)<br />
preprocessSingleArg('headerclass')<br />
preprocessSingleArg('headerstyle')<br />
preprocessSingleArg('labelstyle')<br />
preprocessSingleArg('datastyle')<br />
preprocessSingleArg('below')<br />
preprocessSingleArg('belowclass')<br />
preprocessSingleArg('belowstyle')<br />
preprocessSingleArg('name')<br />
-- different behaviour for italics if blank or absent<br />
args['italic title'] = origArgs['italic title']<br />
preprocessSingleArg('decat')<br />
preprocessSingleArg('templatestyles')<br />
preprocessSingleArg('child templatestyles')<br />
preprocessSingleArg('grandchild templatestyles')<br />
end<br />
<br />
-- If called via #invoke, use the args passed into the invoking template.<br />
-- Otherwise, for testing purposes, assume args are being passed directly in.<br />
function p.infobox(frame)<br />
if frame == mw.getCurrentFrame() then<br />
origArgs = frame:getParent().args<br />
else<br />
origArgs = frame<br />
end<br />
<br />
parseDataParameters()<br />
<br />
return _infobox()<br />
end<br />
<br />
-- For calling via #invoke within a template<br />
function p.infoboxTemplate(frame)<br />
origArgs = {}<br />
for k,v in pairs(frame.args) do origArgs[k] = mw.text.trim(v) end<br />
<br />
parseDataParameters()<br />
<br />
return _infobox()<br />
end<br />
return p</div>
tmpl>Fayenatic london