More pdfTeX work
This commit is contained in:
parent
e21116b501
commit
d63bed65a1
23
luamml.dtx
23
luamml.dtx
@ -130,6 +130,25 @@
|
|||||||
}
|
}
|
||||||
% \end{macro}
|
% \end{macro}
|
||||||
%
|
%
|
||||||
|
% \begin{macro}{\__luamml_style_to_num:N}
|
||||||
|
% \begin{macrocode}
|
||||||
|
\cs_new:Npn \__luamml_style_to_num:N #1 {
|
||||||
|
%<luatex> 32 * #1
|
||||||
|
%<*pdftex>
|
||||||
|
\token_case_meaning:NnF #1 {
|
||||||
|
\displaystyle {0}
|
||||||
|
\textstyle {32}
|
||||||
|
\scriptstyle {64}
|
||||||
|
\scriptscriptstyle {96}
|
||||||
|
} {
|
||||||
|
\Invalid_mathstyle
|
||||||
|
}
|
||||||
|
%</pdftex>
|
||||||
|
}
|
||||||
|
% \end{macrocode}
|
||||||
|
% \end{macro}
|
||||||
|
%
|
||||||
|
%
|
||||||
% \begin{macro}{\luamml_flag_save:n,
|
% \begin{macro}{\luamml_flag_save:n,
|
||||||
% \luamml_flag_save:nN,
|
% \luamml_flag_save:nN,
|
||||||
% \luamml_flag_save:nn,
|
% \luamml_flag_save:nn,
|
||||||
@ -151,7 +170,7 @@
|
|||||||
}
|
}
|
||||||
\cs_new_protected:Npn \luamml_flag_save:nN #1#2 {
|
\cs_new_protected:Npn \luamml_flag_save:nN #1#2 {
|
||||||
\tl_set:Nn \l__luamml_label_tl {#1}
|
\tl_set:Nn \l__luamml_label_tl {#1}
|
||||||
\int_set:Nn \l__luamml_flag_int { \__luamml_maybe_structelem: 17 + 32 * #2 }
|
\int_set:Nn \l__luamml_flag_int { \__luamml_maybe_structelem: 17 + \__luamml_style_to_num:N #2 }
|
||||||
}
|
}
|
||||||
\cs_new_protected:Npn \luamml_flag_save:nn #1 {
|
\cs_new_protected:Npn \luamml_flag_save:nn #1 {
|
||||||
\tl_set:Nn \l__luamml_label_tl {#1}
|
\tl_set:Nn \l__luamml_label_tl {#1}
|
||||||
@ -160,7 +179,7 @@
|
|||||||
}
|
}
|
||||||
\cs_new_protected:Npn \luamml_flag_save:nNn #1#2 {
|
\cs_new_protected:Npn \luamml_flag_save:nNn #1#2 {
|
||||||
\tl_set:Nn \l__luamml_label_tl {#1}
|
\tl_set:Nn \l__luamml_label_tl {#1}
|
||||||
\int_set:Nn \l__luamml_flag_int { \__luamml_maybe_structelem: 21 + 32 * #2 }
|
\int_set:Nn \l__luamml_flag_int { \__luamml_maybe_structelem: 21 + \__luamml_style_to_num:N #2 }
|
||||||
\tl_set:Nn \l__luamml_root_tl
|
\tl_set:Nn \l__luamml_root_tl
|
||||||
}
|
}
|
||||||
% \end{macrocode}
|
% \end{macrocode}
|
||||||
|
@ -2,7 +2,7 @@ local l = lpeg or require'lpeg'
|
|||||||
|
|
||||||
local line = (1-l.P'\n')^0 * '\n'
|
local line = (1-l.P'\n')^0 * '\n'
|
||||||
|
|
||||||
local id = l.R'09'/tonumber
|
local id = l.R'09'^1/tonumber
|
||||||
local non_final_list_block = (l.C((1-l.P'\n')^1) * '\n' - '### ' + '\n')^0
|
local non_final_list_block = (l.C((1-l.P'\n')^1) * '\n' - '### ' + '\n')^0
|
||||||
local math_lists_block = l.Ct('### ' * l.Cg(l.C'display' * ' ', 'display')^-1 * 'math mode entered at line ' * l.Cg(l.R'09'^1 / tonumber, 'line') * '\n'
|
local math_lists_block = l.Ct('### ' * l.Cg(l.C'display' * ' ', 'display')^-1 * 'math mode entered at line ' * l.Cg(l.R'09'^1 / tonumber, 'line') * '\n'
|
||||||
* non_final_list_block)^1
|
* non_final_list_block)^1
|
||||||
|
@ -56,6 +56,8 @@ local simple_noad = l.Ct(
|
|||||||
+ '\\kern' * l.Cg(' ' * l.Cc(1) + l.Cc(0), 'subtype') * l.Cg(scaled, 'kern') * (' (for ' * (l.R'az' + l.S'/\\') * ')')^-1 * l.Cg(l.Cc'kern', 'id')
|
+ '\\kern' * l.Cg(' ' * l.Cc(1) + l.Cc(0), 'subtype') * l.Cg(scaled, 'kern') * (' (for ' * (l.R'az' + l.S'/\\') * ')')^-1 * l.Cg(l.Cc'kern', 'id')
|
||||||
) * -1
|
) * -1
|
||||||
|
|
||||||
|
local box_node = '\\' * l.S'hv' * 'box('
|
||||||
|
|
||||||
local fraction_noad = l.Ct('\\fraction, thickness '
|
local fraction_noad = l.Ct('\\fraction, thickness '
|
||||||
* l.Cg('= default' * l.Cc(0x40000000) + scaled, 'width')
|
* l.Cg('= default' * l.Cc(0x40000000) + scaled, 'width')
|
||||||
* l.Cg(', left-delimiter ' * delimiter_code, 'left')^-1 * l.Cg(', right-delimiter ' * delimiter_code, 'right')^-1
|
* l.Cg(', left-delimiter ' * delimiter_code, 'left')^-1 * l.Cg(', right-delimiter ' * delimiter_code, 'right')^-1
|
||||||
@ -72,9 +74,18 @@ local function parse_kernel(lines, i, prefix, parsed)
|
|||||||
if not line or line:sub(1, #prefix) ~= prefix then return nil, i end
|
if not line or line:sub(1, #prefix) ~= prefix then return nil, i end
|
||||||
local result = math_char:match(lines[i], #prefix + 1)
|
local result = math_char:match(lines[i], #prefix + 1)
|
||||||
if result then return result, i+1 end
|
if result then return result, i+1 end
|
||||||
|
if box_node:match(lines[i], #prefix + 1) then return skip_list(lines, i+1, prefix .. '.') end
|
||||||
result, i = parse_list(lines, i, prefix, parsed)
|
result, i = parse_list(lines, i, prefix, parsed)
|
||||||
return {list = result, id = 'sub_mlist'}, i
|
return {list = result, id = 'sub_mlist'}, i
|
||||||
end
|
end
|
||||||
|
function skip_list(lines, i, prefix)
|
||||||
|
i = i or 1
|
||||||
|
local count = #lines
|
||||||
|
while i <= count and lines[i]:sub(1, #prefix) == prefix do
|
||||||
|
i = i + 1
|
||||||
|
end
|
||||||
|
return {id = 'sub_box', list = {}}, i
|
||||||
|
end
|
||||||
function parse_list(lines, i, prefix, parsed)
|
function parse_list(lines, i, prefix, parsed)
|
||||||
i = i or 1
|
i = i or 1
|
||||||
prefix = prefix or ''
|
prefix = prefix or ''
|
||||||
|
@ -84,7 +84,7 @@ for i, block in ipairs(parsed.groups) do
|
|||||||
xml = {[0] = tag, xml}
|
xml = {[0] = tag, xml}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if style == 2 and flag & 1 == 1 and label ~= '' then
|
if style == 2 and flag & 1 == 1 and label then
|
||||||
if parsed.mathml[label] then
|
if parsed.mathml[label] then
|
||||||
error'Invalid label reuse'
|
error'Invalid label reuse'
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user