From 19e7ed0cb7049e7fccc75a6c0adb67757789a602 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 25 Apr 2009 10:03:00 -0700 Subject: [PATCH] More miscellaneous bug fixes --- src/calibre/ebooks/epub/input.py | 2 +- src/calibre/ebooks/epub/output.py | 23 +- src/calibre/ebooks/html_old.py | 1190 ----------------- src/calibre/ebooks/mobi/reader.py | 3 +- src/calibre/ebooks/oeb/base.py | 6 + .../ebooks/oeb/transforms/structure.py | 2 +- src/pyPdf/pdf.py | 3 +- todo | 2 + 8 files changed, 35 insertions(+), 1196 deletions(-) delete mode 100644 src/calibre/ebooks/html_old.py diff --git a/src/calibre/ebooks/epub/input.py b/src/calibre/ebooks/epub/input.py index 919416ffdc..f134ea6abd 100644 --- a/src/calibre/ebooks/epub/input.py +++ b/src/calibre/ebooks/epub/input.py @@ -110,7 +110,7 @@ class EPUBInput(InputFormatPlugin): parts = os.path.split(opf) opf = OPF(opf, os.path.dirname(os.path.abspath(opf))) - if len(parts) > 1: + if len(parts) > 1 and parts[0]: delta = '/'.join(parts[:-1])+'/' for elem in opf.itermanifest(): elem.set('href', delta+elem.get('href')) diff --git a/src/calibre/ebooks/epub/output.py b/src/calibre/ebooks/epub/output.py index 1b37f054b0..d5f0a9349a 100644 --- a/src/calibre/ebooks/epub/output.py +++ b/src/calibre/ebooks/epub/output.py @@ -6,13 +6,15 @@ __license__ = 'GPL v3' __copyright__ = '2009, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import os +import os, shutil from urllib import unquote from calibre.customize.conversion import OutputFormatPlugin from calibre.ptempfile import TemporaryDirectory from calibre.constants import __appname__, __version__ from calibre import strftime, guess_type +from calibre.customize.conversion import OptionRecommendation + from lxml import etree @@ -22,6 +24,14 @@ class EPUBOutput(OutputFormatPlugin): author = 'Kovid Goyal' file_type = 'epub' + options = set([ + OptionRecommendation(name='extract_to', + help=_('Extract the contents of the generated EPUB file to the ' + 'specified directory. The contents of the directory are first ' + 'deleted, so be careful.')) + ]) + + TITLEPAGE_COVER = '''\ @@ -43,6 +53,7 @@ class EPUBOutput(OutputFormatPlugin): TITLEPAGE = '''\ + %(title)s