Return an escaped character.
| 343 | |
| 344 | |
| 345 | class EscapeInlineProcessor(InlineProcessor): |
| 346 | """ Return an escaped character. """ |
| 347 | |
| 348 | def handleMatch(self, m: re.Match[str], data: str) -> tuple[str | None, int, int]: |
| 349 | """ |
| 350 | If the character matched by `group(1)` of a pattern is in [`ESCAPED_CHARS`][markdown.Markdown.ESCAPED_CHARS] |
| 351 | then return the integer representing the character's Unicode code point (as returned by [`ord`][]) wrapped |
| 352 | in [`util.STX`][markdown.util.STX] and [`util.ETX`][markdown.util.ETX]. |
| 353 | |
| 354 | If the matched character is not in [`ESCAPED_CHARS`][markdown.Markdown.ESCAPED_CHARS], then return `None`. |
| 355 | """ |
| 356 | |
| 357 | char = m.group(1) |
| 358 | if char in self.md.ESCAPED_CHARS: |
| 359 | return '{}{}{}'.format(util.STX, ord(char), util.ETX), m.start(0), m.end(0) |
| 360 | else: |
| 361 | return None, m.start(0), m.end(0) |
| 362 | |
| 363 | |
| 364 | class SimpleTagPattern(Pattern): # pragma: no cover |
no outgoing calls
no test coverage detected
searching dependent graphs…