模块:Unsubst/doc

维基教科书,自由的教学读本

这是Module:Unsubst的文档页面

Lua错误 在package.lua的第80行:module 'Module:Transclusion_count/data/U' not found

此模组是为了预防不应替换引用的模板利用替换引用导入参数(自我替换引用模板)。

用法[编辑]

{{{{{|safesubst:}}}#invoke:Unsubst||$B=

 [ ... 模板的其餘內容 ... ]

}}

参数“$B”为不替换引用时的模板内容。除了$B外所有传入的参数皆视为是替换引用后的模板代码,参数__DATE__会自动转换成时间(Y年n月)。

有些模板有加上<noinclude>但未在结尾加上</noinclude>,此时必须补上。

范例[编辑]

正常时模板应使用此格式:

{{ {{{|safesubst:}}}#invoke:Unsubst||參數1=值1|date=__DATE__ |$B=

 [ ... 模板的其餘內容 ... ]

}}<noinclude>
{{doc}}
</noinclude>
源代码 结果
{{subst:example}} {{Example|参数1=值1|date=2024年4月}}
{{subst:example|参数1=X}} {{Example|参数1=X|date=2024年4月}}
{{subst:example|参数2=X}} {{Example|参数1=值1|参数2=X|date=2024年4月}}
{{subst:example|date={{subst:#time:c}}}} {{Example|参数1=值1|date=2024-04-19T04:17:24+00:00}}