Skip to content

Commit 3020a66

Browse files
committed
Fix isindex
1 parent 5470504 commit 3020a66

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

src/html5lib/html5parser.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,22 +1126,31 @@ def startTagIsIndex(self, token):
11261126
self.parser.parseError("deprecated-tag", {"name": "isindex"})
11271127
if self.tree.formPointer:
11281128
return
1129-
self.processStartTag(impliedTagToken("form", "StartTag"))
1129+
form_attrs = {}
1130+
if "action" in token["data"]:
1131+
form_attrs["action"] = token["data"]["action"]
1132+
self.processStartTag(impliedTagToken("form", "StartTag",
1133+
attributes=form_attrs))
11301134
self.processStartTag(impliedTagToken("hr", "StartTag"))
1131-
self.processStartTag(impliedTagToken("p", "StartTag"))
11321135
self.processStartTag(impliedTagToken("label", "StartTag"))
11331136
# XXX Localization ...
1137+
if "prompt" in token["data"]:
1138+
prompt = token["data"]["prompt"]
1139+
else:
1140+
prompt = "This is a searchable index. Insert your search keywords here: "
11341141
self.processCharacters(
1135-
{"type":tokenTypes["Characters"],
1136-
"data":"This is a searchable index. Insert your search keywords here: "})
1137-
attributes = token["data"].copy() #don't really need a copy here I think
1142+
{"type":tokenTypes["Characters"], "data":prompt})
1143+
attributes = token["data"].copy()
1144+
if "action" in attributes:
1145+
del attributes["action"]
1146+
if "prompt" in attributes:
1147+
del attributes["prompt"]
11381148
attributes["name"] = "isindex"
11391149
self.processStartTag(impliedTagToken("input", "StartTag",
11401150
attributes = attributes,
11411151
selfClosing =
11421152
token["selfClosing"]))
11431153
self.processEndTag(impliedTagToken("label"))
1144-
self.processEndTag(impliedTagToken("p"))
11451154
self.processStartTag(impliedTagToken("hr", "StartTag"))
11461155
self.processEndTag(impliedTagToken("form"))
11471156

@@ -1612,10 +1621,7 @@ def startTagTable(self, token):
16121621
self.parser.phase.processStartTag(token)
16131622

16141623
def startTagStyleScript(self, token):
1615-
if "tainted" not in self.getCurrentTable()._flags:
1616-
self.parser.phases["inHead"].processStartTag(token)
1617-
else:
1618-
self.startTagOther(token)
1624+
self.parser.phases["inHead"].processStartTag(token)
16191625

16201626
def startTagInput(self, token):
16211627
if ("type" in token["data"] and

0 commit comments

Comments
 (0)