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_d


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/convert/convert_html.c (convert_displaymath_command) 'commands_internal_conversion_table): implement convert_displaymath_command.
Date: Sat, 30 Dec 2023 19:05:07 -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 7c5da730de * tp/Texinfo/XS/convert/convert_html.c 
(convert_displaymath_command) 'commands_internal_conversion_table): implement 
convert_displaymath_command.
7c5da730de is described below

commit 7c5da730dec7bbe044cb7aaa6ae847574ccb422b
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Dec 31 01:05:04 2023 +0100

    * tp/Texinfo/XS/convert/convert_html.c (convert_displaymath_command)
    'commands_internal_conversion_table): implement
    convert_displaymath_command.
---
 ChangeLog                            |  6 +++++
 tp/Texinfo/XS/convert/convert_html.c | 47 ++++++++++++++++++++++++++++++++++++
 2 files changed, 53 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 213c356ec9..fa5409e499 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-12-30  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/convert/convert_html.c (convert_displaymath_command)
+       'commands_internal_conversion_table): implement
+       convert_displaymath_command.
+
 2023-12-30  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/convert/convert_html.c (convert_verbatim_command)
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 6d9ac52d61..ed1cce58e7 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -10111,6 +10111,52 @@ convert_verbatim_command (CONVERTER *self, const enum 
command_id cmd,
    }
 }
 
+void
+convert_displaymath_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;
+
+  if (html_in_string (self))
+    {
+      if (content)
+        text_append (result, content);
+    }
+
+  classes = (STRING_LIST *) malloc (sizeof (STRING_LIST));
+  memset (classes, 0, sizeof (STRING_LIST));
+  add_string (builtin_command_name (cmd), classes);
+  attribute_class = html_attribute_class (self, "div", classes);
+  text_append (result, attribute_class);
+  free (attribute_class);
+  text_append_n (result, ">", 1);
+
+  clear_strings_list (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>", content);
+      goto out;
+    }
+
+  attribute_class = html_attribute_class (self, "em", 0);
+  text_append (result, attribute_class);
+  text_printf (result, ">%s</em>", content);
+
+ out:
+  text_append_n (result, "</div>", 6);
+
+  destroy_strings_list (classes);
+  free (attribute_class);
+}
+
 void
 convert_xref_commands (CONVERTER *self, const enum command_id cmd,
                     const ELEMENT *element,
@@ -10963,6 +11009,7 @@ static COMMAND_INTERNAL_CONVERSION 
commands_internal_conversion_table[] = {
   {CM_indentedblock, &convert_indented_command},
   {CM_smallindentedblock, &convert_indented_command},
   {CM_verbatim, &convert_verbatim_command},
+  {CM_displaymath, &convert_displaymath_command},
 
   {CM_contents, &convert_contents_command},
   {CM_shortcontents, &convert_contents_command},



reply via email to

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