16 $parser->setHook(
'poem', [ self::class,
'renderPoem' ] );
30 $newline = isset( $param[
'compact'] ) ?
'' :
"\n";
32 $tag =
$parser->insertStripItem(
"<br />" );
35 $text = preg_replace_callback(
'/^(:+)(.+)$/m', [ self::class,
'indentVerse' ], $in );
41 [
'/^\n/',
'/\n$/D',
'/(?<!^----)\n/m' ],
47 $text = preg_replace_callback(
'/^( +)/m', [ self::class,
'replaceSpaces' ], $text );
49 $text =
$parser->recursiveTagParse( $text, $frame );
53 $text = str_replace(
'<hr />' . $tag,
'<hr />', $text );
55 $attribs = Sanitizer::validateTagAttributes( $param,
'div' );
64 return Html::rawElement(
'div',
$attribs, $newline . trim( $text ) . $newline );
74 return str_replace(
' ',
' ', $m[1] );
86 'class' =>
'mw-poem-indented',
87 'style' =>
'display: inline-block; margin-left: ' . strlen( $m[1] ) .
'em;'
90 return Html::rawElement(
'span',
$attribs, $m[2] );
PHP Parser - Processes wiki markup (which uses a more user-friendly syntax, such as "[[link]]" for ma...
This class handles formatting poems in WikiText, specifically anything within <poem></poem> tags.
static replaceSpaces(array $m)
Callback for preg_replace_callback() that replaces spaces with non-breaking spaces.
static indentVerse(array $m)
Callback for preg_replace_callback() that wraps content in an indented span.
static renderPoem( $in, array $param=[], Parser $parser, PPFrame $frame)
Parse the text into proper poem format.
static init(Parser $parser)
Bind the renderPoem function to the <poem> tag.
see documentation in includes Linker php for Linker::makeImageLink or false for current used if you return false $parser
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing & $attribs
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))