04-23-2013, 02:36 PM | #1 |
onlinenewsreader.net
Posts: 324
Karma: 10143
Join Date: Dec 2009
Location: Phoenix, AZ & Victoria, BC
Device: Kindle 3, Kindle Fire, IPad3, iPhone4, Playbook, HTC Inspire
|
Processing remove_javascript
At present the remove_javascript directive is implemented in _postprocess_html. Unless there is a compelling reason to leave that processing there I suggest it be moved to where remove_tags is implemented. The reason for this is that in preprocess_html, script tags (within other tags) containing jQuery code result in self.tag_to_string on an outer tag returning fragments of the jQuery code as well as the expected string content. So the processing in a custom preprocess_html doesn't work as expected.
When I added 'script' to my remove_tags list the problem went away. This is a completely effective workaround, but recipe writers might expect remove_javascript to be equivalent to including 'script' in the remove_tags list which it currently is not. |
04-23-2013, 11:10 PM | #2 |
creator of calibre
Posts: 43,871
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
The reason it is implemented the way it is, is that some recipes need to parse the javascript to get print urls or other info out, so the script tags must be removed only after preprocessing. Changing it would break those recipes.
|
04-23-2013, 11:42 PM | #3 |
onlinenewsreader.net
Posts: 324
Karma: 10143
Join Date: Dec 2009
Location: Phoenix, AZ & Victoria, BC
Device: Kindle 3, Kindle Fire, IPad3, iPhone4, Playbook, HTC Inspire
|
OK, makes sense.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Heuristic processing | saxondawg | Conversion | 6 | 01-21-2018 07:43 PM |
Bug in Kobo processing of epub files causing hang in "Processing content" | BensonBear | Kobo Reader | 21 | 12-21-2012 05:47 AM |
Processing new content after FTP | Darth_Bane | Kobo Developer's Corner | 1 | 07-25-2012 02:13 PM |
Trying to use Textile processing | getajob | Conversion | 18 | 03-09-2011 07:34 AM |
Perl processing | alexxxm | Sony Reader | 3 | 11-26-2007 06:13 AM |