Testsuite: Fix check_dir_size() fs dependencies
[exim.git] / doc / doc-scripts / g2h
index e940e669bfb69041165de786a5a5082faaa76b99..b6e292211ae46ba6cbbb25459e6d64f13e0d91ee 100755 (executable)
@@ -1,5 +1,4 @@
 #! /usr/bin/perl -w
-# $Cambridge: exim/doc/doc-scripts/g2h,v 1.1 2004/10/07 15:04:35 ph10 Exp $
 
 # This is a script that turns the SGCAL source of Exim's documentation into
 # HTML. It can be used for both the filter document and the main Exim
@@ -180,6 +179,7 @@ $key = "$text";
 $key =~ s/<[^>]+>//g;
 $key =~ s/&#(\d+);/chr($1)/eg;
 $key =~ s/^`+//;
+$key =~ s/^"//;
 
 # Turn all spaces in the text into &nbsp; so that they don't ever split.
 # However, there may be spaces in the HTML that already exists in the
@@ -654,20 +654,20 @@ elsif (/^\.display\b/)
       {
       print OUT "<br>\n";
       }
-      
+
     # Some displays have emphasis inside them
-    
+
     elsif (/^\.em\b/)
       {
       print OUT "<font color=green>" if ! $inem;
       $inem = 1;
-      }    
+      }
 
     elsif (/^\.nem\b/)
       {
       print OUT "</font>" if $inem;
       $inem = 0;
-      }    
+      }
 
     # There are occasional instances of .if [!]~~sys.fancy inside displays.
     # In both cases we want the non-fancy alternative. (The only thing that
@@ -689,10 +689,10 @@ elsif (/^\.display\b/)
     # Ignore .newline and .linelength
 
     elsif (/^\.newline\b/ || /^\.linelength\b/) {}
-    
+
     # Ignore comments
-    
-    elsif (/^\.(\s|$)/) {}  
+
+    elsif (/^\.(\s|$)/) {}
 
     # There shouldn't be any other directives inside displays
 
@@ -755,7 +755,10 @@ elsif (/^\.display\b/)
 
 # Handle configuration option definitions
 
-elsif (/^\.startconf\b/) {}
+elsif (/^\.startconf\s+(.*)/)
+  {
+  $confuse = &handle_text($1);
+  }
 
 elsif (/^\.conf\b/)
   {
@@ -781,6 +784,7 @@ elsif (/^\.conf\b/)
   &setpar(0);
   &handle_index($option, 0);
   print OUT "<h3>$option</h3>\n" .
+            "<i>Use:</i>&nbsp; $confuse<br>" .
             "<i>Type:</i>&nbsp; $type<br><i>Default:</i>&nbsp; $default<br>\n";
   }
 
@@ -831,7 +835,7 @@ elsif (/^\.startoptions\b/) {}
 elsif (/^\.option\s+(.*)/)
   {
   my($arg) = $1;
-  $arg =~ s/^"(.*)"$/$1/;
+  $arg =~ s/"([^"]*)"/$1/g;
 
   print OUT "<hr>";
   &setpar(0);
@@ -881,7 +885,10 @@ open (IN, $source_file) || die "Can't open $source_file (first pass)\n";
 $_ = <IN>;
 
 # At the start of the specification text, there are some textual replacement
-# definitions. They set values, but not cross-references.
+# definitions. They set values, but not cross-references. They may be preceded
+# by comments.
+
+$_ = <IN> while (/^\.(\s|$)/);
 
 while (/^\.r?set\s+(\S+)\s+"?([^"]+)\"?\s*$/)
   {
@@ -979,7 +986,7 @@ open (IN, $source_file) || die "Can't open $source_file (2nd pass)\n";
 $_ = <IN>;
 
 # Skip on till we hit the start of the first chapter, but note if we
-# pass ".set chapter -1", which is used to indicate no chapter numbering for 
+# pass ".set chapter -1", which is used to indicate no chapter numbering for
 # the first chapter (we number is 0). Keep track of whether we are in macro
 # definitions or not, and when not, notice occurrences of .index, because this
 # are the "x see y" type entries.
@@ -1002,7 +1009,7 @@ while (!/^\.chapter/)
     }
   $_ = <IN>;
   }
-  
+
 # Open the TOC file
 
 open (TOC, ">$html/${file_base}_toc.html") ||
@@ -1021,7 +1028,7 @@ print TOC "<h1>$doctitle</h1><hr>\n<ul>\n";
 # Loop for handling chapters. At the start of this loop, $_ is either EOF,
 # or contains a .chapter line.
 
-$firstchapter = $thischapter + 1; 
+$firstchapter = $thischapter + 1;
 
 while ($_)
   {
@@ -1072,8 +1079,8 @@ while ($_)
       print TOC "<ul>\n" if !$insection;
       $insection = 1;
 
-      my($title) = (($thischapter > 0)? "$thischapter." : "") .
-        "$thissection. " . &handle_text($1, 0);
+      my($title) = (($thischapter > 0)? "$thischapter.$thissection " : 
+                   "$thissection. ") . &handle_text($1, 0);
 
       if ($sectsplit)
         {
@@ -1119,7 +1126,7 @@ while ($_)
           print OUT "<font color=green>" if ! $inem;
           $inem = 1;
           # Used to handle it here - but that fails if it is .section.
-          # Just let the next iteration of the loop handle it.  
+          # Just let the next iteration of the loop handle it.
           # &handle_directive();
           }
 
@@ -1300,7 +1307,7 @@ foreach $key (keys %$hash)
   {
   my($initial) = substr($key,0,1);
   $initial = "\U$initial";
-  $indexindex{$initial} = 1 if $initial ge "A";
+  $indexindex{$initial} = 1 if $initial ge "A" && $initial le "Z";
   }
 
 print INDEX "<p>\n";
@@ -1314,19 +1321,24 @@ my($letter) = "";
 print INDEX "<p>\n";
 
 foreach $key (sort
-      { ("\L$a" eq "\L$b")? ("$a" cmp "$b") : ("\L$a" cmp "\L$b") }
+      {
+      my($aa) = $a;
+      my($bb) = $b;
+
+      $aa =~ s/^\x93//;   # Seems like the actual char values are
+      $bb =~ s/^\x93//;   # set by this time, not "&#147;"
+
+      return ("\L$aa" eq "\L$bb")? ("$aa" cmp "$bb") : ("\L$aa" cmp "\L$bb");
+      }
     keys %$hash)
   {
   my($initial) = substr($key,0,1);
   $initial = "\U$initial";
-  if ($initial ne $letter)
+  if ($initial ne $letter && $initial ge "A" && $initial le "Z")
     {
-    if ($initial ge "A")
-      {
-      print INDEX "<br>\n" if $letter ne "";
-      print INDEX "<a name=\"$initial\"></a>\n";
-      print INDEX "<font size=\"+1\">\U$initial\E</font><br>\n";
-      }
+    print INDEX "<br>\n";
+    print INDEX "<a name=\"$initial\"></a>\n";
+    print INDEX "<font size=\"+1\">\U$initial\E</font><br>\n";
     $letter = $initial;
     }
   print INDEX "$$hash{$key}<br>\n";
@@ -1367,6 +1379,7 @@ $html = "html";
 
 $chapsplit = 0;
 $cindex_tocn = 0;
+$confuse = "";
 $file_base = "";
 $index_count = 0;
 $inem = 0;