Editing Module:Infobox
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 2: | Line 2: | ||
-- This module implements {{Infobox}} | -- This module implements {{Infobox}} | ||
-- | -- | ||
local p = {} | local p = {} | ||
local args = {} | local args = {} | ||
local origArgs | local origArgs | ||
local root | local root | ||
local function union(t1, t2) | local function union(t1, t2) | ||
Line 105: | Line 54: | ||
:css('text-align', 'center') | :css('text-align', 'center') | ||
:cssText(args.headerstyle) | :cssText(args.headerstyle) | ||
:wikitext(rowArgs.header) | |||
:wikitext | |||
elseif rowArgs.data then | elseif rowArgs.data then | ||
local row = root:tag('tr') | local row = root:tag('tr') | ||
row:addClass(rowArgs.rowclass) | row:addClass(rowArgs.rowclass) | ||
row:attr('id', rowArgs.rowid) | row:attr('id', rowArgs.rowid) | ||
if rowArgs.label then | if rowArgs.label then | ||
Line 117: | Line 64: | ||
:attr('scope', 'row') | :attr('scope', 'row') | ||
:attr('id', rowArgs.labelid) | :attr('id', rowArgs.labelid) | ||
:css('text-align', 'left') | |||
:cssText(args.labelstyle) | :cssText(args.labelstyle) | ||
:wikitext(rowArgs.label) | :wikitext(rowArgs.label) | ||
:done() | :done() | ||
Line 133: | Line 80: | ||
:addClass(rowArgs.class) | :addClass(rowArgs.class) | ||
:cssText(rowArgs.datastyle) | :cssText(rowArgs.datastyle) | ||
:newline() | :newline() | ||
:wikitext | :wikitext(rowArgs.data) | ||
end | end | ||
end | end | ||
Line 161: | Line 107: | ||
:css('font-weight', 'bold') | :css('font-weight', 'bold') | ||
:cssText(args.abovestyle) | :cssText(args.abovestyle) | ||
:wikitext | :wikitext(args.above) | ||
end | end | ||
Line 175: | Line 121: | ||
:cssText(args.belowstyle) | :cssText(args.belowstyle) | ||
:newline() | :newline() | ||
:wikitext | :wikitext(args.below) | ||
end | end | ||
Line 236: | Line 182: | ||
rowclass = args['rowclass' .. tostring(num)], | rowclass = args['rowclass' .. tostring(num)], | ||
rowstyle = args['rowstyle' .. tostring(num)], | rowstyle = args['rowstyle' .. tostring(num)], | ||
dataid = args['dataid' .. tostring(num)], | dataid = args['dataid' .. tostring(num)], | ||
labelid = args['labelid' .. tostring(num)], | labelid = args['labelid' .. tostring(num)], | ||
Line 253: | Line 198: | ||
:attr('colspan', '2') | :attr('colspan', '2') | ||
:css('text-align', 'right') | :css('text-align', 'right') | ||
:wikitext(navbar | :wikitext(mw.getCurrentFrame():expandTemplate({ | ||
args.name, | title = 'navbar', | ||
args = { args.name, mini = 1 } | |||
}) | })) | ||
end | end | ||
Line 268: | Line 213: | ||
local function renderTrackingCategories() | local function renderTrackingCategories() | ||
if args.decat ~= 'yes' then | if args.decat ~= 'yes' then | ||
if #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then | |||
root:wikitext('[[Category:Articles which use infobox templates with no data rows]]') | root:wikitext('[[Category:Articles which use infobox templates with no data rows]]') | ||
end | |||
if args.child == 'yes' and args.title then | |||
root:wikitext('[[Category:Articles which use embedded infobox templates with the title parameter]]') | |||
end | end | ||
end | end | ||
Line 285: | Line 229: | ||
root | root | ||
:addClass( | :addClass('infobox') | ||
:addClass(args.bodyclass) | :addClass(args.bodyclass) | ||
:css('border-spacing', '3px') | |||
if args.subbox == 'yes' then | if args.subbox == 'yes' then | ||
Line 431: | Line 376: | ||
{prefix = 'rowclass'}, | {prefix = 'rowclass'}, | ||
{prefix = 'rowstyle'}, | {prefix = 'rowstyle'}, | ||
{prefix = 'class'}, | {prefix = 'class'}, | ||
{prefix = 'dataid'}, | {prefix = 'dataid'}, |