texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Sun, 29 Sep 2024 10:18:14 -0400 (EDT)

branch: master
commit 89cc9df294b665b819583453a714788eb272d28e
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Jul 4 21:51:09 2024 +0200

    * tp/Texinfo/Convert/Plaintext.pm (_convert): try to make code finding
    next @*ref element more straightforward.
---
 ChangeLog                       |  5 +++++
 tp/Texinfo/Convert/Plaintext.pm | 11 +++++------
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 117be4c21f..279a1bdb7b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-07-04  Patrice Dumas  <pertusus@free.f>
+
+       * tp/Texinfo/Convert/Plaintext.pm (_convert): try to make code finding
+       next @*ref element more straightforward.
+
 2024-07-04  Patrice Dumas  <pertusus@free.f>
 
        * tp/Texinfo/Convert/Plaintext.pm (process_printindex): output for
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index b9ef03ae70..7fb3ca6af1 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -2978,14 +2978,13 @@ sub _convert($$)
           if ($name) {
             # Find next element
             my $next;
-            my $count = 0;
-
-            for my $e (@{$self->{'current_contents'}->[-1]}) {
-               if ($count == 1) {
-                 $next = $e;
+            my $current_contents = $self->{'current_contents'}->[-1];
+            my $contents_nr = scalar(@$current_contents);
+            for (my $i = 0; $i < $contents_nr - 1; $i++) {
+               if ($current_contents->[$i] == $element) {
+                 $next = $current_contents->[$i+1];
                  last;
                }
-               $count++ if $e == $element;
             }
 
             if (!($next and $next->{'text'}



reply via email to

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