Parse the content between `[]` of the start of an image or link resolving nested square brackets.
(self, data: str, index: int)
| 1181 | return href, title, index, handled |
| 1182 | |
| 1183 | def getText(self, data: str, index: int) -> tuple[str, int, bool]: |
| 1184 | """Parse the content between `[]` of the start of an image or link |
| 1185 | resolving nested square brackets. |
| 1186 | |
| 1187 | """ |
| 1188 | bracket_count = 1 |
| 1189 | text = [] |
| 1190 | for pos in range(index, len(data)): |
| 1191 | c = data[pos] |
| 1192 | if c == ']': |
| 1193 | bracket_count -= 1 |
| 1194 | elif c == '[': |
| 1195 | bracket_count += 1 |
| 1196 | index += 1 |
| 1197 | if bracket_count == 0: |
| 1198 | break |
| 1199 | text.append(c) |
| 1200 | return ''.join(text), index, bracket_count == 0 |
| 1201 | |
| 1202 | |
| 1203 | class ImageInlineProcessor(LinkInlineProcessor): |
no outgoing calls
no test coverage detected