[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Convert/Plaintext.pm (_convert): do
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Convert/Plaintext.pm (_convert): do not consider the cartouche title to be a paragraph, reset paragraph count to the value before the title. Do not set the text_element_context counter, as the title is on its own line. Do not increase redundantly lines count. |
Date: |
Wed, 21 Dec 2022 15:39:31 -0500 |
This is an automated email from the git hooks/post-receive script.
pertusus pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new 1e2c52554e * tp/Texinfo/Convert/Plaintext.pm (_convert): do not
consider the cartouche title to be a paragraph, reset paragraph count to the
value before the title. Do not set the text_element_context counter, as the
title is on its own line. Do not increase redundantly lines count.
1e2c52554e is described below
commit 1e2c52554ee97b4686173f2f58e8e52144a91f6d
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Dec 21 21:39:20 2022 +0100
* tp/Texinfo/Convert/Plaintext.pm (_convert): do not consider the
cartouche title to be a paragraph, reset paragraph count to the value
before the title.
Do not set the text_element_context counter, as the title is on its
own line. Do not increase redundantly lines count.
* tp/Makefile.tres, tp/t/02coverage.t: add cartouche_title_and_content
new test with cartouche title and some content in the cartouche.
---
ChangeLog | 11 +
tp/Makefile.tres | 1 +
tp/Texinfo/Convert/Plaintext.pm | 10 +-
tp/t/02coverage.t | 6 +
tp/t/results/coverage/cartouche.pl | 2 +-
.../coverage/cartouche_title_and_content.pl | 157 ++++
tp/t/results/coverage/comment_on_cartouche_line.pl | 2 +-
.../res_parser/formatting_info/formatting.info | 836 ++++++++++-----------
.../formatting.info | 836 ++++++++++-----------
.../res_parser/formatting_plaintext/formatting.txt | 802 ++++++++++----------
10 files changed, 1421 insertions(+), 1242 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 846a18a5da..a18d8b2504 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2022-12-21 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/Plaintext.pm (_convert): do not consider the
+ cartouche title to be a paragraph, reset paragraph count to the value
+ before the title.
+ Do not set the text_element_context counter, as the title is on its
+ own line. Do not increase redundantly lines count.
+
+ * tp/Makefile.tres, tp/t/02coverage.t: add cartouche_title_and_content
+ new test with cartouche title and some content in the cartouche.
+
2022-12-21 Patrice Dumas <pertusus@free.fr>
* doc/texinfo.texi (@code{@@cartouche}): document the title argument
diff --git a/tp/Makefile.tres b/tp/Makefile.tres
index 6d763b417e..d14bdd69f1 100644
--- a/tp/Makefile.tres
+++ b/tp/Makefile.tres
@@ -236,6 +236,7 @@ test_files_generated_list =
$(test_tap_files_generated_list) \
t/results/coverage/cartouche.pl \
t/results/coverage/cartouche_in_example.pl \
t/results/coverage/cartouche_in_quotation.pl \
+ t/results/coverage/cartouche_title_and_content.pl \
t/results/coverage/center.pl \
t/results/coverage/command_in_end.pl \
t/results/coverage/command_in_end_expanded_raw_command_after.pl \
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index 05eecde0cd..57500054fa 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -2584,14 +2584,18 @@ sub _convert($$)
if ($element->{'args'} and $element->{'args'}->[0]
and $element->{'args'}->[0]->{'contents'}
and @{$element->{'args'}->[0]->{'contents'}}) {
+ # FIXME reset the paragraph count in cartouche and use a
+ # specific format_context?
my $prepended = $self->gdt('@center @b{{cartouche_arg}}',
{'cartouche_arg' => $element->{'args'}->[0]->{'contents'}});
$prepended->{'type'} = 'frenchspacing';
+ # Do not consider the title to be like a paragraph
+ my $previous_paragraph_count
+ = $self->{'format_context'}->[-1]->{'paragraph_count'};
$result .= $self->convert_line($prepended);
- $self->{'text_element_context'}->[-1]->{'counter'} +=
- Texinfo::Convert::Unicode::string_width($result);
$self->{'empty_lines_count'} = 0 unless ($result eq '');
- _add_lines_count($self, 1);
+ $self->{'format_context'}->[-1]->{'paragraph_count'}
+ = $previous_paragraph_count;
}
}
} elsif ($command eq 'node') {
diff --git a/tp/t/02coverage.t b/tp/t/02coverage.t
index be67f545c4..0e9e2901ff 100644
--- a/tp/t/02coverage.t
+++ b/tp/t/02coverage.t
@@ -343,6 +343,12 @@ in cartouche.
Out of main text
@end cartouche
'],
+['cartouche_title_and_content',
+'@cartouche Box title on @emph{documentation}
+Text on documentation explaining something important out of the main
+flow of the text.
+@end cartouche
+',],
['comment_on_group_line',
'@group @c comment
in group.
diff --git a/tp/t/results/coverage/cartouche.pl
b/tp/t/results/coverage/cartouche.pl
index 25d374c42d..5c41c4ff3e 100644
--- a/tp/t/results/coverage/cartouche.pl
+++ b/tp/t/results/coverage/cartouche.pl
@@ -182,7 +182,7 @@ $result_floats{'cartouche'} = {};
$result_converted{'plaintext'}->{'cartouche'} = 'in cartouche.
_Title of box_
-Out of main text
+ Out of main text
';
diff --git a/tp/t/results/coverage/cartouche_title_and_content.pl
b/tp/t/results/coverage/cartouche_title_and_content.pl
new file mode 100644
index 0000000000..187879767c
--- /dev/null
+++ b/tp/t/results/coverage/cartouche_title_and_content.pl
@@ -0,0 +1,157 @@
+use vars qw(%result_texis %result_texts %result_trees %result_errors
+ %result_indices %result_sectioning %result_nodes %result_menus
+ %result_floats %result_converted %result_converted_errors
+ %result_elements %result_directions_text %result_indices_sort_strings);
+
+use utf8;
+
+$result_trees{'cartouche_title_and_content'} = {
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'Box title on '
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'documentation'
+ }
+ ],
+ 'type' => 'brace_command_arg'
+ }
+ ],
+ 'cmdname' => 'emph',
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => ''
+ }
+ }
+ ],
+ 'info' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'block_line_arg'
+ }
+ ],
+ 'cmdname' => 'cartouche',
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'Text on documentation explaining something
important out of the main
+'
+ },
+ {
+ 'text' => 'flow of the text.
+'
+ }
+ ],
+ 'type' => 'paragraph'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'cartouche'
+ }
+ ],
+ 'info' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'end',
+ 'extra' => {
+ 'text_arg' => 'cartouche'
+ },
+ 'info' => {
+ 'spaces_before_argument' => ' '
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 4,
+ 'macro' => ''
+ }
+ }
+ ],
+ 'info' => {
+ 'spaces_before_argument' => ' '
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => ''
+ }
+ }
+ ],
+ 'type' => 'before_node_section'
+ }
+ ],
+ 'type' => 'document_root'
+};
+
+$result_texis{'cartouche_title_and_content'} = '@cartouche Box title on
@emph{documentation}
+Text on documentation explaining something important out of the main
+flow of the text.
+@end cartouche
+';
+
+
+$result_texts{'cartouche_title_and_content'} = 'Box title on documentation
+Text on documentation explaining something important out of the main
+flow of the text.
+';
+
+$result_errors{'cartouche_title_and_content'} = [];
+
+
+$result_floats{'cartouche_title_and_content'} = {};
+
+
+
+$result_converted{'plaintext'}->{'cartouche_title_and_content'} = '
Box title on _documentation_
+Text on documentation explaining something important out of the main
+flow of the text.
+';
+
+
+$result_converted{'html_text'}->{'cartouche_title_and_content'} = '<table
class="cartouche" border="1"><tr><th>
+Box title on <em class="emph">documentation</em></th></tr><tr><td>
+<p>Text on documentation explaining something important out of the main
+flow of the text.
+</p></td></tr></table>
+';
+
+
+$result_converted{'xml'}->{'cartouche_title_and_content'} = '<cartouche
spaces=" " endspaces=" "><cartouchetitle>Box title on
<emph>documentation</emph></cartouchetitle>
+<para>Text on documentation explaining something important out of the main
+flow of the text.
+</para></cartouche>
+';
+
+
+$result_converted{'latex_text'}->{'cartouche_title_and_content'} =
'\\begin{mdframed}[style=Texinfocartouche, frametitle={Box title on
\\emph{documentation}}]
+Text on documentation explaining something important out of the main
+flow of the text.
+\\end{mdframed}
+';
+
+
+$result_converted{'docbook'}->{'cartouche_title_and_content'} =
'<sidebar><title>Box title on <emphasis>documentation</emphasis></title>
+<para>Text on documentation explaining something important out of the main
+flow of the text.
+</para></sidebar>';
+
+1;
diff --git a/tp/t/results/coverage/comment_on_cartouche_line.pl
b/tp/t/results/coverage/comment_on_cartouche_line.pl
index fc8bada810..e16b1f2969 100644
--- a/tp/t/results/coverage/comment_on_cartouche_line.pl
+++ b/tp/t/results/coverage/comment_on_cartouche_line.pl
@@ -214,7 +214,7 @@ $result_floats{'comment_on_cartouche_line'} = {};
$result_converted{'plaintext'}->{'comment_on_cartouche_line'} = 'in cartouche.
_Title of box_
-Out of main text
+ Out of main text
';
diff --git a/tp/tests/layout/res_parser/formatting_info/formatting.info
b/tp/tests/layout/res_parser/formatting_info/formatting.info
index ee23651b87..69fe94ac09 100644
--- a/tp/tests/layout/res_parser/formatting_info/formatting.info
+++ b/tp/tests/layout/res_parser/formatting_info/formatting.info
@@ -515,7 +515,7 @@ _b_
c-artouche
Tit-le _of box_
-With title c-artouche
+ With title c-artouche
f-lushleft
more text
@@ -1239,7 +1239,7 @@ _b_
c-artouche
Tit-le _of box_
-With title c-artouche
+ With title c-artouche
f-lushleft
more text
@@ -1920,7 +1920,7 @@ _b_
c-artouche
Tit-le _of box_
-With title c-artouche
+ With title c-artouche
f-lushleft
more text
@@ -2739,7 +2739,7 @@ cross ref name: (file name). '@inforef{}' *note ::
c--artouche
Tit-le _of box_
- With title c--artouche
+ With title c--artouche
f--lushleft
more text
@@ -2952,14 +2952,14 @@ aaa"