git://git.exim.org
/
exim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Generate ePub files of documentation.
[exim.git]
/
doc
/
doc-docbook
/
Pre-xml
diff --git
a/doc/doc-docbook/Pre-xml
b/doc/doc-docbook/Pre-xml
index 6c017e7c8b0dca87716ab70febb42fc1986cb780..22b343d8db8b234b95ed28bf35b952f478ff6916 100755
(executable)
--- a/
doc/doc-docbook/Pre-xml
+++ b/
doc/doc-docbook/Pre-xml
@@
-36,7
+36,9
@@
# except when preceded by <entry> (i.e. not in tables). The same is
# also done within a word of four or more upper-case letters (for
# compile-time options).
# except when preceded by <entry> (i.e. not in tables). The same is
# also done within a word of four or more upper-case letters (for
# compile-time options).
-
+#
+# -epub Convert date formats to comply with epub specification
+#
# The function that processes non-literal, non-monospaced text
# The function that processes non-literal, non-monospaced text
@@
-71,11
+73,18
@@
if ($ascii)
$s;
}
$s;
}
+# Mapping needed for epub
+
+my %months = (
+ jan => '01', feb => '02', mar => '03', apr => '04', may => '05', jun => '06',
+ jul => '07', aug => '08', sep => '09', oct => '10', nov => '11', dec => '12',
+);
# The main program
$ascii = 0;
$bookinfo = 0;
# The main program
$ascii = 0;
$bookinfo = 0;
+$epub = 0;
$html = 0;
$inliteral = 0;
$inliterallayout = 0;
$html = 0;
$inliteral = 0;
$inliterallayout = 0;
@@
-91,6
+100,7
@@
foreach $arg (@ARGV)
if ($arg eq "-fi") { $ligatures = 1; }
elsif ($arg eq "-ascii") { $ascii = 1; }
elsif ($arg eq "-bookinfo") { $bookinfo = 1; }
if ($arg eq "-fi") { $ligatures = 1; }
elsif ($arg eq "-ascii") { $ascii = 1; }
elsif ($arg eq "-bookinfo") { $bookinfo = 1; }
+ elsif ($arg eq "-epub") { $epub = 1; }
elsif ($arg eq "-html") { $html = 1; }
elsif ($arg eq "-noindex") { $noindex = 1; }
elsif ($arg eq "-oneindex") { $oneindex = 1; }
elsif ($arg eq "-html") { $html = 1; }
elsif ($arg eq "-noindex") { $noindex = 1; }
elsif ($arg eq "-oneindex") { $oneindex = 1; }
@@
-141,6
+151,25
@@
while (<STDIN>)
next;
}
next;
}
+ # Adjust dates to YYYY-MM-DD
+
+ if ($epub && /^\s*<date[\s>]/)
+ {
+ print;
+ while (<STDIN>)
+ {
+ last if /^\s*<\/date>/;
+
+ if (/^ \s* (\d{1,2}) \s+ ([a-zA-Z]{3}) \s+ (\d{4})/x)
+ {
+ die "Unknown month '$2'\n" unless exists $months{lc $2};
+ my $month = $months{lc $2};
+ s//$3-$month-$1/;
+ }
+ print;
+ }
+ }
+
# A line that is not in a monospaced literal block; keep track of which
# parts are in <literal> and which not. The latter get processed by the
# function above. Items in <literal> get quoted unless they are also in
# A line that is not in a monospaced literal block; keep track of which
# parts are in <literal> and which not. The latter get processed by the
# function above. Items in <literal> get quoted unless they are also in