X-Git-Url: https://git.exim.org/users/heiko/exim.git/blobdiff_plain/168e428fc4dfcf7f4d377d137743d8332784fa35..c816d12454be94abb341da9658ca60a8e25fab7c:/doc/doc-docbook/TidyHTML-filter?ds=inline
diff --git a/doc/doc-docbook/TidyHTML-filter b/doc/doc-docbook/TidyHTML-filter
index f23a9a728..70bb86520 100755
--- a/doc/doc-docbook/TidyHTML-filter
+++ b/doc/doc-docbook/TidyHTML-filter
@@ -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.3 2006/02/01 11:01:01 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
into
and
+# a matching
into
to get rid of unwanted vertical white
+# space.
$tocref = 1;
+$thisdiv = 0;
# Read in the filter.html file.
@@ -17,13 +21,21 @@ open(IN, "filter.html") || die "Failed to open filter.html for reading: $!\n";
@text = ;
close(IN);
-# Insert a newline after every > because the whole toc is generated as one
-# humungous line that is hard to check. Then split the lines so that each one
-# is a separate element in the vector.
+# Insert a newline after every > in the toc, because the whole toc is generated
+# as one humungous line that is hard to check. Indeed, the start of the first
+# chapter is also on the line, so we have to split if off first. Having
+# inserted newlines, we split the toc into separate items in the vector.
-foreach $line (@text) { $line =~ s/>\s*/>\n/g; }
for ($i = 0; $i < scalar(@text); $i++)
- { splice @text, $i, 1, (split /(?<=\n)/, $text[$i]); }
+ {
+ if ($text[$i] =~ ?Exim's interfaces to mail filtering?)
+ {
+ splice @text, $i, 1, (split /(?=\s*/>\n/g;
+ splice @text, $i, 1, (split /(?<=\n)/, $text[$i]);
+ last;
+ }
+ }
# We want to create reverse links from each chapter and section title back to
# the relevant place in the TOC. Scan the TOC for the relevant entries. Add
@@ -56,16 +68,25 @@ for (; $i < scalar(@text); $i++)
for (; $i < scalar(@text); $i++)
{
- if ($text[$i] =~ /^<\/a>(.*?)<\/h(.*)/)
{
- $i++;
- if ($text[$i] =~ /^$/)
+ my($ref) = $backref{"#$2"};
+ $text[$i] = "$1$4(?:
)?(.*)/)
+ {
+ my($j);
+ $text[$i] = "$1