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

Function get_entities

test/entity_tests.py:12–20  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10from cmark import CMark
11
12def get_entities():
13 regex = r'^{\(unsigned char\*\)"([^"]+)", \{([^}]+)\}'
14 with open(os.path.join(os.path.dirname(__file__), '..', 'src', 'entities.inc')) as f:
15 code = f.read()
16 entities = []
17 for entity, utf8 in re.findall(regex, code, re.MULTILINE):
18 utf8 = bytes(map(int, utf8.split(", ")[:-1])).decode('utf-8')
19 entities.append((entity, utf8))
20 return entities
21
22parser = argparse.ArgumentParser(description='Run cmark tests.')
23parser.add_argument('--program', dest='program', nargs='?', default=None,

Callers 1

entity_tests.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected