Last modified: 2014-09-24 01:18:03 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T21226, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 19226 - Parser renders UI messages with up to one newline different from more
Parser renders UI messages with up to one newline different from more
Status: REOPENED
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
1.20.x
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: i18n, need-unittest, patch, patch-reviewed
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-06-15 21:27 UTC by Siebrand Mazeland
Modified: 2014-09-24 01:18 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Add newlines before $1 to wrapWikiMsgs of <div>s (8.00 KB, patch)
2010-01-10 16:37 UTC, Platonides
Details

Description Siebrand Mazeland 2009-06-15 21:27:32 UTC
If there is more than one newline in a message that is rendered, the parser will render line 1 and the last line separately, and the middle part in a 'para'. If more lines are used, the behaviour stays the same.

Steps to reproduce:
1. Create [[MediaWiki:Newarticletext]] for the following cases:
a. "1 2 3\n4 5 6"
b. "1\n2\n3\n4\n5\n6"
2. Check the way this works out when editing a non-existing page

Observations:
* step 2 for a:
<*div class="mw-newarticletext">1 2 3
4 5 6<*/div>

* step 3 for b:
<*div class="mw-newarticletext">1
<*p>2
3
4
5
<*/p>
6<*/div>

Expected behaviour: In a normal content page these 2 cases will render the same (<*p>1 2 3 4 5 6<*/p>
). I expect the UI messages to render the same way.
Comment 1 Platonides 2010-01-10 16:37:05 UTC
Created attachment 6945 [details]
Add newlines before $1 to wrapWikiMsgs of <div>s

I have seen it before for other messages.
There should be a new line after opening the <div>
Many messages also add a new line after closing.

The underlying cause is that <div>s aren't handled properly in wikitext 
(as shown by case b).
Wikitext is very sensitive to newlines.
Comment 2 Platonides 2010-01-14 17:15:33 UTC
Fixed on r61055.
Comment 3 Siebrand Mazeland 2010-05-01 17:46:03 UTC
Reopening. The following case still gives an unexpected result:

Message is: "1\n2\n3\n\n4\n\n5\n6"

wfMsg result is: <div>\n<p>1\n2\n3\n</p><p>4\n</p><p>5\n</p>\n6</div>

Expected result: <div><p>1\n2\n3</p>\n<p>4</p>\n<p>5\n6</p>\n</div> (location of the newlines isn't that important, the grouping of the sections going into a para *is*.

Additional information:
* In a regular wiki page, this renders as "<p>1 2 3</p>\n<p>4</p>\n<p>5 6</p>"
Comment 4 Platonides 2010-05-01 18:01:11 UTC
In a wiki page it renders as <p>1\n2\n3\n</p><p>4\n</p><p>5\n</p>\n6</div> if surrounded by <divs>. Looks like something to fix on the parser.
Comment 5 p858snake 2011-04-30 00:09:57 UTC
*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*
Comment 6 T. Gries 2011-05-28 14:14:02 UTC
When using wrapWikiMsg() - this suggested Nikerabbit - in example

$wgOut->wrapWikiMsg( "OpenID $1", array( 'usermerge-userdeleted', $username, $userID ) );

this is rendered into <p>...</p> which I do not want in my output, because when it is executed repeatedly, the output looks ugly due to different bigger line spacing.

Please can you explain how I can avoid this?

I want to have output as follows

line1<br/>
line2<br/>
line3<br/>
...

But using wrapWikiMsg() I can only get

<p>line1
</p>line2<p>
</p>line3<p>
</p>

Please can you assist? A plain output appears to be impossible using the suggested wrapWikiMsg() method.
Comment 7 T. Gries 2011-09-03 17:44:42 UTC
set to 1.19-svn
Comment 8 Platonides 2011-09-04 17:55:17 UTC
I just noticed comment #6
I don't see why would you get some lines inside <p> but not others. You have new lines inside the username??
Comment 9 T. Gries 2011-09-04 18:28:35 UTC
no, you see this also on arbitrary other pages. When I have the time, I will add more examples here.
Comment 10 Siebrand Mazeland 2011-09-04 18:40:32 UTC
Can we add a unit test for this?
Comment 11 T. Gries 2011-10-09 16:18:00 UTC
(In reply to comment #10)
> Can we add a unit test for this?
see comment #6 https://bugzilla.wikimedia.org/show_bug.cgi?id=19226#c6 as a proposal for such a test (Sorry - I am not experienced enough to write a unit test.)
Comment 12 Sumana Harihareswara 2011-11-09 20:09:26 UTC
+reviewed since the patch was applied.
Comment 13 T. Gries 2012-01-27 21:05:33 UTC
(In reply to comment #12)
> +reviewed since the patch was applied.

When was the patch applied ? (revision number ?)
Comment 14 Platonides 2012-01-28 22:47:48 UTC
Look at comment #2 :)
Comment 15 T. Gries 2012-01-29 03:23:44 UTC
(In reply to comment #14)
> Look at comment #2 :)

The problem was mentioned in comment #6 https://bugzilla.wikimedia.org/show_bug.cgi?id=19226#c6
Comment 16 Platonides 2012-01-29 15:14:41 UTC
But the tag reviewed was only related to the patch of comment #1.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links