samedi 9 novembre 2019

Trying to fix an #ifeq statement in a MediaWiki template

I'm trying to make a spoiler notice template in Fandom, with an expandable text section below it. I've hit a wall trying to get the variables and #ifeq statement to work.

The way this is supposed to work, the first parameter is the story type and controls the #ifeq statement. If the user puts "short story" into parameter 1, it wraps the title (parameter 2) in double quotes (""). Any other input (it defaults to "novel") italicizes it. The third param is a text section, what you're flagging as a spoiler, that defaults to hidden using built-in MediaWiki classes (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 } }|short story|} "[[}}}]]"|}}}}]]''}}. Expand at your own risk.
|-
|}<div class="mw-collapsible mw-collapsed">
}
</div>

Source: https://aeon14.fandom.com/wiki/Template:Spoiler

Aucun commentaire:

Enregistrer un commentaire