Parse the content between `[]` of the start of an image or link resolving nested square brackets.
(self, data: str, index: int)
| 830 | return href, title, index, handled |
| 831 | |
| 832 | def getText(self, data: str, index: int) -> tuple[str, int, bool]: |
| 833 | """Parse the content between `[]` of the start of an image or link |
| 834 | resolving nested square brackets. |
| 835 | |
| 836 | """ |
| 837 | bracket_count = 1 |
| 838 | text = [] |
| 839 | for pos in range(index, len(data)): |
| 840 | c = data[pos] |
| 841 | if c == ']': |
| 842 | bracket_count -= 1 |
| 843 | elif c == '[': |
| 844 | bracket_count += 1 |
| 845 | index += 1 |
| 846 | if bracket_count == 0: |
| 847 | break |
| 848 | text.append(c) |
| 849 | return ''.join(text), index, bracket_count == 0 |
| 850 | |
| 851 | |
| 852 | class ImageInlineProcessor(LinkInlineProcessor): |
no outgoing calls
no test coverage detected