texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Convert/Info.pm (output): Rename a v


From: Gavin D. Smith
Subject: branch master updated: * tp/Texinfo/Convert/Info.pm (output): Rename a variable to be less confusing. Explain in comment that setting 'text_before_first_node' was a side-effect of calling convert_output_unit, and explain the purpose of saving it. Reorder code slightly for clarity. No functional changes intended.
Date: Mon, 15 Jan 2024 15:57:32 -0500

This is an automated email from the git hooks/post-receive script.

gavin pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 5a18fc618a * tp/Texinfo/Convert/Info.pm (output): Rename a variable to 
be less confusing.  Explain in comment that setting 'text_before_first_node' 
was a side-effect of calling convert_output_unit, and explain the purpose of 
saving it.  Reorder code slightly for clarity.  No functional changes intended.
5a18fc618a is described below

commit 5a18fc618ad266fe9e2f3c9227725d7dc43e0fe0
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Mon Jan 15 20:52:12 2024 +0000

    * tp/Texinfo/Convert/Info.pm (output): Rename a variable
    to be less confusing.  Explain in comment that setting
    'text_before_first_node' was a side-effect of calling
    convert_output_unit, and explain the purpose of saving it.  Reorder
    code slightly for clarity.  No functional changes intended.
---
 ChangeLog                  |  8 ++++++++
 tp/Texinfo/Convert/Info.pm | 17 ++++++++++-------
 2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2f6d64ae66..e5c8d59e33 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-01-15  Gavin Smith <gavinsmith0123@gmail.com>
+
+       * tp/Texinfo/Convert/Info.pm (output): Rename a variable
+       to be less confusing.  Explain in comment that setting
+       'text_before_first_node' was a side-effect of calling
+       convert_output_unit, and explain the purpose of saving it.  Reorder
+       code slightly for clarity.  No functional changes intended.
+
 2024-01-15  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Indices.pm, tp/Texinfo/Structuring.pm, tp/Makefile.am
diff --git a/tp/Texinfo/Convert/Info.pm b/tp/Texinfo/Convert/Info.pm
index 2d4ab9a3c7..16ae0d832e 100644
--- a/tp/Texinfo/Convert/Info.pm
+++ b/tp/Texinfo/Convert/Info.pm
@@ -143,23 +143,26 @@ sub output($$)
              {'file_name' => $self->{'document_info'}->{'input_file_name'}});
     }
     $out_file_nr = 1;
-    my $first_node = 0;
+    my $first_node_seen = 0;
     $self->{'count_context'}->[-1]->{'bytes'} += $header_bytes;
     # FIXME use a simple foreach
     my @nodes_root_elements = @$tree_units;
     while (@nodes_root_elements) {
       my $node_root_element = shift @nodes_root_elements;
       my $node_text = $self->convert_output_unit($node_root_element);
-      if (!$first_node) {
-        $first_node = 1;
+      if (!$first_node_seen) {
+        # We are outputting the first node.
+        $first_node_seen = 1;
+        $node_text = $header . $node_text;
+
+        # When the first node was converted in convert_output_unit above, the
+        # text before the first node (type 'before_node_section') was saved in
+        # 'text_before_first_node'.  Save this text for subsequent use in
+        # case of split Info output.
         if (defined($self->{'text_before_first_node'})) {
           $complete_header .= $self->{'text_before_first_node'};
           $complete_header_bytes += length($self->{'text_before_first_node'});
         }
-        # for the first node, header is prepended, not complete_header
-        # as 'text_before_first_node' is already part of the node
-        # text
-        $node_text = $header . $node_text;
       }
       if ($fh) {
         print $fh $node_text;



reply via email to

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