Fix for whofic.com with replace_br_with_p

This commit is contained in:
Jim Miller
2015-10-31 14:26:51 -05:00
parent b2238e10e7
commit 235c5ae62f
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -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('<br />')
metadatachunks = self.utf8FromSoup(None,metadata,allow_replace_br_with_p=False).split('<br />')
# process metadata for this story.
self.setDescription(url,metadatachunks[1])
#self.story.setMetadata('description', metadatachunks[1])
+2 -2
View File
@@ -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"</?(html|head|body)[^>]*>\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 <br> paragraph
# breaks with <p> tags.
retval = replace_br_with_p(retval)