texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/ParserNonXS.pm (_end_line_starting_b


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/ParserNonXS.pm (_end_line_starting_block), tp/Texinfo/XS/parsetexi/end_line.c (end_line_starting_block): check only that there is a command_as_argument, not the parent command to error on accent command being used as command_as_argument.
Date: Fri, 24 Feb 2023 17:02: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 43b4697d82 * tp/Texinfo/ParserNonXS.pm (_end_line_starting_block), 
tp/Texinfo/XS/parsetexi/end_line.c (end_line_starting_block): check only that 
there is a command_as_argument, not the parent command to error on accent 
command being used as command_as_argument.
43b4697d82 is described below

commit 43b4697d825b4b9397e773cecd0469f582b5f09d
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Feb 24 23:01:57 2023 +0100

    * tp/Texinfo/ParserNonXS.pm (_end_line_starting_block),
    tp/Texinfo/XS/parsetexi/end_line.c (end_line_starting_block): check
    only that there is a command_as_argument, not the parent command to
    error on accent command being used as command_as_argument.
    
    * tp/Texinfo/ParserNonXS.pm (_end_line_starting_block): remove
    a useless check of contents content.
    
    * tp/Texinfo/XS/parsetexi/end_line.c (end_line_starting_block): use
    a else if to be more similar to pure parser code.
---
 ChangeLog                          | 13 +++++++++++++
 tp/Texinfo/ParserNonXS.pm          | 12 +++++-------
 tp/Texinfo/XS/parsetexi/end_line.c | 30 ++++++++++++------------------
 3 files changed, 30 insertions(+), 25 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2f085bb898..79e0d15e93 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2023-02-24  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/ParserNonXS.pm (_end_line_starting_block),
+       tp/Texinfo/XS/parsetexi/end_line.c (end_line_starting_block): check
+       only that there is a command_as_argument, not the parent command to
+       error on accent command being used as command_as_argument.
+
+       * tp/Texinfo/ParserNonXS.pm (_end_line_starting_block): remove
+       a useless check of contents content.
+
+       * tp/Texinfo/XS/parsetexi/end_line.c (end_line_starting_block): use
+       a else if to be more similar to pure parser code.
+
 2023-02-24  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/ParserNonXS.pm (_close_current)
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 08dde4c299..1a67057d01 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -3948,12 +3948,11 @@ sub _end_line_starting_block($$$)
         }
       }
     }
+    # Check if command_as_argument isn't an accent command
     if ($current->{'extra'}
         and $current->{'extra'}->{'command_as_argument'}
         and $accent_commands{$current->{'extra'}->{'command_as_argument'}
-                                                                 ->{'cmdname'}}
-        and ($command eq 'itemize'
-             or $block_commands{$command} eq 'item_line')) {
+                                                            ->{'cmdname'}}) {
       # this can only happen to an accent command with brace, if without
       # brace it is not set as command_as_argument to begin with.
       $self->_command_warn($current, $source_info,
@@ -3966,10 +3965,9 @@ sub _end_line_starting_block($$$)
       }
     }
     if ($command eq 'itemize') {
-      if ((!$current->{'args'}
-          or !$current->{'args'}->[0]
-          or !$current->{'args'}->[0]->{'contents'}
-          or !@{$current->{'args'}->[0]->{'contents'}})) {
+      if (!$current->{'args'}
+          or !scalar(@{$current->{'args'}})
+          or !$current->{'args'}->[0]->{'contents'}) {
         my $block_line_arg;
         if ($current->{'args'} and $current->{'args'}->[-1]
             and $current->{'args'}->[-1]->{'type'}
diff --git a/tp/Texinfo/XS/parsetexi/end_line.c 
b/tp/Texinfo/XS/parsetexi/end_line.c
index de59eefea5..205e4d87c7 100644
--- a/tp/Texinfo/XS/parsetexi/end_line.c
+++ b/tp/Texinfo/XS/parsetexi/end_line.c
@@ -1230,15 +1230,13 @@ end_line_starting_block (ELEMENT *current)
                                  command_name(command));
                   k->key = "";
                   k->type = extra_deleted;
-                  /* FIXME: Error message for accent commands is done
-                     elsewhere (3040). */
                 }
             }
         }
 
       /* check that command_as_argument of the @itemize is alone on the line,
          otherwise it is not a command_as_argument */
-      if (command == CM_itemize)
+      else if (command == CM_itemize)
         {
           KEY_PAIR *k;
           k = lookup_extra (current, "command_as_argument");
@@ -1274,25 +1272,21 @@ end_line_starting_block (ELEMENT *current)
         }
 
       /* Check if command_as_argument isn't an accent command */
-      if (command == CM_itemize || item_line_command(command))
+      KEY_PAIR *k = lookup_extra (current, "command_as_argument");
+      if (k && k->value)
         {
-          KEY_PAIR *k = lookup_extra (current, "command_as_argument");
-          if (k && k->value)
+          enum command_id cmd = k->value->cmd;
+          if (cmd && (command_data(cmd).flags & CF_accent))
             {
-              enum command_id cmd = k->value->cmd;
-              if (cmd && (command_data(cmd).flags & CF_accent))
-                {
-                  command_warn (current, "accent command `@%s' "
-                                "not allowed as @%s argument",
-                                command_name(cmd),
-                                command_name(command));
-                  k->key = "";
-                  k->value = 0;
-                  k->type = extra_deleted;
-                }
+              command_warn (current, "accent command `@%s' "
+                            "not allowed as @%s argument",
+                            command_name(cmd),
+                            command_name(command));
+              k->key = "";
+              k->value = 0;
+              k->type = extra_deleted;
             }
         }
-
       /* if no command_as_argument given, default to @bullet for
          @itemize, and @asis for @table. */
       if (command == CM_itemize



reply via email to

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