模組討論:CGroupViewer
外观
Xiplus在话题“編輯請求 2020-01-06”中的最新留言:5年前
編輯請求 2020-01-06
请求已拒绝--Xiplus#Talk 2020年1月6日 (一) 23:01 (UTC)
把函數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
-- Sunny00217 2020年1月6日 (一) 15:21 (UTC)
未完成,嘗試修改後部分頁面出現以下錯誤:「Lua錯誤:not enough memory。」。--Xiplus#Talk 2020年1月6日 (一) 23:01 (UTC)