Normalize some names of combining characters

The list remaps according to the table in MathML-Core, always selecting
the variant which has an XML entity name is such a character exists.
This commit is contained in:
Marcel Fabian Krüger 2021-04-19 17:07:29 +02:00
parent 165c6bd9ad
commit 7ca21203ac
2 changed files with 31 additions and 0 deletions

View File

@ -1,3 +1,5 @@
local remap_comb = require'remap_comb'
local noad_t, accent_t, style_t, choice_t = node.id'noad', node.id'accent', node.id'style', node.id'choice'
local radical_t, fraction_t, fence_t = node.id'radical', node.id'fraction', node.id'fence'
@ -102,12 +104,14 @@ local function accent_to_table(accent, sub, cur_style)
if sub & 1 == 1 then
top_acc.stretchy = 'false'
end
top_acc[1] = remap_comb[top_acc[1]] or top_acc[1]
end
if bot_acc then
bot_acc[0] = 'mo'
if sub & 2 == 2 then
bot_acc.stretchy = 'false'
end
bot_acc[1] = remap_comb[bot_acc[1]] or bot_acc[1]
end
return {[0] = top_acc and (bot_acc and 'munderover' or 'mover') or 'munder',
nucleus,

27
remap_comb.lua Normal file
View File

@ -0,0 +1,27 @@
return {
["\u{0332}"] = "\u{2212}",
["\u{0330}"] = "\u{02DC}",
["\u{0328}"] = "\u{02DB}",
["\u{20EF}"] = "\u{2192}",
["\u{032C}"] = "\u{02C7}",
["\u{032E}"] = "\u{02D8}",
["\u{0306}"] = "\u{02D8}",
["\u{030B}"] = "\u{02DD}",
["\u{0302}"] = "\u{02C6}",
["\u{0324}"] = "\u{00A8}",
["\u{0317}"] = "\u{00B4}",
["\u{031F}"] = "\u{002B}",
["\u{0307}"] = "\u{002E}",
["\u{0305}"] = "\u{2212}",
["\u{0303}"] = "\u{02DC}",
["\u{0316}"] = "\u{0060}",
["\u{0301}"] = "\u{00B4}",
["\u{030C}"] = "\u{02C7}",
["\u{0327}"] = "\u{00B8}",
["\u{0308}"] = "\u{00A8}",
["\u{0300}"] = "\u{0060}",
["\u{0323}"] = "\u{002E}",
["\u{0304}"] = "\u{00AF}",
["\u{032D}"] = "\u{005E}",
["\u{20D7}"] = "\u{2192}",
}