MCPcopy Create free account
hub / github.com/aaronsw/html2text / charref

Function charref

html2text.py:76–88  ·  view source on GitHub ↗
(name)

Source from the content-addressed store, hash-verified

74 unifiable_n[name2cp(k)] = unifiable[k]
75
76def charref(name):
77 if name[0] in ['x','X']:
78 c = int(name[1:], 16)
79 else:
80 c = int(name)
81
82 if not UNICODE_SNOB and c in unifiable_n.keys():
83 return unifiable_n[c]
84 else:
85 try:
86 return unichr(c)
87 except NameError: #Python3
88 return chr(c)
89
90def entityref(c):
91 if not UNICODE_SNOB and c in unifiable.keys():

Callers 2

replaceEntitiesFunction · 0.85
handle_charrefMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected