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.

This commit is contained in:
Chad Horohoe 2008-11-15 01:19:46 +00:00
parent 5f8990b91e
commit d8119bd420
4 changed files with 1 additions and 156 deletions

View file

@ -56,7 +56,6 @@ following names for their contribution to the product.
* Michael De La Rue
* Mike Horvath
* Mormegil
* Nathaniel Herman
* Nathan Larson
* Nikolaos S. Karastathis
* Paul Copperman

View file

@ -70,7 +70,6 @@ The following extensions are migrated into MediaWiki 1.14:
* Special:LinkSearch to search for external links (was extension LinkSearch)
* RenderHash
* NoMoveUserPages
* Poem (patch by Nathaniel Herman)
* UniversalEditButton
=== New features in 1.14 ===

View file

@ -128,7 +128,7 @@ class Parser
$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 @@ class Parser
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 @@ class Parser
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 );

View file

@ -7166,117 +7166,6 @@ language=fa
</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
#
#
#