(self, tag)
| 360 | |
| 361 | # Internal -- finish processing of end tag |
| 362 | def finish_endtag(self, tag): |
| 363 | if not tag: |
| 364 | found = len(self.stack) - 1 |
| 365 | if found < 0: |
| 366 | self.unknown_endtag(tag) |
| 367 | return |
| 368 | else: |
| 369 | if tag not in self.stack: |
| 370 | try: |
| 371 | method = getattr(self, 'end_' + tag) |
| 372 | except AttributeError: |
| 373 | self.unknown_endtag(tag) |
| 374 | else: |
| 375 | self.report_unbalanced(tag) |
| 376 | return |
| 377 | found = len(self.stack) |
| 378 | for i in range(found): |
| 379 | if self.stack[i] == tag: |
| 380 | found = i |
| 381 | while len(self.stack) > found: |
| 382 | tag = self.stack[-1] |
| 383 | try: |
| 384 | method = getattr(self, 'end_' + tag) |
| 385 | except AttributeError: |
| 386 | method = None |
| 387 | if method: |
| 388 | self.handle_endtag(tag, method) |
| 389 | else: |
| 390 | self.unknown_endtag(tag) |
| 391 | del self.stack[-1] |
| 392 | |
| 393 | # Overridable -- handle start tag |
| 394 | def handle_starttag(self, tag, method, attrs): |
no test coverage detected