From 2a96d1c7d6a43d35ed47e260d646d728b955ae51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20Fabian=20Kr=C3=BCger?= Date: Mon, 19 Apr 2021 17:07:29 +0200 Subject: [PATCH] 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. --- mlist_to_mml.lua | 4 ++++ remap_comb.lua | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 remap_comb.lua diff --git a/mlist_to_mml.lua b/mlist_to_mml.lua index 3eed3b8..e972480 100644 --- a/mlist_to_mml.lua +++ b/mlist_to_mml.lua @@ -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, diff --git a/remap_comb.lua b/remap_comb.lua new file mode 100644 index 0000000..2083a3f --- /dev/null +++ b/remap_comb.lua @@ -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}", +}