Module:infobox: Difference between revisions

no edit summary
(Created page with "local p = {} local args = {} local origArgs = {} local root local empty_row_categories = {} local category_in_empty_row_pattern = '%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[...")
 
No edit summary
 
(13 intermediate revisions by the same user not shown)
Line 100: Line 100:
:tag('th')
:tag('th')
:attr('colspan', '2')
:attr('colspan', '2')
:addClass('infobox-header')
:cssText('vertical-align: top; text-align: center;')
:addClass(rowArgs.class)
:addClass(rowArgs.class)
:addClass(args.headerclass)
:addClass(args.headerclass)
Line 122: Line 122:
:tag('th')
:tag('th')
:attr('scope', 'row')
:attr('scope', 'row')
:addClass('infobox-label')
:cssText('text-align:left; font-weight:bold;')
-- @deprecated next; target .infobox-<name> .infobox-label
-- @deprecated next; target .infobox-<name> .infobox-label
:cssText(args.labelstyle)
:cssText(args.labelstyle)
Line 133: Line 133:
dataCell
dataCell
:attr('colspan', not rowArgs.label and '2' or nil)
:attr('colspan', not rowArgs.label and '2' or nil)
:addClass(not rowArgs.label and 'infobox-full-data' or 'infobox-data')
:cssText('vertical-align: top; text-align: left;')
:addClass(rowArgs.class)
:addClass(rowArgs.class)
-- @deprecated next; target .infobox-<name> .infobox(-full)-data
-- @deprecated next; target .infobox-<name> .infobox(-full)-data
Line 149: Line 149:
root
root
:tag('caption')
:tag('caption')
:addClass('infobox-title')
:cssText('text-align: center; padding: 0.2em;')
:addClass(args.titleclass)
:addClass(args.titleclass)
-- @deprecated next; target .infobox-<name> .infobox-title
-- @deprecated next; target .infobox-<name> .infobox-title
Line 163: Line 163:
:tag('th')
:tag('th')
:attr('colspan', '2')
:attr('colspan', '2')
:addClass('infobox-above')
:cssText('vertical-align: top; font-size: 130%; font-weight: bold; text-align: center;')
:addClass(args.aboveclass)
:addClass(args.aboveclass)
-- @deprecated next; target .infobox-<name> .infobox-above
-- @deprecated next; target .infobox-<name> .infobox-above
Line 177: Line 177:
:tag('td')
:tag('td')
:attr('colspan', '2')
:attr('colspan', '2')
:addClass('infobox-below')
:cssText('text-align: center; vertical-align: top;')
:addClass(args.belowclass)
:addClass(args.belowclass)
-- @deprecated next; target .infobox-<name> .infobox-below
-- @deprecated next; target .infobox-<name> .infobox-below
Line 193: Line 193:
dataCell
dataCell
:attr('colspan', '2')
:attr('colspan', '2')
:addClass('infobox-subheader')
:cssText('text-align: center; vertical-align: top;')
:addClass(subheaderArgs.class)
:addClass(subheaderArgs.class)
:cssText(subheaderArgs.datastyle)
:cssText(subheaderArgs.datastyle)
Line 234: Line 234:
dataCell
dataCell
:attr('colspan', '2')
:attr('colspan', '2')
:addClass('infobox-image')
:cssText('text-align: center; vertical-align: top;')
:addClass(imageArgs.class)
:addClass(imageArgs.class)
:cssText(imageArgs.datastyle)
:cssText(imageArgs.datastyle)
Line 257: Line 257:
data
data
:tag('div')
:tag('div')
:addClass('infobox-caption')
:cssText('font-size: 125%; font-weight: bold; text-align: center; padding: 0.2em;')
-- @deprecated next; target .infobox-<name> .infobox-caption
-- @deprecated next; target .infobox-<name> .infobox-caption
:cssText(args.captionstyle)
:cssText(args.captionstyle)
Line 328: Line 328:
:tag('td')
:tag('td')
:attr('colspan', '2')
:attr('colspan', '2')
:addClass('infobox-navbar')
:cssText('vertical-align: top; text-align: right;')
:wikitext(require('Module:Navbar')._navbar{
:wikitext(require('Module:Navbar')._navbar{
args.name,
args.name,
Line 349: Line 349:
for _, s in ipairs(empty_row_categories) do
for _, s in ipairs(empty_row_categories) do
root:wikitext(s)
root:wikitext(s)
end
end
-- Render tracking categories. args.decat == turns off tracking categories.
local function renderTrackingCategories()
if args.decat == 'yes' then return end
if args.child == 'yes' then
if args.title then
root:wikitext(
'[[Category:Pages which use embedded infobox templates with the title parameter]]'
)
end
elseif #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then
root:wikitext('[[Category:Articles which use infobox templates with no data rows]]')
end
end
end
end
Line 418: Line 404:


root
root
:addClass(args.subbox == 'yes' and 'infobox-subbox' or 'infobox')
:cssText(args.subbox == 'yes' and 'padding: 0; border: none; margin: -3px; width: auto; min-width: 100%; font-size: 100%; clear: none; float: none; background-color: transparent;'
or 'border: 1px solid #a2a9b1; border-spacing: 3px; background-color: #f8f9fa; color: black; margin: 0.5em 0 0.5em 1em; padding: 0.2em; float: right; clear: right; font-size: 100%; line-height: 1.5em; width: 22em;')
:addClass(args.bodyclass)
:addClass(args.bodyclass)
-- @deprecated next; target .infobox-<name>
-- @deprecated next; target .infobox-<name>
Line 440: Line 427:
renderItalicTitle()
renderItalicTitle()
renderEmptyRowCategories()
renderEmptyRowCategories()
renderTrackingCategories()


return loadTemplateStyles() .. tostring(root)
return loadTemplateStyles() .. tostring(root)