| 166 | self.lastWasNL = s[-1] == "\n" |
| 167 | |
| 168 | def finish(self) -> str: |
| 169 | self.close() |
| 170 | |
| 171 | self.pbr() |
| 172 | self.o("", force="end") |
| 173 | |
| 174 | outtext = "".join(self.outtextlist) |
| 175 | |
| 176 | if self.unicode_snob: |
| 177 | nbsp = html.entities.html5["nbsp;"] |
| 178 | else: |
| 179 | nbsp = " " |
| 180 | outtext = outtext.replace(" _place_holder;", nbsp) |
| 181 | |
| 182 | # Clear self.outtextlist to avoid memory leak of its content to |
| 183 | # the next handling. |
| 184 | self.outtextlist = [] |
| 185 | |
| 186 | return outtext |
| 187 | |
| 188 | def handle_charref(self, c: str) -> None: |
| 189 | self.handle_data(self.charref(c), True) |