]> wagner.pp.ru Git - fiction/Kate-the-Empress.git/commitdiff
added fb2-related stuff to .gitignore and make clean. Added version of Tex2fb2 which...
authorVictor Wagner <vitus@wagner.pp.ru>
Thu, 14 Nov 2013 17:30:01 +0000 (21:30 +0400)
committerVictor Wagner <vitus@wagner.pp.ru>
Thu, 14 Nov 2013 17:30:01 +0000 (21:30 +0400)
.gitignore
Makefile
Tex2fb2

index 2b77885f9371dd81e5f35b4cf412033a0542052a..f9e76d36ed1ad43732efff9cc628d8b31a790ad4 100644 (file)
@@ -1,7 +1,10 @@
 Kate-the-Empress.pdf
 Kate-the-Empress.epub
 Kate-the-Empress.html
+Kate-the-Empress.fb2
+Kate-the-Empress.fb2.zip
 onefile.tex
+fb2lint
 *.aux
 *.toc
 *.log
index bef816b0d1a67aabd5a7efb37d6c6aff299f45bc..6d28215400984687e4c7e41b6c577d88952d986d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -25,4 +25,4 @@ onefile.tex: joinfiles.awk $(wildcard *.tex)
        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
diff --git a/Tex2fb2 b/Tex2fb2
index 22d83434cdcc887bf7382299656a993c4ac007ee..30988082287d8c4345292a34f511a10b60ca4e66 100755 (executable)
--- a/Tex2fb2
+++ b/Tex2fb2
@@ -22,7 +22,7 @@ open F,"<",$metadata;
 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
@@ -77,6 +77,12 @@ if (/\\vspace{/) {
        next LINE;
 }
 next LINE if /\\pagebreak\b/;
+#replace ' and " with entities
+s/&/&amp;/g;
+s/'/&apos;/g;
+s/"/&quot;/g;
+s/</&lt;/g;
+s/>/&gt;/g;
 #normal mode: 
 if (!$verbatim) {
 #strip TeX comments 
@@ -92,21 +98,26 @@ s/\s+$//;
 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/&/&amp;/g;
-s/'/&apos;/g;
-s/"/&quot;/g;
-s/</&lt;/g;
-s/>/&gt;/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) {