Merge "No <br /> tag after <hr /> tag to avoid extra space"

This commit is contained in:
jenkins-bot 2018-06-05 15:10:00 +00:00 committed by Gerrit Code Review
commit a8932c74bd
2 changed files with 8 additions and 3 deletions

View file

@ -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.

View file

@ -65,7 +65,7 @@ text
<div class="poem">
<p>some<br />
</p>
<hr /><br />
<hr />
<p>text
</p>
</div>