texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: * doc/texinfo.texi (MathJax Customization Variabl


From: Patrice Dumas
Subject: branch master updated: * doc/texinfo.texi (MathJax Customization Variables), tp/Texinfo/Convert/HTML.pm (output): add tex MathJax option block that tighten the configuration to what is really needed for MathJax in texi2any output.
Date: Tue, 10 Sep 2024 02:52:44 -0400

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 706f6815f5 * doc/texinfo.texi (MathJax Customization Variables), 
tp/Texinfo/Convert/HTML.pm (output): add tex MathJax option block that tighten 
the configuration to what is really needed for MathJax in texi2any output.
706f6815f5 is described below

commit 706f6815f5d210068bdc40e86b1538062ed78465
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Sep 10 08:52:29 2024 +0200

    * doc/texinfo.texi (MathJax Customization Variables),
    tp/Texinfo/Convert/HTML.pm (output): add tex MathJax option block that
    tighten the configuration to what is really needed for MathJax in
    texi2any output.
---
 ChangeLog                                                  | 12 ++++++++++++
 doc/texinfo.texi                                           | 14 +++++++++++---
 tp/Texinfo/Convert/HTML.pm                                 | 10 +++++++++-
 tp/t/results/html_tests/mathjax_with_texinfo.pl            | 10 +++++++++-
 .../html_tests/mathjax_with_texinfo_enable_encoding.pl     | 10 +++++++++-
 .../mathjax_with_texinfo_html_file/res_html/index.html     | 10 +++++++++-
 .../html_tests/mathjax_with_texinfo_no_convert_to_latex.pl | 10 +++++++++-
 tp/t/results/raw/displaymath.pl                            | 10 +++++++++-
 tp/tests/Makefile.am                                       | 10 ++++++----
 .../layout/res_parser/formatting_mathjax/formatting.html   | 10 +++++++++-
 .../tex_html/res_parser/tex_gdef_mathjax/tex_gdef.html     | 10 +++++++++-
 tp/tests/tex_html/res_parser/tex_mathjax/tex.html          | 10 +++++++++-
 12 files changed, 110 insertions(+), 16 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3b31291880..0d8a0ba2b6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-09-10  Patrice Dumas  <pertusus@free.fr>
+
+       * doc/texinfo.texi (MathJax Customization Variables),
+       tp/Texinfo/Convert/HTML.pm (output): add tex MathJax option block that
+       tighten the configuration to what is really needed for MathJax in
+       texi2any output.
+
+2024-09-10  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/tests/Makefile.am (parser_tests_environment): add srcdir in the
+       environment for parser_tests.sh calls.
+
 2024-09-09  Patrice Dumas  <pertusus@free.fr>
 
        * tp/t/test_utils.pl (%formats, test): add the epub_file format,
diff --git a/doc/texinfo.texi b/doc/texinfo.texi
index 670dc744b4..e79e5c13f2 100644
--- a/doc/texinfo.texi
+++ b/doc/texinfo.texi
@@ -18684,14 +18684,22 @@ is set to @samp{mathjax}.
 @vtable @code
 @item MATHJAX_CONFIGURATION
 Global @samp{MathJax} object configuration (inside the object braces).
-If @code{undef}, @command{texi2any} provides a default with an
-@samp{option} component, which could be, for example:
+If @code{undef}, @command{texi2any} provides a defaults, which could be,
+for example:
 @example
   options: @{
-    skipHtmlTags: @{'[-]': ['pre']@},
+    skipHtmlTags: @{'[-]': ['pre']@},       // do not skip pre
     ignoreHtmlClass: 'tex2jax_ignore',
     processHtmlClass: 'tex2jax_process'
   @},
+  tex: @{
+    processEscapes: false,
+    processEnvironments: false,
+    processRefs: false,
+    displayMath: [
+      ['\\[', '\\]']
+    ],
+  @},
 @end example
 
 If you provide different defaults, you should make sure that they align
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index ba8fcef8f7..92ad9569e1 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -13158,9 +13158,17 @@ sub output($$)
     my $mathjax_configuration = $self->get_conf('MATHJAX_CONFIGURATION');
     if (!defined($mathjax_configuration)) {
       $mathjax_configuration = "  options: {
-    skipHtmlTags: {'[-]': ['pre']},
+    skipHtmlTags: {'[-]': ['pre']},       // do not skip pre
     ignoreHtmlClass: 'tex2jax_ignore',
     processHtmlClass: 'tex2jax_process'
+  },
+  tex: {
+    processEscapes: false,      // do not use \\\$ to produce a literal dollar 
sign
+    processEnvironments: false, // do not process \\begin{xxx}...\\end{xxx} 
outside math mode
+    processRefs: false,         // do not process \\ref{...} outside of math 
mode
+    displayMath: [             // start/end delimiter pairs for display math
+      ['\\\\[', '\\\\]']
+    ],
   },";
       $self->set_conf('MATHJAX_CONFIGURATION', $mathjax_configuration);
     }
