- commit
- 54e26d6
- parent
- ccabcc6
- author
- cruft
- date
- 2009-11-18 20:45:24 -0700 MST
A stab at ePub
M
Makefile
+18,
-0
1@@ -5,6 +5,10 @@ SUPPORT = chapauth.sty praise.tex
2 STORIES = stories/*.tex
3 ART = art/*
4
5+all: pdf epub
6+pdf: horrors2-book.pdf
7+epub: book.epub
8+
9 horrors2-book.pdf: horrors2-book.ps
10 ps2pdf $< $@
11
12@@ -18,8 +22,22 @@ horrors2.pdf: horrors2.ltx $(SUPPORT) $(STORIES) $(ART)
13 pdflatex $<
14 pdflatex $<
15
16+horrors2.mdwn: horrors2.ltx $(STORIES)
17+ ./toxhtml.py > $@
18+
19+horrors2.xhtml: horrors2.mdwn head.xhtml foot.xhtml
20+ cat head.xhtml > $@
21+ markdown $< >> $@
22+ cat foot.xhtml >> $@
23+
24+book.epub: horrors2.xhtml
25+ ./mkepub
26+
27+
28 publish: horrors2.pdf
29 cp horrors2.pdf horrors2.$(shell TZ=UTC date "+%Y-%m-%dT%H:%M:%SZ").pdf
30
31 clean:
32 rm -f *aux *dvi *log
33+ rm -f horrors2.xhtml horrors2.mdwn book.epub
34+ rm -f epub/art/*
+0,
-0
+0,
-0
+0,
-0
+7,
-0
1@@ -0,0 +1,7 @@
2+<?xml version="1.0" encoding="UTF-8"?>
3+<container xmlns="urn:oasis:names:tc:opendocument:xmlns:container"
4+ version="1.0">
5+ <rootfiles>
6+ <rootfile full-path="content.opf" media-type="application/oebps-package+xml" />
7+ </rootfiles>
8+</container>
+29,
-0
1@@ -0,0 +1,29 @@
2+<?xml version="1.0" encoding="UTF-8"?>
3+<!DOCTYPE ncx PUBLIC "-//NISO//DTD ncx 2005-1//EN"
4+ "http://www.daisy.org/z3986/2005/ncx-2005-1.dtd">
5+
6+<ncx version="2005-1" xml:lang="en"
7+ xmlns="http://www.daisy.org/z3986/2005/ncx/">
8+
9+<head>
10+ <!-- The following four metadata items are required for all NCX documents,
11+ including those conforming to the relaxed constraints of OPS 2.0 -->
12+
13+ <meta name="dtb:uid" content="horrors2"/> <!-- same as in .opf -->
14+ <meta name="dtb:depth" content="1"/> <!-- 1 or higher -->
15+ <meta name="dtb:totalPageCount" content="0"/> <!-- must be 0 -->
16+ <meta name="dtb:maxPageNumber" content="0"/> <!-- must be 0 -->
17+</head>
18+
19+<docTitle>
20+ <text>Horrors 2</text>
21+</docTitle>
22+
23+<navMap>
24+ <navPoint class="chapter" id="chapter1" playOrder="1">
25+ <navLabel><text>Chapter 1</text></navLabel>
26+ <content src="book.xhtml"/>
27+ </navPoint>
28+</navMap>
29+
30+</ncx>
+2,
-0
1@@ -0,0 +1,2 @@
2+</body>
3+</html>
+11,
-0
1@@ -0,0 +1,11 @@
2+<?xml version="1.0" encoding="UTF-8"?>
3+<!DOCTYPE html PUBLIC
4+ "-//W3C//DTD XHTML 1.0 Strict//EN"
5+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
6+<html xmlns="http://www.w3.org/1999/xhtml">
7+ <head>
8+ <title>Horrors 2</title>
9+ <link rel="stylesheet" href="style.css" type="text/css" />
10+ </head>
11+
12+ <body>
A
mkepub
+73,
-0
1@@ -0,0 +1,73 @@
2+#! /bin/sh
3+
4+cat horrors2.xhtml > epub/book.xhtml
5+rm -rf epub/art
6+mkdir epub/art
7+cp art/*.png art/*.jpg epub/art
8+cp style.css epub/
9+
10+
11+
12+cd epub
13+echo -n application/epub+zip > mimetype
14+cat >MANIFEST <<EOF
15+mimetype
16+META-INF/container.xml
17+content.opf
18+EOF
19+cat > content.opf <<EOF
20+<?xml version="1.0"?>
21+<package version="2.0" xmlns="http://www.idpf.org/2007/opf" unique-identifier="BookId">
22+<metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf">
23+ <dc:title>Horrors 2</dc:title>
24+ <dc:language>en</dc:language>
25+ <dc:identifier id="BookId" opf:scheme="title">Horrors2</dc:identifier>
26+ <dc:creator opf:file-as="Something Awful Forums" opf:role="aut">The Something Awful Forums</dc:creator>
27+</metadata>
28+
29+<manifest>
30+EOF
31+find . -type f | sed 's#./##' | while read fn; do
32+ b=$(basename $fn)
33+ id=thing$count
34+ count=$(expr $count + 1)
35+ case "$b" in
36+ META-INF/*|MANIFEST|mimetype|content.opf)
37+ continue
38+ ;;
39+ book.xhtml)
40+ id=book
41+ type=application/xhtml+xml
42+ ;;
43+ *.css)
44+ type=image/css
45+ ;;
46+ book.ncx)
47+ id=ncx
48+ ;;
49+ *.png)
50+ type=image/png
51+ ;;
52+ *.jpg)
53+ type=image/jpeg
54+ ;;
55+ *.svg)
56+ type=image/svg+xml
57+ ;;
58+ *.otf)
59+ type=application/octet-stream
60+ ;;
61+ esac
62+ echo "<item id=\"$id\" href=\"$fn\" media-type=\"$type\"/>" >> content.opf
63+ echo $fn >> MANIFEST
64+done
65+cat >> content.opf <<EOF
66+</manifest>
67+
68+<spine toc="ncx">
69+ <itemref idref="book" />
70+</spine>
71+ </package>
72+EOF
73+
74+xargs zip -Xr9D ../book.epub < MANIFEST
+6,
-6
1@@ -22,27 +22,27 @@ address book.
2
3
4
5-{\em ABE
6+{\em ABE}
7
8
9
10-CYNTHIA
11+{\em CYNTHIA}
12
13
14
15-MOM
16+{\em MOM}
17
18
19
20-PIZZA HUT
21+{\em PIZZA HUT}
22
23
24
25-DIRECTORIES
26+{\em DIRECTORIES}
27
28
29
30-INFO HOTLINE}
31+{\em INFO HOTLINE}
32
33
34
1@@ -128,11 +128,7 @@ Awesome!
2
3
4 {\em But confetti doesn't wear its hair in a blond, barretted
5-ponytail.
6-
7-
8-
9-Good Christ--} (he thought)
10+ponytail. Good Christ--} (he thought)
11
12
13
1@@ -180,4 +180,4 @@ Red lights whirled closer. Suddenly, I was sobbing.
2
3
4
5-\illustration{lucifer chikken}{Gun / Warehouse}{art/lucifer_chickken-gun_warehouse.png}
6+\illustration{lucifer chikken}{Gun / Warehouse}{art/lucifer_chikken-gun_warehouse.png}
+17,
-0
1@@ -1,3 +1,20 @@
2+@font-face {
3+ font-family: "Antykwa Torunska";
4+ src: url(AntykwaTorunska-Regular.otf);
5+}
6+
7+@font-face {
8+ font-family: "Antykwa Torunska";
9+ font-style: italic;
10+ src: url(AntykwaTorunska-Italic.otf);
11+}
12+
13+@font-face {
14+ font-family: "Antykwa Torunska";
15+ font-weight: bold;
16+ src: url(AntykwaTorunska-Bold.otf);
17+}
18+
19 body {
20 max-width: 40em;
21 font-family: Antykwa Torunska;
+0,
-17
1@@ -199,22 +199,5 @@ for l in f:
2 if l.startswith('\\begin{document'):
3 break
4
5-print('''<?xml version="1.0" encoding="UTF-8"?>
6-<!DOCTYPE html PUBLIC
7- "-//W3C//DTD XHTML 1.0 Strict//EN"
8- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
9-<html xmlns="http://www.w3.org/1999/xhtml">
10- <head>
11- <title>Horrors 2</title>
12- <link rel="stylesheet" href="style.css" type="text/css" />
13- </head>
14-
15- <body>
16-''')
17-
18 for l in f:
19 outline(l)
20-
21-print('''</body>
22-</html>
23-''')