revert r28371 to r28375

This commit is contained in:
Siebrand Mazeland 2007-12-16 18:27:23 +00:00
parent e342606278
commit 00663f283c

View file

@ -8,7 +8,7 @@
# (with modified parser callback and attribute additions)
#
# Anyone is allowed to use this code for any purpose.
#
#
# To install, copy the extension to your extensions directory and add line
# include("extensions/Poem.php");
# to the bottom of your LocalSettings.php
@ -21,10 +21,9 @@
$wgExtensionFunctions[]="wfPoemExtension";
$wgExtensionCredits['parserhook'][] = array(
'name' => 'Poem',
'version' => '1.1',
'author' => array( 'Nikola Smolenski', 'Brion Vibber', 'Steve Sanbeg' ),
'description' => 'Adds <tt>&lt;poem&gt;</tt> tag for poem formatting',
'url' => 'http://www.mediawiki.org/wiki/Extension:Poem',
'url' => 'http://www.mediawiki.org/wiki/Extension:Poem'
);
$wgParserTestFiles[] = dirname( __FILE__ ) . "/poemParserTests.txt";
@ -43,7 +42,7 @@ function PoemExtension( $in, $param=array(), $parser=null ) {
$in );
$text = $parser->recursiveTagParse($text);
} else {
$text = preg_replace(
array("/^\n/","/\n$/D","/\n/", "/^( +)/me"),
array("", "", "<br />\n","str_replace(' ','&nbsp;','\\1')"),
@ -60,10 +59,10 @@ function PoemExtension( $in, $param=array(), $parser=null ) {
// thing up.
false
);
$text = $ret->getText();
}
global $wgVersion;
if( version_compare( $wgVersion, "1.7alpha" ) >= 0 ) {
// Pass HTML attributes through to the output.
@ -72,16 +71,18 @@ function PoemExtension( $in, $param=array(), $parser=null ) {
// Can't guarantee safety on 1.6 or older.
$attribs = array();
}
// Wrap output in a <div> with "poem" class.
if( isset( $attribs['class'] ) ) {
$attribs['class'] = 'poem ' . $attribs['class'];
} else {
$attribs['class'] = 'poem';
}
return wfOpenElement( 'div', $attribs ) .
"\n" .
trim( $text ) .
"\n</div>";
}