模組討論:CGroupViewer
外观
Sunny00217在话题“編輯請求 2020-01-06”中的最新留言:5年前
編輯請求 2020-01-06
![]() | 正在請求他人代為編輯受保護的頁面(编辑:仅允许自动确认用户;移动:仅允许管理员(保护日志)) 注意:本模板不是用於請求開放頁面給予編輯,相關請求請至请求解除保护頁申請;本模板是用於請求可以編輯的用户幫忙修改內容。 請求時請列明理由及內容,確保修改有共識基礎及沒有爭議,否則請先在受保護頁面的討論頁進行討論。(工具:處理、申請解除保護) 如果您想直接展示给管理员修改后的页面及清楚地列出编辑差异,请将本模板改为 {{Editprotected|patch=}} ,点击「显示预览」并按照提示进一步操作。 |
把函數main改成這樣:
function z.main( frame )
local name = frame.args[1]
if not name or name == '' then
return ''
end
local data = require( 'Module:CGroup/' .. name )
if type( data ) ~= 'table' or not data.name or data.name == '' then
return error.error{ '指定-{zh-hans:模块;zh-hant:模組}-“' .. name .. '”不是有效的转换组' }
end
if data.name ~= name then
return frame:expandTemplate{ title = 'Template:CGroup redirect', args = { 'Module:CGroup/' .. data.name } }
end
local text = '<strong>-{H|zh-hans:模块;zh-hant:模組}-以下是[[Wikipedia:字詞轉換處理/公共轉換組|公共转换组]]“' .. data.description .. '”。</strong>\n\n'
for i, v in ipairs( data.content ) do
if v.type == 'text' then
text = text .. makeText( frame, v )
elseif v.type == 'item' then
text = text .. makeItem( frame, v )
end
end
text = text .. '[[Category:公共轉換組模板|' .. name .. ']][[Category:公共转换组模块|' .. name .. ']]'
return text
end