Fix replace_hr feature so it works with BS4 html.

This commit is contained in:
Jim Miller 2015-10-14 23:53:13 -05:00
parent 897976b4bd
commit 6d1798c29e
2 changed files with 4 additions and 2 deletions

View file

@ -624,7 +624,7 @@ class BaseSiteAdapter(Configurable):
if self.getConfig('replace_hr'):
# replacing a self-closing tag with a container tag in the
# soup is more difficult than it first appears. So cheat.
retval = retval.replace("<hr />","<div class='center'>* * *</div>")
retval = re.sub("<hr[^>]*>","<div class='center'>* * *</div>",retval)
return retval

View file

@ -279,7 +279,9 @@ div { margin: 0pt; padding: 0pt; }
retval = retval + END.substitute(self.story.getAllMetadata())
if self.getConfig('replace_hr'):
retval = retval.replace("<hr />","<div class='center'>* * *</div>")
# replacing a self-closing tag with a container tag in the
# soup is more difficult than it first appears. So cheat.
retval = re.sub("<hr[^>]*>","<div class='center'>* * *</div>",retval)
return retval