Last modified: 2007-09-20 14:21:03 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
I can't really tell what you mean; can you provide an example?
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. ~~~~
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
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?
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
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?
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 < --- > ?>
Forgot to say thanks - Thanks.
Great. :) Marking this as WORKSFORME since we got that resolved w/ current version.