mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Poem
synced 2024-11-11 16:49:12 +00:00
Merge "No <br /> tag after <hr /> tag to avoid extra space"
This commit is contained in:
commit
a8932c74bd
|
@ -35,9 +35,10 @@ class Poem {
|
|||
$text = preg_replace_callback( '/^(:+)(.+)$/m', [ self::class, 'indentVerse' ], $in );
|
||||
|
||||
// replace newlines with <br /> tags unless they are at the beginning or end
|
||||
// of the poem
|
||||
// of the poem, or would directly follow exactly 4 dashes. See Parser::internalParse() for
|
||||
// the exact syntax for horizontal rules.
|
||||
$text = preg_replace(
|
||||
[ "/^\n/", "/\n$/D", "/\n/" ],
|
||||
[ '/^\n/', '/\n$/D', '/(?<!^----)\n/m' ],
|
||||
[ "", "", "$tag\n" ],
|
||||
$text
|
||||
);
|
||||
|
@ -47,6 +48,10 @@ class Poem {
|
|||
|
||||
$text = $parser->recursiveTagParse( $text, $frame );
|
||||
|
||||
// Because of limitations of the regular expression above, horizontal rules with more than 4
|
||||
// dashes still need special handling.
|
||||
$text = str_replace( '<hr />' . $tag, '<hr />', $text );
|
||||
|
||||
$attribs = Sanitizer::validateTagAttributes( $param, 'div' );
|
||||
|
||||
// Wrap output in a <div> with "poem" class.
|
||||
|
|
|
@ -65,7 +65,7 @@ text
|
|||
<div class="poem">
|
||||
<p>some<br />
|
||||
</p>
|
||||
<hr /><br />
|
||||
<hr />
|
||||
<p>text
|
||||
</p>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue