add line breaks to formatting output
authorAdrian Oldham <adriann@visualthought.com.au>
Mon, 21 Oct 2013 05:00:00 +0000 (16:00 +1100)
committerTony Cook <tony@develop-help.com>
Sun, 3 Nov 2013 23:20:22 +0000 (10:20 +1100)
site/cgi-bin/modules/DevHelp/Formatter.pm

index 2ce8d40ba2f431c3789e78e32cb8f91f8379acc0..bde7f1f1cd689a6e42ca04eecafe77864d924dd9 100644 (file)
@@ -358,28 +358,28 @@ sub format {
       $part =~ s/^\s+|\s+\z//g; # avoid spurious leading/trailing <p>
       $part =~ s!(\n([ \r]*\n)*)!$1 eq "\n" ? "<br />\n" : "</p>\n<p>"!eg;
       $part = "<p>$part</p>";
-      1 while $part =~ s/<p>(<div(?: [^>]*)?>)/$1<p>/g;
-      1 while $part =~ s!</div></p>!</p></div>!g;
-      1 while $part =~ s/<p>(<address(?: [^>]*)?>)/$1<p>/g;
-      1 while $part =~ s!</address></p>!</p></address>!g;
-      1 while $part =~ s/<p>(<blockquote(?: [^>]*)?>)/$1<p>/g;
-      1 while $part =~ s!</blockquote></p>!</p></blockquote>!g;
-      1 while $part =~ s/<p>(<article(?: [^>]*)?>)/$1<p>/g;
-      1 while $part =~ s!</article></p>!</p></article>!g;
-      1 while $part =~ s/<p>(<section(?: [^>]*)?>)/$1<p>/g;
-      1 while $part =~ s!</section></p>!</p></section>!g;
-      1 while $part =~ s/<p>(<header(?: [^>]*)?>)/$1<p>/g;
-      1 while $part =~ s!</header></p>!</p></header>!g;
-      1 while $part =~ s/<p>(<footer(?: [^>]*)?>)/$1<p>/g;
-      1 while $part =~ s!</footer></p>!</p></footer>!g;
-      1 while $part =~ s/<p>(<aside(?: [^>]*)?>)/$1<p>/g;
-      1 while $part =~ s!</aside></p>!</p></aside>!g;
-      1 while $part =~ s/<p>(<nav(?: [^>]*)?>)/$1<p>/g;
-      1 while $part =~ s!</nav></p>!</p></nav>!g;
-      1 while $part =~ s/<p>(<figure(?: [^>]*)?>)/$1<p>/g;
-      1 while $part =~ s!</figure></p>!</p></figure>!g;
-      1 while $part =~ s/<p>(<figcaption(?: [^>]*)?>)/$1<p>/g;
-      1 while $part =~ s!</figcaption></p>!</p></figcaption>!g;
+      1 while $part =~ s/<p>(<div(?: [^>]*)?>)/$1\n<p>/g;
+      1 while $part =~ s!</div></p>!</p>\n</div>!g;
+      1 while $part =~ s/<p>(<address(?: [^>]*)?>)/$1\n<p>/g;
+      1 while $part =~ s!</address></p>!</p>\n</address>!g;
+      1 while $part =~ s/<p>(<blockquote(?: [^>]*)?>)/$1\n<p>/g;
+      1 while $part =~ s!</blockquote></p>!</p>\n</blockquote>!g;
+      1 while $part =~ s/<p>(<article(?: [^>]*)?>)/$1\n<p>/g;
+      1 while $part =~ s!</article></p>!</p>\n</article>!g;
+      1 while $part =~ s/<p>(<section(?: [^>]*)?>)/$1\n<p>/g;
+      1 while $part =~ s!</section></p>!</p>\n</section>!g;
+      1 while $part =~ s/<p>(<header(?: [^>]*)?>)/$1\n<p>/g;
+      1 while $part =~ s!</header></p>!</p>\n</header>!g;
+      1 while $part =~ s/<p>(<footer(?: [^>]*)?>)/$1\n<p>/g;
+      1 while $part =~ s!</footer></p>!</p>\n</footer>!g;
+      1 while $part =~ s/<p>(<aside(?: [^>]*)?>)/$1\n<p>/g;
+      1 while $part =~ s!</aside></p>!</p>\n</aside>!g;
+      1 while $part =~ s/<p>(<nav(?: [^>]*)?>)/$1\n<p>/g;
+      1 while $part =~ s!</nav></p>!</p>\n</nav>!g;
+      1 while $part =~ s/<p>(<figure(?: [^>]*)?>)/$1\n<p>/g;
+      1 while $part =~ s!</figure></p>!</p>\n</figure>!g;
+      1 while $part =~ s/<p>(<figcaption(?: [^>]*)?>)/$1\n<p>/g;
+      1 while $part =~ s!</figcaption></p>!</p>\n</figcaption>!g;
       1 while $part =~ s!<p>(<a\s[^>]+>)</p>!$1!g;
       1 while $part =~ s!<p></a></p>!</a>!g;
       1 while $part =~ s! ?(<a\s[^>]+>)</p>!</p>\n$1!g;