texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Convert/Plaintext.pm (convert_line_n


From: Gavin D. Smith
Subject: branch master updated: * tp/Texinfo/Convert/Plaintext.pm (convert_line_new_context): Unconditionally disable encoding in the nested count context and remove a parameter. All callers updated. (node_name): Call _stream_encode on the result of convert_line_new_context in order still to work with an encoded node name.
Date: Wed, 24 Jan 2024 14:41:10 -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 a6788509f9 * tp/Texinfo/Convert/Plaintext.pm 
(convert_line_new_context): Unconditionally disable encoding in the nested 
count context and remove a parameter.  All callers updated. (node_name): Call 
_stream_encode on the result of convert_line_new_context in order still to work 
with an encoded node name.
a6788509f9 is described below

commit a6788509f96c2bfa393fc64002e4b6c2da8b6f6d
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Wed Jan 24 19:41:02 2024 +0000

    * tp/Texinfo/Convert/Plaintext.pm (convert_line_new_context):
    Unconditionally disable encoding in the nested count context
    and remove a parameter.  All callers updated.
    (node_name): Call _stream_encode on the result of
    convert_line_new_context in order still to work with an encoded
    node name.
---
 ChangeLog                       |  9 +++++++++
 tp/Texinfo/Convert/Info.pm      |  2 +-
 tp/Texinfo/Convert/Plaintext.pm | 29 +++++++++++++----------------
 3 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 35ecfeb2ad..318622642b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-01-24  Gavin Smith <gavinsmith0123@gmail.com>
+
+       * tp/Texinfo/Convert/Plaintext.pm (convert_line_new_context):
+       Unconditionally disable encoding in the nested count context
+       and remove a parameter.  All callers updated.
+       (node_name): Call _stream_encode on the result of
+       convert_line_new_context in order still to work with an encoded
+       node name.
+
 2024-01-24  Gavin Smith <gavinsmith0123@gmail.com>
 
        * tp/Texinfo/Convert/Plaintext.pm (process_printindex)
diff --git a/tp/Texinfo/Convert/Info.pm b/tp/Texinfo/Convert/Info.pm
index 04fff3f421..30814f6db5 100644
--- a/tp/Texinfo/Convert/Info.pm
+++ b/tp/Texinfo/Convert/Info.pm
@@ -455,7 +455,7 @@ sub _info_header($$$)
         if ($command->{'args'} and @{$command->{'args'}}
             and defined($command->{'args'}->[0]->{'contents'})) {
           my ($converted, undef) = $self->convert_line_new_context(
-             {'contents' => $command->{'args'}->[0]->{'contents'}}, undef, 1);
+             {'contents' => $command->{'args'}->[0]->{'contents'}});
           $self->_stream_output("INFO-DIR-SECTION " . $converted . "\n");
         }
       } elsif ($command->{'cmdname'} eq 'direntry') {
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index 6a09def4af..e776963f49 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -846,15 +846,12 @@ sub convert_line($$;$)
 
 # convert with a line formatter in a new count context, not changing
 # the current context.  return the result of the conversion.
-sub convert_line_new_context($$;$$)
+sub convert_line_new_context($$;$)
 {
-  my ($self, $converted, $conf, $encoding_disabled) = @_;
+  my ($self, $converted, $conf) = @_;
 
-  push @{$self->{'count_context'}}, {'lines' => 0, 'bytes' => 0};
-  if ($encoding_disabled) {
-    # TODO: Update all callers and make this the only option.
-    $self->{'count_context'}->[-1]->{'encoding_disabled'} = 1;
-  }
+  push @{$self->{'count_context'}}, {'lines' => 0, 'bytes' => 0,
+                                     'encoding_disabled' => 1};
   my $formatter = $self->new_formatter('line', $conf);
   push @{$self->{'formatters'}}, $formatter;
   $self->_convert($converted);
@@ -1390,8 +1387,7 @@ sub format_contents($$$)
         _stream_output($self, ' ' x $repeat_count);
       }
       my ($text, undef) = $self->convert_line_new_context(
-            {'contents' => [$section_title_tree],
-             'type' => 'frenchspacing'}, undef, 1);
+            {'contents' => [$section_title_tree], 'type' => 'frenchspacing'});
       chomp ($text);
       $text .= "\n";
       _stream_output($self, $text);
@@ -1467,6 +1463,7 @@ sub node_name($$)
     my ($result, $width) = $self->convert_line_new_context($node_text,
                                     {'suppress_styles' => 1,
                                      'no_added_eol' => 1,});
+    $result = $self->_stream_encode($result);
     $self->{'node_names_text'}->{$node}
       = {'text' => _normalize_top_node($result),
          'width' => $width };
@@ -1664,7 +1661,7 @@ sub process_printindex($$;$)
        if (!$self->{'outside_of_any_node_text'}) {
           my $tree = $self->gdt('(outside of any node)');
           my ($node_text, $width)
-            = $self->convert_line_new_context($tree, undef, 1);
+            = $self->convert_line_new_context($tree);
           $self->{'outside_of_any_node_text'} = $node_text;
           $self->{'outside_of_any_node_text_width'} = $width;
        }
@@ -1855,7 +1852,7 @@ sub _text_heading($$$;$$)
 
   my ($heading, undef) = $self->convert_line_new_context (
                               {'type' => 'frenchspacing',
-                               'contents' => [$heading_element]}, undef, 1);
+                               'contents' => [$heading_element]});
 
   my $text;
   if (defined($number)) {
@@ -2458,7 +2455,7 @@ sub _convert($$)
                                           {'type' => '_code',
                                            'contents' => [$label_element]},
                                           {'suppress_styles' => 1,
-                                            'no_added_eol' => 1}, undef, 1);
+                                            'no_added_eol' => 1});
             $self->{'silent'}--;
           }
 
@@ -2967,7 +2964,7 @@ sub _convert($$)
           $prepended->{'type'} = 'frenchspacing';
           #_convert($self, $prepended);
           my ($converted, $width, $extra_lines)
-            = $self->convert_line_new_context($prepended, undef, 1);
+            = $self->convert_line_new_context($prepended);
           _stream_output($self, $converted);
           $self->{'count_context'}->[-1]->{'lines'} += $extra_lines;
 
@@ -2991,8 +2988,8 @@ sub _convert($$)
               my $column_size = 0;
               if ($content->{'contents'}) {
                 my ($formatted_prototype, $width)
-                    = $self->convert_line_new_context($content,
-                                                      {'indent_length' => 0});
+                    = $self->convert_line_new_context
+                        ($content, {'indent_length' => 0});
                 $column_size = $width;
               }
               push @$columnsize, 2+$column_size;
@@ -4077,7 +4074,7 @@ sub _convert($$)
         if ($prepended) {
           $prepended->{'type'} = 'frenchspacing';
           my ($float_number, $columns)
-            = $self->convert_line_new_context ($prepended, undef, 1);
+            = $self->convert_line_new_context($prepended);
           _stream_output($self, $float_number);
 
           $self->{'text_element_context'}->[-1]->{'counter'} += $columns;



reply via email to

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