[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Gavin D. Smith |
Date: |
Sun, 26 Nov 2023 13:16:28 -0500 (EST) |
branch: master
commit 718f1f420df22ec4f83a02573ab4377a0ddf5ce9
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sun Nov 26 15:52:44 2023 +0000
* tp/Texinfo/Convert/Plaintext.pm (new_formatter):
Do no save the "type" of the formatter (line/paragraph/unfilled).
(_convert) <@image>: Reset 'empty_lines_count' regardless of
formatter type.
<"format raw commands">: Always flush the output of the current
formatter, not just for "paragraph" formatters. Do not output
an extra end of line afterwards.
---
ChangeLog | 10 ++++++++++
tp/Texinfo/Convert/Plaintext.pm | 9 +++------
tp/t/results/plaintext_tests/expanded_tex.pl | 6 +++---
tp/t/results/plaintext_tests/html_expanded.pl | 3 +--
tp/t/results/raw/raw_expanded_in_style.pl | 3 +--
5 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e17efa2927..e1b4c21c92 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2023-11-26 Gavin Smith <gavinsmith0123@gmail.com>
+
+ * tp/Texinfo/Convert/Plaintext.pm (new_formatter):
+ Do no save the "type" of the formatter (line/paragraph/unfilled).
+ (_convert) <@image>: Reset 'empty_lines_count' regardless of
+ formatter type.
+ <"format raw commands">: Always flush the output of the current
+ formatter, not just for "paragraph" formatters. Do not output
+ an extra end of line afterwards.
+
2023-11-26 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/ParagraphNonXS.pm: remove a FIXME comment fixed.
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index 30900a8505..30d6fcd46c 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -740,7 +740,7 @@ sub new_formatter($$;$)
my $formatter = {'container' => $container,
'upper_case_stack' => [{}],
'font_type_stack' => [{}],
- 'w' => 0, 'type' => $type,
+ 'w' => 0,
'frenchspacing_stack' => [$self->{'conf'}->{'frenchspacing'}],
#'frenchspacing_stack' => [$self->get_conf('frenchspacing')],
# access 'conf' hash directly for efficiency
@@ -2346,7 +2346,7 @@ sub _convert($$)
my ($image, $lines_count) = $self->format_image($element);
_add_lines_count($self, $lines_count);
add_text_to_count($self, $image);
- if ($image ne '' and $formatter->{'type'} ne 'paragraph') {
+ if ($image ne '') {
$self->{'empty_lines_count'} = 0;
}
$result .= $image;
@@ -2678,12 +2678,9 @@ sub _convert($$)
}
if ($self->{'preformatted_context_commands'}->{$command}
or $command eq 'float') {
- if ($self->{'formatters'}->[-1]->{'type'} eq 'paragraph'
- and $format_raw_commands{$command}) {
+ if ($format_raw_commands{$command}) {
$result .= _count_added($self, $formatter->{'container'},
add_pending_word($formatter->{'container'}, 1));
- $result .= _count_added($self, $formatter->{'container'},
- end_line($formatter->{'container'}));
}
push @{$self->{'context'}}, $command;
} elsif ($flush_commands{$command}) {
diff --git a/tp/t/results/plaintext_tests/expanded_tex.pl
b/tp/t/results/plaintext_tests/expanded_tex.pl
index a7304f216d..9430d85950 100644
--- a/tp/t/results/plaintext_tests/expanded_tex.pl
+++ b/tp/t/results/plaintext_tests/expanded_tex.pl
@@ -123,11 +123,11 @@ $result_floats{'expanded_tex'} = {};
-$result_converted{'plaintext'}->{'expanded_tex'} =
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-TTT
+$result_converted{'plaintext'}->{'expanded_tex'} =
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa TTT
GGG
HHH
-bbbbbbbbb1 bbbbbbbbbbb2 bbbbbbbbbb3 bbbbbbbbbbbbbb4.
+bbbbbbbbb1 bbbbbbbbbbb2 bbbbbbbbbb3
+bbbbbbbbbbbbbb4.
';
1;
diff --git a/tp/t/results/plaintext_tests/html_expanded.pl
b/tp/t/results/plaintext_tests/html_expanded.pl
index 2293a339ea..bd466bd427 100644
--- a/tp/t/results/plaintext_tests/html_expanded.pl
+++ b/tp/t/results/plaintext_tests/html_expanded.pl
@@ -111,8 +111,7 @@ $result_floats{'html_expanded'} = {};
-$result_converted{'plaintext'}->{'html_expanded'} = 'Before
-html
+$result_converted{'plaintext'}->{'html_expanded'} = 'Before html
after.
';
diff --git a/tp/t/results/raw/raw_expanded_in_style.pl
b/tp/t/results/raw/raw_expanded_in_style.pl
index 39a518b194..244bbcebc3 100644
--- a/tp/t/results/raw/raw_expanded_in_style.pl
+++ b/tp/t/results/raw/raw_expanded_in_style.pl
@@ -120,8 +120,7 @@ $result_floats{'raw_expanded_in_style'} = {};
-$result_converted{'plaintext'}->{'raw_expanded_in_style'} = '‘
-in html
+$result_converted{'plaintext'}->{'raw_expanded_in_style'} = '‘ in html
’
';