| 1703 | open_: list = [] |
| 1704 | |
| 1705 | class _P(HTMLParser): |
| 1706 | def handle_starttag(self, tag, attrs): |
| 1707 | tags.append([tag, dict(attrs), ""]) |
| 1708 | open_.append(tags[-1]) |
| 1709 | |
| 1710 | def handle_endtag(self, tag): |
| 1711 | if open_: |
| 1712 | open_.pop() |
| 1713 | |
| 1714 | def handle_data(self, data): |
| 1715 | if open_: |
| 1716 | open_[-1][2] += data |
| 1717 | |
| 1718 | _P(convert_charrefs=True).feed(fragment) |
| 1719 | return tags |
no outgoing calls