MediaWiki r43520 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r43519‎ | r43520 (on ViewVC)‎ | r43521 >
Date:01:19, 15 November 2008
Author:demon
Status:ok
Tags:
Comment:
Revert r41710, r41978, r42012, r42048 (integration of Poem extension to core plus misc. fixes). Per Wikitech-l, this isn't properly attributed to the original authors of the extension. Furthermore, "Poem" is entirely too narrow a name for the functionality this tag provides. If this is to be integrated, a better name should be chosen.
Modified paths:

Diff [purge]

Index: trunk/phase3/maintenance/parserTests.txt
===================================================================
--- trunk/phase3/maintenance/parserTests.txt	(revision 43519)
+++ trunk/phase3/maintenance/parserTests.txt	(revision 43520)
@@ -7166,117 +7166,6 @@
 </p>
 !! end
 
-!!test
-<poem>
-!!input
-<poem>
-this
-is
-a
-test
-</poem>
-!!result
-<div class="poem">
-<p>this<br />
-is<br />
-a<br />
-test
-</p>
-</div>
-
-!!end
-
-!!test
-  <poem> with recursive parsing
-!!input
-<poem>
-this ''is'' a '''test'''
-</poem>
-!! result
-<div class="poem">
-<p>this <i>is</i> a <b>test</b>
-</p>
-</div>
-
-!!end
-
-
-!!test
-  <poem> with leading whitespace
-!!input
-<poem>
-
-   test
-
-</poem>
-!!result
-<div class="poem">
-<p><br />
-&nbsp;&nbsp;&nbsp;test<br />
-</p>
-</div>
-
-!!end
-
-!!test
-Horizontal rule
-!!input
-<poem>
-some
------
-text
-</poem>
-!!result
-<div class="poem">
-<p>some<br />
-</p>
-<hr /><br />
-<p>text
-</p>
-</div>
-
-!!end
-
-!!test
-  nested <poem><nowiki>
-!!input
-<poem><nowiki>
-this
-is
-a
-test
-</nowiki></poem>
-!!result
-<div class="poem">
-<p>this<br />
-is<br />
-a<br />
-test
-</p>
-</div>
-
-!!end
-
-!!test
-  nested <poem><nowiki> with formatting
-!!input
-<poem><nowiki>
-this
-'''is'''
-a
-test
-</nowiki></poem>
-!!result
-<div class="poem">
-<p>this<br />
-'''is'''<br />
-a<br />
-test
-</p>
-</div>
-
-!! end
-
 #
 #
 #
Index: trunk/phase3/CREDITS
===================================================================
--- trunk/phase3/CREDITS	(revision 43519)
+++ trunk/phase3/CREDITS	(revision 43520)
@@ -56,7 +56,6 @@
 * Michael De La Rue
 * Mike Horvath
 * Mormegil
-* Nathaniel Herman
 * Nathan Larson
 * Nikolaos S. Karastathis
 * Paul Copperman
Index: trunk/phase3/includes/parser/Parser.php
===================================================================
--- trunk/phase3/includes/parser/Parser.php	(revision 43519)
+++ trunk/phase3/includes/parser/Parser.php	(revision 43520)
@@ -128,7 +128,7 @@
 		$this->mTransparentTagHooks = array();
 		$this->mFunctionHooks = array();
 		$this->mFunctionSynonyms = array( 0 => array(), 1 => array() );
-		$this->mDefaultStripList = $this->mStripList = array( 'nowiki', 'gallery', 'poem' );
+		$this->mDefaultStripList = $this->mStripList = array( 'nowiki', 'gallery' );
 		$this->mUrlProtocols = wfUrlProtocols();
 		$this->mExtLinkBracketedRegex = '/\[(\b(' . wfUrlProtocols() . ')'.
 			'[^][<>"\\x00-\\x20\\x7F]+) *([^\]\\x0a\\x0d]*?)\]/S';
@@ -3317,9 +3317,6 @@
 				case 'gallery':
 					$output = $this->renderImageGallery( $content, $attributes );
 					break;
-				case 'poem':
-					$output = $this->renderPoem( $content, $attributes );
-					break;
 				default:
 					if( isset( $this->mTagHooks[$name] ) ) {
 						# Workaround for PHP bug 35229 and similar
@@ -4190,45 +4187,6 @@
 		return $ig->toHTML();
 	}
 
-	/** Renders any text in between <poem></poem> tags
-	 * based on http://www.mediawiki.org/wiki/Extension:Poem
-	 */
-
-	function renderPoem( $in, $param = array() ) {
-
-		/* using newlines in the text will cause the parser to add <p> tags,
- 	 	* which may not be desired in some cases
-	 	*/
-		$nl = array_key_exists( 'compact', $param ) ? '' : "\n";
-  
-		$replacer = new DoubleReplacer( ' ', '&nbsp;' );
-		$text = $this->recursiveTagParse( $in );
-		$text = $this->mStripState->unstripNoWiki( $text );
-		// Only strip the very first and very last \n (which trim cannot do)
-		if( substr( $text, 0, 1 ) == "\n" )
-			$text = substr( $text, 1 );
-		if( substr( $text, -1 ) == "\n" )
-			$text = substr( $text, 0, -1 );
-		
-		$text = str_replace( "\n", "<br />\n", $text );
-		$text = preg_replace_callback(
-			"/^( +)/m",
-			$replacer->cb(),
-			$text );
-
-		// Pass HTML attributes through to the output.
-		$attribs = Sanitizer::validateTagAttributes( $param, 'div' );
-
-		// Wrap output in a <div> with "poem" class.
-		if( array_key_exists( 'class', $attribs ) ) {
-			$attribs['class'] = 'poem ' . $attribs['class'];
-		} else {
-			$attribs['class'] = 'poem';
-		}
-
-		return Xml::openElement( 'div', $attribs ) . $nl . trim( $text ) . $nl . Xml::closeElement( 'div' );
-	}
-
 	function getImageParams( $handler ) {
 		if ( $handler ) {
 			$handlerClass = get_class( $handler );
Index: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES	(revision 43519)
+++ trunk/phase3/RELEASE-NOTES	(revision 43520)
@@ -70,7 +70,6 @@
 * Special:LinkSearch to search for external links (was extension LinkSearch)
 * RenderHash
 * NoMoveUserPages
-* Poem (patch by Nathaniel Herman)
 * UniversalEditButton
 
 === New features in 1.14 ===

Follow-up revisions

Rev.Commit summaryAuthorDate
r43537Readd Poem to Translatewiki per removal of Poem from core in r43520raymond09:07, 15 November 2008

Status & tagging log

Personal tools
Namespaces
Variants
Views
Actions
Site
Support
Download
Development
Communication
Toolbox