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_t


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/convert/convert_html.c (convert_title_command) (convert_subtitle_command, commands_internal_conversion_table): implement convert_title_command and convert_subtitle_command.
Date: Sun, 31 Dec 2023 05:47:10 -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 c26878eb02 * tp/Texinfo/XS/convert/convert_html.c 
(convert_title_command) (convert_subtitle_command, 
commands_internal_conversion_table): implement convert_title_command and 
convert_subtitle_command.
c26878eb02 is described below

commit c26878eb022666591bb3578547fc151457be3653
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Dec 31 11:47:09 2023 +0100

    * tp/Texinfo/XS/convert/convert_html.c (convert_title_command)
    (convert_subtitle_command, commands_internal_conversion_table):
    implement convert_title_command and convert_subtitle_command.
---
 ChangeLog                            |  6 +++
 tp/Texinfo/XS/convert/convert_html.c | 78 ++++++++++++++++++++++++++++++++++++
 2 files changed, 84 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index ed03d14ae8..9822327003 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_title_command)
+       (convert_subtitle_command, commands_internal_conversion_table):
+       implement convert_title_command and convert_subtitle_command.
+
 2023-12-31  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/convert/convert_html.c (convert_author_command),
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 60839eb636..82d240edba 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -10372,6 +10372,82 @@ convert_author_command (CONVERTER *self, const enum 
command_id cmd,
   destroy_strings_list (classes);
 }
 
+void
+convert_title_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);
+      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, "h1", classes);
+  text_append (result, attribute_class);
+  text_append_n (result, ">", 1);
+  text_append (result, arg);
+  text_append_n (result, "</h1>", 5);
+  text_append_n (result, "\n", 1);
+
+  free (attribute_class);
+  destroy_strings_list (classes);
+}
+
+void
+convert_subtitle_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);
+      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, "h3", classes);
+  text_append (result, attribute_class);
+  text_append_n (result, ">", 1);
+  text_append (result, arg);
+  text_append_n (result, "</h3>", 5);
+  text_append_n (result, "\n", 1);
+
+  free (attribute_class);
+  destroy_strings_list (classes);
+}
+
 void
 convert_xref_commands (CONVERTER *self, const enum command_id cmd,
                     const ELEMENT *element,
@@ -11235,6 +11311,8 @@ static COMMAND_INTERNAL_CONVERSION 
commands_internal_conversion_table[] = {
   {CM_exdent, &convert_exdent_command},
   {CM_center, &convert_center_command},
   {CM_author, &convert_author_command},
+  {CM_title, &convert_title_command},
+  {CM_subtitle, &convert_subtitle_command},
 
   {CM_contents, &convert_contents_command},
   {CM_shortcontents, &convert_contents_command},



reply via email to

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