awk -f joinfiles.awk book.tex > $@
clean:
- rm -f onefile.tex book.log book.aux book.out book.toc
+ rm -f onefile.tex book.log book.aux book.out book.toc Kate-the-Empress.fb2 fb2lint
while (<F>) {
# Replace empty date with current date
if (/<date\s+\/>/ || /<date>\s*<\/date>/) {
- $_ = "<date value=\">".strftime("%Y-%m-%d",localtime())."\">".
+ $_ = "<date value=\"".strftime("%Y-%m-%d",localtime())."\">".
strftime("%d/%m/%Y",localtime())."</date>\n";
}
# Add current to date as fractional part to version
next LINE;
}
next LINE if /\\pagebreak\b/;
+#replace ' and " with entities
+s/&/&/g;
+s/'/'/g;
+s/"/"/g;
+s/</</g;
+s/>/>/g;
#normal mode:
if (!$verbatim) {
#strip TeX comments
s/(\s)\s+/$1/g;
#replace TeX ligatures ~ --- << >> \% with appropriate unicode symbols
s/~/\xA0/g;
+s/\\-/\xAD/g;
s/---/—/g;
s/<</«/g;
s/>>/»/g;
s/\\%/%/g;
s/\\dots/\x{2026}/g;
+s/\\verb(.)(.*)\1/<code>$2<\/code>/;
}
-#replace ' and " with entities
-s/&/&/g;
-s/'/'/g;
-s/"/"/g;
-s/</</g;
-s/>/>/g;
if ($poetry) {
chomp;
+ if ($poetic_buffer) {
+ $_ = $poetic_buffer." ".$_;
+ $poetic_buffer = undef;
+ }
+ if (/{[^}]+$/) {
+ $poetic_buffer=$_;
+ next LINE;
+ }
+ s/\\footnote{(.*)}/push_footnote($1)/e;
s/\s*\\\\$//;
$buffer.=tag($_,'v')."\n";
} elsif ($verbatim) {