Skip to content

Commit 61c7700

Browse files
committed
Fix test output for missing public or system id
1 parent 5976856 commit 61c7700

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/html5lib/treewalkers/_base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ def comment(self, data):
6060
def doctype(self, name, publicId=None, systemId=None, correct=True):
6161
return {"type": "Doctype",
6262
"name": name is not None and unicode(name) or u"",
63-
"publicId": publicId, "systemId": systemId,
63+
"publicId": publicId,
64+
"systemId": systemId,
6465
"correct": correct}
6566

6667
def unknown(self, nodeType):

tests/test_treewalkers.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,14 @@ def convertTokens(tokens):
196196
output.append("%s<!-- %s -->" % (" "*indent, token["data"]))
197197
elif type == "Doctype":
198198
if token["name"]:
199-
if token["publicId"] or token["systemId"]:
199+
if token["publicId"]:
200200
output.append("""%s<!DOCTYPE %s "%s" "%s">"""%
201201
(" "*indent, token["name"],
202202
token["publicId"],
203+
token["systemId"] and token["systemId"] or ""))
204+
elif token["systemId"]:
205+
output.append("""%s<!DOCTYPE %s SYSTEM "%s">"""%
206+
(" "*indent, token["name"],
203207
token["systemId"]))
204208
else:
205209
output.append("%s<!DOCTYPE %s>"%(" "*indent,

0 commit comments

Comments
 (0)