diff --git a/calibre-plugin/plugin-defaults.ini b/calibre-plugin/plugin-defaults.ini index 4892a7fb..cb3a0720 100644 --- a/calibre-plugin/plugin-defaults.ini +++ b/calibre-plugin/plugin-defaults.ini @@ -385,6 +385,12 @@ replace_tags_with_spans:u,big,small ## setting can adjust which tags are kept. keep_empty_tags:p,td,th +## By default, script and style tags are removed from chapter text as +## part of cleaning up the source HTML. Found several book readers +## that didn't treat those tags in correctly. Set to empty if +## you want to keep those tags. +remove_tags:script,style + ## If a chapter range was given, use this pattern for the book title. ## replace_metadata and include/exclude will be applied *after* this. ## Set to empty value to disable. @@ -1682,7 +1688,7 @@ legend_spoilers:true show_spoiler_tags:false ## don't fetch covers marked as nsfw. covers for fiction.live can't be pornographic, but can get very close. show_nsfw_cover_images:false -## displays the timestamps on the story chunks, showing when each part went live. +## displays the timestamps on the story chunks, showing when each part went live. show_timestamps:false ## site has more original than fan fiction diff --git a/fanficfare/adapters/adapter_test1.py b/fanficfare/adapters/adapter_test1.py index f5d0aad3..ce994736 100644 --- a/fanficfare/adapters/adapter_test1.py +++ b/fanficfare/adapters/adapter_test1.py @@ -409,6 +409,10 @@ Some more longer description. "I suck at summaries!" "Better than it sounds!" text=u'''

Chapter title from site

+

chapter URL:'''+url+'''

Timestamp:'''+datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")+'''

Lorem '''+self.crazystring+u''' italics, bold, underline consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

diff --git a/fanficfare/adapters/base_adapter.py b/fanficfare/adapters/base_adapter.py index df5d1172..35870d8d 100644 --- a/fanficfare/adapters/base_adapter.py +++ b/fanficfare/adapters/base_adapter.py @@ -483,7 +483,7 @@ class BaseSiteAdapter(Configurable): else: ## remove all img tags entirely for img in soup.find_all('img'): - img.extract() + img.decompose() for attr in self.get_attr_keys(soup): if attr not in acceptable_attributes: @@ -519,11 +519,13 @@ class BaseSiteAdapter(Configurable): t.name='div' # removes paired, but empty non paragraph tags. if t.name not in self.getConfigList('keep_empty_tags',['p','td','th']) and t.string != None and len(t.string.strip()) == 0 : - t.extract() + t.decompose() # remove script tags cross the board. - if t.name=='script': - t.extract() + # epub readers (Moon+, FBReader & Aldiko at least) + # don't like