diff options
author | Philip Hazel <ph10@hermes.cam.ac.uk> | 2006-02-01 11:01:01 +0000 |
---|---|---|
committer | Philip Hazel <ph10@hermes.cam.ac.uk> | 2006-02-01 11:01:01 +0000 |
commit | 9b3719888275859f10e5a8c6e87a92899abc0d95 (patch) | |
tree | 5ffdcf44ce71a8c3c4313c4d5b518a1a5db9be49 /doc/doc-docbook/TidyHTML-filter | |
parent | f8ebba6859de95223d3d3ddc7468bed41057e82d (diff) |
Remove Asciidoc versions of the documentation and building apparatus;
replace with xfpt versions.
Diffstat (limited to 'doc/doc-docbook/TidyHTML-filter')
-rwxr-xr-x | doc/doc-docbook/TidyHTML-filter | 51 |
1 files changed, 29 insertions, 22 deletions
diff --git a/doc/doc-docbook/TidyHTML-filter b/doc/doc-docbook/TidyHTML-filter index 5056c1723..70bb86520 100755 --- a/doc/doc-docbook/TidyHTML-filter +++ b/doc/doc-docbook/TidyHTML-filter @@ -1,6 +1,6 @@ #! /usr/bin/perl -# $Cambridge: exim/doc/doc-docbook/TidyHTML-filter,v 1.2 2005/11/10 12:30:13 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: @@ -21,13 +21,21 @@ open(IN, "filter.html") || die "Failed to open filter.html for reading: $!\n"; @text = <IN>; 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] =~ ?<title>Exim's interfaces to mail filtering</title>?) + { + splice @text, $i, 1, (split /(?=<div class="chapter")/, $text[$i]); + $text[$i] =~ s/>\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 @@ -60,26 +68,25 @@ for (; $i < scalar(@text); $i++) for (; $i < scalar(@text); $i++) { - if ($text[$i] eq "<div class=\"literallayout\">\n" && $text[$i+1] eq "<p>\n") + while ($text[$i] =~ + /^(.*)<a( xmlns="[^"]+")? id="([^"]+)"><\/a>(.*?)<\/h(.*)/) { - $text[++$i] = ""; - $thisdiv = 1; + my($ref) = $backref{"#$2"}; + $text[$i] = "$1<a$2 href=\"#$ref\" id=\"$3\">$4</a></h$5"; } - elsif ($thisdiv && $text[$i] eq "</p>\n" && $text[$i+1] eq "</div>\n") - { - $text[$i] = ""; - $thisdiv = 0; - } - elsif ($text[$i] =~ /^<h[23] /) + + if ($text[$i] =~ /^(.*)<div class="literallayout"><p>(?:<br \/>)?(.*)/) { - $i++; - if ($text[$i] =~ /^<a( xmlns="[^"]+")? id="([^"]+)">$/) + my($j); + $text[$i] = "$1<div class=\"literallayout\">$2"; + + for ($j = $i + 1; $j < scalar(@text); $j++) { - my($ref) = $backref{"#$2"}; - $text[$i++] = "<a$1 href=\"#$ref\" id=\"$2\">\n"; - my($temp) = $text[$i]; - $text[$i] = $text[$i+1]; - $text[++$i] = $temp; + if ($text[$j] =~ /^<\/p><\/div>/) + { + $text[$j] =~ s/<\/p>//; + last; + } } } } |