Mô tổ:Unsubst2
Vẻ ngoài
Mô khối hồ sơ[Sáng tạo]
Ngài khả năng muốnSáng tạoBổnScribunto mô khốiHồ sơ. Người biên tập có thể ở bổn mô khối hộp cát(Sáng tạo|Cảnh trong gương)Cùng thí nghiệm dạng lệ(Sáng tạo)Giao diện tiến hành thực nghiệm. Thỉnh ở/docTử giao diện trung tăng thêm phân loại.Bổn mô khối tử giao diện. |
localp={}
localmerror=require("Module:Error")
localspecialParams={
['$N']='template name',-- Deprecated, but keeping until it is removed from transcluding templates
['$B']='template content',
}
p['']=function(frame)
ifmw.isSubsting()then
---- substing
-- Combine passed args with passed defaults
localargs={}
fork,vinpairs(frame.args)do
ifnotspecialParams[k]then
ifv=='__DATE__'then
v=mw.getContentLanguage():formatDate('Y năm n nguyệt ')
end
ifv=='__TIME__'or'__time__'then
v=mw.getContentLanguage():formatDate('c')
end
args[k]=v
end
end
fork,vinpairs(frame:getParent().args)do
args[k]=v
end
-- Build an equivalent template invocation
-- First, find the title to use
localtitleobj=mw.title.new(frame:getParent():getTitle())
localtitle
iftitleobj.namespace==10then-- NS_TEMPLATE
title=titleobj.text
elseiftitleobj.namespace==0then-- NS_MAIN
title=':'..titleobj.text
else
title=titleobj.prefixedText
end
-- Build the invocation body with numbered args first, then named
localret='{{'..title
fork,vinipairs(args)do
ifstring.find(v,'=',1,true)then
-- likely something like 1=foo=bar, we need to do it as a named arg
break
end
ret=ret..'|'..v
args[k]=nil
end
fork,vinpairs(args)do
ret=ret..'|'..k..'='..v
end
returnret..'}}'
else
---- Not substing
-- Just return the "body"
returnframe.args['$B']..(frame.args['$N']andframe:getParent():getTitle()==mw.title.getCurrentTitle().prefixedTextand'[[Category: Sử dụng $N Module:Unsubst thuyên chuyển ]]'or'')
end
end
returnp