diff --git a/Lib/_markupbase.py b/Lib/_markupbase.py index 614f0cd16ddb44..c46f24520c3636 100644 --- a/Lib/_markupbase.py +++ b/Lib/_markupbase.py @@ -9,7 +9,7 @@ _declname_match = re.compile(r'[a-zA-Z][-_.a-zA-Z0-9]*\s*').match _declstringlit_match = re.compile(r'(\'[^\']*\'|"[^"]*")\s*').match -_commentclose = re.compile(r'--\s*>') +_commentclose = re.compile(r'--!?>') _markedsectionclose = re.compile(r']\s*]\s*>') # An analysis of the MS-Word extensions is available at @@ -81,7 +81,7 @@ def parse_declaration(self, i): # A simple, practical version could look like: ((name|stringlit) S*) + '>' n = len(rawdata) if rawdata[j:j+2] == '--': #comment - # Locate --.*-- as the body of the comment + # Locate the body of the comment. return self.parse_comment(i) elif rawdata[j] == '[': #marked section # Locate [statusWord [...arbitrary SGML...]] as the body of the marked section @@ -161,13 +161,19 @@ def parse_marked_section(self, i, report=1): self.unknown_decl(rawdata[i+3: j]) return match.end(0) - # Internal -- parse comment, return length or -1 if not terminated - def parse_comment(self, i, report=1): + # Internal -- parse comment + # if end is True, returns EOF location if no close tag is found, otherwise + # return length or -1 if not terminated + def parse_comment(self, i, report=1, end=False): rawdata = self.rawdata if rawdata[i:i+4] != '' '' '' - '') + '' + '' + '' + '' + '' + '' + '' + '' + '' + '