Page MenuHomePhabricator

{{#ifeq:}} treats the options as standalone wikitext, not a part of the code, which sometimes causes rendering issues.
Closed, DuplicatePublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Write a table with a style attribute that assigns a color, using {{#ifeq:}} block
  • Press "Preview" to see your changes
  • Save the edits

What happens?:
While I was trying to create a template on isvwiki, I encountered a rather interesting bug. Take this wikicode I made:

wikitext
<div align="center">
{| style="border: {{{obrub|{{#ifeq:{{{tip}}}|bystrostično|5|1}}px solid {{{kolor obruba|{{#ifeq:{{{tip}}}|bystrostično|#990000|black}}}}}}}}; background:{{{podklad|{{#ifeq:{{{tip}}}|bystrostično|#ffcccc|{{#ifeq:{{{tip}}}|odstraniti|#ffcccc|{{#ifeq:{{{tip}}}|ostrěgti|#ffcc99|{{#ifeq:{{{tip}}}|primětka|#99ccff|#cccccc}}}}}}}}}}}; padding-inline:1em; margin-block:1em;"
|-
{{#if:{{{ikona|}}}|! [[Fajl:{{{ikona}}}|frameless|57x57px|link=]] !}}! {{#if:{{{glavica|}}}|'''<big><u>{{{glavica}}}</u></big>'''

}}{{{tekst}}}{{#if:{{{zapiska|}}}|
{{!}}- style="font-size: 80%; text-align: left;"
{{!}} {{{zapiska}}}}}
|-
|
|}
</div><noinclude>
{{Dokumentacija}}
</noinclude>

This is what it looks like in the preview:
!preview

And this is what it looks like when saved:
!saved

Now, the difference in the saved and previewed version might be actually caused by a different bug (but wouldn't be bad to fix it as well), where if you're trying to do in-line table cells for a row with {{#ifeq:}} parsing, it breaks (like here):

wikitext
{{#if:{{{ikona|}}}|! [[Fajl:{{{ikona}}}|frameless|57x57px|link=]] !}}! {{#if:{{{glavica|}}}|'''<big><u>{{{glavica}}}</u></big>'''

and I've already quite verified to be independent. It's easy to work around it tho. But the most prominent bug is the detached context one, where any option that starts with a special character (like the pound symbol # that's used for numbered list), it gets treated as wikitext of a separate context and rendered as that.

The reason why it doesn't render the border color as numbered list is that the default value is actually the word "black", which gets treated normally, and therefore is part of the style code. But once I've actually introduced the keyword into the mix, sure enough, the border color gets treated as wikitext again and renders as a numbered list.

When I introduce those values as direct template arguments for overrides, they are rendered normally.

What should have happened instead?:
I would have expected something like this:
!correct behaviour

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

Event Timeline

Oh, I can't show images in there...

Interesting. I did a search before posting this issue, and T14974 didn't show up. And I can see why. Because I searched specifically for {{#ifeq:}} usage, but it seems like it's related to template transclusions instead, which is what I didn't test. The {{#ifeq:}} parser might therefore behave like a template transclusion.