MCPcopy Index your code
hub / github.com/Python-Markdown/markdown / parse_html_declaration

Method parse_html_declaration

markdown/htmlparser.py:333–347  ·  view source on GitHub ↗
(self, i: int)

Source from the content-addressed store, hash-verified

331 return match.end()
332
333 def parse_html_declaration(self, i: int) -> int:
334 if self.at_line_start() or self.intail:
335 if self.rawdata[i:i+3] == '<![' and not self.rawdata[i:i+9] == '<![CDATA[':
336 # We have encountered the bug in #1534 (Python bug `gh-77057`).
337 # Provide an override until we drop support for Python < 3.13.
338 result = self.parse_bogus_comment(i)
339 if result == -1:
340 self.handle_data(self.rawdata[i:i + 1])
341 return i + 1
342 return result
343 return super().parse_html_declaration(i)
344 # This is not the beginning of a raw block so treat as plain data
345 # and avoid consuming any tags which may follow (see #1066).
346 self.handle_data('<!')
347 return i + 2
348
349 def parse_bogus_comment(self, i: int, report: int = 0) -> int:
350 # Override the default behavior so that bogus comments get passed

Callers

nothing calls this directly

Calls 3

at_line_startMethod · 0.95
parse_bogus_commentMethod · 0.95
handle_dataMethod · 0.95

Tested by

no test coverage detected