[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Convert/Plaintext.pm (convert): Set
From: |
Gavin D. Smith |
Subject: |
branch master updated: * tp/Texinfo/Convert/Plaintext.pm (convert): Set $self->{'encoding_disabled'} to 1 so that 'convert' will always return an unencoded character string. * tp/t/test_utils.pl (convert_to_plaintext, convert_to_info): Do not set OUTPUT_PERL_ENCODING to prevent encoding. * tp/Texinfo/Convert/Info.pm (output): Set $self->{'encoding_disabled'} if not outputting to a file, before any conversion is done. |
Date: |
Tue, 20 Feb 2024 13:21:11 -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 a018b80546 * tp/Texinfo/Convert/Plaintext.pm (convert): Set
$self->{'encoding_disabled'} to 1 so that 'convert' will always return an
unencoded character string. * tp/t/test_utils.pl (convert_to_plaintext,
convert_to_info): Do not set OUTPUT_PERL_ENCODING to prevent encoding. *
tp/Texinfo/Convert/Info.pm (output): Set $self->{'encoding_disabled'} if not
outputting to a file, before any conversion is done.
a018b80546 is described below
commit a018b8054636f2fdc4baa5a584ceee53ca40e9a9
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Tue Feb 20 18:17:25 2024 +0000
* tp/Texinfo/Convert/Plaintext.pm (convert):
Set $self->{'encoding_disabled'} to 1 so that 'convert' will
always return an unencoded character string.
* tp/t/test_utils.pl (convert_to_plaintext, convert_to_info):
Do not set OUTPUT_PERL_ENCODING to prevent encoding.
* tp/Texinfo/Convert/Info.pm (output): Set
$self->{'encoding_disabled'} if not outputting to a file, before
any conversion is done.
---
ChangeLog | 12 ++++++++++++
tp/Texinfo/Convert/Info.pm | 19 +++++++++++--------
tp/Texinfo/Convert/Plaintext.pm | 5 +++++
tp/t/test_utils.pl | 18 ------------------
4 files changed, 28 insertions(+), 26 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 98f1792792..ef33f48c2e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-02-19 Gavin Smith <gavinsmith0123@gmail.com>, and
+ Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/Plaintext.pm (convert):
+ Set $self->{'encoding_disabled'} to 1 so that 'convert' will
+ always return an unencoded character string.
+ * tp/t/test_utils.pl (convert_to_plaintext, convert_to_info):
+ Do not set OUTPUT_PERL_ENCODING to prevent encoding.
+ * tp/Texinfo/Convert/Info.pm (output): Set
+ $self->{'encoding_disabled'} if not outputting to a file, before
+ any conversion is done.
+
2024-02-20 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/main/build_perl_info.c
diff --git a/tp/Texinfo/Convert/Info.pm b/tp/Texinfo/Convert/Info.pm
index e59a198193..d91dabbb1f 100644
--- a/tp/Texinfo/Convert/Info.pm
+++ b/tp/Texinfo/Convert/Info.pm
@@ -97,14 +97,6 @@ sub output($$)
$self->force_conf('SPLIT_SIZE', undef);
}
- my $header = $self->_info_header($input_basefile, $output_filename);
- # header + text between setfilename and first node
- my $complete_header = $header;
-
- my $header_bytes = length($header);
- my $complete_header_bytes = $header_bytes;
- my $tree_units = Texinfo::Structuring::split_by_node($root);
-
my $fh;
if (! $output_file eq '') {
if ($self->get_conf('VERBOSE')) {
@@ -115,7 +107,18 @@ sub output($$)
$self->conversion_finalization();
return undef;
}
+ } else {
+ $self->{'encoding_disabled'} = 1;
}
+
+ my $header = $self->_info_header($input_basefile, $output_filename);
+ # header + text between setfilename and first node
+ my $complete_header = $header;
+
+ my $header_bytes = length($header);
+ my $complete_header_bytes = $header_bytes;
+ my $tree_units = Texinfo::Structuring::split_by_node($root);
+
print STDERR "DOCUMENT\n" if ($self->get_conf('DEBUG'));
my $out_file_nr = 0;
my @indirect_files;
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index 19df4a8912..d681b41baa 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -572,6 +572,10 @@ sub conversion_finalization($)
my $self = shift;
$self->pop_top_formatter();
+
+ if ($self->{'encoding_disabled'}) {
+ delete $self->{'encoding_disabled'};
+ }
}
sub count_context_bug_message($$$)
@@ -619,6 +623,7 @@ sub convert($$)
my ($self, $document) = @_;
$self->conversion_initialization($document);
+ $self->{'encoding_disabled'} = 1;
my $root = $document->tree();
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index 906fb2cee9..bfc5799c52 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -532,14 +532,6 @@ sub convert_to_plaintext($$$$$)
}
}
- # If not outputing to a file, do not encode. Return value from
- # 'output' is a character string. It will be encoded to
- # UTF-8 in the results file.
- if (defined($converter_options->{'OUTFILE'})
- and $converter_options->{'OUTFILE'} eq '') {
- $converter_options->{'OUTPUT_PERL_ENCODING'} = '';
- }
-
my $converter = Texinfo::Convert::Plaintext->converter($converter_options);
my $result;
@@ -574,16 +566,6 @@ sub convert_to_info($$$$$)
= set_converter_option_defaults($converter_options, 'info',
$self->{'DEBUG'});
- # If not outputing to a file, do not encode. Return value from
- # 'output' is a character string. This will be encoded to
- # UTF-8 in the results file. This may make byte offsets in the tag table
- # incorrect, so if those needed to be tested, an separate output file
- # would have to be used instead.
- if (defined($converter_options->{'OUTFILE'})
- and $converter_options->{'OUTFILE'} eq '') {
- $converter_options->{'OUTPUT_PERL_ENCODING'} = '';
- }
-
my $converter = Texinfo::Convert::Info->converter($converter_options);
my $result = $converter->output($document);
close_files($converter);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Convert/Plaintext.pm (convert): Set $self->{'encoding_disabled'} to 1 so that 'convert' will always return an unencoded character string. * tp/t/test_utils.pl (convert_to_plaintext, convert_to_info): Do not set OUTPUT_PERL_ENCODING to prevent encoding. * tp/Texinfo/Convert/Info.pm (output): Set $self->{'encoding_disabled'} if not outputting to a file, before any conversion is done.,
Gavin D. Smith <=