r45499 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45498‎ | r45499 | r45500 >
Date:13:10, 7 January 2009
Author:tstarling
Status:ok
Tags:
Comment:
Reverting r45379 as per comment 5 on bug 16854, i.e. it doesn't work with section editing.
Modified paths:
  • /trunk/extensions/Cite/Cite.i18n.php (modified) (history)
  • /trunk/extensions/Cite/Cite_body.php (modified) (history)
  • /trunk/extensions/Cite/citeParserTests.txt (modified) (history)

Diff [purge]

Index: trunk/extensions/Cite/Cite_body.php
@@ -426,7 +426,7 @@
427427 // Named references with >1 occurrences
428428 else {
429429 $links = array();
430 - //for group handling, we have an extra key here.
 430+//for group handling, we have an extra key here.
431431 for ( $i = 0; $i <= $val['count']; ++$i ) {
432432 $links[] = wfMsgForContentNoTrans(
433433 'cite_references_link_many_format',
@@ -665,23 +665,6 @@
666666
667667 return true;
668668 }
669 -
670 - /**
671 - * Called at the end of page processing to append an error if refs were
672 - * used without a references tag.
673 - */
674 - function checkRefsNoReferences( &$parser, &$text ) {
675 - foreach ( $this->mRefs as $group => $refs ) {
676 - if ( count( $refs ) == 0 ) continue;
677 - $text .= "\n<br />";
678 - if ( $group == CITE_DEFAULT_GROUP ) {
679 - $text .= $this->error( 'cite_error_refs_without_references' );
680 - } else {
681 - $text .= $this->error( 'cite_error_group_refs_without_references', htmlspecialchars( $group ) );
682 - }
683 - }
684 - return true;
685 - }
686669
687670 /**
688671 * Initialize the parser hooks
@@ -693,7 +676,6 @@
694677 $wgParser->setHook( 'references' , array( &$this, 'references' ) );
695678
696679 $wgHooks['ParserClearState'][] = array( &$this, 'clearState' );
697 - $wgHooks['ParserBeforeTidy'][] = array( &$this, 'checkRefsNoReferences' );
698680 }
699681
700682 /**
Index: trunk/extensions/Cite/Cite.i18n.php
@@ -44,8 +44,6 @@
4545 'cite_error_references_no_text' => 'Invalid <code>&lt;ref&gt;</code> tag;
4646 no text was provided for refs named <code>$1</code>',
4747 'cite_error_included_ref' => 'Closing &lt;/ref&gt; missing for &lt;ref&gt; tag',
48 - 'cite_error_refs_without_references' => '<code>&lt;ref&gt;</code> tags exist, but no <code>&lt;references/&gt;</code> tag was found',
49 - 'cite_error_group_refs_without_references' => '<code>&lt;ref&gt;</code> tags exist for a group named "$1", but no corresponding <code>&lt;references group="$1"/&gt;</code> tag was found',
5048
5149 /*
5250 Output formatting
Index: trunk/extensions/Cite/citeParserTests.txt
@@ -11,7 +11,6 @@
1212 !! result
1313 <p>Wikipedia rocks!<sup id="cite_ref-0" class="reference"><a href="#cite_note-0" title="">[1]</a></sup>
1414 </p>
15 -<br /><strong class="error">Cite error: <code>&lt;ref&gt;</code> tags exist, but no <code>&lt;references/&gt;</code> tag was found</strong>
1615 !! end
1716
1817 !! test
@@ -130,7 +129,6 @@
131130 !! result
132131 <p>1337<sup id="cite_ref-0" class="reference"><a href="#cite_note-0" title="">[1]</a></sup>
133132 </p>
134 -<br /><strong class="error">Cite error: <code>&lt;ref&gt;</code> tags exist, but no <code>&lt;references/&gt;</code> tag was found</strong>
135133 !! end
136134
137135 !! test
@@ -238,8 +236,8 @@
239237 </p><p><strong class="error">Cite error: Invalid <code>&lt;references&gt;</code> tag;
240238 no input is allowed. Use <code>&lt;references /&gt;</code></strong>
241239 </p><p><strong class="error">Cite error: Invalid <code>&lt;references&gt;</code> tag;
242 -parameter "group" is allowed only.
243 -Use <code>&lt;references /&gt;</code>, or <code>&lt;references group="..." /&gt;</code></strong>
 240+no parameters are allowed.
 241+Use <code>&lt;references /&gt;</code></strong>
244242 </p>
245243 <ol class="references"><li id="cite_note-0"><a href="#cite_ref-0" title="">↑</a> Also zero, but differently! (Normal ref)</li>
246244 <li id="cite_note-bar"><a href="#cite_ref-bar_0" title="">↑</a> <strong class="error">Cite error: Invalid <code>&lt;ref&gt;</code> tag;

Follow-up revisions

RevisionCommit summaryAuthorDate
r45554Backport of r45499tstarling07:31, 8 January 2009
r46270add mIsPreview and mIsSectionPreview to parserOptions, set in EditPage. patch...mrzman18:02, 26 January 2009
r46271(bug 16854) Show an error message when a page has <ref> tags and no <referenc...mrzman18:02, 26 January 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r45379(bug 16854) Provide explicit error when <references /> is omitted. Patch by B...demon18:59, 3 January 2009

Status & tagging log