有兽档案馆
搜索
切换搜索
切换菜单
切换个人菜单
查看“Module:Template invocation/doc”的源代码
来自有兽档案馆
更多语言
阅读
查看源代码
查看历史
模块
讨论
更多操作
←
Module:Template invocation/doc
因为以下原因,您没有权限编辑该页面:
您所请求的操作,仅限具有
注册用户
、
自动确认用户
、
管理员
、
界面管理员
、
优质编辑者
、
确认用户
、
巡查员
、
档案理事员
等
权限
的
用户
执行。
若您尚未登录有兽档案馆账号,请您
登录
有兽档案馆账号后操作。
您尚未完成电子邮件确认,因此操作受限,请尽快
完成电子邮件确认
。
若您无法完成前述手续,请通过适当渠道请求管理员或档案理事员协助。
您可以查看和复制此页面的源代码。
若您无权编辑本页面,您可以
提出编辑请求
,提请有权限者代为编辑。
This is a meta-module for producing MediaWiki template invocations. == Usage == First load the module: <syntaxhighlight lang="lua"> local mTemplateInvocation = require('Module:Template invocation') </syntaxhighlight> Then you can use the individual functions as documented below. === Name === <syntaxhighlight lang="lua"> mTemplateInvocation.name(title) </syntaxhighlight> This function produces the name to be used in a template invocation. For pages in the template namespace it returns the page name with no namespace prefix, for pages in the main namespace it returns the full page name prefixed with ":", and for other pages it returns the full page name. <var>title</var> can be a string or a [[mw:Extension:Scribunto/Lua reference manual#Title objects|mw.title object]]. {{red|If <var>title</var> is a string, a mw.title object is created for it, which is [[QW:EXPENSIVE|expensive]].}} === Invocation === <syntaxhighlight lang="lua"> mTemplateInvocation.invocation(name, args, format) </syntaxhighlight> This function creates a MediaWiki [[Help:Template|template]] invocation. Parameters: * '''name''' - the name of the template (string, required). This should be exactly as it will appear in the invocation, e.g. for [[Template:Example]] use "Example". To generate the template name from a page name you can use the [[#Name|name]] function. * '''args''' - the arguments to use in the invocation (table, required). Table keys and values must be either strings or numbers. * '''format''' - the format of the invocation (string, optional). The default is a normal invocation with unescaped curly braces, pipes, and equals signs. If this parameter is the string "nowiki", then the curly braces, pipes and equals signs are replaced with the appropriate [[HTML entities]]. '''Example''' The code {{code|1=mTemplateInvocation.invocation('foo', {'bar', 'baz', abc = 'def'})|2=lua}} would produce <code><nowiki>{{foo|bar|baz|abc=def}}</nowiki></code>. <includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox|| <!-- Categories go here and interwikis go in Wikidata. --> }}</includeonly>
该页面使用的模板:
Template:Code
(
查看源代码
)
Template:Font color
(
查看源代码
)
Template:Fontcolor
(
查看源代码
)
Template:Red
(
查看源代码
)
Template:Trim
(
查看源代码
)
Template:紅
(
查看源代码
)
Module:List
(
查看源代码
)
返回
Module:Template invocation/doc
。