Skip to content

Commit 0e4a080

Browse files
committed
Stop etree crashing on doctypes with public id but not system id. Tests later
--HG-- extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%401106
1 parent 40f494d commit 0e4a080

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/html5lib/treebuilders/etree_lxml.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,9 @@ def insertRoot(self, name):
169169
docStr = ""
170170
if self.doctype:
171171
docStr += "<!DOCTYPE %s"%self.doctype.name
172-
if self.doctype.publicId is not None:
173-
docStr += ' PUBLIC "%s"'%self.doctype.publicId
174-
if self.doctype.systemId:
175-
docStr += ' "%s"'%self.doctype.systemId
172+
if self.doctype.publicId is not None or self.doctype.systemId is not None:
173+
docStr += ' PUBLIC "%s" "%s"'%(self.doctype.publicId or "",
174+
self.doctype.systemId or "")
176175
docStr += ">"
177176
docStr += "<html></html>"
178177

0 commit comments

Comments
 (0)