Page MenuHomePhabricator

HTML tags choke templates with parameters, because of a "=" (regardless of being masked by <nowiki>)
Closed, ResolvedPublic

Description

Author: D.U.Thibault

Description:
This template works fine:
<nowiki>
{{User language subcategory|

language-code=fr
language-name=French language
level=0
description=Ces utilisateurs '''[[:Category:User fr-0|ne comprennent pas]]'''

le '''[[:Category:User fr|français]]''' (ou ne le comprennent pas sans grande
difficulté). [[Category:User fr|Français]]
}}
</nowiki>
(It is used in :en:Category:User_fr-0)

However, if we add a font tag to one parameter, the template renders incorrectly:
<nowiki>

description=Ces utilisateurs '''<font color="#FF0000">ne

comprennent pas]]</font>''' le '''[[:Category:User fr|français]]''' (ou ne le
comprennent pas sans grande difficulté). [[Category:User fr|Français]]
</nowiki>
The description appears as "2" within triple curly brackets.


Version: unspecified
Severity: normal
URL: http://en.wikipedia.org/wiki/Category:User_fr-0

Details

Reference
bz5138

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:08 PM
bzimport set Reference to bz5138.
bzimport added a subscriber: Unknown Object (MLST).

D.U.Thibault wrote:

It does not matter where the font tag is inserted: outside the triple
apostrophes, or within the link pipe gives the same effect.

Wiki.Melancholie wrote:

Yes, the reason is the equal sign "=", so the parser thinks you are specifying
an parameter there!

Wiki.Melancholie wrote:

Because equals signs sometimes should not indicate that a value for a given
parameter will follow, there is the possibility to include equals signs by typing:
<nowiki>=</nowiki>

But paradoxically this does *not* work if an equal sign is inside a HTML tag
(although the following syntax would work outside of templates!):
<span style<nowiki>=</nowiki>"color: #00FF00;">blabla</span>

gangleri wrote:

Dear Daniel;

Please see the fix for your request at
http://en.wikipedia.org/w/index.php?title=User:Gangleri/tests/bugzilla/05138/template:User_language_subcategory&diff=47170376&oldid=47169728
I did not like to change the "live" template.

Please follow the links at [[user:Gangleri/tests/bugzilla/05138]].
In [[template:User_language_subcategory]] you will need to use
2={{{description}}}
to achive what you like.

I thing this bug should be closed with resolution INVALID.

*notes*
The safest way to use nested templates is to use named parameters only.

Example: The provided solution would break if you would call
[[template:User_language_subcategory]] with {{{language-code}}} containing a "="
character. Then you would probably need also
1={{{language-code}}}
but I am not shure if "1" is a reserved parameter name or not.

best regards reinhardt [[user:gangleri]]

gangleri wrote:

Thing about a "real" parser who can identify *<font color="#FF0000">* as an HTML
tag the descibed behaviour is a bug.
Resolution LATER would be more apropriate.
This should be a "testcase", Brion do you agree?

D.U.Thibault wrote:

Meanwhile, someone found a simpler solution. The color tag is written as « <span style="color:
#FF0000;"> », which does not break rendering.

D.U.Thibault wrote:

Hmmm...The question marks framing the quotes above are supposed to be guillemets : << >>. Another
bug...

Wiki.Melancholie wrote:

No, there just has been done what Gangleri wrote in comment #4.
The problem described in comment #3 is still there.

Wiki.Melancholie wrote:

But the problem of comment #3 only appears
when there is no ...|2={{{...
in [[Template:User_language_subcategory]]

See
http://en.wikipedia.org/w/index.php?title=Template:
User_language_subcategory&diff=prev&oldid=47233590

D.U.Thibault wrote:

Yup, Melancholie is right: the problem subsists.

Wiki.Melancholie wrote:

[[de:Vorlage_Diskussion:Link-Bild#Verwendung_der_Vorlage_in_einer_Vorlage]]

andreas.schwab wrote:

If an url containing a = is used in http://en.wikipedia.org/wiki/Template:Copyvio, it will only show if enclosed in <nowiki>...</nowiki>.
However, it will not shown as a link (in blue with arrow), and one cannot double-click on it. Enclosing just the = sign does not work either.

ais523 wrote:

You need to quote the parameter with a number, like this: {{copyvio|1=(url=here)}}; if the template uses a named
parameter, like copyvio on :w:en, you can use that instead: {{copyvio|url=(url=here)}}.

ui2t5v002 wrote:

Equals signs in URLs also break templates, forcing users to type |1=something|2=URL etc. Equals signs inside URLs and HTML should not be interpreted as part of template parameters.

nicolas.schudel wrote:

A simple way around the URL problem would be to encode the equal signs like "%3D".
For example: url=here -> url%3Dhere

ayg wrote:

No, because escaping characters like '=' with special meanings in URLs changes the meaning of the URL.

bretthillebrand wrote:

*** Bug 16309 has been marked as a duplicate of this bug. ***

dhroll wrote:

I have a similar problem regarding the equal sign (=). See [[w:Template:Cite gvp]] http://en.wikipedia.org/wiki/Template:Cite_gvp for an example. I understand that the problem is that the parser interprets any string containing an equals sign as a parameter name. If there is no such parameter name then why should that assumption stand. It goes back to the mindless notion of using unnamed parameters. I sincerely wish you'all luck with this but I'm not to hopeful.

Part of this bug, namely the not-working <nowiki>-tags has been fixed with the intoduction of the new preprocessor. The rest is a dupe of bug 14235.

*** This bug has been marked as a duplicate of bug 14235 ***