添加1,759字节
、 2020年12月31日 (四) 21:31
local PageName = require("Module:PageName")
p = {}
local noStageWarning = "{{未指定创作阶段警告}}"
local noMaintainerWarning = "{{无维护者警告}}"
function p.display_title(type_flag, group_name, page_name)
local node = mw.html.create("span")
if type_flag then
local type_name = PageName.type_name(type_flag)
if page_name then
local base, sub
base, sub = PageName.split(page_name)
if base then
node:wikitext(sub)
node:tag("span"):addClass("ifw-basepagename"):wikitext("("..type_name.."-"..group_name..":"..base..")")
elseif page_name then
node:wikitext(page_name)
node:tag("span"):addClass("ifw-basepagename"):wikitext("("..type_name.."-"..group_name..")")
end
else
node:wikitext(group_name)
node:tag("span"):addClass("ifw-basepagename"):wikitext("("..type_name..")")
end
else
local base, sub
base, sub = PageName.split(page_name)
if base then
node:wikitext(sub)
node:tag("span"):addClass("ifw-basepagename"):wikitext("("..base..")")
else
local type_name = PageName.type_name(page_name)
if type_name then
node:wikitext(type_name.."汇总页")
else
node:wikitext(page_name)
end
end
end
return node:done()
end
function p.render(frame)
local pagename = frame:expandTemplate{title="PAGENAME"}
local type_flag, group_name, page_name
type_flag, group_name, page_name = PageName.parse(pagename)
local title = p.display_title(type_flag, group_name, page_name)
return title
end
return p