Skip to content

Commit

Permalink
Fixed a problem with the HTML as of the latest changes in the forums.
Browse files Browse the repository at this point in the history
  • Loading branch information
Armin Ronacher committed May 25, 2011
1 parent 25dfce1 commit 74b8431
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion brink.py
Expand Up @@ -15,6 +15,7 @@
import cookielib
import html5lib
import logging
from lxml import etree
from twitter_text import TwitterText
from datetime import datetime, timedelta
from urlparse import urljoin
Expand Down Expand Up @@ -388,6 +389,8 @@ def move_table_contents_out(node):
parent.remove(node)

def transform(node):
if node.tag is etree.Comment:
return node
if '}' in node.tag:
node.tag = node.tag.split('}')[-1]
if node.tag == 'a':
Expand All @@ -407,7 +410,8 @@ def transform(node):
node.attrib.pop('cellspacing', None)
elif node.tag == 'div':
if node.getchildren():
div_children = node.getchildren()
div_children = [x for x in node.getchildren()
if x.tag is not etree.Comment]
if len(div_children) >= 2 and \
div_children[0].tag.split('}')[-1] == 'div' and \
div_children[0].text and \
Expand Down

0 comments on commit 74b8431

Please sign in to comment.