缺氧 wiki 编辑团队提示:注册账号并登录后体验更佳,且可通过参数设置定制优化您的浏览体验!
该站点为镜像站点,如果你想帮助这个由玩家志愿编辑的 wiki 站点,请前往原站点参与编辑,
同时欢迎加入编辑讨论群 851803695 与其他编辑者一起参与建设!
全站通知:
模块:信息框/元素
刷
历
编
< 模块:信息框
跳到导航
跳到搜索
此模块的文档可以在模块:信息框/元素/doc创建
local infobox = require([[Module:信息框]])
local fstr = mw.ustring.format
local p = {}
local innerNodes = {
{
tag = 'image',
source = '图片',
children = {
{
tag = 'caption',
source = '图片说明'
}
}
},
{
tag = 'data',
source = 'ID',
label = 'ID'
},
{
tag = 'data',
source = '分类',
label = '分类'
},
{
tag = 'data',
source = '标签',
label = '标签'
},
{
tag = 'group',
header = '属性',
attr = {collapse = 'open'},
children = {
{
tag = 'data',
source = '比热',
label = '比热'
},
{
tag = 'data',
source = '热导率',
label = '[[热导率]]'
},
{
tag = 'data',
source = '硬度',
label = '硬度'
},
{
tag = 'data',
source = '摩尔质量',
label = '<abbr title="密度">摩尔质量</abbr>'
},
{
tag = 'data',
source = '单格最大质量',
label = '单格最大质量'
},
{
tag = 'data',
source = '光吸收率',
label = '[[照明|光]]吸收率'
},
{
tag = 'data',
source = '辐射吸收率',
label = '辐射吸收因数'
},
{
tag = 'data',
source = '辐射',
label = '辐射'
},
}
},
{
tag = 'group',
header = '额外信息',
attr = {collapse = 'open'},
children = {
{
tag = 'data',
source = '最大流动速度',
label = '最大流动速度'
},
{
tag = 'data',
source = '最小垂直流动',
label = '最小垂直流动'
},
{
tag = 'data',
source = '最小水平流动',
label = '最小水平流动'
},
{
tag = 'data',
source = '结块临界质量',
label = '结块临界质量'
},
{
tag = 'data',
source = '毒性',
label = '毒性'
},
}
},
{
tag = 'group',
header = '相变',
attr = {collapse = 'open', layout = "horizontal"},
children = {
{
tag = 'data',
source = '低温相变',
label = '低温相变'
},
{
tag = 'data',
source = '高温相变',
label = '高温相变'
},
}
}
}
-- test: = p.infoboxContent{['分类'] = "[[人造材料]]", ['ID'] = "Algae"}
function p.infoboxContent(args)
if args['低温相变温度'] ~= nil then
local lowTempInfo = {}
table.insert(lowTempInfo, args['低温相变温度'] .. " [[计量单位|°C]]")
if args['低温相变产物'] ~= nil then
table.insert(lowTempInfo, args['低温相变产物'])
end
args['低温相变'] = table.concat(lowTempInfo, "<br/>")
end
if args['高温相变温度'] ~= nil then
local highTempInfo = {}
table.insert(highTempInfo, args['高温相变温度'] .. " [[计量单位|°C]]")
if args['高温相变产物'] ~= nil then
table.insert(highTempInfo, args['高温相变产物'])
end
args['高温相变'] = table.concat(highTempInfo, "<br/>")
end
if args['比热'] ~= nil then
args['比热'] = args['比热'] .. " [[计量单位|(复制热/克)/°C]]"
end
if args['热导率'] ~= nil then
args['热导率'] = args['热导率'] .. " [[计量单位|(复制热/(格*秒))/°C]]"
end
if args['摩尔质量'] ~= nil then
args['摩尔质量'] = args['摩尔质量'] .. " [[计量单位|克/摩尔]]"
end
if args['辐射'] ~= nil then
args['辐射'] = args['辐射'] .. " [[计量单位|拉德/周期/吨]]"
end
if args['摩尔质量'] ~= nil then
args['摩尔质量'] = args['摩尔质量'] .. " [[计量单位|克/摩尔]]"
end
if args['单格最大质量'] ~= nil then
args['单格最大质量'] = args['单格最大质量'] .. " [[计量单位|kg]]"
end
if args['结块临界质量'] ~= nil then
args['结块临界质量'] = args['结块临界质量'] .. " [[计量单位|kg]]"
end
local generated = {}
for _, n in ipairs(innerNodes) do
local child = infobox.genNode(n, args)
if child ~= nil then
table.insert(generated, child)
end
end
return generated
end
function p.main(title, data, raw)
local contentNodes = nil
if #data == 1 then
contentNodes = p.infoboxContent(data[1].data)
else
local panelData = {}
for _, pData in ipairs(data) do
table.insert(panelData, {
label = pData.label,
content = p.infoboxContent(pData.data)
})
end
contentNodes = {
infobox.panel(panelData)
}
end
return infobox.infobox(title, contentNodes, raw, 'element')
end
function p.demo(frame)
local getArgs = require('Module:Dev/Arguments').getArgs
local args = getArgs(frame)
return p.main(args['标题'], {
{
data = args
}
}, args.raw)
end
return p