diff --git a/src/calibre/constants.py b/src/calibre/constants.py index d5e25661dd..4f52c5a3ab 100644 --- a/src/calibre/constants.py +++ b/src/calibre/constants.py @@ -2,7 +2,7 @@ __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net' __docformat__ = 'restructuredtext en' __appname__ = 'calibre' -__version__ = '0.6.0b9' +__version__ = '0.6.0b10' __author__ = "Kovid Goyal " import re diff --git a/src/calibre/devices/prs505/driver.py b/src/calibre/devices/prs505/driver.py index 1dca0586f9..fe1f987dc9 100644 --- a/src/calibre/devices/prs505/driver.py +++ b/src/calibre/devices/prs505/driver.py @@ -186,12 +186,12 @@ class PRS505(CLI, Device): info = metadata.next() path = location[0] blist = 2 if location[3] == 'cardb' else 1 if location[3] == 'carda' else 0 - - if path.startswith(self._main_prefix): + + if self._main_prefix and path.startswith(self._main_prefix): name = path.replace(self._main_prefix, '') - elif path.startswith(self._card_a_prefix): + elif self._card_a_prefix and path.startswith(self._card_a_prefix): name = path.replace(self._card_a_prefix, '') - elif path.startswith(self._card_b_prefix): + elif self._card_b_prefix and path.startswith(self._card_b_prefix): name = path.replace(self._card_b_prefix, '') name = name.replace('\\', '/') diff --git a/src/calibre/ebooks/mobi/output.py b/src/calibre/ebooks/mobi/output.py index 301e0a5a67..84860d3d0f 100644 --- a/src/calibre/ebooks/mobi/output.py +++ b/src/calibre/ebooks/mobi/output.py @@ -47,6 +47,7 @@ class MOBIOutput(OutputFormatPlugin): from calibre.ebooks.oeb.transforms.manglecase import CaseMangler from calibre.ebooks.oeb.transforms.rasterize import SVGRasterizer from calibre.ebooks.oeb.transforms.htmltoc import HTMLTOCAdder + from calibre.customize.ui import plugin_for_input_format imagemax = PALM_MAX_IMAGE_SIZE if opts.rescale_images else None tocadder = HTMLTOCAdder(title=opts.toc_title) tocadder(oeb, opts) @@ -56,8 +57,11 @@ class MOBIOutput(OutputFormatPlugin): rasterizer(oeb, opts) mobimlizer = MobiMLizer(ignore_tables=opts.linearize_tables) mobimlizer(oeb, opts) + write_page_breaks_after_item = not input_plugin is plugin_for_input_format('cbz') + print 111111, write_page_breaks_after_item writer = MobiWriter(opts, imagemax=imagemax, compression=UNCOMPRESSED if opts.dont_compress else PALMDOC, - prefer_author_sort=opts.prefer_author_sort) + prefer_author_sort=opts.prefer_author_sort, + write_page_breaks_after_item=write_page_breaks_after_item) writer(oeb, output_path) diff --git a/src/calibre/ebooks/mobi/writer.py b/src/calibre/ebooks/mobi/writer.py index 07bc713b94..28aacd6e07 100644 --- a/src/calibre/ebooks/mobi/writer.py +++ b/src/calibre/ebooks/mobi/writer.py @@ -156,10 +156,11 @@ def rescale_image(data, maxsizeb, dimen=None): class Serializer(object): NSRMAP = {'': None, XML_NS: 'xml', XHTML_NS: '', MBP_NS: 'mbp'} - def __init__(self, oeb, images): + def __init__(self, oeb, images, write_page_breaks_after_item=True): self.oeb = oeb self.images = images self.logger = oeb.logger + self.write_page_breaks_after_item = write_page_breaks_after_item self.id_offsets = {} self.href_offsets = defaultdict(list) self.breaks = [] @@ -239,7 +240,8 @@ class Serializer(object): self.id_offsets[item.href] = buffer.tell() for elem in item.data.find(XHTML('body')): self.serialize_elem(elem, item) - buffer.write('') + if self.write_page_breaks_after_item: + buffer.write('') def serialize_elem(self, elem, item, nsrmap=NSRMAP): buffer = self.buffer @@ -319,8 +321,9 @@ class MobiWriter(object): COLLAPSE_RE = re.compile(r'[ \t\r\n\v]+') def __init__(self, opts, compression=PALMDOC, imagemax=None, - prefer_author_sort=False): + prefer_author_sort=False, write_page_breaks_after_item=True): self.opts = opts + self.write_page_breaks_after_item = write_page_breaks_after_item self._compression = compression or UNCOMPRESSED self._imagemax = imagemax or OTHER_MAX_IMAGE_SIZE self._prefer_author_sort = prefer_author_sort @@ -583,7 +586,8 @@ class MobiWriter(object): def _generate_text(self): self._oeb.logger.info('Serializing markup content...') - serializer = Serializer(self._oeb, self._images) + serializer = Serializer(self._oeb, self._images, + write_page_breaks_after_item=self.write_page_breaks_after_item) breaks = serializer.breaks text = serializer.text self._id_offsets = serializer.id_offsets diff --git a/src/calibre/ebooks/oeb/transforms/split.py b/src/calibre/ebooks/oeb/transforms/split.py index 4b4fb95fb7..1fba7ffa64 100644 --- a/src/calibre/ebooks/oeb/transforms/split.py +++ b/src/calibre/ebooks/oeb/transforms/split.py @@ -308,6 +308,7 @@ class FlowSplitter(object): if not hit_split_point: x = elem.get('id', None) nix_element(elem, top=False) + body2.text = '\n' return tree, tree2 diff --git a/src/calibre/www/static/img/faces/john.png b/src/calibre/www/static/img/faces/john.png index dee76699fd..c18a0e77d1 100644 Binary files a/src/calibre/www/static/img/faces/john.png and b/src/calibre/www/static/img/faces/john.png differ