diff options
| author | Felix (xq) Queißner <git@mq32.de> | 2020-06-22 20:53:39 +0200 |
|---|---|---|
| committer | Felix (xq) Queißner <git@mq32.de> | 2020-06-22 20:53:39 +0200 |
| commit | 8dbfb0890560fd1cd698d06fa05ac868c4db8576 (patch) | |
| tree | 57d138d7e9967473b8ed52863dabeb739a34ac8e /lib/cmark/tools/make_entities_inc.py | |
| parent | 058aeef80e8a33d0e385f284b23eeb117f5ec547 (diff) | |
| download | kristall-8dbfb0890560fd1cd698d06fa05ac868c4db8576.tar.gz | |
Removes 'cruft' from cmark. We only care for the source anyways.
Diffstat (limited to 'lib/cmark/tools/make_entities_inc.py')
| -rw-r--r-- | lib/cmark/tools/make_entities_inc.py | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/lib/cmark/tools/make_entities_inc.py b/lib/cmark/tools/make_entities_inc.py deleted file mode 100644 index 7b8ee41..0000000 --- a/lib/cmark/tools/make_entities_inc.py +++ /dev/null @@ -1,32 +0,0 @@ -# Creates C data structures for binary lookup table of entities, -# using python's html5 entity data. -# Usage: python3 tools/make_entities_inc.py > src/entities.inc - -import html - -entities5 = html.entities.html5 - -# remove keys without semicolons. For some reason the list -# has duplicates of a few things, like auml, one with and one -# without a semicolon. -entities = sorted([(k[:-1], entities5[k].encode('utf-8')) for k in entities5.keys() if k[-1] == ';']) - -# Print out the header: -print("""/* Autogenerated by tools/make_headers_inc.py */ - -struct cmark_entity_node { - unsigned char *entity; - unsigned char bytes[8]; -}; - -#define CMARK_ENTITY_MIN_LENGTH 2 -#define CMARK_ENTITY_MAX_LENGTH 32""") - -print("#define CMARK_NUM_ENTITIES " + str(len(entities))); - -print("\nstatic const struct cmark_entity_node cmark_entities[] = {"); - -for (ent, bs) in entities: - print('{(unsigned char*)"' + ent + '", {' + ', '.join(map(str, bs)) + ', 0}},') - -print("};") |
