Khiêu chí nội dung

Mô tổ:Main

Chók-cê̤ṳ Wikipedia

Khả tạiMô tổ:Main/docKiến lập thử mô tổ đích thuyết minh văn kiện

--[[
-- 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".
--]]

localmHatnote=require('Module:Hatnote')
localmHatlist=require('Module:Hatnote list')
localmArguments-- lazily initialise
localp={}

functionp.main(frame)
mArguments=require('Module:Arguments')
localargs=mArguments.getArgs(frame,{parentOnly=true})
localpages={}
fork,vinpairs(args)do
iftype(k)=='number'then
localdisplay=args['label '..k]orargs['l'..k]
localpage=displayand
string.format('%s|%s',string.gsub(v,'|.*$',''),display)orv
pages[#pages+1]=page
end
end
if#pages==0andmw.title.getCurrentTitle().namespace==0then
-- bổn địa hóa chú ý
returnmHatnote.makeWikitextError(
' vô định điều mục danh ',
'Template:Main# thác ngộ ',
args.category
)
end
localoptions={
selfref=args.selfref
}
returnp._main(pages,options)
end

functionp._main(args,options)
-- Get the list of pages. If no first page was specified we use the current
-- page name.
localcurrentTitle=mw.title.getCurrentTitle()
if#args==0thenargs={currentTitle.text}end
localfirstPage=string.gsub(args[1],'|.*$','')
-- Find the pagetype.
-- bổn địa hóa chú ý
localpageType=mHatnote.findNamespaceId(firstPage)==0and' điều mục 'or' hiệt diện '
-- Make the formatted link text
list=mHatlist.andList(args,true)
-- Build the text.
localisPlural=#args>1
localmainForm
localcurNs=currentTitle.namespace
-- bổn địa hóa chú ý
if(curNs==14)or(curNs==15)then--category/talk namespaces
mainForm=' tư tỉ [[Wikipedia: Hiệt diện phân loại | phân loại ]] kỳ chủ %s thị %s. '
else
mainForm=' chủ %s: %s'
end
localtext=string.format(mainForm,pageType,list)
-- Process the options and pass the text to the _rellink function in
-- [[Module:Hatnote]].
options=optionsor{}
localhnOptions={
selfref=options.selfref
}
returnmHatnote._hatnote(text,hnOptions)
end

returnp