diff --git a/src/calibre/ebooks/oeb/display/cfi.coffee b/src/calibre/ebooks/oeb/display/cfi.coffee index edcc0ad0df..86594854a4 100644 --- a/src/calibre/ebooks/oeb/display/cfi.coffee +++ b/src/calibre/ebooks/oeb/display/cfi.coffee @@ -260,7 +260,7 @@ class CanonicalFragmentIdentifier index |= 1 # Increment index by 1 if it is even if child.nodeType == 1 index++ - if ( index == target ) + if index == target cfi = cfi.substr(r[0].length) node = child if assertion and node.id != assertion diff --git a/src/calibre/ebooks/oeb/display/test-cfi/index.html b/src/calibre/ebooks/oeb/display/test-cfi/index.html index e5d8eea491..03adb57d2b 100644 --- a/src/calibre/ebooks/oeb/display/test-cfi/index.html +++ b/src/calibre/ebooks/oeb/display/test-cfi/index.html @@ -31,6 +31,7 @@ max-height: 100px; overflow: scroll; border: solid 1px black; + padding: 2em; } @@ -39,6 +40,7 @@

Testing EPUB CFI

Current CFI: None

A div with scrollbars

+

Scroll down and click on some elements. Make sure to hit both bold and not bold text

But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the @@ -60,6 +62,9 @@ demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee
+

Some entities

+

Entities: & © § >

+

An invisible CDATA: followed by some text

diff --git a/src/calibre/ebooks/oeb/display/test-cfi/test.py b/src/calibre/ebooks/oeb/display/test-cfi/test.py index a09f45dcf0..f6be76f478 100644 --- a/src/calibre/ebooks/oeb/display/test-cfi/test.py +++ b/src/calibre/ebooks/oeb/display/test-cfi/test.py @@ -18,7 +18,7 @@ except ImportError: def run_devel_server(): os.chdir(os.path.dirname(os.path.abspath(__file__))) - serve(resources={'cfi.coffee':'../cfi.coffee'}) + serve(resources={'cfi.coffee':'../cfi.coffee', '/':'index.html'}) if __name__ == '__main__': run_devel_server() diff --git a/src/calibre/utils/coffeescript.py b/src/calibre/utils/coffeescript.py index 057cfeef17..65fd6b96ea 100644 --- a/src/calibre/utils/coffeescript.py +++ b/src/calibre/utils/coffeescript.py @@ -41,6 +41,10 @@ class Handler(SimpleHTTPServer.SimpleHTTPRequestHandler): return SimpleHTTPServer.SimpleHTTPRequestHandler.translate_path(self, path) + def guess_type(self, path): + ans = SimpleHTTPServer.SimpleHTTPRequestHandler.guess_type(self, path) + return ans + def newer(self, src, dest): try: sstat = os.stat(src)