跳转到内容

模块:Module wikitext/CGroup

本页使用了标题或全文手工转换
被永久保护的模块
维基百科,自由的百科全书
文档图示 模块文档[查看] [编辑] [历史] [清除缓存]

本模块为提供Module:CGroup实现{{Special wikitext}}中的Module:Module wikitext功能所架设。能让转换组能加入自定义的wikitext并纳入分类,以方便诸如提删或挂维护模板之功能。详细使用方法请参考Module:Module wikitext/doc

本模块的主模块Module:Module wikitext被引用于MediaWiki:Scribunto-doc-page-does-not-exist嵌入于所有模块因此被全保护;而本子模版只嵌入了所有公共转换组,因此只被半保护。

如公共转换组在调用本模块的位置出现错误,请检查Module:Documentation中的getEnvironment_getModuleWikitext是否被删除或更名,如是,请更新本模块或回退Module:Documentation中的相关更改。

--模組用於提供轉換組加上分類的支援
local p = {}
local lib_arg = {}

function p.main(frame)
	local args, working_frame
    if frame == mw.getCurrentFrame() then
        -- We're being called via #invoke. The args are passed through to the module
        -- from the template page, so use the args that were passed into the template.
        if lib_arg.getArgs == nil then lib_arg = require('Module:Arguments') end
        args = lib_arg.getArgs(frame)
        working_frame = frame
    else
        -- We're being called from another module or from the debug console, so assume
        -- the args are passed in directly.
        args = frame
        working_frame = mw.getCurrentFrame()
        if type(args) ~= type({}) then args = {frame} end
    end
    local root = mw.html.create()
    local lib_doc = require('Module:Documentation')
    local env = lib_doc.getEnvironment(args)
    root:wikitext(lib_doc._getModuleWikitext(args, env))
	return tostring(root)
end

return p