From 925b3ea1fcdf76b98b9048f09c8d5333f85deead Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 3 Jan 2010 13:45:50 -0700 Subject: [PATCH] EPUB Output: Fix play order in generated NCX being uniformly zero when the input HTML file has a name with special characters. Fixes #4397 (Play order) --- src/calibre/ebooks/oeb/base.py | 8 ++++---- src/calibre/manual/faq.rst | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/calibre/ebooks/oeb/base.py b/src/calibre/ebooks/oeb/base.py index c8e66b70bb..c57dfc3706 100644 --- a/src/calibre/ebooks/oeb/base.py +++ b/src/calibre/ebooks/oeb/base.py @@ -1806,7 +1806,7 @@ class OEBBook(object): return {OPF_MIME: ('content.opf', package)} def _update_playorder(self, ncx): - hrefs = set(xpath(ncx, '//ncx:content/@src')) + hrefs = set(map(urlnormalize, xpath(ncx, '//ncx:content/@src'))) playorder = {} next = 1 selector = XPath('h:body//*[@id or @name]') @@ -1828,9 +1828,9 @@ class OEBBook(object): if added: next += 1 selector = XPath('ncx:content/@src') - for elem in xpath(ncx, '//*[@playOrder and ./ncx:content[@src]]'): - href = selector(elem)[0] - order = playorder.get(href, 0) + for i, elem in enumerate(xpath(ncx, '//*[@playOrder and ./ncx:content[@src]]')): + href = urlnormalize(selector(elem)[0]) + order = playorder.get(href, i) elem.attrib['playOrder'] = str(order) return diff --git a/src/calibre/manual/faq.rst b/src/calibre/manual/faq.rst index 9e0b2a85de..18feb2a519 100644 --- a/src/calibre/manual/faq.rst +++ b/src/calibre/manual/faq.rst @@ -86,7 +86,7 @@ At the moment |app| has full support for the SONY PRS 300/500/505/600/700/900, B How can I help get my device supported in |app|? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -If your device appears as a USB disk to the operating system. Adding support for it to |app| is very easy. +If your device appears as a USB disk to the operating system, adding support for it to |app| is very easy. We just need some information from you: * What e-book formats does your device support?