Smaller improvements
This commit is contained in:
parent
75c92b1ff5
commit
75ede91b5d
@ -139,7 +139,7 @@ local function delim_to_table(delim)
|
||||
else
|
||||
local fam = delim.small_fam
|
||||
char = remap_lookup[fam << 21 | char]
|
||||
local result = {[0] = 'mo', char, ['tex:family'] = fam ~= 0 and fam or nil, stretchy = not stretchy[char] or nil, lspace = 0, rspace = 0, [':nodes'] = {delim} }
|
||||
local result = {[0] = 'mo', char, ['tex:family'] = fam ~= 0 and fam or nil, stretchy = not stretchy[char] or nil, lspace = 0, rspace = 0, [':nodes'] = {delim}, [':actual'] = char}
|
||||
if mathml_filter then
|
||||
return mathml_filter(result, result)
|
||||
else
|
||||
@ -166,7 +166,7 @@ local function acc_to_table(acc, cur_style, stretch)
|
||||
if stretch ~= not stretchy[char] then -- Handle nil gracefully in stretchy
|
||||
stretch = nil
|
||||
end
|
||||
local result = {[0] = 'mo', char, ['tex:family'] = fam ~= 0 and fam or nil, stretchy = stretch, [':nodes'] = {acc}}
|
||||
local result = {[0] = 'mo', char, ['tex:family'] = fam ~= 0 and fam or nil, stretchy = stretch, [':nodes'] = {acc}, [':actual'] = stretch and char or nil}
|
||||
if mathml_filter then
|
||||
return mathml_filter(result)
|
||||
else
|
||||
|
@ -13,10 +13,14 @@
|
||||
}
|
||||
|
||||
\ExplSyntaxOn
|
||||
|
||||
\bool_new:N \l__luamml_demo_structelem_bool
|
||||
|
||||
\DeclareOption{tracing}{
|
||||
\tracingmathml=2
|
||||
}
|
||||
\DeclareOption{structelem}{
|
||||
\bool_set_true:N \l__luamml_demo_structelem_bool
|
||||
\luamml_flag_structelem:
|
||||
}
|
||||
\DeclareOption{files}{
|
||||
@ -36,7 +40,9 @@
|
||||
\int_gincr:N \g__luamml_demo_af_int
|
||||
\exp_args:Ne \pdf_object_new:nn{__luamml_demo_\int_use:N \g__luamml_demo_af_int}{dict}
|
||||
\exp_args:Ne \tagstructbegin{tag=Formula,AF=__luamml_demo_\int_use:N \g__luamml_demo_af_int,#1}
|
||||
\tagmcbegin{tag=Formula}
|
||||
\bool_if:NF \l__luamml_demo_structelem_bool {
|
||||
\tagmcbegin{tag=Formula}
|
||||
}
|
||||
#2
|
||||
\group_begin:
|
||||
\pdfdict_put:nnn {l_pdffile/Filespec} {AFRelationship}{/Supplement}
|
||||
@ -45,7 +51,9 @@
|
||||
{ test.xml }
|
||||
{ \luamml_get_last_mathml_stream:e{}\c_space_tl 0~R}
|
||||
\group_end:
|
||||
\tagmcend
|
||||
\bool_if:NF \l__luamml_demo_structelem_bool {
|
||||
\tagmcend
|
||||
}
|
||||
\tagstructend
|
||||
}
|
||||
|
||||
|
@ -61,15 +61,18 @@ local function write_elem(tree, stash)
|
||||
stash = '__luamml_stashed_' .. stash_cnt
|
||||
tree[':struct'] = stash
|
||||
stash = ', stash, label = ' .. stash
|
||||
else
|
||||
stash = ''
|
||||
end
|
||||
|
||||
if i == 0 then
|
||||
tex.sprint(struct_begin, '{tag=' .. tree[0] .. '/mathml' .. stash .. '}')
|
||||
else
|
||||
tex.sprint(struct_begin, '{tag=' .. tree[0] .. '/mathml, attribute=' .. attributes[table.concat(attrs)] .. stash .. '}')
|
||||
local attr_flag = i ~= 0 and ', attribute=' .. attributes[table.concat(attrs)]
|
||||
tex.sprint(struct_begin, '{tag=' .. tree[0] .. '/mathml')
|
||||
if stash then tex.sprint(stash) end
|
||||
if attr_flag then tex.sprint(attr_flag) end
|
||||
if tree[':actual'] then
|
||||
tex.sprint(', actualtext = {')
|
||||
tex.cprint(12, tree[':actual'])
|
||||
tex.sprint'}'
|
||||
end
|
||||
tex.sprint'}'
|
||||
for j = 1, i do attrs[j] = nil end
|
||||
|
||||
if tree[':nodes'] then
|
||||
|
Loading…
Reference in New Issue
Block a user