[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Common.pm (_copy_tree, _substitute_r
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Common.pm (_copy_tree, _substitute_references): handle def_index_element and def_index_ref_element explicitly as out of tree elements. |
Date: |
Tue, 07 Mar 2023 05:56:47 -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 6be142cc97 * tp/Texinfo/Common.pm (_copy_tree,
_substitute_references): handle def_index_element and def_index_ref_element
explicitly as out of tree elements.
6be142cc97 is described below
commit 6be142cc973c67da3ea569bc285a4c3989b57d52
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Mar 7 11:56:38 2023 +0100
* tp/Texinfo/Common.pm (_copy_tree, _substitute_references): handle
def_index_element and def_index_ref_element explicitly as out of tree
elements.
---
ChangeLog | 6 ++++++
tp/Texinfo/Common.pm | 36 ++++++++++++++++++++++++++++++------
2 files changed, 36 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 512fe825d6..5b432c5f6f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-03-07 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Common.pm (_copy_tree, _substitute_references): handle
+ def_index_element and def_index_ref_element explicitly as out of tree
+ elements.
+
2023-03-07 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/ParserNonXS.pm (_end_line_def_line),
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index 87c6246749..e45499c908 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -1881,6 +1881,12 @@ sub _collect_commands_list_in_tree($$$)
# modules but are not generally useful in converters
# and therefore not public.
+# FIXME still work to do for elements located at multiple points
+# in the tree, right now the reference_associations is overwritten,
+# there should probably be a better way to do. Maybe setup only the
+# main tree, and handle extra/info information in _substitute_references
+# with more copy_tree for out-of-tree elements there.
+
sub _copy_tree($$$);
sub _copy_tree($$$)
{
@@ -1888,6 +1894,11 @@ sub _copy_tree($$$)
my $parent = shift;
my $reference_associations = shift;
my $new = {};
+ #if (exists($reference_associations->{$current})) {
+ # print STDERR "COPY: replace $current: "
+ # ."$reference_associations->{$current} -> $new; "
+ # .Texinfo::Common::debug_print_element($current)."\n";
+ #}
$reference_associations->{$current} = $new;
$new->{'parent'} = $parent if ($parent);
foreach my $key ('type', 'cmdname', 'text') {
@@ -1930,8 +1941,11 @@ sub _copy_tree($$$)
}
} elsif (ref($current->{$info_type}->{$key}) eq '') {
$new->{$info_type}->{$key} = $current->{$info_type}->{$key};
- } elsif ($info_type eq 'info'
- and ref($current->{$info_type}->{$key}) eq 'HASH') {
+ } elsif (($info_type eq 'info'
+ and ref($current->{$info_type}->{$key}) eq 'HASH')
+ or ($info_type eq 'extra'
+ and ($key eq 'def_index_element'
+ or $key eq 'def_index_ref_element'))) {
$new->{$info_type}->{$key} = _copy_tree($current->{$info_type}->{$key},
undef,
$reference_associations);
#print STDERR "ELEMENT: $info_type: $key\n";
@@ -2017,6 +2031,9 @@ sub _substitute_references($$$;$)
}
}
+ # FIXME would be better to recurse in info/extra when needed without
+ # the need to know the name of the keys.
+
# in general there is nothing to do in info elements, as they only
# hold text, but code is ready.
if ($current->{'info'}) {
@@ -2029,6 +2046,15 @@ sub _substitute_references($$$;$)
}
}
}
+ if ($current->{'extra'}) {
+ foreach my $key ('def_index_element', 'def_index_ref_element') {
+ if ($current->{'extra'}->{$key}) {
+ _substitute_references($current->{'extra'}->{$key},
+ $new->{'extra'}->{$key},
+ $reference_associations, $level+1);
+ }
+ }
+ }
foreach my $info_type ('info', 'extra') {
next if (!$current->{$info_type});
@@ -2061,16 +2087,14 @@ sub _substitute_references($$$;$)
#print STDERR "Done $info_type [$command_or_type]: $key\n";
} else {
if (ref($current->{$info_type}->{$key}) eq 'ARRAY') {
+ # authors index_entry manual_content menus misc_args node_content
#print STDERR "Array $command_or_type $info_type -> $key\n";
$new->{$info_type}->{$key} = _substitute_references_in_array(
$current->{$info_type}->{$key}, $reference_associations,
"${info_type}[$command_or_type]{$key}", $level);
} else {
- # here are index_entry def_index_element def_index_ref_element
+ # nothing here for now
#print STDERR "HASH $info_type $key\n";
- # FIXME for def_index_element def_index_ref_element maybe
- # it would be better to call _copy_tree before
- # _substitute_references, or even process in _copy_tree
$new->{$info_type}->{$key} = {};
foreach my $type_key (keys(%{$current->{$info_type}->{$key}})) {
if (ref($current->{$info_type}->{$key}->{$type_key}) eq '') {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Common.pm (_copy_tree, _substitute_references): handle def_index_element and def_index_ref_element explicitly as out of tree elements.,
Patrice Dumas <=
- Prev by Date:
branch master updated: * tp/Texinfo/ParserNonXS.pm (_end_line_def_line), tp/Texinfo/XS/parsetexi/api.c (store_additional_info), tp/Texinfo/XS/parsetexi/end_line.c (end_line_def_line), tp/Texinfo/XS/parsetexi/extra.c (add_extra_misc_args), tp/Texinfo/XS/parsetexi/tree.c (destroy_associated_info), tp/Texinfo/XS/parsetexi/tree_types.h (enum extra_type): do not set extra def_parsed_hash in the tree. It is easy to look at the contents, and in general the @def args argument need to be collected at the same time, such [...]
- Next by Date:
branch master updated: * tp/Texinfo/Convert/DocBook.pm (_convert), tp/Texinfo/Convert/LaTeX.pm (_convert), tp/Texinfo/Convert/Plaintext.pm (_convert), tp/Texinfo/Convert/TexinfoMarkup.pm (_convert): use directly the multitable line argument and the bracketed on that line to determine the prototype, instead of extra prototypes.
- Previous by thread:
branch master updated: * tp/Texinfo/ParserNonXS.pm (_end_line_def_line), tp/Texinfo/XS/parsetexi/api.c (store_additional_info), tp/Texinfo/XS/parsetexi/end_line.c (end_line_def_line), tp/Texinfo/XS/parsetexi/extra.c (add_extra_misc_args), tp/Texinfo/XS/parsetexi/tree.c (destroy_associated_info), tp/Texinfo/XS/parsetexi/tree_types.h (enum extra_type): do not set extra def_parsed_hash in the tree. It is easy to look at the contents, and in general the @def args argument need to be collected at the same time, such [...]
- Next by thread:
branch master updated: * tp/Texinfo/Convert/DocBook.pm (_convert), tp/Texinfo/Convert/LaTeX.pm (_convert), tp/Texinfo/Convert/Plaintext.pm (_convert), tp/Texinfo/Convert/TexinfoMarkup.pm (_convert): use directly the multitable line argument and the bracketed on that line to determine the prototype, instead of extra prototypes.
- Index(es):