[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Translations.pm (complete_indices):
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Translations.pm (complete_indices): determine the name and class of def command by looking at the contents instead of using def_parsed_hash. |
Date: |
Tue, 07 Mar 2023 02:46:28 -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 e9e31ce8b1 * tp/Texinfo/Translations.pm (complete_indices): determine
the name and class of def command by looking at the contents instead of using
def_parsed_hash.
e9e31ce8b1 is described below
commit e9e31ce8b1771b838552b69a05541bbd145dbb86
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Mar 7 08:46:18 2023 +0100
* tp/Texinfo/Translations.pm (complete_indices): determine the name
and class of def command by looking at the contents instead of using
def_parsed_hash.
---
ChangeLog | 6 +++++
tp/Texinfo/Translations.pm | 55 +++++++++++++++++++++++++++-------------------
2 files changed, 38 insertions(+), 23 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index eeb839732e..b0d27b6d0f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-03-07 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Translations.pm (complete_indices): determine the name
+ and class of def command by looking at the contents instead of using
+ def_parsed_hash.
+
2023-03-06 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/parsetexi/api.c (store_additional_info),
diff --git a/tp/Texinfo/Translations.pm b/tp/Texinfo/Translations.pm
index 2865f91e40..13388587a1 100644
--- a/tp/Texinfo/Translations.pm
+++ b/tp/Texinfo/Translations.pm
@@ -394,12 +394,24 @@ sub complete_indices($)
if ($main_entry_element->{'extra'}
and $main_entry_element->{'extra'}->{'def_command'}
and not $main_entry_element->{'extra'}->{'def_index_element'}) {
- my ($index_entry, $index_contents_normalized);
- my $def_command = $main_entry_element->{'extra'}->{'def_command'};
+ my ($name, $class);
+ if ($main_entry_element->{'args'}->[0]->{'contents'}) {
+ foreach my $arg
(@{$main_entry_element->{'args'}->[0]->{'contents'}}) {
+ my $role = $arg->{'extra'}->{'def_role'};
+ if ($role eq 'name') {
+ $name = $arg;
+ } elsif ($role eq 'class') {
+ $class = $arg;
+ } elsif ($role eq 'arg' or $role eq 'typearg' or $role eq
'delimiter') {
+ last;
+ }
+ }
+ }
+
+ if ($name and $class) {
+ my ($index_entry, $index_contents_normalized);
+ my $def_command = $main_entry_element->{'extra'}->{'def_command'};
- my $def_parsed_hash =
$main_entry_element->{'extra'}->{'def_parsed_hash'};
- if ($def_parsed_hash and $def_parsed_hash->{'class'}
- and $def_command) {
# Use the document language that was current when the command was
# used for getting the translation.
my $entry_language
@@ -409,37 +421,34 @@ sub complete_indices($)
or $def_command eq 'defmethod'
or $def_command eq 'deftypemethod') {
$index_entry = gdt($self, '{name} on {class}',
- {'name' => $def_parsed_hash->{'name'},
- 'class' => $def_parsed_hash->{'class'}},
- undef, undef, $entry_language);
+ {'name' => $name, 'class' => $class},
+ undef, undef, $entry_language);
$index_contents_normalized
- = [_non_bracketed_contents($def_parsed_hash->{'name'}),
+ = [_non_bracketed_contents($name),
{ 'text' => ' on '},
- _non_bracketed_contents($def_parsed_hash->{'class'})];
+ _non_bracketed_contents($class)];
} elsif ($def_command eq 'defcv'
or $def_command eq 'defivar'
or $def_command eq 'deftypeivar'
or $def_command eq 'deftypecv') {
$index_entry = gdt($self, '{name} of {class}',
- {'name' => $def_parsed_hash->{'name'},
- 'class' => $def_parsed_hash->{'class'}},
- undef, undef, $entry_language);
+ {'name' => $name, 'class' => $class},
+ undef, undef, $entry_language);
$index_contents_normalized
- = [_non_bracketed_contents($def_parsed_hash->{'name'}),
+ = [_non_bracketed_contents($name),
{ 'text' => ' of '},
- _non_bracketed_contents($def_parsed_hash->{'class'})];
+ _non_bracketed_contents($class)];
}
- }
- # 'root_line' is the container returned by gdt.
- if ($index_entry->{'type'} and $index_entry->{'type'} eq 'root_line') {
- for my $child (@{$index_entry->{'contents'}}) {
- delete $child->{'parent'};
+
+ # 'root_line' is the container returned by gdt.
+ if ($index_entry->{'type'} and $index_entry->{'type'} eq
'root_line') {
+ for my $child (@{$index_entry->{'contents'}}) {
+ delete $child->{'parent'};
+ }
}
- }
- if ($index_entry->{'contents'}) {
$main_entry_element->{'extra'}->{'def_index_element'} = $index_entry;
$main_entry_element->{'extra'}->{'def_index_ref_element'}
- = {'contents' => $index_contents_normalized};
+ = {'contents' => $index_contents_normalized};
}
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Translations.pm (complete_indices): determine the name and class of def command by looking at the contents instead of using def_parsed_hash.,
Patrice Dumas <=