diff --git a/tp/t/results/html_tests/mathjax_with_texinfo.pl 
b/tp/t/results/html_tests/mathjax_with_texinfo.pl
index a2aae9e0a6..2c45524b97 100644
--- a/tp/t/results/html_tests/mathjax_with_texinfo.pl
+++ b/tp/t/results/html_tests/mathjax_with_texinfo.pl
@@ -276,10 +276,18 @@ pre.displaymath {font-style: italic; font-family: serif; 
display: flex; justify-
 <script type=\'text/javascript\'>
 MathJax = {
   options: {
-    skipHtmlTags: {\'[-]\': [\'pre\']},
+    skipHtmlTags: {\'[-]\': [\'pre\']},       // do not skip pre
     ignoreHtmlClass: \'tex2jax_ignore\',
     processHtmlClass: \'tex2jax_process\'
   },
+  tex: {
+    processEscapes: false,      // do not use \\$ to produce a literal dollar 
sign
+    processEnvironments: false, // do not process \\begin{xxx}...\\end{xxx} 
outside math mode
+    processRefs: false,         // do not process \\ref{...} outside of math 
mode
+    displayMath: [             // start/end delimiter pairs for display math
+      [\'\\\\[\', \'\\\\]\']
+    ],
+  },
 };
 </script><script type="text/javascript" id="MathJax-script" async
   src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js";>
diff --git a/tp/t/results/html_tests/mathjax_with_texinfo_enable_encoding.pl 
b/tp/t/results/html_tests/mathjax_with_texinfo_enable_encoding.pl
index 4643a0e1c5..a1e92607b4 100644
--- a/tp/t/results/html_tests/mathjax_with_texinfo_enable_encoding.pl
+++ b/tp/t/results/html_tests/mathjax_with_texinfo_enable_encoding.pl
@@ -288,10 +288,18 @@ pre.displaymath {font-style: italic; font-family: serif; 
display: flex; justify-
 <script type=\'text/javascript\'>
 MathJax = {
   options: {
-    skipHtmlTags: {\'[-]\': [\'pre\']},
+    skipHtmlTags: {\'[-]\': [\'pre\']},       // do not skip pre
     ignoreHtmlClass: \'tex2jax_ignore\',
     processHtmlClass: \'tex2jax_process\'
   },
+  tex: {
+    processEscapes: false,      // do not use \\$ to produce a literal dollar 
sign
+    processEnvironments: false, // do not process \\begin{xxx}...\\end{xxx} 
outside math mode
+    processRefs: false,         // do not process \\ref{...} outside of math 
mode
+    displayMath: [             // start/end delimiter pairs for display math
+      [\'\\\\[\', \'\\\\]\']
+    ],
+  },
 };
 </script><script type="text/javascript" id="MathJax-script" async
   src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js";>
diff --git 
a/tp/t/results/html_tests/mathjax_with_texinfo_html_file/res_html/index.html 
b/tp/t/results/html_tests/mathjax_with_texinfo_html_file/res_html/index.html
index c3cc275f73..7947cafbf6 100644
--- a/tp/t/results/html_tests/mathjax_with_texinfo_html_file/res_html/index.html
+++ b/tp/t/results/html_tests/mathjax_with_texinfo_html_file/res_html/index.html
@@ -20,10 +20,18 @@ pre.displaymath {font-style: italic; font-family: serif; 
display: flex; justify-
 <script type='text/javascript'>
 MathJax = {
   options: {
-    skipHtmlTags: {'[-]': ['pre']},
+    skipHtmlTags: {'[-]': ['pre']},       // do not skip pre
     ignoreHtmlClass: 'tex2jax_ignore',
     processHtmlClass: 'tex2jax_process'
   },
+  tex: {
+    processEscapes: false,      // do not use \$ to produce a literal dollar 
sign
+    processEnvironments: false, // do not process \begin{xxx}...\end{xxx} 
outside math mode
+    processRefs: false,         // do not process \ref{...} outside of math 
mode
+    displayMath: [             // start/end delimiter pairs for display math
+      ['\\[', '\\]']
+    ],
+  },
 };
 </script><script type="text/javascript" id="MathJax-script" async
   src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js";>
diff --git 
a/tp/t/results/html_tests/mathjax_with_texinfo_no_convert_to_latex.pl 
b/tp/t/results/html_tests/mathjax_with_texinfo_no_convert_to_latex.pl
index 6a6dd3c20f..56aabc315c 100644
--- a/tp/t/results/html_tests/mathjax_with_texinfo_no_convert_to_latex.pl
+++ b/tp/t/results/html_tests/mathjax_with_texinfo_no_convert_to_latex.pl
@@ -276,10 +276,18 @@ pre.displaymath {font-style: italic; font-family: serif; 
display: flex; justify-
 <script type=\'text/javascript\'>
 MathJax = {
   options: {
-    skipHtmlTags: {\'[-]\': [\'pre\']},
+    skipHtmlTags: {\'[-]\': [\'pre\']},       // do not skip pre
     ignoreHtmlClass: \'tex2jax_ignore\',
     processHtmlClass: \'tex2jax_process\'
   },
+  tex: {
+    processEscapes: false,      // do not use \\$ to produce a literal dollar 
sign
+    processEnvironments: false, // do not process \\begin{xxx}...\\end{xxx} 
outside math mode
+    processRefs: false,         // do not process \\ref{...} outside of math 
mode
+    displayMath: [             // start/end delimiter pairs for display math
+      [\'\\\\[\', \'\\\\]\']
+    ],
+  },
 };
 </script><script type="text/javascript" id="MathJax-script" async
   src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js";>
diff --git a/tp/t/results/raw/displaymath.pl b/tp/t/results/raw/displaymath.pl
index 9aeb5bd673..058a3d535e 100644
--- a/tp/t/results/raw/displaymath.pl
+++ b/tp/t/results/raw/displaymath.pl
@@ -249,10 +249,18 @@ pre.displaymath {font-style: italic; font-family: serif; 
display: flex; justify-
 <script type=\'text/javascript\'>
 MathJax = {
   options: {
-    skipHtmlTags: {\'[-]\': [\'pre\']},
+    skipHtmlTags: {\'[-]\': [\'pre\']},       // do not skip pre
     ignoreHtmlClass: \'tex2jax_ignore\',
     processHtmlClass: \'tex2jax_process\'
   },
+  tex: {
+    processEscapes: false,      // do not use \\$ to produce a literal dollar 
sign
+    processEnvironments: false, // do not process \\begin{xxx}...\\end{xxx} 
outside math mode
+    processRefs: false,         // do not process \\ref{...} outside of math 
mode
+    displayMath: [             // start/end delimiter pairs for display math
+      [\'\\\\[\', \'\\\\]\']
+    ],
+  },
 };
 </script><script type="text/javascript" id="MathJax-script" async
   src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js";>
diff --git a/tp/tests/Makefile.am b/tp/tests/Makefile.am
index 74eb9ea2fa..b33672a2a7 100644
--- a/tp/tests/Makefile.am
+++ b/tp/tests/Makefile.am
@@ -28,19 +28,21 @@ other_tests_dirs = other
 DIST_SUBDIRS = many_input_files $(base_tests_dirs) $(tex_html_tests_dirs) 
$(other_tests_dirs)
 SUBDIRS = . many_input_files
 
+parser_tests_environment = srcdir="$(srcdir)"; export srcdir;
+
 copy-tests:
-       $(srcdir)/parser_tests.sh -copy $(base_tests_dirs)
+       $(parser_tests_environment) $(srcdir)/parser_tests.sh -copy 
$(base_tests_dirs)
        cd many_input_files && $(MAKE) copy-tests
 
 copy-tex-html:
-       $(srcdir)/parser_tests.sh -copy $(tex_html_tests_dirs)
+       $(parser_tests_environment) $(srcdir)/parser_tests.sh -copy 
$(tex_html_tests_dirs)
        cd many_input_files && $(MAKE) copy-tex-html
 
 copy-other-tests:
-       $(srcdir)/parser_tests.sh -copy $(other_tests_dirs)
+       $(parser_tests_environment) $(srcdir)/parser_tests.sh -copy 
$(other_tests_dirs)
 
 clean-tests:
-       $(srcdir)/parser_tests.sh -clean $(base_tests_dirs) 
$(tex_html_tests_dirs) $(other_tests_dirs)
+       $(parser_tests_environment) $(srcdir)/parser_tests.sh -clean 
$(base_tests_dirs) $(tex_html_tests_dirs) $(other_tests_dirs)
 
 TESTS = $(one_test_files_generated_list)
 
diff --git a/tp/tests/layout/res_parser/formatting_mathjax/formatting.html 
b/tp/tests/layout/res_parser/formatting_mathjax/formatting.html
index 01dee5cb2b..8339dfee89 100644
--- a/tp/tests/layout/res_parser/formatting_mathjax/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_mathjax/formatting.html
@@ -911,10 +911,18 @@ ul.toc-numbered-mark {list-style: none}
 <script type='text/javascript'>
 MathJax = {
   options: {
-    skipHtmlTags: {'[-]': ['pre']},
+    skipHtmlTags: {'[-]': ['pre']},       // do not skip pre
     ignoreHtmlClass: 'tex2jax_ignore',
     processHtmlClass: 'tex2jax_process'
   },
+  tex: {
+    processEscapes: false,      // do not use \$ to produce a literal dollar 
sign
+    processEnvironments: false, // do not process \begin{xxx}...\end{xxx} 
outside math mode
+    processRefs: false,         // do not process \ref{...} outside of math 
mode
+    displayMath: [             // start/end delimiter pairs for display math
+      ['\\[', '\\]']
+    ],
+  },
 };
 </script><script type="text/javascript" id="MathJax-script" async
   src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js";>
diff --git a/tp/tests/tex_html/res_parser/tex_gdef_mathjax/tex_gdef.html 
b/tp/tests/tex_html/res_parser/tex_gdef_mathjax/tex_gdef.html
index c0cb238717..fc928fa74a 100644
--- a/tp/tests/tex_html/res_parser/tex_gdef_mathjax/tex_gdef.html
+++ b/tp/tests/tex_html/res_parser/tex_gdef_mathjax/tex_gdef.html
@@ -24,10 +24,18 @@ span:hover a.copiable-link {visibility: visible}
 <script type='text/javascript'>
 MathJax = {
   options: {
-    skipHtmlTags: {'[-]': ['pre']},
+    skipHtmlTags: {'[-]': ['pre']},       // do not skip pre
     ignoreHtmlClass: 'tex2jax_ignore',
     processHtmlClass: 'tex2jax_process'
   },
+  tex: {
+    processEscapes: false,      // do not use \$ to produce a literal dollar 
sign
+    processEnvironments: false, // do not process \begin{xxx}...\end{xxx} 
outside math mode
+    processRefs: false,         // do not process \ref{...} outside of math 
mode
+    displayMath: [             // start/end delimiter pairs for display math
+      ['\\[', '\\]']
+    ],
+  },
 };
 </script><script type="text/javascript" id="MathJax-script" async
   src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js";>
diff --git a/tp/tests/tex_html/res_parser/tex_mathjax/tex.html 
b/tp/tests/tex_html/res_parser/tex_mathjax/tex.html
index fb8f1f18ed..aebf8771ed 100644
--- a/tp/tests/tex_html/res_parser/tex_mathjax/tex.html
+++ b/tp/tests/tex_html/res_parser/tex_mathjax/tex.html
@@ -24,10 +24,18 @@ span:hover a.copiable-link {visibility: visible}
 <script type='text/javascript'>
 MathJax = {
   options: {
-    skipHtmlTags: {'[-]': ['pre']},
+    skipHtmlTags: {'[-]': ['pre']},       // do not skip pre
     ignoreHtmlClass: 'tex2jax_ignore',
     processHtmlClass: 'tex2jax_process'
   },
+  tex: {
+    processEscapes: false,      // do not use \$ to produce a literal dollar 
sign
+    processEnvironments: false, // do not process \begin{xxx}...\end{xxx} 
outside math mode
+    processRefs: false,         // do not process \ref{...} outside of math 
mode
+    displayMath: [             // start/end delimiter pairs for display math
+      ['\\[', '\\]']
+    ],
+  },
 };
 </script><script type="text/javascript" id="MathJax-script" async
   src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js";>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]