请输入您要查询的百科知识:

 

词条 Module:WikiProjectBanner/autodocs
释义

local export = {}

function export.render_docs(frame)

local m_doc = require('Module:Documentation')

local banner_name, is_templ = frame:getParent():getTitle():gsub("^Template:", "")

banner_name = banner_name:match("^(.*)/sandbox$") or banner_name

if is_templ == 0 then

error("This module must be invoked from within a template")

end

if mw.title.getCurrentTitle().fullText ~= frame:getParent():getTitle() then

error("This function must be invoked only on the banner page.")

end

local success, banner_config = pcall(require, "Module:WikiProjectBanner/config/" .. banner_name)

if not success then

return m_doc._main {

content = ('

'):format(

banner_name,

frame:callParserFunction('fullurl', 'Module:WikiProjectBanner/config/' .. banner_name,

'action=edit&editintro=Template:WikiProjectBanner-editintro&preload=Module:WikiProjectBanner/config-preload'

)

)

}

end

local out = { root = mw.html.create() }

out.root:wikitext(":The following documentation is generated automatically from WikiProjectBanner/config/" .. banner_name .. ".\")

out.root:wikitext(":The hooks page for this banner is WikiProjectBanner/config/" .. banner_name .. "/hooks.\")

local template_data = {

params = {};

sets = {};

}

template_data.description = {

en = "Banner template for " .. (banner_config.project_name or ("WikiProject " .. banner_config.project))

}

-- collects categories needed for the template to operate normally

local categories = {}

-- TODO: assessment scale args

for _, tf_info in ipairs(banner_config.task_forces or {}) do

-- TODO: generate documentation for task force args

end

for _, nt_info in ipairs(banner_config.notices or {}) do

-- TODO: generate documentation for notice args

end

for _, cat in ipairs(categories) do

-- check if cat exists, show message if not

end

local m_json = require("Module:microJSON")

return m_doc._main {

content = tostring(out.root) .. "\== TemplateData documentation ==\" ..

frame:extensionTag("templatedata", m_json.encode_object(template_data, {

description = { [true] = true };

params = {

[true] = {

label = { [true] = true };

description = { [true] = true };

aliases = { [0] = true };

};

};

sets = {

[0] = {

label = { [true] = true };

params = { [0] = true };

};

};

}))

}

end

return export

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/11 6:21:55