diff --git a/src/calibre/ebooks/epub/output.py b/src/calibre/ebooks/epub/output.py index 160676137e..9c542d7b2f 100644 --- a/src/calibre/ebooks/epub/output.py +++ b/src/calibre/ebooks/epub/output.py @@ -80,6 +80,8 @@ class EPUBOutput(OutputFormatPlugin): ]) + recommendations = set([('pretty_print', True, OptionRecommendation.HIGH)]) + TITLEPAGE_COVER = '''\ diff --git a/src/calibre/ebooks/metadata/__init__.py b/src/calibre/ebooks/metadata/__init__.py index 5f575eb2a9..e5619bee63 100644 --- a/src/calibre/ebooks/metadata/__init__.py +++ b/src/calibre/ebooks/metadata/__init__.py @@ -367,7 +367,7 @@ class MetaInformation(object): if self.pubdate is not None: ans += [(_('Published'), unicode(self.pubdate.isoformat(' ')))] if self.rights is not None: - ans += [(_('Rights'), unicode(self.rights.isoformat(' ')))] + ans += [(_('Rights'), unicode(self.rights))] for i, x in enumerate(ans): ans[i] = u'%s%s'%x return u'%s
'%u'\n'.join(ans) diff --git a/src/calibre/ebooks/oeb/output.py b/src/calibre/ebooks/oeb/output.py index 18c20f334d..4df8c0f679 100644 --- a/src/calibre/ebooks/oeb/output.py +++ b/src/calibre/ebooks/oeb/output.py @@ -9,6 +9,8 @@ from lxml import etree from calibre.customize.conversion import OutputFormatPlugin from calibre import CurrentDir +from calibre.customize.conversion import OptionRecommendation + from urllib import unquote class OEBOutput(OutputFormatPlugin): @@ -17,6 +19,9 @@ class OEBOutput(OutputFormatPlugin): author = 'Kovid Goyal' file_type = 'oeb' + recommendations = set([('pretty_print', True, OptionRecommendation.HIGH)]) + + def convert(self, oeb_book, output_path, input_plugin, opts, log): self.log, self.opts = log, opts if not os.path.exists(output_path): diff --git a/src/calibre/ebooks/oeb/transforms/split.py b/src/calibre/ebooks/oeb/transforms/split.py index 1fba7ffa64..d4b60e3a59 100644 --- a/src/calibre/ebooks/oeb/transforms/split.py +++ b/src/calibre/ebooks/oeb/transforms/split.py @@ -16,7 +16,7 @@ from lxml import etree from lxml.cssselect import CSSSelector from calibre.ebooks.oeb.base import OEB_STYLES, XPNSMAP as NAMESPACES, \ - urldefrag, rewrite_links, urlunquote, barename + urldefrag, rewrite_links, urlunquote, barename, XHTML from calibre.ebooks.epub import rules XPath = functools.partial(_XPath, namespaces=NAMESPACES) @@ -216,7 +216,25 @@ class FlowSplitter(object): self.trees.append(before) tree = after self.trees.append(tree) - self.trees = [t for t in self.trees if not self.is_page_empty(t.getroot())] + trees, ids = [], set([]) + for tree in self.trees: + root = tree.getroot() + if self.is_page_empty(root): + discarded_ids = root.xpath('//*[@id]') + for x in discarded_ids: + x = x.get('id') + if not x.startswith('calibre_'): + ids.add(x) + else: + if ids: + body = self.get_body(root) + if body is not None: + for x in ids: + body.insert(0, body.makeelement(XHTML('div'), + id=x, style='height:0pt')) + ids = set([]) + trees.append(tree) + self.trees = trees def get_body(self, root): body = root.xpath('//h:body', namespaces=NAMESPACES)