Skip to content

Commit

Permalink
Add a check for #104 (comment)
Browse files Browse the repository at this point in the history
  • Loading branch information
fred-wang committed Jan 27, 2022
1 parent a80a3ca commit 6c533ee
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions tables/operator-dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from download import downloadUnicodeXML
from math import ceil
from inline_axis_operators import stretchAxis, inlineAxisOperators

from bisect import bisect_left
import operator
import json

Expand Down Expand Up @@ -489,7 +489,24 @@ def serializeValue(value, fence, separator):
print("done.");
################################################################################

# Delete infix operators using default values.
# Delete infix operators using default values. But before doing that, check
# (for single char entries) whether they actually don't exist in another
# category. Otherwise, such a category will be used when no explicit form is
# specified, which will override the default values.
# https://w3c.github.io/mathml-core/#ref-for-dfn-algorithm-for-determining-the-properties-of-an-embellished-operator-1

for entry in knownTables["infixEntriesWithDefaultValues"]["singleChar"]:
otherCategories = []
for name in knownTables:
if name.startswith("infix") or name == "fence":
continue
i = bisect_left(knownTables[name]["singleChar"], entry)
if (i != len(knownTables[name]["singleChar"]) and
knownTables[name]["singleChar"][i] == entry):
otherCategories.append(name)
assert len(otherCategories) == 0, (
"U+%04X is in infixEntriesWithDefaultValues but also in %s" %
(entry, str(otherCategories)))
del knownTables["infixEntriesWithDefaultValues"]

# Convert nonBMP characters to surrogates pair (multiChar)
Expand Down

0 comments on commit 6c533ee

Please sign in to comment.