texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Convert/HTML.pm (%default_commands_a


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Convert/HTML.pm (%default_commands_args) (_convert_explained_command), tp/Texinfo/XS/convert/convert_html.c (default_commands_args, convert_explained_command): set 'normal' command arg for the second argument of explained commands and use it instead of calling convert_tree in convert_explained_command.
Date: Sun, 24 Dec 2023 18:13:03 -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 3c92955119 * tp/Texinfo/Convert/HTML.pm (%default_commands_args) 
(_convert_explained_command), tp/Texinfo/XS/convert/convert_html.c 
(default_commands_args, convert_explained_command): set 'normal' command arg 
for the second argument of explained commands and use it instead of calling 
convert_tree in convert_explained_command.
3c92955119 is described below

commit 3c929551196d9d3b86cd26e305257d04786e378d
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Dec 25 00:13:00 2023 +0100

    * tp/Texinfo/Convert/HTML.pm (%default_commands_args)
    (_convert_explained_command), tp/Texinfo/XS/convert/convert_html.c
    (default_commands_args, convert_explained_command): set 'normal'
    command arg for the second argument of explained commands and use
    it instead of calling convert_tree in convert_explained_command.
---
 ChangeLog                            |  8 +++++++
 tp/Texinfo/Convert/HTML.pm           | 12 ++++------
 tp/Texinfo/XS/convert/convert_html.c | 44 ++++++++++++++++--------------------
 3 files changed, 31 insertions(+), 33 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 41d8de7c02..0e3d58ada7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-12-24  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/HTML.pm (%default_commands_args)
+       (_convert_explained_command), tp/Texinfo/XS/convert/convert_html.c
+       (default_commands_args, convert_explained_command): set 'normal'
+       command arg for the second argument of explained commands and use
+       it instead of calling convert_tree in convert_explained_command.
+
 2023-12-24  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/HTML.pm (_convert_def_line_type): call
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 4a37e8ed3d..e209346917 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -2825,7 +2825,7 @@ my %default_commands_args = (
 
 foreach my $explained_command (keys(%explained_commands)) {
   $default_commands_args{$explained_command}
-     = [['normal'], ['string']];
+     = [['normal'], ['normal', 'string']];
 }
 
 # intercept warning and error messages to take 'ignore_notice' into
@@ -3384,16 +3384,11 @@ sub _convert_explained_command($$$$)
   if ($args and $args->[1] and defined($args->[1]->{'string'})
                  and $args->[1]->{'string'} =~ /\S/) {
     $explanation_string = $args->[1]->{'string'};
-
-    # Convert the explanation of the acronym.  Doing this before of after
-    # saving the explanation for the future changes the output for
-    # recursively-defined acronyms.
-    $explanation_result = $self->convert_tree($args->[1]->{'tree'},
-                                              "convert $cmdname explanation");
     $explained_commands->{$cmdname}->{$normalized_type} = $explanation_string;
   } elsif ($explained_commands->{$cmdname}->{$normalized_type}) {
     $explanation_string = $explained_commands->{$cmdname}->{$normalized_type};
   }
+
   my $result = '';
   if ($args and defined($args->[0])) {
     $result = $args->[0]->{'normal'};
@@ -3406,7 +3401,8 @@ sub _convert_explained_command($$$$)
     $result = $self->html_attribute_class($html_element, [$cmdname])
          ."${explanation}>".$result."</$html_element>";
   }
-  if (defined($explanation_result)) {
+  if ($args and $args->[1] and defined($args->[1]->{'normal'})) {
+    my $explanation_result = $args->[1]->{'normal'};
     # TRANSLATORS: abbreviation or acronym explanation
     $result = $self->convert_tree($self->gdt('{explained_string} 
({explanation})',
           {'explained_string' => {'type' => '_converted',
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index cd3128c841..a65af0751e 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -245,8 +245,8 @@ static COMMAND_ID_ARGS_SPECIFICATION 
default_commands_args[] = {
   {CM_item, {F_AFT_none}}, /* no flag */
   {CM_itemx, {F_AFT_none}}, /* no flag */
   {CM_value, {F_AFT_monospacestring}},
-  {CM_abbr, {F_AFT_normal, F_AFT_string}},
-  {CM_acronym, {F_AFT_normal, F_AFT_string}},
+  {CM_abbr, {F_AFT_normal, F_AFT_string | F_AFT_normal}},
+  {CM_acronym, {F_AFT_normal, F_AFT_string | F_AFT_normal}},
 };
 
 typedef struct COMMAND_ARGS_SPECIFICATION {
@@ -8388,8 +8388,8 @@ convert_explained_command (CONVERTER *self, const enum 
command_id cmd,
   TEXT *text_result;
   char *explained_arg = 0;
   char *normalized_type = 0;
-  char *explanation_result = 0;
   char *explanation_string = 0;
+  char *explanation_result = 0;
   EXPLAINED_COMMAND_TYPE_LIST *type_explanations
     = &self->shared_conversion_state.explained_commands;
 
@@ -8401,32 +8401,27 @@ convert_explained_command (CONVERTER *self, const enum 
command_id cmd,
   else
     normalized_type = strdup ("");
 
-  if (args_formatted && args_formatted->number > 1
-      && args_formatted->args[1].formatted[AFT_type_string])
+  if (args_formatted && args_formatted->number > 1)
     {
-      explanation_string
-        = args_formatted->args[1].formatted[AFT_type_string];
+      if (args_formatted->args[1].formatted[AFT_type_string])
+        {
+          explanation_string
+            = args_formatted->args[1].formatted[AFT_type_string];
 
-      if (explanation_string[strspn
+          if (explanation_string[strspn
                      (explanation_string, whitespace_chars)] != '\0')
-        {
-          char *conversion_description;
-   /* Convert the explanation of the acronym.  Doing this before of after
-      saving the explanation for the future changes the output for
-      recursively-defined acronyms. */
-          xasprintf (&conversion_description, "convert %s explanation",
-                                            builtin_command_name (cmd));
-          explanation_result
-            = html_convert_tree (self, args_formatted->args[1].tree,
-                                 conversion_description);
-          free (conversion_description);
-          register_explained_command_string (type_explanations,
+            {
+              register_explained_command_string (type_explanations,
                            cmd, normalized_type, explanation_string);
-        }
-      else
-        explanation_string = 0;
+            }
+          else
+            explanation_string = 0;
+       }
+     if (args_formatted->args[1].formatted[AFT_type_normal])
+       explanation_result = args_formatted->args[1].formatted[AFT_type_normal];
     }
-  else
+
+  if (!explanation_string)
     {
       EXPLAINED_COMMAND_TYPE *type_explanation
           = find_explained_command_string (type_explanations,
@@ -8485,7 +8480,6 @@ convert_explained_command (CONVERTER *self, const enum 
command_id cmd,
       text_append (&explained_string_element->text, text_result->text);
       free (text_result->text);
       text_append (&explanation_result_element->text, explanation_result);
-      free (explanation_result);
 
       add_element_to_named_string_element_list (substrings,
                           "explained_string", explained_string_element);



reply via email to

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