texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/convert/convert_html.c (convert_m


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/convert/convert_html.c (convert_math_command) (commands_internal_conversion_table): implement convert_math_command in C.
Date: Fri, 29 Dec 2023 00:32:08 -0500

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 fdd232e09d * tp/Texinfo/XS/convert/convert_html.c 
(convert_math_command) (commands_internal_conversion_table): implement 
convert_math_command in C.
fdd232e09d is described below

commit fdd232e09dd9bec484d099bb86ac6d42f25a6a1b
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Dec 29 06:32:01 2023 +0100

    * tp/Texinfo/XS/convert/convert_html.c (convert_math_command)
    (commands_internal_conversion_table): implement convert_math_command
    in C.
---
 ChangeLog                            |  6 ++++++
 tp/Texinfo/XS/convert/convert_html.c | 39 ++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index ef6988c6bd..456b7a42c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-12-29  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/convert/convert_html.c (convert_math_command)
+       (commands_internal_conversion_table): implement convert_math_command
+       in C.
+
 2023-12-28  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/convert/convert_html.c (url_protect_file_text): cast
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index a47009b098..99d2fabcb0 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -8986,6 +8986,44 @@ convert_image_command (CONVERTER *self, const enum 
command_id cmd,
     }
 }
 
+void
+convert_math_command (CONVERTER *self, const enum command_id cmd,
+                    const ELEMENT *element,
+                    const HTML_ARGS_FORMATTED *args_formatted,
+                    const char *content, TEXT *result)
+{
+  char *attribute_class;
+  STRING_LIST *classes;
+  char *arg;
+
+  if (!args_formatted || args_formatted->number <= 0
+      || !args_formatted->args[0].formatted[AFT_type_normal])
+    return;
+
+  arg = args_formatted->args[0].formatted[AFT_type_normal];
+
+  classes = (STRING_LIST *) malloc (sizeof (STRING_LIST));
+  memset (classes, 0, sizeof (STRING_LIST));
+  add_string (builtin_command_name (cmd), classes);
+
+  if (self->conf->HTML_MATH && !strcmp (self->conf->HTML_MATH, "mathjax"))
+    {
+      html_register_file_information (self, "mathjax", 1);
+      add_string ("tex2jax_process", classes);
+      attribute_class = html_attribute_class (self, "em", classes);
+      text_append (result, attribute_class);
+      text_printf (result, ">\\(%s\\)</em>", arg);
+      return;
+    }
+
+  attribute_class = html_attribute_class (self, "em", classes);
+  text_append (result, attribute_class);
+  text_printf (result, ">%s</em>", arg);
+
+  destroy_strings_list (classes);
+  free (attribute_class);
+}
+
 void
 convert_indicateurl_command (CONVERTER *self, const enum command_id cmd,
                     const ELEMENT *element,
@@ -10481,6 +10519,7 @@ static COMMAND_INTERNAL_CONVERSION 
commands_internal_conversion_table[] = {
   {CM_uref, &convert_uref_command},
   {CM_url, &convert_uref_command},
   {CM_image, convert_image_command},
+  {CM_math, convert_math_command},
 
   /* note that if indicateurl had been in self->style_formatted_cmd this
      would have prevented indicateurl to be associated to



reply via email to

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