[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/tp/Texinfo Parser.pm Convert/HTML.pm
From: |
Patrice Dumas |
Subject: |
texinfo/tp/Texinfo Parser.pm Convert/HTML.pm |
Date: |
Sat, 03 Sep 2011 18:02:40 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 11/09/03 18:02:40
Modified files:
tp/Texinfo : Parser.pm
tp/Texinfo/Convert: HTML.pm
Log message:
Add a 'content_normalized' key to index_entry, with the non translated
index entry content tree. Used for html anchors.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.287&r2=1.288
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/HTML.pm?cvsroot=texinfo&r1=1.142&r2=1.143
Patches:
Index: Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.287
retrieving revision 1.288
diff -u -b -r1.287 -r1.288
--- Parser.pm 3 Sep 2011 17:13:42 -0000 1.287
+++ Parser.pm 3 Sep 2011 18:02:39 -0000 1.288
@@ -2187,20 +2187,36 @@
}
}
+sub _non_bracketed_contents($)
+{
+ my $current = shift;
+ if ($current->{'type'} and $current->{'type'} eq 'bracketed') {
+ my $new = {};
+ $new->{'contents'} = $current->{'contents'} if ($current->{'parent'});
+ $new->{'parent'} = $current->{'parent'} if ($current->{'parent'});
+ return $new;
+ } else {
+ return $current;
+ }
+}
+
# store an index entry.
# $current is the command element.
# $content holds the actual content.
# for index entries and v|ftable items, it is the index entry content,
# for def, it is the parsed arguments, based on the definition line
# arguments.
-sub _enter_index_entry($$$$$)
+sub _enter_index_entry($$$$$$)
{
my $self = shift;
my $command = shift;
my $current = shift;
my $content = shift;
+ my $content_normalized = shift;
my $line_nr = shift;
+ $content_normalized = $content if (!defined($content_normalized));
+
my $prefix = $self->{'command_index_prefix'}->{$command};
my $index_name = $self->{'prefix_to_index_name'}->{$prefix};
my $number = (defined($self->{'index_entries'}->{$index_name})
@@ -2210,6 +2226,7 @@
'index_at_command' => $command,
'index_prefix' => $prefix,
'content' => $content,
+ 'content_normalized' => $content_normalized,
'command' => $current,
'number' => $number,
};
@@ -2452,18 +2469,29 @@
# do an standard index entry tree
my $index_entry = $def_parsed_hash->{'name'};
if (defined($index_entry)) {
+ my $index_contents_normalized;
if ($def_parsed_hash->{'class'}) {
if ($command_index_prefix{$def_command} eq 'f') {
$index_entry = $self->gdt('{name} on {class}',
{'name' => $def_parsed_hash->{'name'},
'class' => $def_parsed_hash->{'class'}});
+ $index_contents_normalized
+ = [_non_bracketed_contents($def_parsed_hash->{'name'}),
+ { 'text' => ' on '},
+ _non_bracketed_contents($def_parsed_hash->{'class'})];
} elsif ($command_index_prefix{$def_command} eq 'v'
and $def_command ne 'defcv') {
$index_entry = $self->gdt('{name} of {class}',
{'name' => $def_parsed_hash->{'name'},
'class' => $def_parsed_hash->{'class'}});
+ $index_contents_normalized
+ = [_non_bracketed_contents($def_parsed_hash->{'name'}),
+ { 'text' => ' of '},
+ _non_bracketed_contents($def_parsed_hash->{'class'})];
}
}
+ $index_contents_normalized = [$index_entry]
+ if (!defined($index_contents_normalized));
my $index_contents;
# 'root_line' is the container returned by gdt.
if ($index_entry->{'type'} and $index_entry->{'type'} eq 'root_line') {
@@ -2473,7 +2501,8 @@
}
_enter_index_entry($self,
$current->{'parent'}->{'extra'}->{'original_def_cmdname'},
- $current->{'parent'}, $index_contents, $line_nr);
+ $current->{'parent'}, $index_contents,
+ $index_contents_normalized, $line_nr);
} else {
$self->line_warn (sprintf($self->__('Missing name for @%s'),
$current->{'parent'}->{'extra'}->{'original_def_cmdname'}),
$line_nr);
@@ -2838,10 +2867,12 @@
if (($command eq 'item' or $command eq 'itemx')
and
$self->{'command_index_prefix'}->{$current->{'parent'}->{'cmdname'}}) {
_enter_index_entry($self, $current->{'parent'}->{'cmdname'},
$current,
- $current->{'extra'}->{'misc_content'}, $line_nr);
+ $current->{'extra'}->{'misc_content'},
+ undef, $line_nr);
} elsif ($self->{'command_index_prefix'}->{$current->{'cmdname'}}) {
_enter_index_entry($self, $current->{'cmdname'}, $current,
- $current->{'extra'}->{'misc_content'}, $line_nr);
+ $current->{'extra'}->{'misc_content'},
+ undef, $line_nr);
}
}
if (defined($command_structuring_level{$command})) {
Index: Convert/HTML.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/HTML.pm,v
retrieving revision 1.142
retrieving revision 1.143
diff -u -b -r1.142 -r1.143
--- Convert/HTML.pm 3 Sep 2011 10:29:17 -0000 1.142
+++ Convert/HTML.pm 3 Sep 2011 18:02:40 -0000 1.143
@@ -5027,7 +5027,7 @@
my $region = '';
$region = "$index_entry->{'region'}->{'cmdname'}-"
if (defined($index_entry->{'region'}));
- my @contents = @{$index_entry->{'content'}};
+ my @contents = @{$index_entry->{'content_normalized'}};
my $trimmed_contents
= Texinfo::Common::trim_spaces_comment_from_content(address@hidden);
my $normalized_index =
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- texinfo/tp/Texinfo Parser.pm Convert/HTML.pm,
Patrice Dumas <=