MCPcopy Index your code
hub / github.com/unclecode/crawl4ai / charref

Method charref

crawl4ai/html2text/__init__.py:910–922  ·  view source on GitHub ↗
(self, name: str)

Source from the content-addressed store, hash-verified

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:

Callers 1

handle_charrefMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected