summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.scm20
-rw-r--r--templates/book.epub (renamed from templates/ebook/book.epub)5
2 files changed, 24 insertions, 1 deletions
diff --git a/Makefile.scm b/Makefile.scm
index b593a3c..cc36c8b 100644
--- a/Makefile.scm
+++ b/Makefile.scm
@@ -50,7 +50,6 @@
`("./utils/yaml2json.py" ,file)
"Error parsing Metadata file")))
-;TODO
(define (pandoc-web-simple lang output input)
(let ((outpath (make-path output "WebSimple"))
(files (directory-sources lang input))
@@ -119,6 +118,24 @@
`("--metadata-file" ,metafile))
"Error in book creation")))
+(define (pandoc-epub lang output input)
+ (let ((outpath (make-path output "Epub"))
+ (files (directory-sources lang input))
+ (metafile (directory-meta lang input)))
+ (create-directory* outpath)
+ (process->string-or-fail
+ (append
+ `("pandoc"
+ "-o" ,(make-path outpath (string-append lang ".epub"))
+ "--standalone"
+ "--data-dir=."
+ ,(string-append "--resource-path=" input)
+ "--css=./templates/ebook/epub.css"
+ "--template=book.epub"
+ "--lua-filter=appendixes.lua")
+ files
+ `("--metadata-file" ,metafile))
+ "Error in book creation")))
;; RUN THIS LIKE:
;; chibi-scheme Makefile.scm src/BOOK_FOLDER
;;
@@ -133,6 +150,7 @@
(pandoc-web "es" output input)
(pandoc-web-simple "es" output input)
(pandoc-book "es" output input)
+(pandoc-epub "es" output input)
;(display (process->string-or-fail '("./utils/yaml2json.py" "src/Programming_in_Python/es/Metadata.yaml") ""))
;(display (cdr (assoc 'title (read-meta "src/Programming_in_Python/es/Metadata.yaml"))))
diff --git a/templates/ebook/book.epub b/templates/book.epub
index 336b608..ae658fa 100644
--- a/templates/ebook/book.epub
+++ b/templates/book.epub
@@ -56,6 +56,11 @@ $else$
$for(include-before)$
$include-before$
$endfor$
+$if(toc)$
+<section ebook:type="toc" class="toc">
+$table-of-contents$
+</section>
+$endif$
$body$
$for(include-after)$
$include-after$