尝试修复 MediaWiki 模板中的#ifeq 语句
Trying to fix an #ifeq statement in a MediaWiki template
我正在尝试在 Fandom 中制作一个剧透通知模板,其下方有一个可扩展的文本部分。我在尝试让变量和#ifeq 语句起作用时遇到了困难。
这是应该的工作方式,第一个参数是故事类型并控制#ifeq 语句。如果用户将 "short story" 放入参数 1,它会将标题(参数 2)用双引号 ("") 引起来。任何其他输入(默认为 "novel")将其设为斜体。第三个参数是一个文本部分,你标记为剧透的内容,默认使用 built-in MediaWiki 类 (from here).
隐藏
{| style="width:100%; margin-top:1em; border:1px solid #999; font-size:90%; text-align:center;"
|-
! style="padding:0.2em 0.5em; background-color:red;" nowrap="nowrap" class="color1" | ''SPOILER WARNING<nowiki>!!!</nowiki>''
|-
| This section contains spoilers for the {{{1|novel}}} {{#ifeq: {{{1|}}}|short story|{{{1}}} "[[{{{2|{{PAGENAME}}}}}]]"|{{{1}}}{{{''[[{{{2|{{PAGENAME}}}}}]]''}}. Expand at your own risk.
|-
|}<div class="mw-collapsible mw-collapsed">
{{{3}}}
</div>
好的,我找到问题了。原来我在那里有一些无关的括号,而且我在两个字段中错误地留下了参数 1 的第二个副本。这是固定代码:
{| style="width:100%; margin-top:1em; border:1px solid #999; font-size:90%; text-align:center;"
|-
! style="padding:0.2em 0.5em; background-color:red;" nowrap="nowrap" class="color1" | ''SPOILER WARNING<nowiki>!!!</nowiki>''
|-
| This section contains spoilers for the {{{1|novel}}} {{#ifeq: {{{1|}}}|short story|"[[{{{2|{{PAGENAME}}}}}]]"|''[[{{{2|{{PAGENAME}}}}}]]''}}. Expand at your own risk.
|-
|}<div class="mw-collapsible mw-collapsed">
{{{3}}}
</div>
我正在尝试在 Fandom 中制作一个剧透通知模板,其下方有一个可扩展的文本部分。我在尝试让变量和#ifeq 语句起作用时遇到了困难。
这是应该的工作方式,第一个参数是故事类型并控制#ifeq 语句。如果用户将 "short story" 放入参数 1,它会将标题(参数 2)用双引号 ("") 引起来。任何其他输入(默认为 "novel")将其设为斜体。第三个参数是一个文本部分,你标记为剧透的内容,默认使用 built-in MediaWiki 类 (from here).
隐藏{| style="width:100%; margin-top:1em; border:1px solid #999; font-size:90%; text-align:center;"
|-
! style="padding:0.2em 0.5em; background-color:red;" nowrap="nowrap" class="color1" | ''SPOILER WARNING<nowiki>!!!</nowiki>''
|-
| This section contains spoilers for the {{{1|novel}}} {{#ifeq: {{{1|}}}|short story|{{{1}}} "[[{{{2|{{PAGENAME}}}}}]]"|{{{1}}}{{{''[[{{{2|{{PAGENAME}}}}}]]''}}. Expand at your own risk.
|-
|}<div class="mw-collapsible mw-collapsed">
{{{3}}}
</div>
好的,我找到问题了。原来我在那里有一些无关的括号,而且我在两个字段中错误地留下了参数 1 的第二个副本。这是固定代码:
{| style="width:100%; margin-top:1em; border:1px solid #999; font-size:90%; text-align:center;"
|-
! style="padding:0.2em 0.5em; background-color:red;" nowrap="nowrap" class="color1" | ''SPOILER WARNING<nowiki>!!!</nowiki>''
|-
| This section contains spoilers for the {{{1|novel}}} {{#ifeq: {{{1|}}}|short story|"[[{{{2|{{PAGENAME}}}}}]]"|''[[{{{2|{{PAGENAME}}}}}]]''}}. Expand at your own risk.
|-
|}<div class="mw-collapsible mw-collapsed">
{{{3}}}
</div>