第2行: |
第2行: |
| local PageName = require("Module:PageName") | | local PageName = require("Module:PageName") |
| local p = {} | | local p = {} |
| + | |
| + | function p.display_title(frame) |
| + | local pagename = mw.title.getCurrentTitle().text |
| + | local node = mw.html.create(nil) |
| + | local type_flag, group_name, page_name |
| + | local parent, name |
| + | base, sub = PageName.split(pagename) |
| + | if base then |
| + | node:wikitext(sub) |
| + | node:tag("span"):addClass("ifw-basepagename"):wikitext(" ("..base..")") |
| + | else |
| + | node:wikitext(page_name) |
| + | end |
| + | local code = node:done() |
| + | return code |
| + | end |
| | | |
| function renderMaintainers(frame, maintainers, other_creators) | | function renderMaintainers(frame, maintainers, other_creators) |
第28行: |
第44行: |
| }) | | }) |
| return frame:expandTemplate{title = "本页面仅允许维护者编辑", args = {}} | | return frame:expandTemplate{title = "本页面仅允许维护者编辑", args = {}} |
| + | end |
| + | |
| + | function renderLiteInfoBox(frame, image, content) |
| + | local args = { |
| + | image = image, |
| + | content = content |
| + | } |
| + | return frame:expandTemplate{title = "LiteInfoBox", args = args} |
| end | | end |
| | | |
| function renderStage(frame, stage) | | function renderStage(frame, stage) |
| return frame:expandTemplate{title = "创作阶段", args = {["创作阶段"]=stage}} | | return frame:expandTemplate{title = "创作阶段", args = {["创作阶段"]=stage}} |
| + | end |
| + | |
| + | function renderType(frame, isIndexPage, type, relGroup) |
| + | local pagename = mw.title.getCurrentTitle().text |
| + | local parent, name |
| + | base, sub = PageName.split(pagename) |
| + | local root = mw.html.create(nil) |
| + | if isIndexPage or not base then |
| + | if type == "世界观设定" then |
| + | root:wikitext(renderLiteInfoBox("WorldItem.svg", "世界观介绍页")) |
| + | elseif type == "联动设定" then |
| + | local text = "" |
| + | root:wikitext(renderLiteInfoBox("联动.svg", "联动介绍页")) |
| + | else -- 公共设定 |
| + | root:wikitext(renderLiteInfoBox("SharedItem.svg", "公共设定页")) |
| + | end |
| + | else |
| + | if type == "世界观设定" then |
| + | root:wikitext(renderLiteInfoBox("WorldItem.svg", "本页面属于世界观: [[" .. base .. "]]")) |
| + | elseif type == "联动设定" then |
| + | local text = "" |
| + | root:wikitext(renderLiteInfoBox("联动.svg", "本页面属于联动: [["..base.."]")) |
| + | else -- 公共设定 |
| + | root:wikitext(renderLiteInfoBox("SharedItem.svg", "公共设定页")) |
| + | end |
| + | end |
| + | return root:done() |
| end | | end |
| | | |
第40行: |
第91行: |
| local root = mw.html.create(nil) | | local root = mw.html.create(nil) |
| local maintainerTemp = renderMaintainers(frame, props["维护者"], props["创作者"]) | | local maintainerTemp = renderMaintainers(frame, props["维护者"], props["创作者"]) |
| + | |
| root:wikitext(maintainerTemp) | | root:wikitext(maintainerTemp) |
| if props["仅允许维护者编辑"][1] == "t" then | | if props["仅允许维护者编辑"][1] == "t" then |
| root:wikitext(renderLockedPage(frame)) | | root:wikitext(renderLockedPage(frame)) |
| end | | end |
| + | local isIndexPage = props["设定集核心页"][1] == 't' |
| + | root:wikitext(renderType(frame, isIndexPage, props["设定类型"][1] or "公共设定"), props["依赖设定集"]) |
| root:wikitext(renderStage(frame, props["创作阶段"][1] or "空白")) | | root:wikitext(renderStage(frame, props["创作阶段"][1] or "空白")) |
| return root:done() | | return root:done() |
| end | | end |
| | | |
− | function p.display_title(frame)
| + | |
− | local pagename = mw.title.getCurrentTitle().text
| |
− | local node = mw.html.create(nil)
| |
− | local type_flag, group_name, page_name
| |
− | local parent, name
| |
− | base, sub = PageName.split(pagename)
| |
− | if base then
| |
− | node:wikitext(sub)
| |
− | node:tag("span"):addClass("ifw-basepagename"):wikitext(" ("..base..")")
| |
− | else
| |
− | node:wikitext(page_name)
| |
− | end
| |
− | local code = node:done()
| |
− | return code
| |
− | end
| |
| | | |
| return p | | return p |