diff options
Diffstat (limited to 'Lib/_markupbase.py')
| -rw-r--r-- | Lib/_markupbase.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Lib/_markupbase.py b/Lib/_markupbase.py index adf6ba2..2af5f1c 100644 --- a/Lib/_markupbase.py +++ b/Lib/_markupbase.py @@ -107,6 +107,10 @@ class ParserBase: if decltype == "doctype": self.handle_decl(data) else: + # According to the HTML5 specs sections "8.2.4.44 Bogus + # comment state" and "8.2.4.45 Markup declaration open + # state", a comment token should be emitted. + # Calling unknown_decl provides more flexibility though. self.unknown_decl(data) return j + 1 if c in "\"'": @@ -122,7 +126,7 @@ class ParserBase: # this could be handled in a separate doctype parser if decltype == "doctype": j = self._parse_doctype_subset(j + 1, i) - elif decltype in ("attlist", "linktype", "link", "element"): + elif decltype in {"attlist", "linktype", "link", "element"}: # must tolerate []'d groups in a content model in an element declaration # also in data attribute specifications of attlist declaration # also link type declaration subsets in linktype declarations @@ -145,10 +149,10 @@ class ParserBase: sectName, j = self._scan_name( i+3, i ) if j < 0: return j - if sectName in ("temp", "cdata", "ignore", "include", "rcdata"): + if sectName in {"temp", "cdata", "ignore", "include", "rcdata"}: # look for standard ]]> ending match= _markedsectionclose.search(rawdata, i+3) - elif sectName in ("if", "else", "endif"): + elif sectName in {"if", "else", "endif"}: # look for MS Office ]> ending match= _msmarkedsectionclose.search(rawdata, i+3) else: @@ -203,7 +207,7 @@ class ParserBase: name, j = self._scan_name(j + 2, declstartpos) if j == -1: return -1 - if name not in ("attlist", "element", "entity", "notation"): + if name not in {"attlist", "element", "entity", "notation"}: self.updatepos(declstartpos, j + 2) self.error( "unknown declaration %r in internal subset" % name) |
