Skip to content

Commit

Permalink
write mathml template, WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
u-fischer committed Jan 19, 2024
1 parent 3fcc743 commit 43a7bfb
Showing 1 changed file with 60 additions and 2 deletions.
62 changes: 60 additions & 2 deletions required/latex-lab/latex-lab-math.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@
% \end{macrocode}
% \end{variable}
%
% \begin{variable}{\l_@@_tmpa_tl,\l_@@_tmpa_skip}
% \begin{variable}{\l_@@_tmpa_tl,\l_@@_tmpa_skip,\l_@@_tmpa_str}
% Temporary variables
% \begin{macrocode}
\tl_new:N \l_@@_tmpa_tl
Expand Down Expand Up @@ -615,6 +615,62 @@
% \end{macrocode}
% \end{macro}
%
% \begin{socketdecl}{tagsupport/math/mathml/write}
% This writes a html-template with the hash and the math content.
% This should be optional, so it uses a socket that can be disabled
%
% \begin{macrocode}
\socket_new:nn {tagsupport/math/mathml/write}{0}
% \end{macrocode}
% \end{socketdecl}
%
% \begin{plugdecl}{On}
% \begin{macrocode}
\socket_new_plug:nnn{tagsupport/math/mathml/write}{On}
{
\str_set:NV\l_@@_tmpa_str\l_@@_content_AF_source_tl
\str_replace_all:Nnn\l_@@_tmpa_str{&}{&}
\str_replace_all:Nnn\l_@@_tmpa_str{<}{&lt;}
\iow_now:Ne \g_@@_writehash_iow
{
\iow_newline:
<div>
\iow_newline:
<h2>\c_backslash_str mml\c_space_tl \int_use:N \g_@@_AF_total_int </h2>
\iow_newline:
<p>\l_@@_tmpa_str</p>
\iow_newline:
<p>\l_@@_content_hash_tl </p>
\iow_newline:
<math></math>
\iow_newline:
</div>
\iow_newline:
}
}
% \end{macrocode}
% \end{plugdecl}
% And now a key to activate the socket.
% There should be a test so
% \begin{macrocode}

\keys_define:nn { math / tagging }
{
mathml/writehash .code:n =
{
\iow_new:N \g_@@_writehash_iow
\iow_open:Nn \g_@@_writehash_iow
{
\c_sys_jobname_str-mathml-template.html
}
\AssignSocketPlug {tagsupport/math/mathml/write}{On}
},
mathml/writehash .usage:n=preamble
}

% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@_AF_process_mathml_files:}
% \begin{macrocode}
\box_new:N\l_@@_tmpa_box
Expand Down Expand Up @@ -715,7 +771,8 @@
mathml/setfiles .clist_set:N = \l__tag_math_mathml_files_clist,
mathml/panel .bool_set:N = \l__tag_math_mathml_panel_bool,
mathml/panel .initial:n = true,
texsource/panel .bool_set:N = \l__tag_math_texsource_panel_bool,
texsource/panel .bool_set:N = \l__tag_math_texsource_panel_bool,
mathml/activate .bool_gset:N = \g__tag_math_mathml_AF_bool
}
% \end{macrocode}
%
Expand Down Expand Up @@ -1019,6 +1076,7 @@
{
\typeout{WARNING:~mathml~missing~for~hash\l_@@_content_hash_tl}
}
\socket_use:n {tagsupport/math/mathml/write} % write hash if request
\tag_struct_begin:n
{
tag=Formula,
Expand Down

0 comments on commit 43a7bfb

Please sign in to comment.