Mikhsha​(留言 | 贡献)
无编辑摘要
Lhscogs​(留言 | 贡献)
小 导入1个版本
 
(未显示4个用户的7个中间版本)
第5行: 第5行:
local args = {}
local args = {}
local origArgs = {}
local origArgs = {}
local root = mw.html.create('table')
local root
    :addClass(args.bodyclass or 'infobox') -- 只添加一次
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 = {
第47行: 第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


第159行: 第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')
第170行: 第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:使用已忽略数据行信息框模板的条目]]'
第193行: 第198行:
:wikitext(rowArgs.label)
:wikitext(rowArgs.label)
:done()
:done()
else
row:addClass( isUntitledChildBox( rowArgs.data ) and 'infobox-hiddenrow' or nil )
end
end


第234行: 第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')
第251行: 第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')
第268行: 第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')
第312行: 第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')
第459行: 第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
第498行: 第509行:
end
end
-- See function description
local base_templatestyles = frame:extensionTag{
local base_templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = 'Module:Infobox/styles.css' }
name = 'templatestyles', args = { src = 'Module:Infobox/styles.css' }
}
-- ✅ 添加:手动加载 Infobox country 样式表
local country_templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = 'Template:Infobox country/styles.css' }
}
}


第529行: 第536行:
return table.concat({
return table.concat({
-- hlist -> plainlist -> base is best-effort to preserve old Common.css ordering.
-- this ordering is not a guarantee because the rows of interest invoking
-- each class may not be on a specific page
hlist_templatestyles,
hlist_templatestyles,
plainlist_templatestyles,
plainlist_templatestyles,
base_templatestyles,
base_templatestyles,
country_templatestyles, -- ✅ 现在样式会加载了!
templatestyles,
templatestyles,
child_templatestyles,
child_templatestyles,
第558行: 第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')