Saves an HTML segment for later reinsertion. Returns a placeholder string that needs to be inserted into the document. Keyword arguments: html: An html segment. Returns: A placeholder string.
(self, html: str | etree.Element)
| 227 | self.tag_data: list[TagData] = [] # list of dictionaries in the order tags appear |
| 228 | |
| 229 | def store(self, html: str | etree.Element) -> str: |
| 230 | """ |
| 231 | Saves an HTML segment for later reinsertion. Returns a |
| 232 | placeholder string that needs to be inserted into the |
| 233 | document. |
| 234 | |
| 235 | Keyword arguments: |
| 236 | html: An html segment. |
| 237 | |
| 238 | Returns: |
| 239 | A placeholder string. |
| 240 | |
| 241 | """ |
| 242 | self.rawHtmlBlocks.append(html) |
| 243 | placeholder = self.get_placeholder(self.html_counter) |
| 244 | self.html_counter += 1 |
| 245 | return placeholder |
| 246 | |
| 247 | def reset(self) -> None: |
| 248 | """ Clear the stash. """ |