pdfmml \showstream support
This commit is contained in:
parent
e0705c210b
commit
dfee31b4b8
@ -1,26 +1,42 @@
|
|||||||
\ProvidesExplPackage {luamml-pdf} {2021-05-31} {0.0.1-alpha}
|
\ProvidesExplPackage {luamml-pdf} {2021-05-31} {0.0.1-alpha}
|
||||||
{MathML generation for L̶u̶a̶pdfLaTeX}
|
{MathML generation for L̶u̶a̶pdfLaTeX}
|
||||||
|
|
||||||
\cs_new:Npn \__luamml_pdf_showlists: {
|
\cs_if_exist:NTF \showstream {
|
||||||
\group_begin:
|
\iow_new:N \l__luamml_pdf_stream
|
||||||
\int_set:Nn \l_tmpa_int { \tex_interactionmode:D }
|
\iow_open:Nn \l__luamml_pdf_stream { \jobname .tml }
|
||||||
\int_set:Nn \tex_interactionmode:D { 0 }
|
\cs_new_protected:Npn \__luamml_pdf_showlists: {
|
||||||
\int_set:Nn \tex_showboxdepth:D { \c_max_int }
|
\group_begin:
|
||||||
\int_set:Nn \tex_showboxbreadth:D { \c_max_int }
|
\int_set:Nn \tex_showboxdepth:D { \c_max_int }
|
||||||
\tex_showlists:D
|
\int_set:Nn \tex_showboxbreadth:D { \c_max_int }
|
||||||
\int_set:Nn \tex_interactionmode:D { \l_tmpa_int }
|
\showstream = \l__luamml_pdf_stream
|
||||||
\group_end:
|
\tex_showlists:D
|
||||||
|
\iow_now:Nx \l__luamml_pdf_stream {}
|
||||||
|
\group_end:
|
||||||
|
}
|
||||||
|
} {
|
||||||
|
\cs_set_eq:NN \l__luamml_pdf_stream \c_log_iow
|
||||||
|
\cs_set_eq:NN \__luamml_pdf_set_showstream: \scan_stop:
|
||||||
|
\cs_new_protected:Npn \__luamml_pdf_showlists: {
|
||||||
|
\group_begin:
|
||||||
|
\int_set:Nn \l_tmpa_int { \tex_interactionmode:D }
|
||||||
|
\int_set:Nn \tex_interactionmode:D { 0 }
|
||||||
|
\int_set:Nn \tex_showboxdepth:D { \c_max_int }
|
||||||
|
\int_set:Nn \tex_showboxbreadth:D { \c_max_int }
|
||||||
|
\tex_showlists:D
|
||||||
|
\int_set:Nn \tex_interactionmode:D { \l_tmpa_int }
|
||||||
|
\group_end:
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
\int_new:N \g__luamml_formula_id_int
|
\int_new:N \g__luamml_formula_id_int
|
||||||
\cs_new_protected:Npn \luamml_pdf_write: {
|
\cs_new_protected:Npn \luamml_pdf_write: {
|
||||||
\int_gincr:N \g__luamml_formula_id_int
|
\int_gincr:N \g__luamml_formula_id_int
|
||||||
\iow_log:x {
|
\iow_now:Nx \l__luamml_pdf_stream {
|
||||||
LUAMML_FORMULA_BEGIN:
|
LUAMML_FORMULA_BEGIN:
|
||||||
\int_use:N \g__luamml_formula_id_int
|
\int_use:N \g__luamml_formula_id_int
|
||||||
}
|
}
|
||||||
\__luamml_pdf_showlists:
|
\__luamml_pdf_showlists:
|
||||||
\iow_log:x {
|
\iow_now:Nx \l__luamml_pdf_stream {
|
||||||
LUAMML_FORMULA_END
|
LUAMML_FORMULA_END
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -38,7 +54,7 @@
|
|||||||
\int_new:N \g__luamml_annotation_id_int
|
\int_new:N \g__luamml_annotation_id_int
|
||||||
\cs_new_protected:Npn \luamml_pdf_annotate:nnn #1#2#3 {
|
\cs_new_protected:Npn \luamml_pdf_annotate:nnn #1#2#3 {
|
||||||
\int_gincr:N \g__luamml_annotation_id_int
|
\int_gincr:N \g__luamml_annotation_id_int
|
||||||
\iow_shipout_x:Nx \c_log_iow {
|
\iow_shipout_x:Nx \l__luamml_pdf_stream {
|
||||||
\tl_to_str:e {
|
\tl_to_str:e {
|
||||||
LUAMML_MARK:
|
LUAMML_MARK:
|
||||||
\int_use:N \g__luamml_annotation_id_int
|
\int_use:N \g__luamml_annotation_id_int
|
||||||
@ -58,7 +74,7 @@
|
|||||||
% THIS VERSION IS SIGNIFICANTLY SLOWER
|
% THIS VERSION IS SIGNIFICANTLY SLOWER
|
||||||
\cs_new_protected:Npn \luamml_pdf_annotate:nn #1#2 {
|
\cs_new_protected:Npn \luamml_pdf_annotate:nn #1#2 {
|
||||||
\int_gincr:N \g__luamml_annotation_id_int
|
\int_gincr:N \g__luamml_annotation_id_int
|
||||||
\iow_shipout_x:Nx \c_log_iow {
|
\iow_shipout_x:Nx \l__luamml_pdf_stream {
|
||||||
\tl_to_str:e {
|
\tl_to_str:e {
|
||||||
LUAMML_MARK:
|
LUAMML_MARK:
|
||||||
\int_use:N \g__luamml_annotation_id_int
|
\int_use:N \g__luamml_annotation_id_int
|
||||||
@ -69,20 +85,20 @@
|
|||||||
\exp_not:N \iow_newline:
|
\exp_not:N \iow_newline:
|
||||||
LUAMML_MARK_END
|
LUAMML_MARK_END
|
||||||
}
|
}
|
||||||
\iow_now:Nx \c_log_iow {
|
\iow_now:Nx \l__luamml_pdf_stream {
|
||||||
LUAMML_COUNT:
|
LUAMML_COUNT:
|
||||||
\int_use:N \g__luamml_annotation_id_int
|
\int_use:N \g__luamml_annotation_id_int
|
||||||
}
|
}
|
||||||
\__luamml_pdf_showlists:
|
\__luamml_pdf_showlists:
|
||||||
#2
|
#2
|
||||||
\iow_now:Nn \c_log_iow {
|
\iow_now:Nx \l__luamml_pdf_stream {
|
||||||
LUAMML_COUNT_END
|
LUAMML_COUNT_END
|
||||||
}
|
}
|
||||||
\__luamml_pdf_showlists:
|
\__luamml_pdf_showlists:
|
||||||
}
|
}
|
||||||
|
|
||||||
\NewDocumentCommand \RegisterFamilyMapping {m m} {
|
\NewDocumentCommand \RegisterFamilyMapping {m m} {
|
||||||
\iow_log:x {
|
\iow_now:Nx \l__luamml_pdf_stream {
|
||||||
LUAMML_INSTRUCTION:REGISTER_MAPPING: \int_use:N #1 : #2
|
LUAMML_INSTRUCTION:REGISTER_MAPPING: \int_use:N #1 : #2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,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'/tonumber
|
||||||
local non_final_list_block = (l.C((1-l.P'\n')^0) * '\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
|
||||||
local generic_list_block = '### ' * (line - 'current page:') * non_final_list_block
|
local generic_list_block = '### ' * (line - 'current page:') * non_final_list_block
|
||||||
|
@ -64,7 +64,7 @@ local fraction_noad = l.Ct('\\fraction, thickness '
|
|||||||
|
|
||||||
local mathchoice_noad = l.Ct('\\mathchoice' * l.Cg(l.Cc'choice', 'id') * -1)
|
local mathchoice_noad = l.Ct('\\mathchoice' * l.Cg(l.Cc'choice', 'id') * -1)
|
||||||
|
|
||||||
local mark_whatsit = '\\write-{LUAMML_MARK:' * (l.R'09'^1/tonumber) * ':'
|
local mark_whatsit = '\\write' * ('-' + l.R'09'^1) * '{LUAMML_MARK:' * (l.R'09'^1/tonumber) * ':'
|
||||||
|
|
||||||
local parse_list
|
local parse_list
|
||||||
local function parse_kernel(lines, i, prefix, parsed)
|
local function parse_kernel(lines, i, prefix, parsed)
|
||||||
|
Loading…
Reference in New Issue
Block a user