[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Common.pm (_relate_index_entries_to_
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Common.pm (_relate_index_entries_to_table_items_in), tp/Texinfo/Convert/LaTeX.pm (_convert), tp/Texinfo/Convert/Plaintext.pm (_convert): use index_entry_command type instead of extra index_entry when this is more relevant. |
Date: |
Mon, 06 Mar 2023 15:31:53 -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 7e63203725 * tp/Texinfo/Common.pm
(_relate_index_entries_to_table_items_in), tp/Texinfo/Convert/LaTeX.pm
(_convert), tp/Texinfo/Convert/Plaintext.pm (_convert): use index_entry_command
type instead of extra index_entry when this is more relevant.
7e63203725 is described below
commit 7e63203725ea4e3928b1068df94c0ae2a7eab83f
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Mar 6 21:31:44 2023 +0100
* tp/Texinfo/Common.pm (_relate_index_entries_to_table_items_in),
tp/Texinfo/Convert/LaTeX.pm (_convert),
tp/Texinfo/Convert/Plaintext.pm (_convert): use index_entry_command
type instead of extra index_entry when this is more relevant.
* tp/Texinfo/Transformations.pm (_reassociate_to_node): simplify and
generalize code reassociating extra element_node, by using only that
information and not information related to the element as an index
element.
---
ChangeLog | 12 ++++++++++++
tp/Texinfo/Common.pm | 15 +++++++++++----
tp/Texinfo/Convert/LaTeX.pm | 4 ++--
tp/Texinfo/Convert/Plaintext.pm | 6 ++----
tp/Texinfo/Transformations.pm | 11 ++++-------
5 files changed, 31 insertions(+), 17 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 61220dc591..33b020f92f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2023-03-06 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Common.pm (_relate_index_entries_to_table_items_in),
+ tp/Texinfo/Convert/LaTeX.pm (_convert),
+ tp/Texinfo/Convert/Plaintext.pm (_convert): use index_entry_command
+ type instead of extra index_entry when this is more relevant.
+
+ * tp/Texinfo/Transformations.pm (_reassociate_to_node): simplify and
+ generalize code reassociating extra element_node, by using only that
+ information and not information related to the element as an index
+ element.
+
2023-03-06 Patrice Dumas <pertusus@free.fr>
* doc/texi2any_api.texi (Tree Element Conversion Functions),
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index 4702190ae3..8235404075 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -1897,7 +1897,14 @@ sub _copy_tree($$$)
next if (!$current->{$info_type});
$new->{$info_type} = {};
foreach my $key (keys %{$current->{$info_type}}) {
- # here need to copy hashes or arrays with out of tree elements
+ # here need to copy hashes or arrays with out of tree elements. They can
+ # be found by looking at *_oot extra types in the XS parser. Special
+ # constructs can be out of tree too. extra misc_args are only strings
+ # so they are copied in _substitute_references_in_array, extra def_parsed
+ # is also ok, as the hash values refer to tree elements.
+ # Some out of tree elements may be added later too, as is the case of
+ # extra def_index_element and def_index_ref_element added in
+ # complete_indices.
if (($current->{'cmdname'} and $current->{'cmdname'} eq 'multitable'
and $key eq 'prototypes') and $info_type eq 'extra') {
$new->{$info_type}->{$key} = [];
@@ -2387,8 +2394,8 @@ sub _relate_index_entries_to_table_items_in($)
# Now, to discover the related @?index and @item entries.
my ($item, $index);
foreach my $content (@{$term->{'contents'}}) {
- if ($content->{'extra'}
- and $content->{'extra'}->{'index_entry'}) {
+ if ($content->{'type'}
+ and $content->{'type'} eq 'index_entry_command') {
$index = $content->{'extra'}->{'index_entry'} unless $index;
} elsif ($content->{'cmdname'} and $content->{'cmdname'} eq 'item') {
$item = $content unless $item;
@@ -2400,7 +2407,7 @@ sub _relate_index_entries_to_table_items_in($)
next unless $item and $index;
# FIXME it is not ideal, as it adds an undocumented key to the index entry.
# It is better than to reset 'entry_element', as the 'entry_element' holds
- # informations important for the index entry.
+ # information important for the index entry.
$index->{'entry_associated_element'} = $item;
}
}
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index f8bffef74f..cb0e5b8894 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -3986,8 +3986,8 @@ sub _convert($$)
$unknown_command = 1;
}
if ($unknown_command
- and !($element->{'extra'}
- and ($element->{'extra'}->{'index_entry'}))
+ and !($element->{'type'}
+ and ($element->{'type'} eq 'index_entry_command'))
# commands like def*x are not processed above, since only the def_line
# associated is processed. If they have no name and no category they
# are not considered as index entries either so they have a specific
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index af71e77a10..a8ea928d7a 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -3003,10 +3003,8 @@ sub _convert($$)
$unknown_command = 1;
}
if ($unknown_command
- and !($element->{'extra'}
- and ($element->{'extra'}->{'index_entry'}
- or $element->{'extra'}->{'seeentry'}
- or $element->{'extra'}->{'seealso'}))
+ and !($element->{'type'}
+ and ($element->{'type'} eq 'index_entry_command'))
# commands like def*x are not processed above, since only the def_line
# associated is processed. If they have no name and no category they
# are not considered as index entries either so they have a specific
diff --git a/tp/Texinfo/Transformations.pm b/tp/Texinfo/Transformations.pm
index a4a33b8fbc..37d4eafde5 100644
--- a/tp/Texinfo/Transformations.pm
+++ b/tp/Texinfo/Transformations.pm
@@ -316,14 +316,11 @@ sub _reassociate_to_node($$$$)
}
}
push @{$new_node->{'extra'}->{'menus'}}, $current;
- } elsif ($current->{'extra'} and $current->{'extra'}->{'index_entry'}) {
+ } elsif ($current->{'extra'} and $current->{'extra'}->{'element_node'}) {
if ($previous_node
- and (!$current->{'extra'}->{'element_node'}
- or $current->{'extra'}->{'element_node'} ne $previous_node)) {
- print STDERR "Bug: index entry $current (".
- Texinfo::Convert::Texinfo::convert_to_texinfo(
- Texinfo::Common::index_content_element($current))
- .") not in previous node $previous_node\n";
+ and $current->{'extra'}->{'element_node'} ne $previous_node) {
+ print STDERR "Bug: element $current not in previous node $previous_node;
"
+ .Texinfo::Common::debug_print_element($current)."\n";
print STDERR " previous node: "
.Texinfo::Convert::Texinfo::root_heading_command_to_texinfo($previous_node)."\n";
if ($current->{'extra'}->{'element_node'}) {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Common.pm (_relate_index_entries_to_table_items_in), tp/Texinfo/Convert/LaTeX.pm (_convert), tp/Texinfo/Convert/Plaintext.pm (_convert): use index_entry_command type instead of extra index_entry when this is more relevant.,
Patrice Dumas <=
- Prev by Date:
branch master updated: * doc/texi2any_api.texi (Tree Element Conversion Functions), tp/Texinfo/Convert/HTML.pm (_convert) (_convert_index_entry_command_type): use the type of index commands, index_entry_command, to select index commands formatting, instead of a modified command name. Convert with _convert_index_entry_command_type, remove _convert_index_command.
- Next by Date:
branch master updated: * tp/Texinfo/Common.pm (lookup_index_entry) (_relate_index_entries_to_table_items_in) (_relate_index_entries_to_table_items) (relate_index_entries_to_table_items_in_tree), tp/Texinfo/Convert/DocBook.pm (_index_entry), tp/Texinfo/Convert/LaTeX.pm (_index_entry), tp/Texinfo/Convert/TexinfoMarkup.pm (_index_entry, _convert), tp/t/test_utils.pl (test), tp/texi2any.pl: add the lookup_index_entry function, to find an index entry based on the extra index_entry key, that abstracts how the index en [...]
- Previous by thread:
branch master updated: * doc/texi2any_api.texi (Tree Element Conversion Functions), tp/Texinfo/Convert/HTML.pm (_convert) (_convert_index_entry_command_type): use the type of index commands, index_entry_command, to select index commands formatting, instead of a modified command name. Convert with _convert_index_entry_command_type, remove _convert_index_command.
- Next by thread:
branch master updated: * tp/Texinfo/Common.pm (lookup_index_entry) (_relate_index_entries_to_table_items_in) (_relate_index_entries_to_table_items) (relate_index_entries_to_table_items_in_tree), tp/Texinfo/Convert/DocBook.pm (_index_entry), tp/Texinfo/Convert/LaTeX.pm (_index_entry), tp/Texinfo/Convert/TexinfoMarkup.pm (_index_entry, _convert), tp/t/test_utils.pl (test), tp/texi2any.pl: add the lookup_index_entry function, to find an index entry based on the extra index_entry key, that abstracts how the index en [...]
- Index(es):