Lhscogs​(留言 | 贡献)
无编辑摘要
Lhscogs​(留言 | 贡献)
小 导入1个版本
 
(未显示4个用户的9个中间版本)
第5行: 第5行:
local args = {}
local args = {}
local origArgs = {}
local origArgs = {}
local root = mw.html.create('table')
local root
    :addClass('infobox')
    :addClass(args.bodyclass or '')
local empty_row_categories = {}
local empty_row_categories = {}
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 yesno = require("Module:Yesno")
local lists = {
local lists = {
plainlist_t = {
plainlist_t = {
第48行: 第47行:
end
end
end
end
end
local function isUntitledChildBox(sval)
return sval and ( sval:match( '^%s*<%s*[Tt][Rr]' ) or sval:match( '^%s*\127[^\127]*UNIQ%-%-templatestyles%-%x+%-QINU[^\127]*\127%s*<%s*[Tt][Rr]' ) )
end
end


第160行: 第163行:
:tag('tr')
:tag('tr')
:addClass(rowArgs.rowclass)
:addClass(rowArgs.rowclass)
:addClass( isUntitledChildBox( rowArgs.header ) and 'infobox-hiddenrow' or nil )
:cssText(rowArgs.rowstyle)
:cssText(rowArgs.rowstyle)
:tag('th')
:tag('th')
第171行: 第175行:
:cssText(rowArgs.rowcellstyle)
:cssText(rowArgs.rowcellstyle)
:wikitext(fixChildBoxes(rowArgs.header, 'th'))
:wikitext(fixChildBoxes(rowArgs.header, 'th'))
if rowArgs.data then
if rowArgs.data and not yesno(args.decat) then
root:wikitext(
root:wikitext(
'[[Category:使用已忽略数据行信息框模板的条目]]'
'[[Category:使用已忽略数据行信息框模板的条目]]'
第194行: 第198行:
:wikitext(rowArgs.label)
:wikitext(rowArgs.label)
:done()
:done()
else
row:addClass( isUntitledChildBox( rowArgs.data ) and 'infobox-hiddenrow' or nil )
end
end


第235行: 第241行:
root
root
:tag('tr')
:tag('tr')
:addClass( isUntitledChildBox( args.above ) and 'infobox-hiddenrow' or nil )
:tag('th')
:tag('th')
:attr('colspan', '2')
:attr('colspan', '2')
第252行: 第259行:
root
root
:tag('tr')
:tag('tr')
:addClass( isUntitledChildBox( args.below ) and 'infobox-hiddenrow' or nil )
:tag('td')
:tag('td')
:attr('colspan', '2')
:attr('colspan', '2')
第269行: 第277行:
local row = root:tag('tr')
local row = root:tag('tr')
row:addClass(subheaderArgs.rowclass)
row:addClass(subheaderArgs.rowclass)
row:addClass( isUntitledChildBox( subheaderArgs.data ) and 'infobox-hiddenrow' or nil )


local dataCell = row:tag('td')
local dataCell = row:tag('td')
第313行: 第322行:
local row = root:tag('tr')
local row = root:tag('tr')
row:addClass(imageArgs.rowclass)
row:addClass(imageArgs.rowclass)
row:addClass( isUntitledChildBox( imageArgs.data ) and 'infobox-hiddenrow' or nil )


local dataCell = row:tag('td')
local dataCell = row:tag('td')
第460行: 第470行:
-- Render tracking categories. args.decat == turns off tracking categories.
-- Render tracking categories. args.decat == turns off tracking categories.
local function renderTrackingCategories()
local function renderTrackingCategories()
if args.decat == 'yes' then return end
if yesno(args.decat) then return end
if args.child == 'yes' then
if args.child == 'yes' then
if args.title then
if args.title then
第557行: 第567行:
if args.child ~= 'yes' then
if args.child ~= 'yes' then
root = mw.html.create('table')
root = mw.html.create('table')
:addClass('infobox')  -- 加上默认 infobox 样式
 
:addClass(args.bodyclass or '')  -- 同时保留原有的 ib-country 或其他类
root
root
:addClass(args.subbox == 'yes' and 'infobox-subbox' or 'infobox')
:addClass(args.subbox == 'yes' and 'infobox-subbox' or 'infobox')