模块:设定页v2:修订间差异

无编辑摘要
无编辑摘要
第56行: 第56行:
function renderStage(frame, stage)
function renderStage(frame, stage)
     return frame:expandTemplate{title = "创作阶段", args = {["创作阶段"]=stage}}
     return frame:expandTemplate{title = "创作阶段", args = {["创作阶段"]=stage}}
end
function getParentProps(base, props)
    return SMWUtils.query_page_properties("[["..base.."]]", props)[1]["properties"]
end
end


第64行: 第68行:
     local out = ""
     local out = ""
     if isIndexPage or not base then
     if isIndexPage or not base then
        mw.smw.set({['设定集'] = pagename})
         if type == "世界观设定" then
         if type == "世界观设定" then
             out = out .. (renderLiteInfoBox(frame, "WorldItem.svg", "世界观介绍页"))
             out = out .. (renderLiteInfoBox(frame, "WorldItem.svg", "世界观介绍页"))
第72行: 第77行:
             out = out .. (renderLiteInfoBox(frame, "SharedItem.svg", "公共设定页"))
             out = out .. (renderLiteInfoBox(frame, "SharedItem.svg", "公共设定页"))
         end
         end
     else
     else -- base must exist
         if type == "世界观设定" then
        local parent = getParentProps(base, {"设定集", "设定类型"})
        if parent["设定集"] then
            mw.smw.set({['设定集'] = parent["设定集"]})
        end
        local parentType = parent["设定类型"] or "公共设定"
        mw.smw.set({['设定类型'] = parentType})
         if parentType == "世界观设定" then
             out = out .. (renderLiteInfoBox(frame, "WorldItem.svg", "本页面属于世界观: [[" .. base .. "]]"))
             out = out .. (renderLiteInfoBox(frame, "WorldItem.svg", "本页面属于世界观: [[" .. base .. "]]"))
         elseif type == "联动设定" then
         elseif parentType == "联动设定" then
             local text = ""
             local text = ""
             out = out .. (renderLiteInfoBox(frame, "联动.svg", "本页面属于联动: [["..base.."]"))
             out = out .. (renderLiteInfoBox(frame, "联动.svg", "本页面属于联动: [["..base.."]"))