From 235c5ae62fba76988713c85cbea9194c49abb8c5 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Sat, 31 Oct 2015 14:26:51 -0500 Subject: [PATCH] Fix for whofic.com with replace_br_with_p --- fanficfare/adapters/adapter_whoficcom.py | 2 +- fanficfare/adapters/base_adapter.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fanficfare/adapters/adapter_whoficcom.py b/fanficfare/adapters/adapter_whoficcom.py index 4426860..c92a1d7 100644 --- a/fanficfare/adapters/adapter_whoficcom.py +++ b/fanficfare/adapters/adapter_whoficcom.py @@ -124,7 +124,7 @@ class WhoficComSiteAdapter(BaseSiteAdapter): # link instead to find the appropriate metadata. a = soup.find('a', href=re.compile(r'reviews.php\?sid='+self.story.getMetadata('storyId'))) metadata = a.findParent('td') - metadatachunks = self.utf8FromSoup(None,metadata).split('
') + metadatachunks = self.utf8FromSoup(None,metadata,allow_replace_br_with_p=False).split('
') # process metadata for this story. self.setDescription(url,metadatachunks[1]) #self.story.setMetadata('description', metadatachunks[1]) diff --git a/fanficfare/adapters/base_adapter.py b/fanficfare/adapters/base_adapter.py index 44767a0..838d24b 100644 --- a/fanficfare/adapters/base_adapter.py +++ b/fanficfare/adapters/base_adapter.py @@ -557,7 +557,7 @@ class BaseSiteAdapter(Configurable): # This gives us a unicode object, not just a string containing bytes. # (I gave soup a unicode string, you'd think it could give it back...) # Now also does a bunch of other common processing for us. - def utf8FromSoup(self,url,soup,fetch=None): + def utf8FromSoup(self,url,soup,fetch=None,allow_replace_br_with_p=True): if not fetch: fetch=self._fetchUrlRaw @@ -616,7 +616,7 @@ class BaseSiteAdapter(Configurable): # This is primarily for epub updates. retval = re.sub(r"]*>\r?\n?","",retval) - if self.getConfig("replace_br_with_p"): + if self.getConfig("replace_br_with_p") and allow_replace_br_with_p: # Apply heuristic processing to replace
paragraph # breaks with

tags. retval = replace_br_with_p(retval)