Called for the text contents of each tag.
(self, data: str)
| 202 | self.is_header_tag = False |
| 203 | |
| 204 | def handle_data(self, data: str) -> None: |
| 205 | """Called for the text contents of each tag.""" |
| 206 | self._stripped_html.append(data) |
| 207 | |
| 208 | if self.section is None: |
| 209 | # This means we have some content at the start of the |
| 210 | # HTML before we reach a heading tag. We don't actually |
| 211 | # care about that content as it will be added to the |
| 212 | # overall page entry in the search. So just skip it. |
| 213 | return |
| 214 | |
| 215 | # If this is a header, then the data is the title. |
| 216 | # Otherwise it is content of something under that header |
| 217 | # section. |
| 218 | if self.is_header_tag: |
| 219 | self.section.title = data |
| 220 | else: |
| 221 | self.section.text.append(data.rstrip('\n')) |
| 222 | |
| 223 | @property |
| 224 | def stripped_html(self) -> str: |