fix newline handling of block link followed by block
authorTony Cook <tony@develop-help.com>
Thu, 24 Oct 2013 06:04:24 +0000 (17:04 +1100)
committerTony Cook <tony@develop-help.com>
Sun, 3 Nov 2013 23:20:23 +0000 (10:20 +1100)
site/cgi-bin/modules/DevHelp/Formatter.pm
t/010-modules/050-format.t

index 160d9b44afb155ab9be1b93dcd881325198bc1e0..0f4c66e86df2da970c08a635de5577b34cd7d0a6 100644 (file)
@@ -3,7 +3,7 @@ use strict;
 use DevHelp::HTML;
 use Carp 'confess';
 
-our $VERSION = "1.006";
+our $VERSION = "1.007";
 
 use constant DEBUG => 0;
 
@@ -454,6 +454,7 @@ 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#(</a>)(<(?:$all_block_tags)\b)#$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;
index d86e726db7824ace690f26aa4aa514cd8ffbc1db..70166b8af131032330a63479795ae11fd2743be3 100644 (file)
@@ -1,6 +1,6 @@
 #!perl -w
 use strict;
-use Test::More tests => 142;
+use Test::More tests => 143;
 
 sub format_test($$$;$);
 sub noformat_test($$$;$);
@@ -369,6 +369,21 @@ IN
 <p>bar</p>
 <p>quux</p>
 </a>
+OUT
+  format_test <<IN, <<OUT, "multi-p link followed by normal text", 'both';
+link[#foo|
+one
+
+two
+]
+
+normal text
+IN
+<a href="#foo">
+<p>one</p>
+<p>two</p>
+</a>
+<p>normal text</p>
 OUT
   format_test 'tt[hello]', '<p><tt>hello</tt></p>', 'tt';
   format_test 'font[-1|text]', '<p><font size="-1">text</font></p>', 'fontsize';