First pass update for 4.60 documentation.
[exim.git] / doc / doc-docbook / TidyHTML-filter
index f23a9a728cff0b0b87d839f9f25030ac1f4812f5..5056c172373e577966f34e01bc9feefa89b60a4b 100755 (executable)
@@ -1,15 +1,19 @@
 #! /usr/bin/perl
 
-# $Cambridge: exim/doc/doc-docbook/TidyHTML-filter,v 1.1 2005/06/16 10:32:31 ph10 Exp $
+# $Cambridge: exim/doc/doc-docbook/TidyHTML-filter,v 1.2 2005/11/10 12:30:13 ph10 Exp $
 
 # Script to tidy up the filter HTML file that is generated by xmlto. The
 # following changes are made:
 #
 # 1. Split very long lines.
 # 2. Create reverse links from chapter and section titles back to the TOC.
+# 3. Turn <div class="literallayout"><p> into <div class="literallayout"> and
+#    a matching </p></div> into </div> to get rid of unwanted vertical white
+#    space.
 
 
 $tocref = 1;
+$thisdiv = 0;
 
 # Read in the filter.html file.
 
@@ -56,7 +60,17 @@ for (; $i < scalar(@text); $i++)
 
 for (; $i < scalar(@text); $i++)
   {
-  if ($text[$i] =~ /^<h[23] /)
+  if ($text[$i] eq "<div class=\"literallayout\">\n" && $text[$i+1] eq "<p>\n")
+    {
+    $text[++$i] = "";
+    $thisdiv = 1;
+    }
+  elsif ($thisdiv && $text[$i] eq "</p>\n" && $text[$i+1] eq "</div>\n")
+    {
+    $text[$i] = "";
+    $thisdiv = 0;
+    }
+  elsif ($text[$i] =~ /^<h[23] /)
     {
     $i++;
     if ($text[$i] =~ /^<a( xmlns="[^"]+")? id="([^"]+)">$/)