[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: always use arguments being line_arg to determine
From: |
Patrice Dumas |
Subject: |
branch master updated: always use arguments being line_arg to determine if item in table |
Date: |
Tue, 24 Dec 2024 11:22:08 -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 eb593d9f32 always use arguments being line_arg to determine if item in
table
eb593d9f32 is described below
commit eb593d9f32d0566c814ba7da8dd979e48bdf12b4
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Nov 24 19:24:48 2024 +0100
always use arguments being line_arg to determine if item in table
* tp/Texinfo/Convert/DocBook.pm (_convert), tp/Texinfo/Convert/HTML.pm
(_convert_item_command, _convert), tp/Texinfo/Convert/TexinfoMarkup.pm
(_convert), tp/Texinfo/Convert/Text.pm (_convert),
tp/Texinfo/Convert/TextContent.pm (_convert),
tp/Texinfo/XS/convert/convert_html.c (html_convert_tree_append),
tp/Texinfo/XS/convert/format_html.c (html_convert_item_command),
tp/Texinfo/XS/main/builtin_commands.c (element_builtin_data_cmd):
always check that the argument is a line_arg to determine that an item
is to be considered a line command, in a @table or similar, instead of
using the type of the parent element,
---
ChangeLog | 15 +++++++++++++++
tp/Texinfo/Convert/DocBook.pm | 6 +++---
tp/Texinfo/Convert/HTML.pm | 15 +++++++++------
tp/Texinfo/Convert/TexinfoMarkup.pm | 5 +++--
tp/Texinfo/Convert/Text.pm | 6 ++++--
tp/Texinfo/Convert/TextContent.pm | 6 ++++--
tp/Texinfo/XS/convert/convert_html.c | 3 ++-
tp/Texinfo/XS/convert/format_html.c | 3 ++-
tp/Texinfo/XS/main/builtin_commands.c | 3 ++-
.../itemx_in_itemize_enumerate_in_table.pl | 6 ++++--
10 files changed, 48 insertions(+), 20 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8bd621b59e..4995971a36 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2024-11-24 Patrice Dumas <pertusus@free.fr>
+
+ always use arguments being line_arg to determine if item in table
+
+ * tp/Texinfo/Convert/DocBook.pm (_convert), tp/Texinfo/Convert/HTML.pm
+ (_convert_item_command, _convert), tp/Texinfo/Convert/TexinfoMarkup.pm
+ (_convert), tp/Texinfo/Convert/Text.pm (_convert),
+ tp/Texinfo/Convert/TextContent.pm (_convert),
+ tp/Texinfo/XS/convert/convert_html.c (html_convert_tree_append),
+ tp/Texinfo/XS/convert/format_html.c (html_convert_item_command),
+ tp/Texinfo/XS/main/builtin_commands.c (element_builtin_data_cmd):
+ always check that the argument is a line_arg to determine that an item
+ is to be considered a line command, in a @table or similar, instead of
+ using the type of the parent element,
+
2024-11-24 Patrice Dumas <pertusus@free.fr>
rename argument type as arguments_line
diff --git a/tp/Texinfo/Convert/DocBook.pm b/tp/Texinfo/Convert/DocBook.pm
index 78364e15c4..113975a33b 100644
--- a/tp/Texinfo/Convert/DocBook.pm
+++ b/tp/Texinfo/Convert/DocBook.pm
@@ -887,9 +887,9 @@ sub _convert($$;$)
push @close_format_elements, 'listitem';
} elsif (($cmdname eq 'item'
or $cmdname eq 'itemx')
- and $element->{'parent'}->{'type'}
- and $element->{'parent'}->{'type'} eq 'table_term') {
-
+ and $element->{'contents'}
+ and $element->{'contents'}->[0]->{'type'}
+ and $element->{'contents'}->[0]->{'type'} eq 'line_arg') {
$result .= "<term>" if ($cmdname eq 'itemx');
$result .= _index_entry($self, $element);
if ($element->{'contents'}->[0]->{'contents'}) {
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index cc942e4a22..1c094646c3 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -5679,8 +5679,9 @@ sub _convert_item_command($$$$$)
} else {
return '';
}
- } elsif ($command->{'parent'}->{'type'}
- and $command->{'parent'}->{'type'} eq 'table_term') {
+ } elsif ($command->{'contents'}
+ and $command->{'contents'}->[0]->{'type'}
+ and $command->{'contents'}->[0]->{'type'} eq 'line_arg') {
if ($command->{'contents'}->[0]->{'contents'}) {
my $result = ($cmdname eq 'item') ? '' : '<dt>';
@@ -13552,8 +13553,9 @@ sub _convert($$;$)
my $data_command_name;
if ($command_name eq 'item'
- and $element->{'parent'}->{'type'}
- and $element->{'parent'}->{'type'} eq 'table_term') {
+ and $element->{'contents'}
+ and $element->{'contents'}->[0]->{'type'}
+ and $element->{'contents'}->[0]->{'type'} eq 'line_arg') {
$data_command_name = 'item_LINE';
} else {
$data_command_name = $command_name;
@@ -13596,8 +13598,9 @@ sub _convert($$;$)
or ($line_commands{$command_name}
and $line_commands{$command_name} eq 'line')
or (($command_name eq 'item' or $command_name eq 'itemx')
- and ($element->{'parent'}->{'type'}
- and $element->{'parent'}->{'type'} eq 'table_term'))
+ and $element->{'contents'}
+ and $element->{'contents'}->[0]->{'type'}
+ and $element->{'contents'}->[0]->{'type'} eq 'line_arg')
or ($command_name eq 'quotation'
or $command_name eq 'smallquotation')
or $command_name eq 'float'
diff --git a/tp/Texinfo/Convert/TexinfoMarkup.pm
b/tp/Texinfo/Convert/TexinfoMarkup.pm
index d6bf90fd1b..ab855efb5e 100644
--- a/tp/Texinfo/Convert/TexinfoMarkup.pm
+++ b/tp/Texinfo/Convert/TexinfoMarkup.pm
@@ -784,8 +784,9 @@ sub _convert($$;$)
unshift @close_format_elements, 'listitem';
} elsif (($element->{'cmdname'} eq 'item'
or $element->{'cmdname'} eq 'itemx')
- and $element->{'parent'}->{'type'}
- and $element->{'parent'}->{'type'} eq 'table_term') {
+ and $element->{'contents'}
+ and $element->{'contents'}->[0]->{'type'}
+ and $element->{'contents'}->[0]->{'type'} eq 'line_arg') {
my $table_command = $element->{'parent'}->{'parent'}->{'parent'};
my $format_item_command;
my $attribute = [];
diff --git a/tp/Texinfo/Convert/Text.pm b/tp/Texinfo/Convert/Text.pm
index 62fb6ba0c8..5a62fe7a2d 100644
--- a/tp/Texinfo/Convert/Text.pm
+++ b/tp/Texinfo/Convert/Text.pm
@@ -512,8 +512,10 @@ sub _convert($$)
my $data_cmdname;
if (defined($element->{'cmdname'})) {
$cmdname = $element->{'cmdname'};
- if ($cmdname eq 'item' and $element->{'parent'}->{'type'}
- and $element->{'parent'}->{'type'} eq 'table_term') {
+ if ($cmdname eq 'item'
+ and $element->{'contents'}
+ and $element->{'contents'}->[0]->{'type'}
+ and $element->{'contents'}->[0]->{'type'} eq 'line_arg') {
$data_cmdname = 'item_LINE';
} else {
$data_cmdname = $cmdname;
diff --git a/tp/Texinfo/Convert/TextContent.pm
b/tp/Texinfo/Convert/TextContent.pm
index 7d8693952e..d39589d074 100644
--- a/tp/Texinfo/Convert/TextContent.pm
+++ b/tp/Texinfo/Convert/TextContent.pm
@@ -124,8 +124,10 @@ sub _convert($$)
# determine name used to check command properties
my $data_cmdname;
if ($element->{'cmdname'}) {
- if ($element->{'cmdname'} eq 'item' and $element->{'parent'}->{'type'}
- and $element->{'parent'}->{'type'} eq 'table_term') {
+ if ($element->{'cmdname'} eq 'item'
+ and $element->{'contents'}
+ and $element->{'contents'}->[0]->{'type'}
+ and $element->{'contents'}->[0]->{'type'} eq 'line_arg') {
$data_cmdname = 'item_LINE';
} else {
$data_cmdname = $element->{'cmdname'};
diff --git a/tp/Texinfo/XS/convert/convert_html.c
b/tp/Texinfo/XS/convert/convert_html.c
index 033aea55d4..fae25b8f45 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -1336,7 +1336,8 @@ html_convert_tree_append (CONVERTER *self, const ELEMENT
*element,
|| (builtin_command_data[data_cmd].flags & CF_line
&& builtin_command_data[data_cmd].data == LINE_line)
|| ((cmd == CM_item || cmd == CM_itemx)
- && element->parent->type == ET_table_term)
+ && element->e.c->contents.number > 0
+ && element->e.c->contents.list[0]->type == ET_line_arg)
|| (cmd == CM_quotation || cmd == CM_smallquotation)
|| cmd == CM_float
|| cmd == CM_cartouche)
diff --git a/tp/Texinfo/XS/convert/format_html.c
b/tp/Texinfo/XS/convert/format_html.c
index 3aa1ad55c0..7f4bb045f1 100644
--- a/tp/Texinfo/XS/convert/format_html.c
+++ b/tp/Texinfo/XS/convert/format_html.c
@@ -9225,7 +9225,8 @@ html_convert_item_command (CONVERTER *self, const enum
command_id cmd,
text_printf (result, "<li> %s</li>", content);
}
}
- else if (element->parent && element->parent->type == ET_table_term)
+ else if (element->e.c->contents.number > 0
+ && element->e.c->contents.list[0]->type == ET_line_arg)
{
if (element->e.c->contents.list[0]->e.c->contents.number > 0)
{
diff --git a/tp/Texinfo/XS/main/builtin_commands.c
b/tp/Texinfo/XS/main/builtin_commands.c
index d212af2b55..d2ac6e7d8b 100644
--- a/tp/Texinfo/XS/main/builtin_commands.c
+++ b/tp/Texinfo/XS/main/builtin_commands.c
@@ -121,7 +121,8 @@ enum command_id
element_builtin_data_cmd (const ELEMENT *e)
{
if (e->e.c->cmd == CM_item
- && e->parent->type == ET_table_term)
+ && e->e.c->contents.number > 0
+ && e->e.c->contents.list[0]->type == ET_line_arg)
return CM_item_LINE;
return element_builtin_cmd (e);
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 338078a1d9..62e03fc061 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
@@ -410,10 +410,12 @@
$result_converted{'xml'}->{'itemx_in_itemize_enumerate_in_table'} = '<table comm
</tableterm><tableitem>
<para>In item, nested itemize
</para><itemize commandarg="bullet" automaticcommandarg="on" endspaces="
"><itemprepend><formattingcommand command="bullet"
automatic="on"/></itemprepend>
-<beforefirstitem>in nested itemize itemx</beforefirstitem></itemize>
+<beforefirstitem><itemx spaces=" ">in nested itemize itemx</itemx>
+</beforefirstitem></itemize>
<enumerate first="1" endspaces=" ">
-<beforefirstitem>in nested enumerate itemx</beforefirstitem></enumerate>
+<beforefirstitem><itemx spaces=" ">in nested enumerate itemx</itemx>
+</beforefirstitem></enumerate>
</tableitem></tableentry></table>
';
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: always use arguments being line_arg to determine if item in table,
Patrice Dumas <=