texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: Add MATHJAX_CONFIGURATION customization variable


From: Patrice Dumas
Subject: branch master updated: Add MATHJAX_CONFIGURATION customization variable
Date: Tue, 03 Sep 2024 11:54:21 -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 edc041b0aa Add MATHJAX_CONFIGURATION customization variable
edc041b0aa is described below

commit edc041b0aa896ecdf03b7951224e850041a3bed1
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Sep 3 17:54:21 2024 +0200

    Add MATHJAX_CONFIGURATION customization variable
    
    * tp/Texinfo/options_data.txt, doc/texinfo.texi (MathJax Customization
    Variables), tp/Texinfo/Convert/HTML.pm (_file_header_information)
    (output), NEWS: add MATHJAX_CONFIGURATION customization variable, for
    user wanting to change the global MathJax object configuration.
    Report from Rudolf Adamkovič.
---
 ChangeLog                   | 10 ++++++++++
 NEWS                        |  1 +
 doc/texinfo.texi            | 17 ++++++++++++++++-
 tp/Texinfo/Convert/HTML.pm  | 17 ++++++++++++-----
 tp/Texinfo/options_data.txt |  1 +
 5 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a7d684a432..60b1950099 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-09-03  Patrice Dumas  <pertusus@free.fr>
+
+       Add MATHJAX_CONFIGURATION customization variable
+
+       * tp/Texinfo/options_data.txt, doc/texinfo.texi (MathJax Customization
+       Variables), tp/Texinfo/Convert/HTML.pm (_file_header_information)
+       (output), NEWS: add MATHJAX_CONFIGURATION customization variable, for
+       user wanting to change the global MathJax object configuration.
+       Report from Rudolf Adamkovič.
+
 2024-08-28  Patrice Dumas  <pertusus@free.fr>
 
        Use XDG Base Directory Specification for directory lookups
diff --git a/NEWS b/NEWS
index 7fd3b72f51..af60653b21 100644
--- a/NEWS
+++ b/NEWS
@@ -44,6 +44,7 @@ See the manual for detailed information.
  . rename COMPLEX_FORMAT_IN_TABLE customization option as
    INDENTED_BLOCK_COMMANDS_IN_TABLE.
  . Rename BODYTEXT customization option as BODY_ELEMENT_ATTRIBUTES.
+ . Add MATHJAX_CONFIGURATION customization variable.
  . some unused translation files have been removed for the
    "texinfo_document" domain
  . the us-ascii encoding is not tried anymore when looking for a document
diff --git a/doc/texinfo.texi b/doc/texinfo.texi
index e68e744d79..ce94759fb0 100644
--- a/doc/texinfo.texi
+++ b/doc/texinfo.texi
@@ -18654,11 +18654,26 @@ are converted to @LaTeX{}, before converting the 
@code{@@math} or
 @node MathJax Customization Variables
 @subsubsection MathJax Customization Variables
 
-This table lists the customization variables which can be used when 
+This table lists the customization variables which can be used when
 MathJax is being used, which will be the case when @code{HTML_MATH}
 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:
+@example
+  options: @{
+    skipHtmlTags: @{'[-]': ['pre']@},
+    ignoreHtmlClass: 'tex2jax_ignore',
+    processHtmlClass: 'tex2jax_process'
+  @},
+@end example
+
+If you provide different defaults, you should make sure that they align
+with the HTML output produced by @command{texi2any}.
+
 @item MATHJAX_SCRIPT
 URL of the MathJax component file (e.g.@: @file{tex-svg.js}) you are using.
 @command{texi2any} provides a default value for this variable, but you
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index c304b89c88..e6fd8813b2 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -11335,15 +11335,12 @@ sub _file_header_information($$;$)
        and $self->get_conf('HTML_MATH') eq 'mathjax')
       and ($self->get_file_information('mathjax', $filename))) {
     my $mathjax_script = $self->get_conf('MATHJAX_SCRIPT');
+    my $mathjax_configuration = $self->get_conf('MATHJAX_CONFIGURATION');
 
     $extra_head .=
 "<script type='text/javascript'>
 MathJax = {
-  options: {
-    skipHtmlTags: {'[-]': ['pre']},
-    ignoreHtmlClass: 'tex2jax_ignore',
-    processHtmlClass: 'tex2jax_process'
-  },
+$mathjax_configuration
 };
 </script>"
 .'<script type="text/javascript" id="MathJax-script" async
@@ -13077,6 +13074,16 @@ sub output($$)
       $mathjax_source = 
'http://docs.mathjax.org/en/latest/web/hosting.html#getting-mathjax-via-git';
       $self->set_conf('MATHJAX_SOURCE', $mathjax_source);
     }
+
+    my $mathjax_configuration = $self->get_conf('MATHJAX_CONFIGURATION');
+    if (!defined($mathjax_configuration)) {
+      $mathjax_configuration = "  options: {
+    skipHtmlTags: {'[-]': ['pre']},
+    ignoreHtmlClass: 'tex2jax_ignore',
+    processHtmlClass: 'tex2jax_process'
+  },";
+      $self->set_conf('MATHJAX_CONFIGURATION', $mathjax_configuration);
+    }
   }
 
   if ($self->get_conf('HTML_MATH')
diff --git a/tp/Texinfo/options_data.txt b/tp/Texinfo/options_data.txt
index 0ecce9d174..18fca01a14 100644
--- a/tp/Texinfo/options_data.txt
+++ b/tp/Texinfo/options_data.txt
@@ -269,6 +269,7 @@ L2H_HTML_VERSION                   converter_customization 
undef   char
 L2H_L2H                            converter_customization undef   char
 L2H_SKIP                           converter_customization undef   integer
 L2H_TMP                            converter_customization undef   char
+MATHJAX_CONFIGURATION              converter_customization undef   char
 MATHJAX_SCRIPT                     converter_customization undef   char
 MATHJAX_SOURCE                     converter_customization undef   char
 MAX_HEADER_LEVEL                   converter_customization undef   integer



reply via email to

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