texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]


From: Patrice Dumas
Date: Sat, 30 Mar 2024 05:57:24 -0400 (EDT)

branch: master
commit aa79fa441a0a07f5b8422c106265567e2f097a41
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Mar 29 21:10:35 2024 +0100

    * tp/Texinfo/XS/convert/convert_html.c
    (html_prepare_converted_output_info): call message_list_document_warn
    if the input_file_name is not set for missing title message as in
    Perl.
    
    * tp/Texinfo/Convert/HTML.pm (_prepare_converted_output_info): remove
    debug message of little use.
    
    * tp/Texinfo/Convert/HTML.pm (_convert),
    tp/Texinfo/XS/convert/convert_html.c (convert_to_html_internal):
    distinguish undefined text and empty text in debug message.
    
    * tp/Texinfo/XS/convert/converter.c (table_item_content_tree): keep
    information on definfoenclose original command name.
    
    * tp/Texinfo/XS/main/builtin_commands.c (element_command_name): treat
    especially internal commands corresponding to command classes,
    CM_index_entry_command and CM_definfoenclose_command.
    
    * tp/Texinfo/XS/main/errors.c
    (message_list_document_formatted_message): no warning with debug
    message as in Perl.
    
    * tp/Texinfo/XS/main/get_perl_info.c (get_line_message): fix condition
    to issue a warning.
---
 ChangeLog                             | 28 +++++++++++++++++++++++++++
 tp/Texinfo/Convert/HTML.pm            | 10 ++++++----
 tp/Texinfo/XS/convert/convert_html.c  | 36 +++++++++++++++++++++++++----------
 tp/Texinfo/XS/convert/converter.c     |  4 ++++
 tp/Texinfo/XS/main/builtin_commands.c |  6 +++++-
 tp/Texinfo/XS/main/errors.c           |  2 ++
 tp/Texinfo/XS/main/get_perl_info.c    |  2 +-
 7 files changed, 72 insertions(+), 16 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6d60a94f4a..7cf324c433 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,31 @@
+2024-03-29  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/convert/convert_html.c
+       (html_prepare_converted_output_info): call message_list_document_warn
+       if the input_file_name is not set for missing title message as in
+       Perl.
+
+       * tp/Texinfo/Convert/HTML.pm (_prepare_converted_output_info): remove
+       debug message of little use.
+
+       * tp/Texinfo/Convert/HTML.pm (_convert),
+       tp/Texinfo/XS/convert/convert_html.c (convert_to_html_internal):
+       distinguish undefined text and empty text in debug message.
+
+       * tp/Texinfo/XS/convert/converter.c (table_item_content_tree): keep
+       information on definfoenclose original command name.
+
+       * tp/Texinfo/XS/main/builtin_commands.c (element_command_name): treat
+       especially internal commands corresponding to command classes,
+       CM_index_entry_command and CM_definfoenclose_command.
+
+       * tp/Texinfo/XS/main/errors.c
+       (message_list_document_formatted_message): no warning with debug
+       message as in Perl.
+
+       * tp/Texinfo/XS/main/get_perl_info.c (get_line_message): fix condition
+       to issue a warning.
+
 2024-03-29  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/Utils.pm (find_innermost_accent_contents): return
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 15096952b4..e8763162a7 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -12370,8 +12370,6 @@ sub _prepare_converted_output_info($)
         next if (!$command->{'args'} or !$command->{'args'}->[0]
                  or !$command->{'args'}->[0]->{'contents'}
                  or !scalar(@{$command->{'args'}->[0]->{'contents'}}));
-        print STDERR "Using $fulltitle_command as title\n"
-          if ($self->get_conf('DEBUG'));
         $fulltitle_tree = $command->{'args'}->[0];
         last;
       }
@@ -13254,8 +13252,12 @@ sub _convert($$;$)
     print STDERR " type: $element->{'type'}" if ($element->{'type'});
     my $text = $element->{'text'};
     if (defined($text)) {
-      $text =~ s/\n/\\n/;
-      print STDERR " text: $text";
+      if ($text ne '') {
+        $text =~ s/\n/\\n/;
+        print STDERR " text: $text";
+      } else {
+        print STDERR ' text(EMPTY)';
+      }
     }
     print STDERR "\n";
   }
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index b348c43f08..8f81b03b19 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -15848,12 +15848,23 @@ html_prepare_converted_output_info (CONVERTER *self)
 
       self->added_title_tree = 1;
 
