(self, parent: etree.Element, blocks: list[str])
| 389 | child.tail = util.AtomicString(child.tail) |
| 390 | |
| 391 | def run(self, parent: etree.Element, blocks: list[str]) -> bool: |
| 392 | m = util.HTML_PLACEHOLDER_RE.match(blocks[0]) |
| 393 | if m: |
| 394 | index = int(m.group(1)) |
| 395 | element = self.parser.md.htmlStash.rawHtmlBlocks[index] |
| 396 | if isinstance(element, etree.Element): |
| 397 | # We have a matched element. Process it. |
| 398 | block = blocks.pop(0) |
| 399 | parent.append(element) |
| 400 | self.parse_element_content(element) |
| 401 | # Cleanup stash. Replace element with empty string to avoid confusing postprocessor. |
| 402 | self.parser.md.htmlStash.rawHtmlBlocks.pop(index) |
| 403 | self.parser.md.htmlStash.rawHtmlBlocks.insert(index, '') |
| 404 | content = block[m.end(0):] |
| 405 | # Ensure the rest of the content gets handled |
| 406 | if content: |
| 407 | blocks.insert(0, content) |
| 408 | # Confirm the match to the `blockparser`. |
| 409 | return True |
| 410 | # No match found. |
| 411 | return False |
| 412 | |
| 413 | |
| 414 | class MarkdownInHTMLPostprocessor(RawHtmlPostprocessor): |
nothing calls this directly
no test coverage detected