![]() | Help support Yugipedia by using our Chrome extension, which redirects links to the old Wikia/Fandom site to Yugipedia, ensuring you see the most up-to-date information. If you have any issues or find any bugs, be sure to let us know on Discord! |
Template:SMW plain
{{SMW plain}} can be used to strip [[SMW::off]]
and [[SMW::on]]
out of the result of an SMW query.
{{ #ask: [[Release::Yu-Gi-Oh! Duel Monsters (video game)]][[Card number::004]] |?English name | mainlabel = - | format = template | template = echo | link = none }}
The above query will produce the visual output, "Baby Dragon". However the underlying code will be [[SMW::off]]Baby Dragon[[SMW::on]]
. This can be problematic when using string comparisons.
{{ #vardefine: $card_name | {{ #ask: [[Release::Yu-Gi-Oh! Duel Monsters (video game)]][[Card number::004]] |?English name | mainlabel = - | format = template | template = echo | link = none }} }} {{ #ifeq: {{ #var: $card_name }} | Baby Dragon | true | false }}
For example, the above will produce false
because [[SMW::off]]Baby Dragon[[SMW::on]]
is not equal to Baby Dragon
.
{{ #vardefine: $card_name | {{SMW plain | {{ #ask: [[Release::Yu-Gi-Oh! Duel Monsters (video game)]][[Card number::004]] |?English name | mainlabel = - | format = template | template = echo | link = none }} }} }} {{ #ifeq: {{ #var: $card_name }} | Baby Dragon | true | false }}
If {{SMW plain}}
is used around the outcome of the query, the [[SMW::off]]
and [[SMW::on]]
tagging will be removed and the above code will output true
, as expected.