将等号('=')传递给MediaWiki模板中的参数 [英] Passing an equal sign ('=') to a parameter in a MediaWiki template

查看:221
本文介绍了将等号('=')传递给MediaWiki模板中的参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在不破坏模板解析器的情况下在模板参数中使用'='字符?我不是MediaWIKI开发人员,所以我没有调试代码或检查日志,我希望这里的人有一个转义传递给模板的字符的提示.

How can I use a '=' character in a template parameter without breaking the template parser? I'm not a MediaWIKI developer so I haven't debugged the code or checked the logs, I'm hoping someone here has a tip for escaping characters passed to templates.

使用以下内容创建一个名为测试"的模板:

Create a template called "Test" with this content:

{{{1}}}

赞:

{{ Test | R = 3/(2-(1+1)) }} 

将渲染{{{1}}}而不是复杂的公式!我确定"="字符是罪魁祸首.

Will render {{{1}}} instead of the complex formula! I've determined the '=' character is the culprit.

推荐答案

如果MediaWiki模板参数字符串包含等号,则将符号前的所有内容视为参数的名称.如果它不包含等号,则将参数字符串分配给下一个可用的数字参数.

If a MediaWiki template parameter string contains an equals sign, everything before the sign is taken to be the name of the parameter. If it does not contain an equals sign, the parameter string is assigned to the next available numeric parameter.

因此,最简单的解决方法是,如果实际上希望一个带编号的参数值包含一个等号,则是对它进行显式编号,如下所示:

Thus, the simplest workaround, if you actually want a numbered parameter value to contain an equals sign, is to explicitly number it, like this:

{{ Test | 1 = R = 3/(2-(1+1)) }}

这将导致模板内的{{{1}}}扩展为字符串R = 3/(2-(1+1)),如下所示:

This will cause {{{1}}} inside the template to expand to the string R = 3/(2-(1+1)), just as:

{{ Test | equation = R = 3/(2-(1+1)) }}

将导致{{{equation}}}扩展到相同的字符串.

will cause {{{equation}}} to expand to that same string.

这篇关于将等号('=')传递给MediaWiki模板中的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