[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Convert/TexinfoMarkup.pm (_convert):
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Convert/TexinfoMarkup.pm (_convert): do not have an empty columnprototypes when there is an empty columnfraction, but only have a columnfraction. Avoid autovivification of extra columnfraction in case of empty columnfraction. |
Date: |
Sun, 27 Nov 2022 16:48:39 -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 c5090dc72c * tp/Texinfo/Convert/TexinfoMarkup.pm (_convert): do not
have an empty columnprototypes when there is an empty columnfraction, but only
have a columnfraction. Avoid autovivification of extra columnfraction in case
of empty columnfraction.
c5090dc72c is described below
commit c5090dc72ce9dad07c626284bf1551e7d851cef5
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Nov 27 22:48:28 2022 +0100
* tp/Texinfo/Convert/TexinfoMarkup.pm (_convert): do not have
an empty columnprototypes when there is an empty columnfraction,
but only have a columnfraction.
Avoid autovivification of extra columnfraction in case of empty
columnfraction.
---
ChangeLog | 8 ++++++
tp/Texinfo/Convert/TexinfoMarkup.pm | 31 +++++++++++++++-------
tp/t/06columnfractions.t | 24 ++++++++++++-----
tp/t/results/columnfractions/empty.pl | 9 +++++++
tp/t/results/columnfractions/empty_comment.pl | 9 +++++++
tp/t/results/columnfractions/good.pl | 9 +++++++
tp/t/results/columnfractions/good_comment.pl | 9 +++++++
tp/t/results/columnfractions/good_space_comment.pl | 9 +++++++
.../something_before_columnfractions.pl | 9 +++++++
tp/t/results/columnfractions/wrong_command.pl | 9 +++++++
10 files changed, 110 insertions(+), 16 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 47c4534895..64b04e66ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-11-27 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/TexinfoMarkup.pm (_convert): do not have
+ an empty columnprototypes when there is an empty columnfraction,
+ but only have a columnfraction.
+ Avoid autovivification of extra columnfraction in case of empty
+ columnfraction.
+
2022-11-27 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/TexinfoMarkup.pm (_convert): correctly use
diff --git a/tp/Texinfo/Convert/TexinfoMarkup.pm
b/tp/Texinfo/Convert/TexinfoMarkup.pm
index a362af5b31..cb4a1803a9 100644
--- a/tp/Texinfo/Convert/TexinfoMarkup.pm
+++ b/tp/Texinfo/Convert/TexinfoMarkup.pm
@@ -1309,12 +1309,11 @@ sub _convert($$;$)
}
$result .= $end_line;
} else {
-
# in that case the end of line is in the columnfractions line
# or in the columnprototypes.
if ($element->{'cmdname'} eq 'multitable') {
my @prototype_line;
- if (not $element->{'extra'}->{'columnfractions'}) {
+ if ($element->{'extra'}->{'prototypes'}) {
# Like 'prototypes' extra value, but keeping spaces information
if (defined $element->{'args'}->[0]
and defined $element->{'args'}->[0]->{'type'}
@@ -1379,9 +1378,16 @@ sub _convert($$;$)
}
$result .= $self->txi_markup_close_element('columnprototypes');
$result .= $self->format_comment_or_return_end_line($element);
- } elsif ($element->{'extra'}
- and $element->{'extra'}->{'columnfractions'}
- and $element->{'args'}->[0]->{'contents'}) {
+ } elsif ($element->{'args'} and $element->{'args'}->[0]
+ and $element->{'args'}->[0]->{'contents'}
+ and (($element->{'extra'}
+ and $element->{'extra'}->{'columnfractions'})
+ # case of bogus/empty @columnfractions
+ or ($element->{'args'}->[0]->{'contents'}->[0]
+ and $element->{'args'}->[0]->{'contents'}
+ ->[0]->{'cmdname'}
+ and $element->{'args'}->[0]->{'contents'}
+ ->[0]->{'cmdname'} eq 'columnfractions'))) {
my $cmd;
foreach my $content (@{$element->{'args'}->[0]->{'contents'}})
{
if ($content->{'cmdname'}
@@ -1393,11 +1399,16 @@ sub _convert($$;$)
my $attribute = [_leading_spaces_arg($cmd),
$self->_texinfo_line($cmd)];
$result .= $self->txi_markup_open_element('columnfractions',
$attribute);
- foreach my $fraction
(@{$element->{'extra'}->{'columnfractions'}
- ->{'extra'}->{'misc_args'}}) {
- $result .= $self->txi_markup_open_element('columnfraction',
- [['value', $fraction]])
-
.$self->txi_markup_close_element('columnfraction');
+ if ($element->{'extra'}->{'columnfractions'}
+ and $element->{'extra'}->{'columnfractions'}->{'extra'}
+ and $element->{'extra'}->{'columnfractions'}
+ ->{'extra'}->{'misc_args'}) {
+ foreach my $fraction
(@{$element->{'extra'}->{'columnfractions'}
+ ->{'extra'}->{'misc_args'}}) {
+ $result .= $self->txi_markup_open_element('columnfraction',
+ [['value', $fraction]])
+
.$self->txi_markup_close_element('columnfraction');
+ }
}
$result .= $self->txi_markup_close_element('columnfractions');
$result .= $self->format_comment_or_return_end_line($cmd);
diff --git a/tp/t/06columnfractions.t b/tp/t/06columnfractions.t
index 71fc8c89c9..e8b7471fb3 100644
--- a/tp/t/06columnfractions.t
+++ b/tp/t/06columnfractions.t
@@ -5,6 +5,14 @@ use Texinfo::ModulePath (undef, undef, undef, 'updirs' => 2);
require 't/test_utils.pl';
+my @test_tree = (
+[ 'not_fraction','@multitable @columnfractions aaa
+@end multitable' ],
+[ 'invalid','@multitable @columnfractions 2x.2 2.23x
+@end multitable' ],
+[ 'out_of_multitable', '@columnfractions 0.6 0.4 aaa' ],
+);
+
my @test_cases = (
[ 'good', '@multitable @columnfractions 0.4 .6 5.
@end multitable' ],
@@ -12,19 +20,23 @@ my @test_cases = (
@end multitable' ],
[ 'good_space_comment', '@multitable @columnfractions 0 1 @c space comment
@end multitable' ],
-[ 'not_fraction','@multitable @columnfractions aaa
-@end multitable' ],
-[ 'invalid','@multitable @columnfractions 2x.2 2.23x
-@end multitable' ],
[ 'empty', '@multitable @columnfractions
@end multitable' ],
[ 'empty_comment', '@multitable @columnfractions @c
@end multitable' ],
[ 'wrong_command', '@multitable @columnfractions @b{3.4}
@end multitable' ],
-[ 'out_of_multitable', '@columnfractions 0.6 0.4 aaa' ],
[ 'something_before_columnfractions', '@multitable aaa @columnfractions 0.3 0.7
@end multitable' ]
);
-run_all('columnfractions', [@test_cases]);
+foreach my $test (@test_cases) {
+# html and plaintext test results are empty as the multitables
+# are empty. TODO add one line to test those formats?
+# push @{$test->[2]->{'test_formats'}}, 'plaintext';
+# push @{$test->[2]->{'test_formats'}}, 'html_text';
+ push @{$test->[2]->{'test_formats'}}, 'xml';
+ push @{$test->[2]->{'test_formats'}}, 'latex_text';
+}
+
+run_all('columnfractions', [@test_tree, @test_cases]);
diff --git a/tp/t/results/columnfractions/empty.pl
b/tp/t/results/columnfractions/empty.pl
index 6458fd2a6d..178f07cd75 100644
--- a/tp/t/results/columnfractions/empty.pl
+++ b/tp/t/results/columnfractions/empty.pl
@@ -105,4 +105,13 @@ $result_errors{'empty'} = [
$result_floats{'empty'} = {};
+
+$result_converted{'xml'}->{'empty'} = '<multitable spaces=" " endspaces="
"><columnfractions line=" "></columnfractions>
+</multitable>';
+
+
+$result_converted{'latex_text'}->{'empty'} = '\\begin{tabular}{}%
+\\end{tabular}%
+';
+
1;
diff --git a/tp/t/results/columnfractions/empty_comment.pl
b/tp/t/results/columnfractions/empty_comment.pl
index 57f2d43d9b..e1bd3e263f 100644
--- a/tp/t/results/columnfractions/empty_comment.pl
+++ b/tp/t/results/columnfractions/empty_comment.pl
@@ -122,4 +122,13 @@ $result_errors{'empty_comment'} = [
$result_floats{'empty_comment'} = {};
+
+$result_converted{'xml'}->{'empty_comment'} = '<multitable spaces=" "
endspaces=" "><columnfractions spaces=" " line="@c"></columnfractions><!-- c -->
+</multitable>';
+
+
+$result_converted{'latex_text'}->{'empty_comment'} = '\\begin{tabular}{}%
+\\end{tabular}%
+';
+
1;
diff --git a/tp/t/results/columnfractions/good.pl
b/tp/t/results/columnfractions/good.pl
index f6d9ca6c57..e77dd68946 100644
--- a/tp/t/results/columnfractions/good.pl
+++ b/tp/t/results/columnfractions/good.pl
@@ -109,4 +109,13 @@ $result_errors{'good'} = [];
$result_floats{'good'} = {};
+
+$result_converted{'xml'}->{'good'} = '<multitable spaces=" " endspaces="
"><columnfractions spaces=" " line="0.4 .6 5."><columnfraction
value="0.4"></columnfraction><columnfraction
value=".6"></columnfraction><columnfraction
value="5."></columnfraction></columnfractions>
+</multitable>';
+
+
+$result_converted{'latex_text'}->{'good'} =
'\\begin{tabular}{m{0.4\\textwidth} m{.6\\textwidth} m{5.\\textwidth}}%
+\\end{tabular}%
+';
+
1;
diff --git a/tp/t/results/columnfractions/good_comment.pl
b/tp/t/results/columnfractions/good_comment.pl
index 8f91804e38..26562ff06d 100644
--- a/tp/t/results/columnfractions/good_comment.pl
+++ b/tp/t/results/columnfractions/good_comment.pl
@@ -123,4 +123,13 @@ $result_errors{'good_comment'} = [];
$result_floats{'good_comment'} = {};
+
+$result_converted{'xml'}->{'good_comment'} = '<multitable spaces=" "
endspaces=" "><columnfractions spaces=" " line="0.4 .6 5.@c
comment"><columnfraction value="0.4"></columnfraction><columnfraction
value=".6"></columnfraction><columnfraction
value="5."></columnfraction></columnfractions><!-- c comment -->
+</multitable>';
+
+
+$result_converted{'latex_text'}->{'good_comment'} =
'\\begin{tabular}{m{0.4\\textwidth} m{.6\\textwidth} m{5.\\textwidth}}%
+\\end{tabular}%
+';
+
1;
diff --git a/tp/t/results/columnfractions/good_space_comment.pl
b/tp/t/results/columnfractions/good_space_comment.pl
index adfe8e390d..569d6bd73d 100644
--- a/tp/t/results/columnfractions/good_space_comment.pl
+++ b/tp/t/results/columnfractions/good_space_comment.pl
@@ -123,4 +123,13 @@ $result_errors{'good_space_comment'} = [];
$result_floats{'good_space_comment'} = {};
+
+$result_converted{'xml'}->{'good_space_comment'} = '<multitable spaces=" "
endspaces=" "><columnfractions spaces=" " line="0 1 @c space
comment"><columnfraction value="0"></columnfraction><columnfraction
value="1"></columnfraction></columnfractions><!-- c space comment -->
+</multitable>';
+
+
+$result_converted{'latex_text'}->{'good_space_comment'} =
'\\begin{tabular}{m{0\\textwidth} m{1\\textwidth}}%
+\\end{tabular}%
+';
+
1;
diff --git a/tp/t/results/columnfractions/something_before_columnfractions.pl
b/tp/t/results/columnfractions/something_before_columnfractions.pl
index 75163f199c..ce5322d634 100644
--- a/tp/t/results/columnfractions/something_before_columnfractions.pl
+++ b/tp/t/results/columnfractions/something_before_columnfractions.pl
@@ -111,4 +111,13 @@ $result_errors{'something_before_columnfractions'} = [];
$result_floats{'something_before_columnfractions'} = {};
+
+$result_converted{'xml'}->{'something_before_columnfractions'} = '<multitable
spaces=" " endspaces=" "><columnfractions spaces=" " line="0.3
0.7"><columnfraction value="0.3"></columnfraction><columnfraction
value="0.7"></columnfraction></columnfractions>
+</multitable>';
+
+
+$result_converted{'latex_text'}->{'something_before_columnfractions'} =
'\\begin{tabular}{m{0.3\\textwidth} m{0.7\\textwidth}}%
+\\end{tabular}%
+';
+
1;
diff --git a/tp/t/results/columnfractions/wrong_command.pl
b/tp/t/results/columnfractions/wrong_command.pl
index 85ca1f6788..cebf6444bc 100644
--- a/tp/t/results/columnfractions/wrong_command.pl
+++ b/tp/t/results/columnfractions/wrong_command.pl
@@ -134,4 +134,13 @@ $result_errors{'wrong_command'} = [
$result_floats{'wrong_command'} = {};
+
+$result_converted{'xml'}->{'wrong_command'} = '<multitable spaces=" "
endspaces=" "><columnfractions spaces=" " line="@b{3.4} "></columnfractions>
+</multitable>';
+
+
+$result_converted{'latex_text'}->{'wrong_command'} = '\\begin{tabular}{}%
+\\end{tabular}%
+';
+
1;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Convert/TexinfoMarkup.pm (_convert): do not have an empty columnprototypes when there is an empty columnfraction, but only have a columnfraction. Avoid autovivification of extra columnfraction in case of empty columnfraction.,
Patrice Dumas <=