aboutsummaryrefslogtreecommitdiff
path: root/source/epub/templates
diff options
context:
space:
mode:
Diffstat (limited to 'source/epub/templates')
-rw-r--r--source/epub/templates/container.xml6
-rw-r--r--source/epub/templates/content.opf34
-rw-r--r--source/epub/templates/ez-section.html17
-rw-r--r--source/epub/templates/image.html16
-rw-r--r--source/epub/templates/title-page.html22
-rw-r--r--source/epub/templates/toc.html32
-rw-r--r--source/epub/templates/toc.ncx28
7 files changed, 155 insertions, 0 deletions
diff --git a/source/epub/templates/container.xml b/source/epub/templates/container.xml
new file mode 100644
index 00000000..eecf7a0d
--- /dev/null
+++ b/source/epub/templates/container.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<container xmlns="urn:oasis:names:tc:opendocument:xmlns:container" version="1.0">
+ <rootfiles>
+ <rootfile full-path="OEBPS/content.opf" media-type="application/oebps-package+xml"/>
+ </rootfiles>
+</container>
diff --git a/source/epub/templates/content.opf b/source/epub/templates/content.opf
new file mode 100644
index 00000000..67f3f5c6
--- /dev/null
+++ b/source/epub/templates/content.opf
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<opf:package xmlns:opf="http://www.idpf.org/2007/opf"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:py="http://genshi.edgewall.org/"
+ unique-identifier="bookid" version="2.0">
+ <opf:metadata >
+ <dc:identifier id="bookid">urn:uuid:${book.UUID}</dc:identifier>
+ <dc:language>${book.lang}</dc:language>
+ <dc:title>${book.title}</dc:title>
+ <py:for each="name, role in book.creators">
+ <dc:creator opf:role="$role">$name</dc:creator>
+ </py:for>
+ <py:for each="beginTag, content, endTag in book.getMetaTags()">
+ ${Markup(beginTag)}$content${Markup(endTag)}
+ </py:for>
+ <opf:meta name="cover" content="${book.coverImage.id}" py:if="book.coverImage"/>
+ </opf:metadata>
+ <opf:manifest>
+ <opf:item id="ncxtoc" media-type="application/x-dtbncx+xml" href="toc.ncx"/>
+ <py:for each="item in book.getAllItems()">
+ <opf:item id="${item.id}" media-type="${item.mimeType}" href="${item.destPath}"/>
+ </py:for>
+ </opf:manifest>
+ <opf:spine toc="ncxtoc">
+ <py:for each="_, item, linear in book.getSpine()">
+ <opf:itemref idref="${item.id}" linear="${'yes' if linear else 'no'}"/>
+ </py:for>
+ </opf:spine>
+ <opf:guide py:if="book.guide">
+ <py:for each="href, title, type in book.getGuide()">
+ <opf:reference href="$href" type="$type" title="$title"/>
+ </py:for>
+ </opf:guide>
+</opf:package>
diff --git a/source/epub/templates/ez-section.html b/source/epub/templates/ez-section.html
new file mode 100644
index 00000000..0a715e7f
--- /dev/null
+++ b/source/epub/templates/ez-section.html
@@ -0,0 +1,17 @@
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:py="http://genshi.edgewall.org/">
+<head>
+ <title>${section.title}</title>
+ <style type="text/css">
+h1 {
+ text-align: center;
+}
+ </style>
+</head>
+<body>
+ <h1>${section.title}</h1>
+ <py:for each="p in section.paragraphs">
+ <p>$p</p>
+ </py:for>
+</body>
+</html>
diff --git a/source/epub/templates/image.html b/source/epub/templates/image.html
new file mode 100644
index 00000000..9a838c7e
--- /dev/null
+++ b/source/epub/templates/image.html
@@ -0,0 +1,16 @@
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:py="http://genshi.edgewall.org/">
+<head>
+ <title>${item.destPath}</title>
+ <style type="text/css">
+div, img {
+ border: 0;
+ margin: 0;
+ padding: 0;
+}
+ </style>
+</head>
+<body>
+ <div><img src="${item.destPath}" alt="${item.destPath}"/></div>
+</body>
+</html>
diff --git a/source/epub/templates/title-page.html b/source/epub/templates/title-page.html
new file mode 100644
index 00000000..de0f55f0
--- /dev/null
+++ b/source/epub/templates/title-page.html
@@ -0,0 +1,22 @@
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:py="http://genshi.edgewall.org/">
+<head>
+ <title>${book.title}</title>
+ <style type="text/css">
+.title, .authors {
+ text-align: center;
+}
+span.author {
+ margin: 1em;
+}
+ </style>
+</head>
+<body>
+ <h1 class="title">${book.title}</h1>
+ <h3 class="authors">
+ <py:for each="creator, _ in book.creators">
+ <span class="author">$creator</span>
+ </py:for>
+ </h3>
+</body>
+</html>
diff --git a/source/epub/templates/toc.html b/source/epub/templates/toc.html
new file mode 100644
index 00000000..b14c9da3
--- /dev/null
+++ b/source/epub/templates/toc.html
@@ -0,0 +1,32 @@
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:py="http://genshi.edgewall.org/">
+<head>
+ <title>${book.title}</title>
+ <style type="text/css">
+.tocEntry-1 {
+}
+.tocEntry-2 {
+ text-indent: 1em;
+}
+.tocEntry-3 {
+ text-indent: 2em;
+}
+.tocEntry-4 {
+ text-indent: 3em;
+}
+ </style>
+</head>
+<body>
+ <py:def function="tocEntry(node)">
+ <div class="tocEntry-${node.depth}">
+ <a href="${node.href}">${node.title}</a>
+ </div>
+ <py:for each="child in node.children">
+ ${tocEntry(child)}
+ </py:for>
+ </py:def>
+ <py:for each="child in book.getTocMapRoot().children">
+ ${tocEntry(child)}
+ </py:for>
+</body>
+</html>
diff --git a/source/epub/templates/toc.ncx b/source/epub/templates/toc.ncx
new file mode 100644
index 00000000..e7dd391a
--- /dev/null
+++ b/source/epub/templates/toc.ncx
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<ncx xmlns="http://www.daisy.org/z3986/2005/ncx/"
+ xmlns:py="http://genshi.edgewall.org/"
+ version="2005-1">
+ <head>
+ <meta name="dtb:uid" content="urn:uuid:${book.UUID}"/>
+ <meta name="dtb:depth" content="${book.getTocMapHeight()}"/>
+ <meta name="dtb:totalPageCount" content="0"/>
+ <meta name="dtb:maxPageNumber" content="0"/>
+ </head>
+ <docTitle>
+ <text>${book.title}</text>
+ </docTitle>
+ <navMap>
+ <py:def function="navPoint(node)">
+ <navPoint id="navPoint-${node.playOrder}" playOrder="${node.playOrder}">
+ <navLabel><text>${node.title}</text></navLabel>
+ <content src="${node.href}"/>
+ <py:for each="child in node.children">
+ ${navPoint(child)}
+ </py:for>
+ </navPoint>
+ </py:def>
+ <py:for each="child in book.getTocMapRoot().children">
+ ${navPoint(child)}
+ </py:for>
+ </navMap>
+</ncx>
bgstack15