summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharlotte Koch <charlotte@magentastripe.com>2024-06-05 13:27:53 -0700
committerCharlotte Koch <charlotte@magentastripe.com>2024-06-05 13:27:53 -0700
commit07fbca6dba62697c53075e68de31bc6e9a98e8c7 (patch)
tree30a92edbd85ce49b8a2a67d1dd6dba801afdb678
parent555aabff9fb5996c71a65f1407f9cf389fa7a92f (diff)
Significant EPUB3 creation and style fixes
-rw-r--r--mk/willora.mk26
-rw-r--r--themes/epub3-css3-only.scss1
-rw-r--r--themes/epub3.scss52
3 files changed, 78 insertions, 1 deletions
diff --git a/mk/willora.mk b/mk/willora.mk
index 21de0b6..cd05796 100644
--- a/mk/willora.mk
+++ b/mk/willora.mk
@@ -40,6 +40,13 @@ PAPERBACK_COLOPHON_OUT?= colophon-paperback.pdf
HARDCOVER_COLOPHON_OUT?= colophon-hardcover.pdf
EPUB_COLOPHON_OUT?= colophon-epub.pdf
+EPUB_STYLESHEET= ${THEMEDIR}/epub3.scss
+# XXX FIXME vv this shows up as "ISBN" on kobo
+#EPUB_UUID= 4af808df-05d7-442f-a04d-5e23f394b4af
+# XXX FIXME vv this should be the real publication date
+EPUB_REVDATE= 2024-01-01
+EPUB_BLURBFILE= epub-assets/epub_blurb.html
+
DEDICATION_OUT?= dedication.pdf
ACKNOWLEDGMENTS_OUT?= acknowledgments.pdf
BIOGRAPHY_OUT?= biography.pdf
@@ -204,18 +211,35 @@ ${HARDCOVER_FRONTMATTER}: ${FRONTMATTER_TEMPLATE}
# ===== EPUB =====
+EPUB_DESCR!= cat ${EPUB_BLURBFILE}
+
+# Includes a hack to add in my own fonts
CLEANFILES+= ${EPUB_OUT}
-${EPUB_OUT}: Gemfile.lock ${EPUB_ADOC_TOTAL} ${EPUB_COVER_FILE}
+${EPUB_OUT}: Gemfile.lock ${EPUB_ADOC_TOTAL} ${EPUB_COVER_FILE} ${EPUB_STYLESHEET} ${EPUB_BLURBFILE}
${BUNDLE} exec asciidoctor-epub3 \
-v \
-d book \
-o ${.TARGET} \
+ -a uuid="${EPUB_ISBN}" \
+ -a revdate="${EPUB_REVDATE}" \
-a producer="${PUBLISHER}" \
+ -a description="${EPUB_DESCR}" \
-a front-cover-image=${EPUB_COVER_FILE} \
-a ebook-format=epub3 \
+ -a epub3-stylesdir=${THEMEDIR} \
-a media=${MEDIA} \
-a text-align=justify \
${EPUB_ADOC_TOTAL}
+ rm -rf ./epub-cleanup ./cleaned.epub; \
+ mkdir -p ./epub-cleanup; \
+ sync .; \
+ cd ./epub-cleanup; \
+ unzip ../${.TARGET}; \
+ rsync -avr ${FONTDIR}/ ./EPUB/fonts/; \
+ zip ../cleaned.epub -r .; \
+ cd ..; \
+ rm -rf ./epub-cleanup; \
+ mv ./cleaned.epub ${.TARGET};
CLEANFILES+= ${EPUB_ADOC_TOTAL}
${EPUB_ADOC_TOTAL}: ${EPUB_FRONTMATTER} ${CHAPTERS} ${UNICODE_TABLE}
diff --git a/themes/epub3-css3-only.scss b/themes/epub3-css3-only.scss
new file mode 100644
index 0000000..0a74eb1
--- /dev/null
+++ b/themes/epub3-css3-only.scss
@@ -0,0 +1 @@
+/* OK */
diff --git a/themes/epub3.scss b/themes/epub3.scss
new file mode 100644
index 0000000..851d40b
--- /dev/null
+++ b/themes/epub3.scss
@@ -0,0 +1,52 @@
+/*
+ * Magenta Stripe Media - EPUB3 Stylesheet
+ * Charlotte Koch <charlotte@magentastripe.com>
+ */
+
+/* ***** EB GARAMOND FONT ***** */
+
+@font-face {
+ font-family: "EB Garamond";
+ font-style: normal;
+ font-weight: normal;
+ src: url(../fonts/EBGaramond08-Regular.ttf);
+}
+
+@font-face {
+ font-family: "EB Garamond";
+ font-style: italic;
+ font-weight: normal;
+ src: url(../fonts/EBGaramond08-Italic.ttf);
+}
+
+
+/* ***** NAUTICAL FONT ***** */
+
+@font-face {
+ font-family: "Nautical";
+ font-style: normal;
+ font-weight: normal;
+ src: url(../fonts/Nautical.ttf);
+}
+
+
+/* ***** BODY ***** */
+
+body {
+ font-family: "EB Garamond", serif;
+}
+
+/*
+ * Default stylesheet contains 1em margin on the top of every paragraph;
+ * this should remove it.
+ */
+body p {
+ margin: 0em;
+ text-indent: 2em;
+ line-height: 2.0;
+}
+
+hr.thematicbreak {
+ /* XXX try to insert the appropriate dingbat here */
+ text-align: center;
+}