summaryrefslogtreecommitdiff
path: root/doc/doc-docbook/TidyHTML-spec
diff options
context:
space:
mode:
authorPhilip Hazel <ph10@hermes.cam.ac.uk>2005-11-10 12:30:13 +0000
committerPhilip Hazel <ph10@hermes.cam.ac.uk>2005-11-10 12:30:13 +0000
commit068aaea8b5ac80809a1b860f63c625b3ea389ded (patch)
tree3e577f830fb86f789c8b91e150c206a6692ef108 /doc/doc-docbook/TidyHTML-spec
parent1ffd9c6de04e767396ae30a6be8c3597456486fa (diff)
First pass update for 4.60 documentation.
Diffstat (limited to 'doc/doc-docbook/TidyHTML-spec')
-rwxr-xr-xdoc/doc-docbook/TidyHTML-spec48
1 files changed, 44 insertions, 4 deletions
diff --git a/doc/doc-docbook/TidyHTML-spec b/doc/doc-docbook/TidyHTML-spec
index 8459bcf17..05a9d826b 100755
--- a/doc/doc-docbook/TidyHTML-spec
+++ b/doc/doc-docbook/TidyHTML-spec
@@ -1,6 +1,6 @@
#! /usr/bin/perl
-# $Cambridge: exim/doc/doc-docbook/TidyHTML-spec,v 1.1 2005/06/16 10:32:31 ph10 Exp $
+# $Cambridge: exim/doc/doc-docbook/TidyHTML-spec,v 1.2 2005/11/10 12:30:13 ph10 Exp $
# Script to tidy up the spec HTML files that are generated by xmlto. The
# following changes are made:
@@ -9,6 +9,11 @@
# 2. Create reverse links from chapter and section titles back to the TOC.
# 3. Tidy the ix01.html file - the actual index - by splitting long lines.
# 4. Insert links from the letter divisions to the top of the Index.
+# 5. Turn <div class="literallayout"><p> into <div class="literallayout"> and
+# a matching </p></div> into </div> to get rid of unwanted vertical white
+# space.
+# 6. Before each occurrence of </td> insert &nbsp; so that the table's cell
+# is a little bit wider than the text itself.
chdir "spec.html";
@@ -52,7 +57,10 @@ open (OUT, ">index.html") || die "Failed to open index.html for writing: $!\n";
print OUT @toc;
close(OUT);
-# Now scan each of the other page files and insert the reverse links.
+# Now scan each of the other page files and insert the reverse links. While
+# we are at it, we tidy up <div class="literallayout"> by removing unwanted
+# paragraph marks, which generate unwanted vertical space. We also insert
+# &nbsp; before </td> to push table cells apart from each other.
foreach $file (@chlist)
{
@@ -60,9 +68,26 @@ foreach $file (@chlist)
@text = <IN>;
close(IN);
+ # Insert a newline after certain elements, and split the lines so that each
+ # one is a separate element in the vector. This makes it easier to recognize
+ # these elements.
+
foreach $line (@text)
{
- if ($line =~ /^(.*?)<a( xmlns="[^"]+")? id="([^"]+)"><\/a>(.+?)<\/h(.*)$/)
+ $line =~ s/<p>\s*(?!\n)/<p>\n/g;
+ $line =~ s/<\/p>\s*(?!\n)/<\/p>\n/g;
+ $line =~ s/<\/div>\s*(?!\n)/<\/div>\n/g;
+ $line =~ s/<div([^>]*)>(?!\n)/<div$1>\n/g;
+ }
+
+ for ($i = 0; $i < scalar(@text); $i++)
+ { splice @text, $i, 1, (split /(?<=\n)/, $text[$i]); }
+
+ $thisdiv = 0;
+
+ for ($i = 0; $i < scalar(@text); $i++)
+ {
+ if ($text[$i] =~ /^(.*?)<a( xmlns="[^"]+")? id="([^"]+)"><\/a>(.+?)<\/h(.*)$/)
{
my($pre, $opt, $id, $title, $post) = ($1, $2, $3, $4, $5);
@@ -73,7 +98,22 @@ foreach $file (@chlist)
$ref = $backref{"$file"} if !defined $ref;
# Adjust the line
- $line = "$pre<a$opt href=\"index.html#$ref\" id=\"$id\">$title</a></h$post";
+ $text[$i]= "$pre<a$opt href=\"index.html#$ref\" id=\"$id\">$title</a></h$post";
+ }
+
+ elsif ($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] =~ /^\s*<\/td>/)
+ {
+ $text[$i] = "&nbsp;$text[$i]";
}
}