Page MenuHomePhabricator

Problem with templates returning an initial asterisk inside an #if
Closed, DuplicatePublic

Description

Hi, in itwiki we have noticed a problem with templates returning an initial asterisk inside an #if.
Something has changed in MediaWiki parser in the last weeks, i don't know exactly when, but the change should be recent because the problem is evident and nobody noticed it before today.

Example:

There is extra space between "list element 2" and "text returned from template".
This never happened in the past, and what's more it happens only if https://en.wikipedia.org/wiki/User:Rotpunkt/ListElement (the "template" in the example) uses the "#if", if you remove the #if the extra-space disappears.

The extra-space is due to an extra tag "ul":
<ul>
<li>list element 1</li>
<li>list element 2</li>
</ul>
<ul>
<li>text returned from template</li>
<li>list element 3</li>
<li>list element 4</li>
</ul>

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 21 2016, 11:19 AM
Nnvu added a subscriber: Nnvu.Dec 21 2016, 12:21 PM

That sounds like T14974 and there was nothing changed in the last weeks

For your problem on itwiki: Maybe there was a template changed to include a new #if or a empty line was added at begin or end of your used template. That needs the page with the problem, not the sandbox from above.

Rotpunkt added a comment.EditedDec 29 2016, 6:16 PM

@Umherirrender, as I have already said, I wrote an example of the problem here:

As you can see the problem exists: there is extra space between "list element 2" and "text returned from template".
Some weeks ago this extra space didn't exist.

I did not know about a parser change in this area or for this wikitext.

In my opinion this is happen since years.

One possible things changed is that HTML Tidy was replaced, maybe HTML Tidy has combined two direct <ul> together and the new tool does not.

This is the same issue as T14974: The newline added to a template, magic word, variable, or parser function that returns line-start wikicode formatting (*#:; {|) causes unexpected parsing. There is an extra newline inserted before the transclusion. So your wikitext:

* list element 1
* list element 2
{{User:Rotpunkt/ListElement}}
* list element 3
* list element 4

Expands to:

* list element 1
* list element 2

* text returned from template
* list element 3
* list element 4

You can work around this by not adding a newline:

* list element 1
* list element 2{{User:Rotpunkt/ListElement}}
* list element 3
* list element 4