Reorganize and add missing file

This commit is contained in:
Marcel Fabian Krüger 2021-04-23 02:58:07 +02:00
parent 8be2760919
commit d6bda3aff3
8 changed files with 61 additions and 27 deletions

View File

@ -1,5 +1,5 @@
local remap_comb = require'remap_comb'
local stretchy = require'stretchy'
local remap_comb = require'luamml-data-combining'
local stretchy = require'luamml-data-stretchy'
local properties = node.get_properties_table()

View File

@ -0,0 +1,51 @@
-- local remap_ot1 = {
-- 0x0393, 0x0394, 0x0398, 0x039B, 0x039E, 0x03A0, 0x03A3, 0x03A5,
-- 0x03A6, 0x03A8, 0x03A9, nil, nil, nil, nil, nil,
-- }
local remap_oml = { [0] =
-- Greek italic
0x1D6E4, 0x1D6E5, 0x1D6E9, 0x1D6EC, 0x1D6EF, 0x1D6F1, 0x1D6F4, 0x1D6F6,
0x1D6F7, 0x1D6F9, 0x1D6FA, 0x1D6FC, 0x1D6FD, 0x1D6FE, 0x1D6FF, 0x1D716,
0x1D701, 0x1D702, 0x1D703, 0x1D704, 0x1D705, 0x1D706, 0x1D707, 0x1D708,
0x1D709, 0x1D70B, 0x1D70C, 0x1D70E, 0x1D70F, 0x1D710, 0x1D719, 0x1D712,
0x1D713, 0x1D714, 0x1D700, 0x1D717, 0x1D71B, 0x1D71A, 0x1D70D, 0x1D711,
-- Symbols. (The nils are hook parts)
0x21BC, 0x21BD, 0x21C0, 0x21C1, nil, nil, 0x22BB, 0x22BC,
-- old style numerals (nobody should ever use these in math) and some punctuation
nil, nil, nil, nil, nil, nil, nil, nil,
nil, nil, 0x2E, 0x2C, 0x3C, 0x2F, 0x3E, 0x226D,
-- letters filled up with symbols
0x2202, 0x1D434, 0x1D435, 0x1D436, 0x1D437, 0x1D438, 0x1D439, 0x1D43A,
0x1D43B, 0x1D43C, 0x1D43D, 0x1D43E, 0x1D43F, 0x1D440, 0x1D441, 0x1D442,
0x1D443, 0x1D444, 0x1D445, 0x1D446, 0x1D447, 0x1D448, 0x1D449, 0x1D44A,
0x1D44B, 0x1D44C, 0x1D44D, 0x266D, 0x266E, 0x266F, 0x2323, 0x2322,
0x2113, 0x1D44E, 0x1D44F, 0x1D450, 0x1D451, 0x1D452, 0x1D453, 0x1D454,
0x210E, 0x1D456, 0x1D457, 0x1D458, 0x1D459, 0x1D45A, 0x1D45B, 0x1D45C,
0x1D45D, 0x1D45E, 0x1D45F, 0x1D460, 0x1D461, 0x1D462, 0x1D463, 0x1D464,
0x1D465, 0x1D466, 0x1D467, 0x1D6A4, 0x1D6A5, 0x2118, 0x2192, nil,
}
local remap_oms = { [0] =
0x2212, 0x22C5, 0xD7, 0x2A, 0xF7, 0x22C4, 0xB1, 0x2213,
0x2295, 0x2296, 0x2297, 0x2298, 0x2299, 0x25CB, 0x2218, 0x2219,
0x224D, 0x2261, 0x2286, 0x2287, 0x2264, 0x2265, 0x2AAF, 0x2AB0,
0x223C, 0x2248, 0x2282, 0x2283, 0x226A, 0x226B, 0x227A, 0x227B,
0x2190, 0x2192, 0x2191, 0x2193, 0x2194, 0x2197, 0x2198, 0x2243,
0x21D0, 0x21D2, 0x21D1, 0x21D3, 0x21D4, 0x2196, 0x2199, 0x221D,
0x2032, 0x221E, 0x2208, 0x220B, 0x25B3, 0x25BD, 0x0338, 0x21A6,
0x2200, 0x2203, 0xAC, 0x2205, 0x211C, 0x22A9, 0x22A4, 0x22A5,
0x2135, 0x1D49C, 0x212C, 0x1D49E, 0x1D49F, 0x2130, 0x2131, 0x1D4A2,
0x210B, 0x2110, 0x1D4A5, 0x1D4A6, 0x2112, 0x2133, 0x1D4A9, 0x1D4AA,
0x1D4AB, 0x1D4AC, 0x211B, 0x1D4AE, 0x1D4AF, 0x1D4B0, 0x1D4B1, 0x1D4B2,
0x1D4B3, 0x1D4B4, 0x1D4B5, 0x222A, 0x2229, 0x228E, 0x2227, 0x2228,
0x22A2, 0x22A3, 0x230A, 0x230B, 0x2308, 0x2309, 0x7B, 0x7D,
0x27E8, 0x27E9, 0x7C, 0x2016, 0x2195, 0x21D5, 0x5C, 0x2240,
0x221A, 0x2210, 0x2207, 0x222B, 0x2294, 0x2293, 0x2291, 0x2292,
0xA7, 0x2020, 0x2021, 0xB6, 0x2663, 0x2662, 0x2661, 0x2660,
}
return {
oml = remap_oml,
oms = remap_oms,
}

View File

@ -1,12 +1,9 @@
local inspect = require'inspect'
local function show(t) return print(inspect(t)) end
local mlist_to_mml = require'mlist_to_mml'
local mlist_to_mml = require'luamml-convert'
local process_mlist = mlist_to_mml.process
local register_family = mlist_to_mml.register_family
local mappings = require'remap'
local write_xml = require'write_xml'
local mappings = require'luamml-legacy-mappings'
local write_xml = require'luamml-xmlwriter'
local funcid = luatexbase.new_luafunction'RegisterFamilyMapping'
token.set_lua('RegisterFamilyMapping', funcid, 'protected')

View File

@ -3,7 +3,6 @@ local function escape_name(name)
return name
end
-- FIXME: Not sure yet if this will be needed
local escapes = {
['"'] = """,
['<'] = "&lt;",
@ -41,4 +40,7 @@ local function write_elem(tree, indent)
return out .. '</' .. escaped_name .. '>'
end
return write_elem
return function(element, indent, version)
return (version == '11' and '<?xml version="1.1"?>' or '') ..
write_elem(element, indent and '' or nil)
end

View File

@ -1,6 +1,6 @@
\documentclass{article}
% \usepackage{unicode-math}
\directlua{require'test_tex'}
\directlua{require'luamml-tex'}
\RegisterFamilyMapping\symsymbols{oms}
\RegisterFamilyMapping\symletters{oml}
\begin{document}

View File

@ -1,16 +0,0 @@
local write_xml = require'write_xml'
print(write_xml{[0] = "math", xmlns = "http://www.w3.org/1998/Math/MathML",
{[0] = "mi", "a"},
{[0] = "msup",
{[0] = "mi", "x"},
{[0] = "mn", "2"},
},
{[0] = "mo", "+"},
{[0] = "mi", "b"},
{[0] = "mi", "x"},
{[0] = "mo", "+"},
{[0] = "mi", "c"},
{[0] = "mo", "="},
{[0] = "mn", "0"},
})