-      /* setup a source info with file only */
-      memset (&cmd_source_info, 0, sizeof (SOURCE_INFO));
-      cmd_source_info.file_name = self->document->global_info->input_file_name;
-      message_list_line_error_ext(&self->error_messages, self->conf,
+      if (self->document->global_info->input_file_name)
+        {
+          /* setup a source info with file only */
+          memset (&cmd_source_info, 0, sizeof (SOURCE_INFO));
+          cmd_source_info.file_name
+           = self->document->global_info->input_file_name;
+          /* this is more in line with the Perl function used, as DEBUG is
+             checked in the called function */
+          message_list_line_error_ext (&self->error_messages, self->conf,
                                   MSG_warning, 0, &cmd_source_info,
                       "must specify a title with a title command or @top");
+        }
+      else
+        {
+          message_list_document_warn (&self->error_messages, self->conf, 0,
+                      "must specify a title with a title command or @top");
+        }
     }
 
   self->title_string = html_title_string;
@@ -17887,13 +17898,18 @@ convert_to_html_internal (CONVERTER *self, const 
ELEMENT *element,
       if (element->type)
         text_printf (&debug_str, " type: %s",
                      element_type_names[element->type]);
-      if (element->text.end > 0)
+      if (element->text.space > 0)
         {
-          int allocated;
-          char *text = debug_protect_eol (element->text.text, &allocated);
-          text_printf (&debug_str, " text: %s", text);
-          if (allocated)
-            free (text);
+          if (element->text.end > 0)
+            {
+              int allocated;
+              char *text = debug_protect_eol (element->text.text, &allocated);
+              text_printf (&debug_str, " text: %s", text);
+              if (allocated)
+                free (text);
+            }
+          else
+            text_append_n (&debug_str, " text(EMPTY)", 12);
         }
       text_append (&debug_str, "\n");
       fprintf (stderr, "%s", debug_str.text);
diff --git a/tp/Texinfo/XS/convert/converter.c 
b/tp/Texinfo/XS/convert/converter.c
index 2572527837..aef0653c9d 100644
--- a/tp/Texinfo/XS/convert/converter.c
+++ b/tp/Texinfo/XS/convert/converter.c
@@ -532,11 +532,15 @@ table_item_content_tree (CONVERTER *self, const ELEMENT 
*element)
         {
           char *begin = lookup_extra_string (command_as_argument, "begin");
           char *end = lookup_extra_string (command_as_argument, "end");
+          char *command_name = lookup_info_string (command_as_argument,
+                                                   "command_name");
           command->type = command_as_argument->type;
           if (begin)
             add_extra_string_dup (command, "begin", begin);
           if (end)
             add_extra_string_dup (command, "end", end);
+          if (command_name)
+            add_info_string_dup (command, "command_name", command_name);
         }
       add_to_element_args (command, arg);
       add_to_contents_as_array (arg, element->args.list[0]);
diff --git a/tp/Texinfo/XS/main/builtin_commands.c 
b/tp/Texinfo/XS/main/builtin_commands.c
index c1b9cb3847..18c150cf7e 100644
--- a/tp/Texinfo/XS/main/builtin_commands.c
+++ b/tp/Texinfo/XS/main/builtin_commands.c
@@ -67,7 +67,11 @@ lookup_builtin_command (const char *cmdname)
 const char *
 element_command_name (const ELEMENT *e)
 {
-  if (e->cmd && e->cmd < BUILTIN_CMD_NUMBER)
+  if (e->cmd && e->cmd < BUILTIN_CMD_NUMBER
+    /* this can happen if a tree portion is copied and to simplify
+       following code the generic command is used in the copy */
+      && e->cmd != CM_index_entry_command
+      && e->cmd != CM_definfoenclose_command)
     return builtin_command_data[e->cmd].cmdname;
   else
     {
diff --git a/tp/Texinfo/XS/main/errors.c b/tp/Texinfo/XS/main/errors.c
index daa5ac6d09..e7b6841e65 100644
--- a/tp/Texinfo/XS/main/errors.c
+++ b/tp/Texinfo/XS/main/errors.c
@@ -214,8 +214,10 @@ message_list_document_formatted_message 
(ERROR_MESSAGE_LIST *error_messages,
 
   error_message->error_line = error_line.text;
 
+  /*
   if (conf && conf->DEBUG.integer > 0)
     fprintf (stderr, "%s", error_message->error_line);
+   */
 }
 
 static void
diff --git a/tp/Texinfo/XS/main/get_perl_info.c 
b/tp/Texinfo/XS/main/get_perl_info.c
index 9d3b2f4e92..7fc39518f1 100644
--- a/tp/Texinfo/XS/main/get_perl_info.c
+++ b/tp/Texinfo/XS/main/get_perl_info.c
@@ -306,7 +306,7 @@ void
 get_line_message (CONVERTER *self, enum error_type type, int continuation,
                   SV *error_location_info, const char *message)
 {
-  int do_warn = (self->conf->DEBUG.integer > 1);
+  int do_warn = (self->conf->DEBUG.integer > 0);
   SOURCE_INFO *source_info = get_source_info (error_location_info);
   if (source_info->file_name)
     {



reply via email to

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