Page MenuHomePhabricator

ImagePage.php adds linebreaks at the size/mime line
Closed, ResolvedPublic

Description

Author: mrgenixus

Description:
10:18 < Duesentrieb> the page is generated by ImagePage.php, lines 209 and 233
[snip]
10:42 < mrgenixus> Duesentrieb noticed an error on page

http://commons.wikimedia.org/wiki/Image:Wikimania-phase4.pdf
with the mime reporting and I thik the problem is that the
$wgOut->addwikiText() needs the false parameter in lines
IIIII$wgOut->addHTML("<span class=\"fileInfo\"> (");

10:42 < mrgenixus> IIIII$wgOut->addWikiText( $info, false );
10:42 < mrgenixus> IIIII$wgOut->addHTML(")</span>");
10:42 < mrgenixus> oh,
10:42 < mrgenixus> nm
10:42 < mrgenixus> it's already there
10:42 < mrgenixus> but it doesn't work

see
http://cvs.sourceforge.net/viewcvs.py/wikipedia/phase3/includes/ImagePage.php?view=markup/file
http://cvs.sourceforge.net/viewcvs.py/wikipedia/phase3/includes/OutputPage.php?rev=1.240&only_with_tag=HEAD&view=markup
error seems to be in parser.php, I think
$linestart is passed all the way to parse();


Version: 1.5.x
Severity: normal
URL: http://commons.wikimedia.org/wiki/Image:Wikimania-phase4.pdf

Details

Reference
bz3117

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 8:46 PM
bzimport set Reference to bz3117.

The effect of this can be seen on "Image:" pages for non-images, like this one:
http://commons.wikimedia.org/wiki/Image:Wikimania-phase4.pdf: the file-size
and mime-type in the perentecies should be inlined. The message comes from
MediaWiki:Fileinfo, no linebreaks are defined there.

The generated HTML looks like this:
<span class="fileInfo"> (<p>622KB, MIME type:
<code>application/pdf</code></p>)</span>
The question is: where do the <p> tags come from? The "newline" parameter of
addWikitext should suppress those, right?

I just installed the current HEAD - seems to work fine. So, the fix (whatever it
was) needs to be backported to 1.5 and applied to the live sites. This is a
little annoying on the commons, etc

Update: I was unable to find a difference between 1.5alpha4 and HEAD that would
explain why it's working now. Avar suggested that this problem may be caused by
html-tidy. This needs some more investigation, i guess...

Ok, I found the reason for this: tidy is applied individually to messages added
via addWikiText(). Tidy inserts <p> tags if there is not block element wrapping
the input. It would be much better to apply tidy only once, see bug #3119.

The tidy bit is correct behavior; wiki text blocks are blocks, and should be output whole.

Fix applied to HEAD and REL1_5:

  • (bug 3117) Fix display of upload size and type with tidy on

http://cvs.defau.lt/cvsweb.cgi/phase3/includes/ImagePage.php.diff?r1=1.108&r2=1.109