Permalink
Browse files

add newlines around hr tags

  • Loading branch information...
1 parent 9b60b69 commit 7d05b12a7e20badc6ec4abeb53e1666fef9ada1c @tonycoz committed Oct 24, 2013
Showing with 14 additions and 2 deletions.
  1. +2 −1 site/cgi-bin/modules/DevHelp/Formatter.pm
  2. +12 −1 t/010-modules/050-format.t
View
3 site/cgi-bin/modules/DevHelp/Formatter.pm
@@ -454,7 +454,8 @@ sub format {
1 while $part =~ s#(<(?:$all_block_tags)[^>]*>)(<(?:$all_block_tags)\b)#$1\n$2#g;
1 while $part =~ s#(</a>)(<a\s+[^>]*>)(<(?:$all_block_tags))#$1\n$2\n$3#g;
1 while $part =~ s#(<a\s+[^>]*>)(<(?:$all_block_tags))#$1\n$2#g;
- 1 while $part =~ s#(<hr\b[^>]*/>)(<a\s+[^>]*>)#$1\n$2#g;
+ 1 while $part =~ s#(>)(<hr\b[^>]*/>)#$1\n$2#g;
+ 1 while $part =~ s#(<hr\b[^>]*/>)(<)#$1\n$2#g;
#$part =~ s!<p>(<hr[^>]*>)</p>!$1!g;
$part =~ s!<p>(<(?:table|ol|ul|center|h[1-6])[^>]*>)!$1!g;
$part =~ s!(</(?:table|ol|ul|center|h[1-6])>)</p>!$1!g;
View
13 t/010-modules/050-format.t
@@ -1,6 +1,6 @@
#!perl -w
use strict;
-use Test::More tests => 141;
+use Test::More tests => 142;
sub format_test($$$;$);
sub noformat_test($$$;$);
@@ -414,6 +414,17 @@ OUT
format_test 'hr[]', '<hr />', 'hr0';
format_test 'hr[80%]', '<hr width="80%" />', 'hr1';
format_test 'hr[80%|10]', '<hr width="80%" size="10" />', 'hr2';
+ format_test <<'IN', <<'OUT', 'hr with other text', 'both';
+testhr[]test
+hr[80%]
+test
+IN
+<p>test</p>
+<hr />
+<p>test</p>
+<hr width="80%" />
+<p>test</p>
+OUT
format_test <<IN, <<OUT, 'table1', 'both';
table[80%
bgcolor="black"|quux|blarg

0 comments on commit 7d05b12

Please sign in to comment.