「模組:Main」:修訂間差異

imported>CYL992
建立內容為「--[[ -- This module produces a link to a main article or articles. It implements the -- template {{main}}. -- -- If the module is used in category or category talk space, it produces "The -- main article for this category is xxx". Otherwise, it produces -- "Main article: xxx". --]] local mHatnote = require('Module:Hatnote') local mHatlist = require('Module:Hatnote list') local mArguments -- lazily initialise local p = {} function p.main(frame) mArguments…」的新頁面
 
imported>CYL992
無編輯摘要
 
(未顯示同一使用者於中間所作的 3 次修訂)
第28行: 第28行:
-- 本地化注意
-- 本地化注意
return mHatnote.makeWikitextError(
return mHatnote.makeWikitextError(
'没有指定条目名',
'没有指定條目',
'Template:Main#错误',
'Template:Main#錯誤',
args.category
args.category
)
)
第47行: 第47行:
-- Find the pagetype.
-- Find the pagetype.
-- 本地化注意
-- 本地化注意
local pageType = mHatnote.findNamespaceId(firstPage) == 0 and '条目' or '页面'
local pageType = mHatnote.findNamespaceId(firstPage) == 0 and '條目' or '頁面'
-- Make the formatted link text
-- Make the formatted link text
list = mHatlist.andList(args, true)
list = mHatlist.andList(args, true)
第56行: 第56行:
-- 本地化注意
-- 本地化注意
if (curNs == 14) or (curNs == 15) then --category/talk namespaces
if (curNs == 14) or (curNs == 15) then --category/talk namespaces
mainForm = '此[[Wikipedia:頁面分類|分类]]的主%s是%s。'
mainForm = '此分類的主%s是%s。'
else
else
mainForm = '-{}-%s:%s'
mainForm = '主%s:%s'
end
end
local text = string.format(mainForm, pageType, list)
local text = string.format(mainForm, pageType, list)