Skip to content

Commit

Permalink
Update dictionary
Browse files Browse the repository at this point in the history
- Introduce ForcedDefault category for U+007C VERTICAL LINE and U+223C TILDE OPERATOR
- Regenerate after w3c/xml-entities#8
  • Loading branch information
fred-wang committed Mar 21, 2022
1 parent b38642e commit 3b54b10
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
7 changes: 5 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5593,13 +5593,16 @@ <h3>Operator Dictionary</h3>
<li>Otherwise exit with category <code>Default</code>.</li>
</ul>
</li>
<li>If the category of
<li>If <code>Form</code> is infix and <code>Content</code> corresponds
to one of U+007C VERTICAL LINE or U+223C TILDE OPERATOR then exit
with category <code>ForceDefault</code>. If the category of
(<code>Content</code>, <code>Form</code>)
provided by table
<a href="#operator-dictionary-category-table"></a>
has N/A encoding in table
<a href="#operator-dictionary-categories-values"></a>
(namely if it has category L or M), then exit with that category.
(namely if it has category <code>L</code> or <code>M</code>), then
exit with that category.
Otherwise,
<ul>
<li>Set <code>Key</code> to <code>Content</code> if it is in
Expand Down
4 changes: 2 additions & 2 deletions tables/operator-dictionary-compact.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<tr><td>22 entries (6 Unicode ranges) in <strong>prefix</strong> form: <code>[U+220F–U+2211], [U+22C0–U+22C3], [U+2A00–U+2A0A], [U+2A1D–U+2A1E], {U+2AFC}, {U+2AFF}, </code></td><td>J</td></tr>
<tr><td>7 entries (4 Unicode ranges) in <strong>infix</strong> form: <code>{U+005C}, {U+005F}, [U+2061–U+2064], {U+2206}, </code></td><td>K</td></tr>
<tr><td>6 entries (3 Unicode ranges) in <strong>prefix</strong> form: <code>[U+2145–U+2146], {U+2202}, [U+221A–U+221C], </code></td><td>L</td></tr>
<tr><td>4 entries in <strong>infix</strong> form: <code>U+002C, U+003A, U+003B, U+2982, </code></td><td>M</td></tr>
</table><figcaption>Mapping from operator (Content, Form) to a category.<br/>Total size: 726 entries, 641 bytes.<br/>(assuming characters are UTF-16 and 1-byte range lengths)</figcaption></figure><figure id="operator-dictionary-categories-values"><table><tr><th>Category</th><th>Form</th><th>Encoding</th><th>rspace</th><th>lspace</th><th>properties</th></tr>
<tr><td>3 entries in <strong>infix</strong> form: <code>U+002C, U+003A, U+003B, </code></td><td>M</td></tr>
</table><figcaption>Mapping from operator (Content, Form) to a category.<br/>Total size: 725 entries, 639 bytes.<br/>(assuming characters are UTF-16 and 1-byte range lengths)</figcaption></figure><figure id="operator-dictionary-categories-values"><table><tr><th>Category</th><th>Form</th><th>Encoding</th><th>rspace</th><th>lspace</th><th>properties</th></tr>
<tr><td>Default</td><td>N/A</td><td>N/A</td><td><code>0.2777777777777778em</code></td><td><code>0.2777777777777778em</code></td><td>N/A</td></tr>
<tr><td>A</td><td>infix</td><td>0x0</td><td><code>0.2777777777777778em</code></td><td><code>0.2777777777777778em</code></td><td>stretchy </td></tr>
<tr><td>B</td><td>infix</td><td>0x4</td><td><code>0.2222222222222222em</code></td><td><code>0.2222222222222222em</code></td><td>N/A</td></tr>
Expand Down
6 changes: 2 additions & 4 deletions tables/operator-dictionary.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
<tr><td>&#x2224; U+2224</td><td>block</td><td><code>infix</code></td><td><code>0.2777777777777778em</code></td><td><code>0.2777777777777778em</code></td><td>N/A</td></tr>
<tr><td>&#x2225; U+2225</td><td>block</td><td><code>infix</code></td><td><code>0.2777777777777778em</code></td><td><code>0.2777777777777778em</code></td><td>N/A</td></tr>
<tr><td>&#x2226; U+2226</td><td>block</td><td><code>infix</code></td><td><code>0.2777777777777778em</code></td><td><code>0.2777777777777778em</code></td><td>N/A</td></tr>
<tr><td>&#x2234; U+2234</td><td>block</td><td><code>infix</code></td><td><code>0.2777777777777778em</code></td><td><code>0.2777777777777778em</code></td><td>N/A</td></tr>
<tr><td>&#x2235; U+2235</td><td>block</td><td><code>infix</code></td><td><code>0.2777777777777778em</code></td><td><code>0.2777777777777778em</code></td><td>N/A</td></tr>
<tr><td>&#x2237; U+2237</td><td>block</td><td><code>infix</code></td><td><code>0.2777777777777778em</code></td><td><code>0.2777777777777778em</code></td><td>N/A</td></tr>
<tr><td>&#x2239; U+2239</td><td>block</td><td><code>infix</code></td><td><code>0.2777777777777778em</code></td><td><code>0.2777777777777778em</code></td><td>N/A</td></tr>
<tr><td>&#x223A; U+223A</td><td>block</td><td><code>infix</code></td><td><code>0.2777777777777778em</code></td><td><code>0.2777777777777778em</code></td><td>N/A</td></tr>
Expand Down Expand Up @@ -236,6 +234,7 @@
<tr><td>&#x297A; U+297A</td><td>block</td><td><code>infix</code></td><td><code>0.2777777777777778em</code></td><td><code>0.2777777777777778em</code></td><td>N/A</td></tr>
<tr><td>&#x297B; U+297B</td><td>block</td><td><code>infix</code></td><td><code>0.2777777777777778em</code></td><td><code>0.2777777777777778em</code></td><td>N/A</td></tr>
<tr><td>&#x2981; U+2981</td><td>block</td><td><code>infix</code></td><td><code>0.2777777777777778em</code></td><td><code>0.2777777777777778em</code></td><td>N/A</td></tr>
<tr><td>&#x2982; U+2982</td><td>block</td><td><code>infix</code></td><td><code>0.2777777777777778em</code></td><td><code>0.2777777777777778em</code></td><td>N/A</td></tr>
<tr><td>&#x29B6; U+29B6</td><td>block</td><td><code>infix</code></td><td><code>0.2777777777777778em</code></td><td><code>0.2777777777777778em</code></td><td>N/A</td></tr>
<tr><td>&#x29B7; U+29B7</td><td>block</td><td><code>infix</code></td><td><code>0.2777777777777778em</code></td><td><code>0.2777777777777778em</code></td><td>N/A</td></tr>
<tr><td>&#x29B9; U+29B9</td><td>block</td><td><code>infix</code></td><td><code>0.2777777777777778em</code></td><td><code>0.2777777777777778em</code></td><td>N/A</td></tr>
Expand Down Expand Up @@ -1179,6 +1178,5 @@
<tr><td>&#x2C; U+002C</td><td>block</td><td><code>infix</code></td><td><code>0</code></td><td><code>0.16666666666666666em</code></td><td>separator </td></tr>
<tr><td>&#x3A; U+003A</td><td>block</td><td><code>infix</code></td><td><code>0</code></td><td><code>0.16666666666666666em</code></td><td>N/A</td></tr>
<tr><td>&#x3B; U+003B</td><td>block</td><td><code>infix</code></td><td><code>0</code></td><td><code>0.16666666666666666em</code></td><td>separator </td></tr>
<tr><td>&#x2982; U+2982</td><td>block</td><td><code>infix</code></td><td><code>0</code></td><td><code>0.16666666666666666em</code></td><td>N/A</td></tr>
</table>
<figcaption>Mapping from operator (Content, Form) to properties.<br/>Total size: 1179 entries, ≥ 3685 bytes<br/>(assuming 'Content' uses at least one UTF-16 character, 'Stretch Axis' 1 bit, 'Form' 2 bits,the different combinations of 'rspace' and 'space' at least 3 bits, and the different combinations of properties 3 bits).</figcaption></figure>
<figcaption>Mapping from operator (Content, Form) to properties.<br/>Total size: 1177 entries, ≥ 3679 bytes<br/>(assuming 'Content' uses at least one UTF-16 character, 'Stretch Axis' 1 bit, 'Form' 2 bits,the different combinations of 'rspace' and 'space' at least 3 bits, and the different combinations of properties 3 bits).</figcaption></figure>
11 changes: 10 additions & 1 deletion tables/operator-dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,15 @@ def buildKey(characters, form):
def toHexa(character):
return "U+%04X" % character

# Whether this is one of the known BMP characters handled in step 3 of
# Whether this is one of the known "force default" character handled in step 3
# of https://w3c.github.io/mathml-core/#operator-dictionary
# These list of exceptions must remain small!
def hasForceDefaultCategory(codePoint):
return codePoint in [0x007C, 0x223C]

# Whether this is one of the known BMP characters handled in step 2 of
# https://w3c.github.io/mathml-core/#operator-dictionary
# These list of exceptions must remain small!
def isKnownNonBMP(codePoint):
return codePoint in [0x1EEF0, 0x1EEF1]

Expand Down Expand Up @@ -477,6 +484,8 @@ def serializeValue(value, fence, separator):
# 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"]:
if hasForceDefaultCategory(entry):
continue
otherCategories = []
for name in knownTables:
if name.startswith("infix") or name == "fence":
Expand Down

0 comments on commit 3b54b10

Please sign in to comment.