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_c


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/convert/convert_html.c (convert_center_command) (commands_internal_conversion_table): implement convert_center_command.
Date: Sun, 31 Dec 2023 05:03:38 -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 bba494a7fb * tp/Texinfo/XS/convert/convert_html.c 
(convert_center_command) (commands_internal_conversion_table): implement 
convert_center_command.
bba494a7fb is described below

commit bba494a7fbd69bdd7dd3f26249567277c2c995e0
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Dec 31 11:03:37 2023 +0100

    * tp/Texinfo/XS/convert/convert_html.c (convert_center_command)
    (commands_internal_conversion_table): implement
    convert_center_command.
---
 ChangeLog                            |  6 ++++++
 tp/Texinfo/XS/convert/convert_html.c | 40 ++++++++++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 62ef1644e6..334251424d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-12-31  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/convert/convert_html.c (convert_center_command)
+       (commands_internal_conversion_table): implement
+       convert_center_command.
+
 2023-12-31  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/convert/convert_html.c (convert_exdent_command)
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 5242c544aa..eab9caf970 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -10287,6 +10287,45 @@ convert_exdent_command (CONVERTER *self, const enum 
command_id cmd,
   destroy_strings_list (classes);
 }
 
+void
+convert_center_command (CONVERTER *self, const enum command_id cmd,
+                    const ELEMENT *element,
+                    const HTML_ARGS_FORMATTED *args_formatted,
+                    const char *content, TEXT *result)
+{
+  char *arg = 0;
+  char *attribute_class;
+  STRING_LIST *classes;
+
+  if (args_formatted->number > 0
+      && args_formatted->args[0].formatted[AFT_type_normal]
+      && strlen (args_formatted->args[0].formatted[AFT_type_normal]))
+    arg = args_formatted->args[0].formatted[AFT_type_normal];
+  else
+    return;
+
+  if (html_in_string (self))
+    {
+      text_append (result, arg);
+      text_append_n (result, "\n", 1);
+      return;
+    }
+
+  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);
+  text_append_n (result, ">", 1);
+  text_append (result, arg);
+  text_append_n (result, "\n", 1);
+  text_append_n (result, "</div>", 6);
+
+  free (attribute_class);
+  destroy_strings_list (classes);
+}
+
 void
 convert_xref_commands (CONVERTER *self, const enum command_id cmd,
                     const ELEMENT *element,
@@ -11148,6 +11187,7 @@ static COMMAND_INTERNAL_CONVERSION 
commands_internal_conversion_table[] = {
   {CM_verbatiminclude, &convert_verbatiminclude_command},
   {CM_sp, &convert_sp_command},
   {CM_exdent, &convert_exdent_command},
+  {CM_center, &convert_center_command},
 
   {CM_contents, &convert_contents_command},
   {CM_shortcontents, &convert_contents_command},



reply via email to

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