|
|
|
@ -290,6 +290,8 @@ class Document:
|
|
|
|
|
def transform_misused_divs_into_paragraphs(self):
|
|
|
|
|
for elem in self.tags(self.html, 'div'):
|
|
|
|
|
# transform <div>s that do not contain other block elements into <p>s
|
|
|
|
|
#FIXME: The current implementation ignores all descendants that are not direct children of elem
|
|
|
|
|
# This results in incorrect results in case there is an <img> buried within an <a> for example
|
|
|
|
|
if not REGEXES['divToPElementsRe'].search(unicode(''.join(map(tostring, list(elem))))):
|
|
|
|
|
#self.debug("Altering %s to p" % (describe(elem)))
|
|
|
|
|
elem.tag = "p"
|
|
|
|
|