Last modified: 2007-09-20 14:21:03 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 11345 - Formatting problem: Included pages & Parser.php
Formatting problem: Included pages & Parser.php
Status: RESOLVED WORKSFORME
Product: MediaWiki extensions
Classification: Unclassified
Cite (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-09-15 01:09 UTC by Jonathan
Modified: 2007-09-20 14:21 UTC (History)
1 user (show)

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


Attachments

Description Jonathan 2007-09-15 01:09:06 UTC
The HTML comments which are added to give details of include sizes interfere with proper use of cite.php. This is only the case where the page with the cite references is the INCLUDED page.

I have put some more detail here: http://www.mediawiki.org/wiki/Extension:Cite/Cite.php#Formatting_problem:_Included_pages_.26_Parser.php
Comment 1 Brion Vibber 2007-09-17 19:58:47 UTC
I can't really tell what you mean; can you provide an example?
Comment 2 Jonathan 2007-09-17 21:08:23 UTC
Hi, I think my earlier message on meta goes in to a bit more detail:

http://meta.wikimedia.org/wiki/Talk:Cite/Cite.php#1.8.2_and_1.9.1_problem_-_after_each_reference.2C_rest_of_sentence_is_in_.3C_PRE_.3E_tag

I have just tried but couldn't replicate the error on the en.wikipedia.org sandbox, as the "Pre-expand include size" message only appeared once. On my installation it appears after every reference - until I remove it from Parser.php.

I have just noticed on http://www.mediawiki.org/wiki/Extension:Cite/Cite.php the message: "Note: The require_once() line needs to be placed near the end of the file." I must have skipped over this bit before as I have mine directly after require_once( "includes/DefaultSettings.php" ). Perhaps that causes the problem. I'll check it out but will post this for now.

Thanks.

~~~~
Comment 3 Jonathan 2007-09-17 21:19:25 UTC
Moving the require_once() to the bottom [and simultaneously replacing the "pre-expand include size message] did not fix the problem. You probably could have told me that!

But it did let me cut and paste some of the source code, which might help you work out where I'm going wrong! I hope the text appears as plain text on this website.

<p>aaaaaaaaaaaa<a href="/ppp" title="ppp">sssssss</a> dddddddddddddddd <a href="/ppp" title="ppp">fffffffff</a> ggggggggggggggggggggg
</p><p><b>QQQQQQQQQQQQQQ</b>

</p><p>wwwwwwwwwwwwwwww<sup id="_ref-MHA_0" class="reference"><a href="#_note-MHA" title="">[2]</a></sup><!-- 
Pre-expand include size: 8053 bytes
Post-expand include size: 3581 bytes
Template argument size: 14 bytes
Maximum: 2097152 bytes
-->
</p>
<pre>ddddddddddddddddddddd<sup id="_ref-MHA_1" class="reference"><a href="#_note-MHA" title="">[2]</a></sup><!-- 
</pre>
<p>Pre-expand include size: 8053 bytes
Post-expand include size: 3581 bytes
Template argument size: 14 bytes
Maximum: 2097152 bytes
-->
</p>
<pre>cccccccccccccccccccc
</pre>
<p>zzzzzzzzzzzzzzzzzzzz
Comment 4 Brion Vibber 2007-09-18 15:56:04 UTC
Still can't make head or tail of this.

Please provide an example -- how you do you get it to do this? What's the EXACT text of the page(s) you write where it does this?

Can you provide a URL to your site where it does this? If not, can you cut and paste the EXACT wiki source code?
Comment 5 Jonathan 2007-09-18 17:51:27 UTC
Sorry Brian, looking back at what I wrote I can't blame you! I don't fancy having my website in google linked from this page, so I'm about to email you a link to the site. I put Parser.php back to normal so that the pages are broken. Best wishes
Comment 6 Brion Vibber 2007-09-19 19:50:42 UTC
Ok, I've taken a peek... Grabbed the page you referred to me off your wiki and tried to reproduce it locally on my test wiki, but I don't seem to encounter it locally.

The only place where the expansion size comments get inserted into the text is at the end of parsing, in Parser::parse(). You seem to be somehow getting them inserted at the boundary of every <ref>, and maybe in other places too... Further all of them have the same size values listed, which seems odd if there's a subparse or something going on. When I add extra test code on a local copy I get nothing there; the parse code doesn't get run at these points. The additions only come once at the very end of the page.

I'm testing with a stock MW 1.11.0 with Cite extension added in, w/ PHP 5.2.4rc2 which seems to more or less match yours (PHP 5.2.3). Have checked with $wgUseTidy both on and off. Tried copying all the templates and every page linked to from the page...

Is there anything in the wiki configuration that's different from standard? Is extensions/Cite the current SVN code or something older? Any non-standard configurations options in PHP?
Comment 7 Jonathan 2007-09-19 20:46:15 UTC
Brion, you were spot on with your suggestion - I was using an old version of Cite.php. That explains why it caused a problem initially when I upgraded to 1.8.2. I had wrongly assumed that the code hadn't changed, as http://www.mediawiki.org/wiki/Extension:Cite/Cite.php says it works from version 1.6 up. I didn't realise there was a newer version. Sorry about that. Here's the difference between the two files I was using. Some of the comments relate to the exact problem I was having, and sound like the author was a bit frustrated too! Best wishes, Jonathan

diff Cite.php Cite_old.php
8c8,9
<  * @addtogroup Extensions
---
>  * @package MediaWiki
>  * @subpackage Extensions
25,26c26,27
<       'description' => 'Adds <nowiki><ref[ name=id]></nowiki> and <nowiki><references/></nowiki> tags, for citations',
<       'url' => 'http://www.mediawiki.org/wiki/Extension:Cite/Cite.php'
---
>       'description' => 'adds <nowiki><ref[ name=id]></nowiki> and <nowiki><references/></nowiki> tags, for citations',
>       'url' => 'http://meta.wikimedia.org/wiki/Cite/Cite.php'
28d28
< $wgParserTestFiles[] = dirname( __FILE__ ) . "/citeParserTests.txt";
59c59
< require_once( dirname(__FILE__) . '/Cite.i18n.php' );
---
> require_once( 'Cite.i18n.php' );
279c279
<                               if ( ! isset( $this->mRefs[$key] ) || ! is_array( $this->mRefs[$key] ) ) {
---
>                               if ( ! @is_array( $this->mRefs[$key] ) ) {
292c292
<                               } else {
---
>                               } else
294,297d293
<                                       if ( $this->mRefs[$key]['text'] === null && $str !== '' ) {
<                                               // If no text found before, use this text
<                                               $this->mRefs[$key]['text'] = $str;
<                                       };
303c299
<                                               ); }
---
>                                               );
346,348d341
<                       if ( count( $this->mRefs ) == 0 )
<                               return '';
<
349a343
>
358a353,354
>
>
559,579c555,569
<                       if ( method_exists( $this->mParser, 'recursiveTagParse' ) ) {
<                               // New fast method
<                               return $this->mParser->recursiveTagParse( $in );
<                       } else {
<                               // Old method
<                               $ret = $this->mParser->parse(
<                                       $in,
<                                       $this->mParser->mTitle,
<                                       $this->mParser->mOptions,
<                                       // Avoid whitespace buildup
<                                       false,
<                                       // Important, otherwise $this->clearState()
<                                       // would get run every time <ref> or
<                                       // <references> is called, fucking the whole
<                                       // thing up.
<                                       false
<                               );
<                               $text = $ret->getText();
<
<                               return $this->fixTidy( $text );
<                       }
---
>                       $ret = $this->mParser->parse(
>                               $in,
>                               $this->mParser->mTitle,
>                               $this->mParser->mOptions,
>                               // Avoid whitespace buildup
>                               false,
>                               // Important, otherwise $this->clearState()
>                               // would get run every time <ref> or
>                               // <references> is called, fucking the whole
>                               // thing up.
>                               false
>                       );
>                       $text = $ret->getText();
>
>                       return $this->fixTidy( $text );
652c642
<                                               wfMsg( 'cite_error', $id, wfMsg( "cite_error_$id" ) ) .
---
>                                               wfMsgforContent( 'cite_error', $id, wfMsgForContent( "cite_error_$id" ) ) .
656c646
<                               return wfMsg( 'cite_error', $id );
---
>                               return wfMsgforContent( 'cite_error', $id );
677c667
<
---
> ?>
Comment 8 Jonathan 2007-09-19 20:49:33 UTC
Forgot to say thanks - Thanks. 
Comment 9 Brion Vibber 2007-09-20 14:21:03 UTC
Great. :)

Marking this as WORKSFORME since we got that resolved w/ current version.

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


Navigation
Links