(m: re.Match[str])
| 73 | def run(self, text: str) -> str: |
| 74 | """ Iterate over html stash and restore html. """ |
| 75 | def substitute_match(m: re.Match[str]) -> str: |
| 76 | if key := m.group(1): |
| 77 | wrapped = True |
| 78 | else: |
| 79 | key = m.group(2) |
| 80 | wrapped = False |
| 81 | if (key := int(key)) >= self.md.htmlStash.html_counter: |
| 82 | return m.group(0) |
| 83 | html = self.stash_to_string(self.md.htmlStash.rawHtmlBlocks[key]) |
| 84 | if not wrapped or self.isblocklevel(html): |
| 85 | return pattern.sub(substitute_match, html) |
| 86 | return pattern.sub(substitute_match, f"<p>{html}</p>") |
| 87 | |
| 88 | if self.md.htmlStash.html_counter: |
| 89 | base_placeholder = util.HTML_PLACEHOLDER % r'([0-9]+)' |
nothing calls this directly
no test coverage detected