Page MenuHomePhabricator

ParserFunctions insert a newline character before the returned result
Closed, ResolvedPublic

Description

Author: fibonacci.prower

Description:
Some (if not all) of the ParserFunctions appear to be inserting a newline character before the returned string. For example, if the wiki source contains this:
a{{#if:x|#1}}

Instead of rendering it as a#1, MediaWiki produces this in the HTML source:
<p>a</p>
<ol>
<li>1</li>
</ol>

Which is what I would have expected if the wiki source had been this:
a
#1

If the character before 1 is an asterisk, the same problem can be noticed. However, a{{#if:x|1}} renders as expected - understandable, since if there were a newline right after the "a", the result would be the same as if there were none.


Version: unspecified
Severity: normal
URL: http://test.wikipedia.org/wiki/Bug_10687

Details

Reference
bz10687

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:51 PM
bzimport added a project: ParserFunctions.
bzimport set Reference to bz10687.

pyrios wrote:

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

pyrios wrote:

This appears to have been fixed in the trunk.

The following wiki source:
a{{#if:true|#foo|#bar}}

lorem{{#if:true|#foo|#bar}}ipsum

Produces:

			<p>a#foo

</p><p>lorem#fooipsum
</p>

Browsing the changes to ParserFunctions.php, I am unable to identify a change that fixed this problem.

webboy wrote:

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

webboy wrote:

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

Wiki.Melancholie wrote:

Copied from duplicated bug 14036 [semicolon]:

Since some time #ifexist: is producing a line break for the first condition!

If page exists the value is shown with a line break in front. If page does not
exist everything is fine!

See:

http://de.wiktionary.org/w/index.php?title=Benutzer:Melancholie/bug&action=raw&ctype=text/css
(source text)

Note: I could replace the semicolon by &#59; (I know)
http://de.wiktionary.org/w/index.php?title=Benutzer:Melancholie/bug&diff=787160&oldid=787156
(unknown IP),

but it should also work with ";"!

aliter wrote:

I use #if:, but the problem is the same: It looks like inside the if, the semicolon is interpreted as the start of a definition.

herd wrote:

Duping up, bug 12974 properly indicates it is a core problem and affects more than just parserfunctions/extensions.

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

herd wrote:

Duping up, bug 12974 properly indicates it is a core problem and affects more than just parserfunctions/extensions.

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

FYI, 12974 is T14974.