[latex3-commits] [latex3/latex2e] latex-lab/uf-review-05: write mathml template, WIP (43a7bfb3)

github at latex-project.org github at latex-project.org
Fri Jan 19 17:29:25 CET 2024


Repository : https://github.com/latex3/latex2e
On branch  : latex-lab/uf-review-05
Link       : https://github.com/latex3/latex2e/commit/43a7bfb348270786e287e5430a0e639c00121c26

>---------------------------------------------------------------

commit 43a7bfb348270786e287e5430a0e639c00121c26
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Fri Jan 19 17:29:25 2024 +0100

    write mathml template, WIP


>---------------------------------------------------------------

43a7bfb348270786e287e5430a0e639c00121c26
 required/latex-lab/latex-lab-math.dtx | 60 ++++++++++++++++++++++++++++++++++-
 1 file changed, 59 insertions(+), 1 deletion(-)

diff --git a/required/latex-lab/latex-lab-math.dtx b/required/latex-lab/latex-lab-math.dtx
index dc7ccbeb..7c4cbfd6 100644
--- a/required/latex-lab/latex-lab-math.dtx
+++ b/required/latex-lab/latex-lab-math.dtx
@@ -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
@@ -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{<}{<}
+    \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
@@ -716,6 +772,7 @@
    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,  
+   mathml/activate .bool_gset:N = \g__tag_math_mathml_AF_bool  
   } 
 %    \end{macrocode}
 %
@@ -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,





More information about the latex3-commits mailing list.