[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/convert/format_html.c (file_heade
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/convert/format_html.c (file_header_information), tp/Texinfo/XS/convert/html_prepare_converter.c (html_setup_output): only put extra settings in MATHJAX_CONFIGURATION in C code. Do not set MATHJAX_CONFIGURATION in html_setup_output, move default MathJax configuration to file_header_information. Always output it. Only output value of MATHJAX_CONFIGURATION if set. |
Date: |
Sun, 13 Oct 2024 08:59:59 -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 d2e0cf872d * tp/Texinfo/XS/convert/format_html.c
(file_header_information), tp/Texinfo/XS/convert/html_prepare_converter.c
(html_setup_output): only put extra settings in MATHJAX_CONFIGURATION in C
code. Do not set MATHJAX_CONFIGURATION in html_setup_output, move default
MathJax configuration to file_header_information. Always output it. Only
output value of MATHJAX_CONFIGURATION if set.
d2e0cf872d is described below
commit d2e0cf872d163b22df507ca0ce280ac87f68f45b
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Oct 13 14:59:48 2024 +0200
* tp/Texinfo/XS/convert/format_html.c (file_header_information),
tp/Texinfo/XS/convert/html_prepare_converter.c (html_setup_output):
only put extra settings in MATHJAX_CONFIGURATION in C code. Do not
set MATHJAX_CONFIGURATION in html_setup_output, move default MathJax
configuration to file_header_information. Always output it. Only
output value of MATHJAX_CONFIGURATION if set.
---
ChangeLog | 11 +++++-
tp/Texinfo/XS/convert/format_html.c | 48 ++++++++++++++++++++++----
tp/Texinfo/XS/convert/html_prepare_converter.c | 16 ---------
3 files changed, 52 insertions(+), 23 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f5fc61441a..67a3524a3b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-10-13 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/convert/format_html.c (file_header_information),
+ tp/Texinfo/XS/convert/html_prepare_converter.c (html_setup_output):
+ only put extra settings in MATHJAX_CONFIGURATION in C code. Do not
+ set MATHJAX_CONFIGURATION in html_setup_output, move default MathJax
+ configuration to file_header_information. Always output it. Only
+ output value of MATHJAX_CONFIGURATION if set.
+
2024-10-13 Gavin Smith <gavinsmith0123@gmail.com>
Macros for struct initialiser
@@ -13,7 +22,7 @@
* tp/Texinfo/Convert/HTML.pm (_setup_output): do not set
MATHJAX_CONFIGURATION.
(_file_header_information) <MathJax>: Move default MathJax
- configuration here from _setup_output. Always output it.
+ configuration here from _setup_output. Always output it.
Only output value of MATHJAX_CONFIGURATION if set.
* doc/texinfo.texi (MathJax Customization Variables): update.
do not show default texi2any configuration of MathJax.
diff --git a/tp/Texinfo/XS/convert/format_html.c
b/tp/Texinfo/XS/convert/format_html.c
index 74feecb862..07f2a41687 100644
--- a/tp/Texinfo/XS/convert/format_html.c
+++ b/tp/Texinfo/XS/convert/format_html.c
@@ -3850,13 +3850,49 @@ file_header_information (CONVERTER *self, const ELEMENT
*command,
{
char *mathjax_script = url_protect_url_text (self,
self->conf->MATHJAX_SCRIPT.o.string);
+ const char *default_mathjax_configuration =
+ " options: {\n"
+ " skipHtmlTags: {'[-]': ['pre']}, // do not skip pre\n"
+ " ignoreHtmlClass: 'tex2jax_ignore',\n"
+ " processHtmlClass: 'tex2jax_process'\n"
+ " },\n"
+ " tex: {\n"
+ " processEscapes: false, // do not use \\$ to produce a literal
dollar sign\n"
+ " processEnvironments: false, // do not process \\begin{xxx}...\\end{xxx}
outside math mode\n"
+ " processRefs: false, // do not process \\ref{...} outside of math
mode\n"
+ " displayMath: [ // start/end delimiter pairs for display
math\n"
+ " ['\\\\[', '\\\\]']\n"
+ " ],\n"
+ " },";
+
text_printf (&text, "<script type='text/javascript'>\n"
-"MathJax = {\n"
-"%s\n"
-"};\n"
-"</script><script type=\"text/javascript\" id=\"MathJax-script\" async\n"
-" src=\"%s\">\n"
-"</script>", self->conf->MATHJAX_CONFIGURATION.o.string, mathjax_script);
+ "MathJax = {\n"
+ "%s\n"
+ "};\n", default_mathjax_configuration);
+
+ if (self->conf->MATHJAX_CONFIGURATION.o.string)
+ {
+ text_printf (&text,
+ "var MathJax_conf = {\n"
+ "%s\n"
+ "};\n"
+ "\n"
+ "for (let component in MathJax_conf) {\n"
+ " if (!MathJax.hasOwnProperty(component)) {\n"
+ " MathJax[component] = MathJax_conf[component];\n"
+ " } else {\n"
+ " for (let field in MathJax_conf[component]) {\n"
+ " MathJax[component][field] = MathJax_conf[component][field];\n"
+ " }\n"
+ " }\n"
+ "}\n"
+ "\n", self->conf->MATHJAX_CONFIGURATION.o.string);
+ }
+
+ text_printf (&text,
+ "</script><script type=\"text/javascript\" id=\"MathJax-script\" async\n"
+ " src=\"%s\">\n"
+ "</script>", mathjax_script);
free (mathjax_script);
}
begin_info->extra_head = text.text;
diff --git a/tp/Texinfo/XS/convert/html_prepare_converter.c
b/tp/Texinfo/XS/convert/html_prepare_converter.c
index 7a4dd0fbd8..3d786e1c1f 100644
--- a/tp/Texinfo/XS/convert/html_prepare_converter.c
+++ b/tp/Texinfo/XS/convert/html_prepare_converter.c
@@ -3410,22 +3410,6 @@ html_setup_output (CONVERTER *self, char **paths)
if (!self->conf->MATHJAX_SOURCE.o.string)
option_set_conf (&self->conf->MATHJAX_SOURCE, 0,
"http://docs.mathjax.org/en/latest/web/hosting.html#getting-mathjax-via-git");
-
- if (!self->conf->MATHJAX_CONFIGURATION.o.string)
- option_set_conf (&self->conf->MATHJAX_CONFIGURATION, 0,
- " options: {\n"
- " skipHtmlTags: {'[-]': ['pre']}, // do not skip pre\n"
- " ignoreHtmlClass: 'tex2jax_ignore',\n"
- " processHtmlClass: 'tex2jax_process'\n"
- " },\n"
- " tex: {\n"
- " processEscapes: false, // do not use \\$ to produce a literal
dollar sign\n"
- " processEnvironments: false, // do not process \\begin{xxx}...\\end{xxx}
outside math mode\n"
- " processRefs: false, // do not process \\ref{...} outside of math
mode\n"
- " displayMath: [ // start/end delimiter pairs for display
math\n"
- " ['\\\\[', '\\\\]']\n"
- " ],\n"
- " },");
}
setup_handler_status = html_run_stage_handlers (self, HSHT_type_setup);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/convert/format_html.c (file_header_information), tp/Texinfo/XS/convert/html_prepare_converter.c (html_setup_output): only put extra settings in MATHJAX_CONFIGURATION in C code. Do not set MATHJAX_CONFIGURATION in html_setup_output, move default MathJax configuration to file_header_information. Always output it. Only output value of MATHJAX_CONFIGURATION if set.,
Patrice Dumas <=