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): Take a new parameter, $encoding_disabled, and set the 'encoding_disabled' flag if set. * tp/Texinfo/Convert/Info.pm (_info_header): Output copying block directly by calling _convert, rather than passing the result of convert_tree to _stream_output_encoded. Use new argument to convert_line_new_context to convert @dircategory commands. Convert and output @dircategory and @direntry commands without calling _stream_output_encoded.
Date: Tue, 23 Jan 2024 14:17: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 b727806e1d * tp/Texinfo/Convert/Plaintext.pm 
(convert_line_new_context): Take a new parameter, $encoding_disabled, and set 
the 'encoding_disabled' flag if set. * tp/Texinfo/Convert/Info.pm 
(_info_header): Output copying block directly by calling _convert, rather than 
passing the result of convert_tree to _stream_output_encoded.  Use new argument 
to convert_line_new_context to convert @dircategory commands.  Convert and 
output @dircategory and @direntry commands without calling _s [...]
b727806e1d is described below

commit b727806e1d7186cfd7b363c10340ca93bb368b0e
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Tue Jan 23 19:16:46 2024 +0000

    * tp/Texinfo/Convert/Plaintext.pm (convert_line_new_context):
    Take a new parameter, $encoding_disabled, and set the
    'encoding_disabled' flag if set.
    * tp/Texinfo/Convert/Info.pm (_info_header): Output copying
    block directly by calling _convert, rather than passing the
    result of convert_tree to _stream_output_encoded.  Use new
    argument to convert_line_new_context to convert @dircategory
    commands.  Convert and output @dircategory and @direntry commands
    without calling _stream_output_encoded.
---
 ChangeLog                       | 12 ++++++++++++
 tp/Texinfo/Convert/Info.pm      | 19 +++++++------------
 tp/Texinfo/Convert/Plaintext.pm |  8 ++++++--
 3 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5f253adf8a..53919ed69a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-01-23  Gavin Smith <gavinsmith0123@gmail.com>
+
+       * tp/Texinfo/Convert/Plaintext.pm (convert_line_new_context):
+       Take a new parameter, $encoding_disabled, and set the
+       'encoding_disabled' flag if set.
+       * tp/Texinfo/Convert/Info.pm (_info_header): Output copying
+       block directly by calling _convert, rather than passing the
+       result of convert_tree to _stream_output_encoded.  Use new
+       argument to convert_line_new_context to convert @dircategory
+       commands.  Convert and output @dircategory and @direntry commands
+       without calling _stream_output_encoded.
+
 2024-01-23  Gavin Smith <gavinsmith0123@gmail.com>
 
        * tp/Texinfo/Convert/Plaintext.pm (_stream_byte_count):
diff --git a/tp/Texinfo/Convert/Info.pm b/tp/Texinfo/Convert/Info.pm
index 1465052393..26fffb3348 100644
--- a/tp/Texinfo/Convert/Info.pm
+++ b/tp/Texinfo/Convert/Info.pm
@@ -441,36 +441,31 @@ sub _info_header($$$)
   if ($global_commands and $global_commands->{'copying'}) {
     print STDERR "COPYING HEADER\n" if ($self->get_conf('DEBUG'));
     $self->{'in_copying_header'} = 1;
-    my $copying = $self->convert_tree({'contents' =>
+    $self->_convert({'contents' =>
           $global_commands->{'copying'}->{'contents'}});
-    $self->_stream_output_encoded($copying);
     $self->process_footnotes();
     delete $self->{'in_copying_header'};
   }
   $self->set_global_document_commands('before', \@informative_global_commands);
 
   if ($document_info->{'dircategory_direntry'}) {
-    my $dir_section = '';
     $self->{'ignored_commands'}->{'direntry'} = 0;
     foreach my $command (@{$document_info->{'dircategory_direntry'}}) {
       if ($command->{'cmdname'} eq 'dircategory') {
         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'}});
-          my $dircategory = "INFO-DIR-SECTION " . $converted;
-          $dir_section .= $dircategory;
-          $dir_section .= "\n";
+             {'contents' => $command->{'args'}->[0]->{'contents'}}, undef, 1);
+          $self->_stream_output(undef,
+                                "INFO-DIR-SECTION " . $converted . "\n");
         }
       } elsif ($command->{'cmdname'} eq 'direntry') {
-        $dir_section .= "START-INFO-DIR-ENTRY\n";
-        my $direntry = $self->convert_tree($command);
-        $dir_section .= $direntry;
-        $dir_section .= "END-INFO-DIR-ENTRY\n\n";
+        $self->_stream_output(undef, "START-INFO-DIR-ENTRY\n");
+        $self->_convert($command);
+        $self->_stream_output(undef, "END-INFO-DIR-ENTRY\n\n");
       }
     }
     $self->{'ignored_commands'}->{'direntry'} = 1;
-    $self->_stream_output_encoded($dir_section);
   }
   $self->_add_newline_if_needed();
   $result = $self->_stream_result();
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index d2c0cb7ec8..3614ab573b 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -845,11 +845,15 @@ 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) = @_;
+  my ($self, $converted, $conf, $encoding_disabled) = @_;
 
   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;
+  }
   my $formatter = $self->new_formatter('line', $conf);
   push @{$self->{'formatters'}}, $formatter;
   $self->_convert($converted);



reply via email to

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