Module:Infobox: Difference between revisions
enwiki>Izno merge hlist here |
m 1 revision imported |
||
| Line 6: | Line 6: | ||
local category_in_empty_row_pattern = '%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*]]' | local category_in_empty_row_pattern = '%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*]]' | ||
local has_rows = false | local has_rows = false | ||
local function fixChildBoxes(sval, tt) | local function fixChildBoxes(sval, tt) | ||
| Line 150: | Line 112: | ||
if rowArgs.header and rowArgs.header ~= '_BLANK_' then | if rowArgs.header and rowArgs.header ~= '_BLANK_' then | ||
has_rows = true | has_rows = true | ||
root | root | ||
:tag('tr') | :tag('tr') | ||
| Line 170: | Line 130: | ||
) | ) | ||
end | end | ||
elseif rowArgs.data and rowArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then | elseif rowArgs.data and rowArgs.data:gsub( | ||
category_in_empty_row_pattern, '' | |||
):match('^%S') then | |||
has_rows = true | has_rows = true | ||
local row = root:tag('tr') | local row = root:tag('tr') | ||
row:addClass(rowArgs.rowclass) | row:addClass(rowArgs.rowclass) | ||
| Line 207: | Line 167: | ||
has_rows = true | has_rows = true | ||
root | root | ||
:tag('caption') | :tag('caption') | ||
| Line 216: | Line 174: | ||
:cssText(args.titlestyle) | :cssText(args.titlestyle) | ||
:wikitext(args.title) | :wikitext(args.title) | ||
end | end | ||
| Line 223: | Line 180: | ||
has_rows = true | has_rows = true | ||
root | root | ||
:tag('tr') | :tag('tr') | ||
| Line 240: | Line 195: | ||
has_rows = true | has_rows = true | ||
root | root | ||
:tag('tr') | :tag('tr') | ||
| Line 257: | Line 210: | ||
subheaderArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then | subheaderArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then | ||
has_rows = true | has_rows = true | ||
local row = root:tag('tr') | local row = root:tag('tr') | ||
row:addClass(subheaderArgs.rowclass) | row:addClass(subheaderArgs.rowclass) | ||
| Line 301: | Line 252: | ||
has_rows = true | has_rows = true | ||
local row = root:tag('tr') | local row = root:tag('tr') | ||
row:addClass(imageArgs.rowclass) | row:addClass(imageArgs.rowclass) | ||
| Line 414: | Line 363: | ||
local italicTitle = args['italic title'] and mw.ustring.lower(args['italic title']) | local italicTitle = args['italic title'] and mw.ustring.lower(args['italic title']) | ||
if italicTitle == '' or italicTitle == 'force' or italicTitle == 'yes' then | if italicTitle == '' or italicTitle == 'force' or italicTitle == 'yes' then | ||
root:wikitext( | root:wikitext(mw.getCurrentFrame():expandTemplate({title = 'italic title'})) | ||
end | end | ||
end | end | ||
| Line 454: | Line 403: | ||
local function loadTemplateStyles() | local function loadTemplateStyles() | ||
local frame = mw.getCurrentFrame() | local frame = mw.getCurrentFrame() | ||
-- See function description | -- See function description | ||
| Line 475: | Line 410: | ||
local templatestyles = '' | local templatestyles = '' | ||
if args['templatestyles'] then | if args['templatestyles'] then templatestyles = frame:extensionTag{ | ||
name = 'templatestyles', args = { src = args['templatestyles'] } | name = 'templatestyles', args = { src = args['templatestyles'] } | ||
} | } | ||
| Line 482: | Line 416: | ||
local child_templatestyles = '' | local child_templatestyles = '' | ||
if args['child templatestyles'] then | if args['child templatestyles'] then child_templatestyles = frame:extensionTag{ | ||
name = 'templatestyles', args = { src = args['child templatestyles'] } | name = 'templatestyles', args = { src = args['child templatestyles'] } | ||
} | } | ||
| Line 489: | Line 422: | ||
local grandchild_templatestyles = '' | local grandchild_templatestyles = '' | ||
if args['grandchild templatestyles'] then | if args['grandchild templatestyles'] then grandchild_templatestyles = frame:extensionTag{ | ||
name = 'templatestyles', args = { src = args['grandchild templatestyles'] } | name = 'templatestyles', args = { src = args['grandchild templatestyles'] } | ||
} | } | ||
end | end | ||
return table.concat({ | return table.concat({ | ||
-- | base_templatestyles, -- see function description | ||
templatestyles, | templatestyles, | ||
child_templatestyles, | child_templatestyles, | ||
| Line 533: | Line 460: | ||
-- @deprecated next; target .infobox-<name> | -- @deprecated next; target .infobox-<name> | ||
:cssText(args.bodystyle) | :cssText(args.bodystyle) | ||
renderTitle() | renderTitle() | ||