From e84cad0ad8a0a9c47b1a9f77395541f5f947234f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 30 Dec 2008 10:06:45 -0800 Subject: [PATCH] Fix #1488 (epub: displays JavaScript at the top on PRS-505) --- src/calibre/ebooks/epub/from_html.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/calibre/ebooks/epub/from_html.py b/src/calibre/ebooks/epub/from_html.py index 8ebd426a14..a54697a214 100644 --- a/src/calibre/ebooks/epub/from_html.py +++ b/src/calibre/ebooks/epub/from_html.py @@ -123,6 +123,10 @@ class HTMLProcessor(Processor, Rationalizer): if opts.verbose > 2: self.debug_tree('nocss') + if hasattr(self.body, 'xpath'): + for script in list(self.body.xpath('descendant::script')): + script.getparent().remove(script) + def convert_image(self, img): rpath = img.get('src', '') path = os.path.join(os.path.dirname(self.save_path()), *rpath.split('/'))