diff --git a/src/calibre/manual/conf.py b/src/calibre/manual/conf.py index b00a454237..3866008f1f 100644 --- a/src/calibre/manual/conf.py +++ b/src/calibre/manual/conf.py @@ -100,9 +100,8 @@ html_use_smartypants = True html_title = 'calibre User Manual' html_short_title = 'Start' html_logo = 'resources/logo.png' -epub_titlepage = 'resources/titlepage.html' -epub_logo = 'resources/logo.png' epub_author = 'Kovid Goyal' +epub_cover = 'resources/epub_cover.jpg' # Custom sidebar templates, maps document names to template names. #html_sidebars = {} diff --git a/src/calibre/manual/custom.py b/src/calibre/manual/custom.py index 38486cc67a..917b927086 100644 --- a/src/calibre/manual/custom.py +++ b/src/calibre/manual/custom.py @@ -304,9 +304,8 @@ def auto_member(dirname, arguments, options, content, lineno, return list(node) def setup(app): - app.add_config_value('epub_titlepage', None, False) + app.add_config_value('epub_cover', None, False) app.add_config_value('epub_author', '', False) - app.add_config_value('epub_logo', None, False) app.add_builder(CustomBuilder) app.add_builder(CustomQtBuild) app.add_builder(EPUBHelpBuilder) diff --git a/src/calibre/manual/epub.py b/src/calibre/manual/epub.py index 4635e334c0..d54eb99a8d 100644 --- a/src/calibre/manual/epub.py +++ b/src/calibre/manual/epub.py @@ -50,6 +50,7 @@ OPF = '''\ {uid} {date} + {manifest} @@ -71,6 +72,29 @@ CONTAINER='''\ ''' + +SVG_TEMPLATE = '''\ + + + + + Cover + + + + + + + + +''' + class TOC(list): def __init__(self, title=None, href=None): @@ -151,8 +175,6 @@ class EPUBHelpBuilder(StandaloneHTMLBuilder): spine = [' '*8+''%quoteattr(x) for x in self.spine] spine = '\n'.join(spine) guide = '' - if self.conf.epub_titlepage: - guide = ' '*8 + '' opf = OPF.format(title=escape(self.conf.html_title), author=escape(self.conf.epub_author), uid=str(uuid.uuid4()), @@ -162,18 +184,15 @@ class EPUBHelpBuilder(StandaloneHTMLBuilder): self.manifest['content.opf'] = ('application/oebps-package+xml', 'opf') def create_titlepage(self): - if self.conf.epub_titlepage: - img = '' - if self.conf.epub_logo: - img = '_static/epub_logo'+os.path.splitext(self.conf.epub_logo)[1] - shutil.copyfile(self.conf.epub_logo, - os.path.join(self.html_outdir, *img.split('/'))) - raw = open(self.conf.epub_titlepage, 'rb').read() - raw = raw%dict(title=self.conf.html_title, - version=self.conf.version, - img=img.split('/')[-1], - author=self.conf.epub_author) - open(os.path.join(self.html_outdir, '_static', 'titlepage.html'), 'wb').write(raw) + self.cover_image_url = None + if self.conf.epub_cover: + img = '_static/'+os.path.basename(self.conf.epub_cover) + shutil.copyfile(self.conf.epub_cover, os.path.join(self.html_outdir, + *img.split('/'))) + self.cover_image_url = img + tp = SVG_TEMPLATE%img.split('/')[-1] + open(os.path.join(self.html_outdir, '_static', 'titlepage.html'), + 'wb').write(tp) def generate_manifest(self): self.manifest = {} @@ -190,8 +209,12 @@ class EPUBHelpBuilder(StandaloneHTMLBuilder): self.manifest[url] = 'application/octet-stream' if self.manifest[url] == 'text/html': self.manifest[url] = 'application/xhtml+xml' - self.manifest[url] = (self.manifest[url], 'id'+str(id)) - id += 1 + if self.cover_image_url and url.endswith(self.cover_image_url): + id_ = 'cover' + else: + id_ = 'id'+str(id) + id += 1 + self.manifest[url] = (self.manifest[url], id_) def isdocnode(self, node): if not isinstance(node, nodes.list_item): @@ -227,7 +250,7 @@ class EPUBHelpBuilder(StandaloneHTMLBuilder): open('toc.ncx', 'wb').write(ncx) self.manifest['toc.ncx'] = ('application/x-dtbncx+xml', 'ncx') self.spine.insert(0, self.manifest[self.conf.master_doc+'.html'][1]) - if self.conf.epub_titlepage: + if self.conf.epub_cover: self.spine.insert(0, self.manifest['_static/titlepage.html'][1]) def add_to_spine(self, href): diff --git a/src/calibre/manual/faq.rst b/src/calibre/manual/faq.rst index 663c918c6e..a7968fc4e1 100644 --- a/src/calibre/manual/faq.rst +++ b/src/calibre/manual/faq.rst @@ -160,7 +160,7 @@ Alternative for the iPad As of |app| version 0.7.0, you can plugin your iPad into the computer using its charging cable, and |app| will detect it and show you a list of books on the iPad. You can then use the Send to device button to send books directly to iBooks on the iPad. This method only works on Windows XP and higher and OS X 10.5 and higher. Linux is not supported (iTunes is not available in linux) and OS X 10.4 is not supported. For more details, see -`this forum post http://www.mobileread.com/forums/showpost.php?p=944079&postcount=1`_. +`this forum post `_. How do I use |app| with my Android phone? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/src/calibre/manual/resources/epub_cover.jpg b/src/calibre/manual/resources/epub_cover.jpg new file mode 100644 index 0000000000..d5aa42e775 Binary files /dev/null and b/src/calibre/manual/resources/epub_cover.jpg differ diff --git a/src/calibre/manual/resources/titlepage.html b/src/calibre/manual/resources/titlepage.html deleted file mode 100644 index 08f7ddf1cc..0000000000 --- a/src/calibre/manual/resources/titlepage.html +++ /dev/null @@ -1,29 +0,0 @@ - - - %(title)s - - - -

%(title)s

-

%(version)s

-
- -
-

%(author)s

- - -