Fix localize the navbar

Problems:
ebook-convert + beautifulsoup  generate <hr> tag
calibre gui + beautifulsoup  generate <hr /> tag
Solve by revise the regexp.
This commit is contained in:
Kennyl 2017-01-24 16:27:23 +08:00 committed by GitHub
parent eb4ec90043
commit 5c2015233c

View File

@ -264,8 +264,8 @@ class AppleDaily(BasicNewsRecipe):
not self.has_single_feed,
a.orig_url, __appname__, prefix=prefix,
center=self.center_navbar)
translatedTempl =re.sub('<hr>.*<br><br>','<hr>從<a href="'+a.orig_url+'">蘋果日報</a>下載至'+__appname__+
'<br><br>',templ.render(doctype='xhtml').decode('utf-8'),flags=re.S)
translatedTempl =re.sub('<hr.*<br','<hr>從<a href="'+a.orig_url+'">蘋果日報</a>下載至'+__appname__+
'<br',templ.render(doctype='xhtml').decode('utf-8'),flags=re.S)
elem = BeautifulSoup(translatedTempl).find('div')
body.insert(len(body.contents), elem)
with open(last, 'wb') as fi: