/venus

To download this project, use:
bzr branch http://golem.ph.utexas.edu/~distler/code/venus/

« back to all changes in this revision

Viewing changes to planet/reconstitute.py

  • Committer: Sam Ruby
  • Date: 2008-09-29 20:39:49 UTC
  • Revision ID: rubys@intertwingly.net-20080929203949-mkfgex9bvgakneau
Handle nested svg/mathml; recover from feedparser mangling of xhtml

Show diffs side-by-side

added added

removed removed

152
152
        detail['type'] = 'text/html'
153
153
 
154
154
    if detail.type.find('xhtml')>=0 and not bozo:
155
 
        data = minidom.parseString(xdiv % detail.value).documentElement
156
 
        xcontent.setAttribute('type', 'xhtml')
157
 
    else:
 
155
        try:
 
156
            data = minidom.parseString(xdiv % detail.value).documentElement
 
157
            xcontent.setAttribute('type', 'xhtml')
 
158
        except:
 
159
            bozo=1
 
160
 
 
161
    if detail.type.find('xhtml')<0 or bozo:
158
162
        parser = liberalxmlparser.XHTMLParser(tree=dom.TreeBuilder)
159
163
        html = parser.parse(xdiv % detail.value, encoding="utf-8")
160
164
        for body in html.documentElement.childNodes: