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 (html_defa


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/convert/convert_html.c (html_default_format_heading_text): handle the case of being in string.
Date: Sat, 30 Dec 2023 09:11:56 -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 4fdd57172e * tp/Texinfo/XS/convert/convert_html.c 
(html_default_format_heading_text): handle the case of being in string.
4fdd57172e is described below

commit 4fdd57172e095df089a268331aa76ffa1fa27ddc
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Dec 30 15:11:53 2023 +0100

    * tp/Texinfo/XS/convert/convert_html.c
    (html_default_format_heading_text): handle the case of being in
    string.
    
    * tp/Texinfo/XS/convert/convert_html.c (convert_titlefont_command)
    (commands_internal_conversion_table): implement in C.
---
 ChangeLog                            |  9 +++++++++
 tp/Texinfo/Convert/HTML.pm           |  2 +-
 tp/Texinfo/XS/convert/convert_html.c | 35 ++++++++++++++++++++++++++++++++---
 3 files changed, 42 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index bd7814342c..bfc0e21e02 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2023-12-30  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/convert/convert_html.c
+       (html_default_format_heading_text): handle the case of being in
+       string.
+
+       * tp/Texinfo/XS/convert/convert_html.c (convert_titlefont_command)
+       (commands_internal_conversion_table): implement in C.
+
 2023-12-30  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/HTML.pm (_accent_entities_html_accent): do not
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index ab91aba8ea..dfeac2a27c 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -4049,7 +4049,7 @@ sub _default_format_heading_text($$$$$;$$$)
 
   return '' if ($text !~ /\S/ and not defined($id));
 
-  # This should seldom happen.
+  # This happens with titlefont in title for instance
   if (in_string($self)) {
     $text .= "\n" unless (defined($cmdname) and $cmdname eq 'titlefont');
     return $text;
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 1f35b12b9e..6fb4b69018 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -5715,6 +5715,15 @@ html_default_format_heading_text (CONVERTER *self, const 
enum command_id cmd,
   if (!id && text[strspn (text, whitespace_chars)] == '\0')
     return;
 
+  /* This happens with titlefont in title for instance */
+  if (html_in_string (self))
+    {
+      text_append (result, text);
+      if (cmd != CM_titlefont)
+        text_append_n (result, "\n", 1);
+      return;
+    }
+
   if (level < 1)
     heading_level = 1;
   else if (level > self->conf->MAX_HEADER_LEVEL)
@@ -6054,7 +6063,6 @@ format_heading_text (CONVERTER *self, const enum 
command_id cmd,
                      const STRING_LIST *classes, const char *text,
                      int level, const char *id, const ELEMENT *element,
                      const char *target, TEXT *result)
-
 {
   FORMATTING_REFERENCE *formatting_reference
    = &self->current_formatting_references[FR_format_heading_text];
@@ -9156,6 +9164,26 @@ convert_indicateurl_command (CONVERTER *self, const enum 
command_id cmd,
   text_append (result, self->conf->CLOSE_QUOTE_SYMBOL);
 }
 
+void
+convert_titlefont_command (CONVERTER *self, const enum command_id cmd,
+                    const ELEMENT *element,
+                    const HTML_ARGS_FORMATTED *args_formatted,
+                    const char *content, TEXT *result)
+{
+  if (args_formatted->number > 0
+      && args_formatted->args[0].formatted[AFT_type_normal]
+      && strlen (args_formatted->args[0].formatted[AFT_type_normal]))
+    {
+      STRING_LIST *classes;
+      classes = (STRING_LIST *) malloc (sizeof (STRING_LIST));
+      memset (classes, 0, sizeof (STRING_LIST));
+      add_string (builtin_command_name (cmd), classes);
+      format_heading_text (self, cmd, classes,
+                   args_formatted->args[0].formatted[AFT_type_normal],
+                     0, 0, 0, 0, result);
+    }
+}
+
 void
 convert_raw_command (CONVERTER *self, const enum command_id cmd,
                     const ELEMENT *element,
@@ -10613,8 +10641,9 @@ static COMMAND_INTERNAL_CONVERSION 
commands_internal_conversion_table[] = {
   {CM_footnote, &convert_footnote_command},
   {CM_uref, &convert_uref_command},
   {CM_url, &convert_uref_command},
-  {CM_image, convert_image_command},
-  {CM_math, convert_math_command},
+  {CM_image, &convert_image_command},
+  {CM_math, &convert_math_command},
+  {CM_titlefont, &convert_titlefont_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]