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_menu_comment_type) (convert_before_item_type, types_internal_conversion_table): implement convert_menu_comment_type and convert_before_item_type.
Date: Thu, 04 Jan 2024 18:51:32 -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 066098b572 * tp/Texinfo/XS/convert/convert_html.c 
(convert_menu_comment_type) (convert_before_item_type, 
types_internal_conversion_table): implement convert_menu_comment_type and 
convert_before_item_type.
066098b572 is described below

commit 066098b572fa24427487a1a5c4a378e53c2e5d46
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Jan 5 00:51:29 2024 +0100

    * tp/Texinfo/XS/convert/convert_html.c (convert_menu_comment_type)
    (convert_before_item_type, types_internal_conversion_table): implement
    convert_menu_comment_type and convert_before_item_type.
---
 ChangeLog                            |   6 +++
 tp/Texinfo/XS/convert/convert_html.c | 101 ++++++++++++++++++++++++++++++-----
 2 files changed, 95 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9888a9e22a..eac4a3cd61 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-01-04  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/convert/convert_html.c (convert_menu_comment_type)
+       (convert_before_item_type, types_internal_conversion_table): implement
+       convert_menu_comment_type and convert_before_item_type.
+
 2024-01-04  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/HTML.pm (_convert_menu_entry_type): use a
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 373d8c79da..8fcd821506 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -13547,6 +13547,93 @@ convert_menu_entry_type (CONVERTER *self, const enum 
element_type type,
   free (href);
 }
 
+static char *menu_comment_array[] = {"menu-comment"};
+static const STRING_LIST menu_comment_classes = {menu_comment_array, 1, 1};
+
+void
+convert_menu_comment_type (CONVERTER *self, const enum element_type type,
+                       const ELEMENT *element, const char *content,
+                       TEXT *result)
+{
+  char *attribute_class;
+
+  if (html_inside_preformatted (self) || html_in_string (self))
+    {
+      if (content)
+        text_append (result, content);
+      return;
+    }
+
+  text_append_n (result, "<tr>", 4);
+  attribute_class = html_attribute_class (self, "th",
+                                &menu_comment_classes);
+  text_append (result, attribute_class);
+  free (attribute_class);
+  text_append_n (result, " colspan=\"3\">", 13);
+
+  if (content)
+    text_append (result, content);
+
+  text_append_n (result, "</th></tr>", 10);
+}
+
+void
+convert_before_item_type (CONVERTER *self, const enum element_type type,
+                       const ELEMENT *element, const char *content,
+                       TEXT *result)
+{
+  enum command_id in_format_cmd;
+
+  if (!content || content[strspn (content, whitespace_chars)] == '\0')
+    return;
+
+  if (html_in_string (self))
+    {
+      text_append (result, content);
+      return;
+    }
+
+  in_format_cmd = html_top_block_command (self);
+
+  if (in_format_cmd == CM_itemize || in_format_cmd == CM_enumerate)
+    {
+      text_append_n (result, "<li>", 4);
+      text_append (result, content);
+      text_append_n (result, "</li>", 5);
+    }
+  else if (in_format_cmd == CM_table || in_format_cmd == CM_vtable
+           || in_format_cmd == CM_ftable)
+    {
+      text_append_n (result, "<dd>", 4);
+      text_append (result, content);
+      text_append_n (result, "</dd>\n", 6);
+    }
+  else if (in_format_cmd == CM_multitable)
+    {
+      char *trimmed_content;
+      const char *p = content;
+      p += strspn (p, whitespace_chars);
+      trimmed_content = trim_trailing_content (p);
+
+      text_append_n (result, "<tr><td>", 8);
+      text_append (result, trimmed_content);
+      free (trimmed_content);
+      text_append_n (result, "</td></tr>\n", 11);
+    }
+}
+
+void
+convert_table_term_type (CONVERTER *self, const enum element_type type,
+                        const ELEMENT *element, const char *content,
+                        TEXT *result)
+{
+  if (content)
+    {
+      text_append (result, "<dt>");
+      text_append (result, content);
+    }
+}
+
 #define static_class(name, class) \
 static char * name ##_array[] = {#class}; \
 static const STRING_LIST name ##_classes = {name ##_array, 1, 1};
@@ -13919,24 +14006,14 @@ convert_def_line_type (CONVERTER *self, const enum 
element_type type,
   free (anchor);
 }
 
-void
-convert_table_term_type (CONVERTER *self, const enum element_type type,
-                        const ELEMENT *element, const char *content,
-                        TEXT *result)
-{
-  if (content)
-    {
-      text_append (result, "<dt>");
-      text_append (result, content);
-    }
-}
-
 /* associate type to the C function implementing the conversion */
 static TYPE_INTERNAL_CONVERSION types_internal_conversion_table[] = {
   {ET_balanced_braces, &convert_balanced_braces_type},
+  {ET_before_item, convert_before_item_type},
   {ET_def_line, &convert_def_line_type},
   {ET_definfoenclose_command, &convert_definfoenclose_type},
   {ET_index_entry_command, &convert_index_entry_command_type},
+  {ET_menu_comment, &convert_menu_comment_type},
   {ET_menu_entry, convert_menu_entry_type},
   {ET_multitable_body, &convert_multitable_body_type},
   {ET_multitable_head, &convert_multitable_head_type},



reply via email to

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