diff options
Diffstat (limited to 'sphinx/templates/epub3')
-rw-r--r-- | sphinx/templates/epub3/container.xml | 6 | ||||
-rw-r--r-- | sphinx/templates/epub3/content.opf_t | 50 | ||||
-rw-r--r-- | sphinx/templates/epub3/mimetype | 1 | ||||
-rw-r--r-- | sphinx/templates/epub3/nav.xhtml_t | 26 | ||||
-rw-r--r-- | sphinx/templates/epub3/toc.ncx_t | 24 |
5 files changed, 107 insertions, 0 deletions
diff --git a/sphinx/templates/epub3/container.xml b/sphinx/templates/epub3/container.xml new file mode 100644 index 0000000..326cf15 --- /dev/null +++ b/sphinx/templates/epub3/container.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> + <rootfiles> + <rootfile full-path="content.opf" media-type="application/oebps-package+xml"/> + </rootfiles> +</container> diff --git a/sphinx/templates/epub3/content.opf_t b/sphinx/templates/epub3/content.opf_t new file mode 100644 index 0000000..417888c --- /dev/null +++ b/sphinx/templates/epub3/content.opf_t @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> +<package xmlns="http://www.idpf.org/2007/opf" version="{{ epub_version }}" xml:lang="{{ lang }}" + unique-identifier="{{ uid }}" + prefix="ibooks: http://vocabulary.itunes.apple.com/rdf/ibooks/vocabulary-extensions-1.0/"> + <metadata xmlns:opf="http://www.idpf.org/2007/opf" + xmlns:dc="http://purl.org/dc/elements/1.1/"> + <dc:language>{{ lang }}</dc:language> + <dc:title>{{ title }}</dc:title> + <dc:description>{{ description }}</dc:description> + <dc:creator>{{ author }}</dc:creator> + <dc:contributor>{{ contributor }}</dc:contributor> + <dc:publisher>{{ publisher }}</dc:publisher> + <dc:rights>{{ copyright }}</dc:rights> + {%- if epub_version == 3.1 %} + <dc:identifier id="{{ uid }}" opf:scheme="{{ scheme }}">{{ id }}</dc:identifier> + {%- else %} + <dc:identifier id="{{ uid }}">{{ id }}</dc:identifier> + {%- endif %} + <dc:date>{{ date }}</dc:date> + <meta property="dcterms:modified">{{ date }}</meta> + <meta property="ibooks:version">{{ version }}</meta> + <meta property="ibooks:specified-fonts">true</meta> + <meta property="ibooks:binding">true</meta> + <meta property="ibooks:scroll-axis">{{ ibook_scroll_axis }}</meta> + {%- if cover %} + <meta name="cover" content="{{ cover }}"/> + {%- endif %} + </metadata> + <manifest> + <item id="ncx" href="toc.ncx" media-type="application/x-dtbncx+xml" /> + <item id="nav" href="nav.xhtml" media-type="application/xhtml+xml" properties="nav"/> + {%- for item in manifest_items %} + <item id="{{ item.id }}" href="{{ item.href }}" media-type="{{ item.media_type }}" /> + {%- endfor %} + </manifest> + <spine toc="ncx" page-progression-direction="{{ page_progression_direction }}"> + {%- for spine in spines %} + {%- if spine.linear %} + <itemref idref="{{ spine.idref }}" /> + {%- else %} + <itemref idref="{{ spine.idref }}" linear="no" /> + {%- endif %} + {%- endfor %} + </spine> + <guide> + {%- for guide in guides %} + <reference type="{{ guide.type }}" title="{{ guide.title }}" href="{{ guide.uri }}" /> + {%- endfor %} + </guide> +</package> diff --git a/sphinx/templates/epub3/mimetype b/sphinx/templates/epub3/mimetype new file mode 100644 index 0000000..57ef03f --- /dev/null +++ b/sphinx/templates/epub3/mimetype @@ -0,0 +1 @@ +application/epub+zip
\ No newline at end of file diff --git a/sphinx/templates/epub3/nav.xhtml_t b/sphinx/templates/epub3/nav.xhtml_t new file mode 100644 index 0000000..2a32c20 --- /dev/null +++ b/sphinx/templates/epub3/nav.xhtml_t @@ -0,0 +1,26 @@ +{%- macro toctree(navlist) -%} +<ol> +{%- for nav in navlist %} + <li> + <a href="{{ nav.refuri }}">{{ nav.text }}</a> + {%- if nav.children %} +{{ toctree(nav.children)|indent(4, true) }} + {%- endif %} + </li> +{%- endfor %} +</ol> +{%- endmacro -%} +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html> +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:epub="http://www.idpf.org/2007/ops" lang="{{ lang }}" xml:lang="{{ lang }}"> + <head> + <title>{{ toc_locale }}</title> + </head> + <body> + <nav epub:type="toc"> + <h1>{{ toc_locale }}</h1> +{{ toctree(navlist)|indent(6, true) }} + </nav> + </body> +</html> diff --git a/sphinx/templates/epub3/toc.ncx_t b/sphinx/templates/epub3/toc.ncx_t new file mode 100644 index 0000000..0ea7ca3 --- /dev/null +++ b/sphinx/templates/epub3/toc.ncx_t @@ -0,0 +1,24 @@ +{%- macro navPoints(navlist) %} +{%- for nav in navlist %} +<navPoint id="{{ nav.navpoint }}" playOrder="{{ nav.playorder }}"> + <navLabel> + <text>{{ nav.text }}</text> + </navLabel> + <content src="{{ nav.refuri }}" />{{ navPoints(nav.children)|indent(2, true) }} +</navPoint> +{%- endfor %} +{%- endmacro -%} +<?xml version="1.0"?> +<ncx version="2005-1" xmlns="http://www.daisy.org/z3986/2005/ncx/"> + <head> + <meta name="dtb:uid" content="{{ uid }}"/> + <meta name="dtb:depth" content="{{ level }}"/> + <meta name="dtb:totalPageCount" content="0"/> + <meta name="dtb:maxPageNumber" content="0"/> + </head> + <docTitle> + <text>{{ title }}</text> + </docTitle> + <navMap>{{ navPoints(navpoints)|indent(4, true) }} + </navMap> +</ncx> |