切换搜索
搜索
切换菜单
notifications
切换个人菜单
查看“模块:Icon/table”的源代码
来自决策链云智库
更多操作
←
模块:Icon/table
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
高级
特殊字符
帮助
标题
2级
3级
4级
5级
格式
插入
拉丁字母
扩展拉丁字母
国际音标
符号
希腊字母
希腊字母扩展
西里尔字母
阿拉伯字母
扩展阿拉伯字母
希伯来字母
孟加拉语字符集
泰米尔数字和符号
泰卢固语字符集
僧伽罗语字符集
梵文字符集
古吉拉特语字符集
泰语字符集
老挝语
高棉语字母
加拿大原住民音节文字
卢恩
Á
á
À
à
Â
â
Ä
ä
Ã
ã
Ǎ
ǎ
Ā
ā
Ă
ă
Ą
ą
Å
å
Ć
ć
Ĉ
ĉ
Ç
ç
Č
č
Ċ
ċ
Đ
đ
Ď
ď
É
é
È
è
Ê
ê
Ë
ë
Ě
ě
Ē
ē
Ĕ
ĕ
Ė
ė
Ę
ę
Ĝ
ĝ
Ģ
ģ
Ğ
ğ
Ġ
ġ
Ĥ
ĥ
Ħ
ħ
Í
í
Ì
ì
Î
î
Ï
ï
Ĩ
ĩ
Ǐ
ǐ
Ī
ī
Ĭ
ĭ
İ
ı
Į
į
Ĵ
ĵ
Ķ
ķ
Ĺ
ĺ
Ļ
ļ
Ľ
ľ
Ł
ł
Ń
ń
Ñ
ñ
Ņ
ņ
Ň
ň
Ó
ó
Ò
ò
Ô
ô
Ö
ö
Õ
õ
Ǒ
ǒ
Ō
ō
Ŏ
ŏ
Ǫ
ǫ
Ő
ő
Ŕ
ŕ
Ŗ
ŗ
Ř
ř
Ś
ś
Ŝ
ŝ
Ş
ş
Š
š
Ș
ș
Ț
ț
Ť
ť
Ú
ú
Ù
ù
Û
û
Ü
ü
Ũ
ũ
Ů
ů
Ǔ
ǔ
Ū
ū
ǖ
ǘ
ǚ
ǜ
Ŭ
ŭ
Ų
ų
Ű
ű
Ŵ
ŵ
Ý
ý
Ŷ
ŷ
Ÿ
ÿ
Ȳ
ȳ
Ź
ź
Ž
ž
Ż
ż
Æ
æ
Ǣ
ǣ
Ø
ø
Œ
œ
ß
Ð
ð
Þ
þ
Ə
ə
格式
链接
标题
列表
文件
参考
讨论
说明
输入内容
输出结果
斜体
''斜体文字''
斜体文字
粗体
'''粗体文字'''
粗体文字
粗斜体
'''''粗斜体文字'''''
粗斜体文字
-- Create a table of icons to display on the template test case page require('strict') local p = {} local m_iconData = mw.loadData("Module:Icon/data") local m_iconSandboxData = mw.loadData("Module:Icon/data/sandbox") local function mergeTables(...) local ret = {} for _, t in ipairs{...} do for k, v in pairs(t) do ret[k] = v end end return ret end local function reconstituteAliases(iconDataCollection) local ret = {} for code, iconData in pairs(iconDataCollection) do local outputData = ret[iconData.canonicalCode] or { aliases = {}, image = iconData.image, tooltip = iconData.tooltip, link = iconData.link, } if code ~= iconData.canonicalCode then table.insert(outputData.aliases, code) end ret[iconData.canonicalCode] = outputData end return ret end local function makeTableData(iconDataCollection) local ret = {} for code, iconData in pairs(reconstituteAliases(iconDataCollection)) do if code ~= '_DEFAULT' then table.insert(ret, {code = code, description = iconData.tooltip, aliases = iconData.aliases}) end end table.sort( ret, function(t1, t2) return t1.code < t2.code end ) for _, t in ipairs(ret) do table.sort(t.aliases) end return ret end function p.testcases(frame) local tableData = makeTableData(mergeTables(m_iconData, m_iconSandboxData)) local ret = { '{| class="wikitable sortable"', '! Code', '! [[Template:Icon|Template]]', '! [[Template:Icon/sandbox|Sandbox]]', '! Description', } local function addRow(code, description) table.insert(ret, '|-') table.insert(ret, '| <code>' .. mw.text.nowiki('{{icon|' .. code .. '}}') .. '</code>') table.insert(ret, '| style="text-align: center" | ' .. frame:expandTemplate{title = 'icon', args = {code}}) table.insert(ret, '| style="text-align: center" | ' .. frame:expandTemplate{title = 'icon/sandbox', args = {code}}) table.insert(ret, '| ' .. description) end for _, rowData in ipairs(tableData) do addRow(rowData.code, rowData.description) for _, alias in ipairs(rowData.aliases) do addRow(alias, rowData.description) end end table.insert(ret, '|}') return table.concat(ret, '\n') end function p.main(frame) local tableData = makeTableData(m_iconData) local ret = { '{| class="wikitable sortable"', '! Icon', '! Description', '! Code', '! Aliases' } for _, rowData in ipairs(tableData) do table.insert(ret, '|-') table.insert(ret, '| style="text-align: center" | ' .. frame:expandTemplate{title = 'icon', args = {rowData.code}}) table.insert(ret, '| ' .. rowData.description) table.insert(ret, '| <code>' .. mw.text.nowiki('{{icon|' .. rowData.code .. '}}') .. '</code>') local aliasText = {} for _, alias in ipairs(rowData.aliases) do table.insert(aliasText, '<code>' .. alias .. '</code>') end table.insert(ret, '| ' .. table.concat(aliasText, ', ')) end table.insert(ret, '|}') return table.concat(ret, '\n') end return p
调试控制台
* 此模块的返回的值存于控制台变量“p”中,包括没有保存的变更。 * 在一行的前面加上“=”可以将其作为表达式来计算或使用print()显示。显示表格请使用mw.logObject()。 * 在模块代码中使用mw.log()和mw.logObject()来向控制台发送消息。
本页使用的模板:
模板:Icon
(
查看源代码
)
模板:Sandbox other
(
查看源代码
)
模块:Icon/data
(
查看源代码
)
模块:Icon/data/sandbox
(
查看源代码
)
模块:Icon/table
(
查看源代码
)
模块:Icon/table/doc
(
查看源代码
)
模块:String
(
查看源代码
)
返回
模块:Icon/table
。