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