Initial support for text in array

This commit is contained in:
Marcel Fabian Krüger 2021-04-30 20:16:04 +02:00
parent bba310e512
commit 598dfc1b64
2 changed files with 13 additions and 7 deletions

View File

@ -2,8 +2,10 @@ local write_xml = require'luamml-xmlwriter'
local make_root = require'luamml-convert'.make_root local make_root = require'luamml-convert'.make_root
local save_result = require'luamml-tex'.save_result local save_result = require'luamml-tex'.save_result
local store_column = require'luamml-table'.store_column local store_column = require'luamml-table'.store_column
local store_column_xml = require'luamml-table'.store_column_xml
local store_tag = require'luamml-table'.store_tag local store_tag = require'luamml-table'.store_tag
local get_table = require'luamml-table'.get_table local get_table = require'luamml-table'.get_table
local to_text = require'luamml-lr'
local properties = node.get_properties_table() local properties = node.get_properties_table()
@ -41,11 +43,12 @@ lua.get_functions_table()[funcid] = function()
alignment = alignment == 1 and 'left' or alignment == 2 and 'right' or nil alignment = alignment == 1 and 'left' or alignment == 2 and 'right' or nil
if node.end_of_math(startmath) == tex.nest.top.tail then if node.end_of_math(startmath) == tex.nest.top.tail then
if startmath.nest == tex.nest.top.tail then return end if startmath.next == tex.nest.top.tail then return end
store_column(startmath).columnalign = alignment store_column(startmath).columnalign = alignment
else else
-- Oh no, we got text. Let't complain to the user, it's probably their fault -- Oh no, we got text. Let't complain to the user, it's probably their fault
print'We are mathematicians, don\'t bother us with text' print'We are mathematicians, don\'t bother us with text'
store_column_xml{[0] = 'mtext', to_text(startmath, tex.nest.top.tail)}
end end
end end

View File

@ -19,12 +19,7 @@ local function store_get_row()
return mml_row return mml_row
end end
local function store_column(startmath, display) local function store_column_xml(mml, display)
local props = properties[startmath]
if not props then return end
local mml = props.saved_mathml_table
if not mml then return end
props.saved_mathml_table = nil
if display and mml[0] == 'mstyle' and mml.displaystyle == true then if display and mml[0] == 'mstyle' and mml.displaystyle == true then
mml[0], mml.displaystyle, mml.scriptlevel = 'mtd', nil, nil mml[0], mml.displaystyle, mml.scriptlevel = 'mtd', nil, nil
else else
@ -37,6 +32,13 @@ local function store_column(startmath, display)
return mml return mml
end end
local function store_column(startmath, display)
local props = properties[startmath]
if not props then return end
local mml = props.saved_mathml_table
if mml then return store_column_xml(mml, display) end
end
local function store_tag(xml) local function store_tag(xml)
local mml_row = store_get_row() local mml_row = store_get_row()
mml_row[0] = 'mlabeledtr' mml_row[0] = 'mlabeledtr'
@ -79,6 +81,7 @@ end
return { return {
store_column = store_column, store_column = store_column,
store_column_xml = store_column_xml,
store_tag = store_tag, store_tag = store_tag,
get_table = get_table, get_table = get_table,
} }