[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 add an entry for erroneous @itemx/@item/@tab constructs. |
Date: |
Sun, 11 Dec 2022 17:45:01 -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 4de278dff3 * tp/Texinfo/Convert/TexinfoMarkup.pm (_convert): do not
add an entry for erroneous @itemx/@item/@tab constructs.
4de278dff3 is described below
commit 4de278dff303e9b91dc58a529c527829f0a17a96
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Dec 11 23:44:51 2022 +0100
* tp/Texinfo/Convert/TexinfoMarkup.pm (_convert): do not add an
entry for erroneous @itemx/@item/@tab constructs.
* tp/t/57invalid_nestings.t: put itemx_in_itemize_enumerate_in_table
in @formatted_cases, in particular to check XML output.
---
ChangeLog | 8 +++++
tp/Texinfo/Convert/TexinfoMarkup.pm | 34 +++++++++++-----------
tp/t/57invalid_nestings.t | 30 +++++++++----------
.../itemx_in_itemize_enumerate_in_table.pl | 24 +++++++++++++++
4 files changed, 64 insertions(+), 32 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e63365ffc6..fb07e97b3d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-12-11 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/TexinfoMarkup.pm (_convert): do not add an
+ entry for erroneous @itemx/@item/@tab constructs.
+
+ * tp/t/57invalid_nestings.t: put itemx_in_itemize_enumerate_in_table
+ in @formatted_cases, in particular to check XML output.
+
2022-12-11 Patrice Dumas <pertusus@free.fr>
* util/txixml2texi.pl: handle infoenclose.
diff --git a/tp/Texinfo/Convert/TexinfoMarkup.pm
b/tp/Texinfo/Convert/TexinfoMarkup.pm
index 13120933d6..ce8ee35005 100644
--- a/tp/Texinfo/Convert/TexinfoMarkup.pm
+++ b/tp/Texinfo/Convert/TexinfoMarkup.pm
@@ -674,7 +674,8 @@ sub _convert($$;$)
}
return $self->_accent($arg, $element, undef, $attributes);
}
- } elsif ($element->{'cmdname'} eq 'item' or $element->{'cmdname'} eq
'itemx'
+ } elsif ($element->{'cmdname'} eq 'item'
+ or $element->{'cmdname'} eq 'itemx'
or $element->{'cmdname'} eq 'headitem'
or $element->{'cmdname'} eq 'tab') {
if ($element->{'cmdname'} eq 'item'
@@ -691,7 +692,8 @@ sub _convert($$;$)
.$self->txi_markup_close_element('prepend');
}
unshift @close_format_elements, 'listitem';
- } elsif (($element->{'cmdname'} eq 'item' or $element->{'cmdname'} eq
'itemx')
+ } elsif (($element->{'cmdname'} eq 'item'
+ or $element->{'cmdname'} eq 'itemx')
and $element->{'parent'}->{'type'}
and $element->{'parent'}->{'type'} eq 'table_term') {
my $table_command = $element->{'parent'}->{'parent'}->{'parent'};
@@ -702,13 +704,15 @@ sub _convert($$;$)
$format_item_command
= $table_command->{'extra'}->{'command_as_argument'}->{'cmdname'};
$attribute
- =
[$self->_infoenclose_attribute($table_command->{'extra'}->{'command_as_argument'})];
+ = [$self->_infoenclose_attribute(
+ $table_command->{'extra'}->{'command_as_argument'})];
}
- my $line_item_result =
$self->txi_markup_open_element($element->{'cmdname'},
-
[_leading_spaces_arg($element)]);
+ my $line_item_result
+ = $self->txi_markup_open_element($element->{'cmdname'},
+ [_leading_spaces_arg($element)]);
if ($format_item_command) {
$line_item_result .= $self->txi_markup_open_element('itemformat',
- [['command', $format_item_command],
@$attribute]);
+ [['command', $format_item_command],
@$attribute]);
}
$line_item_result .= $self->_index_entry($element);
my $in_code;
@@ -743,21 +747,17 @@ sub _convert($$;$)
$line_item_result
.= $self->txi_markup_close_element($element->{'cmdname'}).$end_line;
return $line_item_result;
- } else {
- unless (($element->{'cmdname'} eq 'item'
- or $element->{'cmdname'} eq 'headitem'
- or $element->{'cmdname'} eq 'tab')
- and $element->{'parent'}->{'type'}
- and $element->{'parent'}->{'type'} eq 'row') {
- print STDERR "BUG: multitable cell command not in a row "
- .Texinfo::Common::debug_print_element($element);
- }
-
+ } elsif (($element->{'cmdname'} eq 'item'
+ or $element->{'cmdname'} eq 'headitem'
+ or $element->{'cmdname'} eq 'tab')
+ and $element->{'parent'}->{'type'}
+ and $element->{'parent'}->{'type'} eq 'row') {
$result .= $self->txi_markup_open_element('entry',
[['command', $element->{'cmdname'}],
_leading_spaces_arg($element)]);
unshift @close_format_elements, 'entry';
- }
+ } # otherwise we have an incorrect construct, for instance
+ # out of block commands @item, @itemx in enumerate or multitable...
} elsif ($element->{'type'} and $element->{'type'} eq
'index_entry_command') {
my $format_element;
my $attribute = [];
diff --git a/tp/t/57invalid_nestings.t b/tp/t/57invalid_nestings.t
index eb048db3a5..b71fb32565 100644
--- a/tp/t/57invalid_nestings.t
+++ b/tp/t/57invalid_nestings.t
@@ -314,21 +314,6 @@ More @math{ in math
@section sec2
'],
-['itemx_in_itemize_enumerate_in_table',
-'@table @strong
-@item item
-
-In item, nested itemize
-@itemize
-@itemx in nested itemize itemx
-@end itemize
-
-@enumerate
-@itemx in nested enumerate itemx
-@end enumerate
-
-@end table
-'],
['item_tab_outside_of_table_lists',
'@itemx itemx outside.
@headitem headitem outside.
@@ -593,6 +578,21 @@ in ifinfo
@end ifinfo on the node line',
{'EXPANDED_FORMATS' => []}
],
+['itemx_in_itemize_enumerate_in_table',
+'@table @strong
+@item item
+
+In item, nested itemize
+@itemize
+@itemx in nested itemize itemx
+@end itemize
+
+@enumerate
+@itemx in nested enumerate itemx
+@end enumerate
+
+@end table
+'],
);
foreach my $test (@formatted_cases) {
diff --git
a/tp/t/results/invalid_nestings/itemx_in_itemize_enumerate_in_table.pl
b/tp/t/results/invalid_nestings/itemx_in_itemize_enumerate_in_table.pl
index 249cc06a60..9483bcd284 100644
--- a/tp/t/results/invalid_nestings/itemx_in_itemize_enumerate_in_table.pl
+++ b/tp/t/results/invalid_nestings/itemx_in_itemize_enumerate_in_table.pl
@@ -380,4 +380,28 @@ $result_errors{'itemx_in_itemize_enumerate_in_table'} = [
$result_floats{'itemx_in_itemize_enumerate_in_table'} = {};
+
+$result_converted{'plaintext'}->{'itemx_in_itemize_enumerate_in_table'} =
'*item*
+
+ In item, nested itemize
+ in nested itemize itemx
+
+ in nested enumerate itemx
+
+';
+
+
+$result_converted{'xml'}->{'itemx_in_itemize_enumerate_in_table'} = '<table
commandarg="strong" spaces=" " endspaces=" ">
+<tableentry><tableterm><item spaces=" "><itemformat
command="strong">item</itemformat></item>
+</tableterm><tableitem>
+<para>In item, nested itemize
+</para><itemize commandarg="bullet" endspaces="
"><itemprepend><formattingcommand command="bullet"
automatic="on"/></itemprepend>
+<beforefirstitem></beforefirstitem></itemize>
+
+<enumerate first="1" endspaces=" ">
+<beforefirstitem></beforefirstitem></enumerate>
+
+</tableitem></tableentry></table>
+';
+
1;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Convert/TexinfoMarkup.pm (_convert): do not add an entry for erroneous @itemx/@item/@tab constructs.,
Patrice Dumas <=