MCPcopy Create free account
hub / github.com/commonmark/cmark / handle_charref

Method handle_charref

test/normalize.py:97–106  ·  view source on GitHub ↗
(self, name)

Source from the content-addressed store, hash-verified

95 self.output_char(c, '&' + name + ';')
96 self.last = "ref"
97 def handle_charref(self, name):
98 try:
99 if name.startswith("x"):
100 c = chr(int(name[1:], 16))
101 else:
102 c = chr(int(name))
103 except ValueError:
104 c = None
105 self.output_char(c, '&' + name + ';')
106 self.last = "ref"
107 # Helpers.
108 def output_char(self, c, fallback):
109 if c == '<':

Callers

nothing calls this directly

Calls 1

output_charMethod · 0.95

Tested by

no test coverage detected