(self, name: str)
| 908 | self.o(data, puredata=True) |
| 909 | |
| 910 | def charref(self, name: str) -> str: |
| 911 | if name[0] in ["x", "X"]: |
| 912 | c = int(name[1:], 16) |
| 913 | else: |
| 914 | c = int(name) |
| 915 | |
| 916 | if not self.unicode_snob and c in unifiable_n: |
| 917 | return unifiable_n[c] |
| 918 | else: |
| 919 | try: |
| 920 | return chr(c) |
| 921 | except ValueError: # invalid unicode |
| 922 | return "" |
| 923 | |
| 924 | def entityref(self, c: str) -> str: |
| 925 | if not self.unicode_snob and c in config.UNIFIABLE: |