[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Tue, 24 Aug 2021 12:59:58 -0400 (EDT) |
branch: master
commit 58fb71def134cefdce42b1128ccbff265b50b02a
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Aug 24 18:59:46 2021 +0200
* tp/Texinfo/Convert/HTML.pm (output_internal_links):
do not use 'key' for index entries, as it may be different
from the index entry to be used for sorting.
---
ChangeLog | 6 ++++++
tp/Texinfo/Convert/HTML.pm | 11 ++++++++++-
tp/tests/layout/formatting.texi | 4 ++--
.../res_parser/formatting/internal_links_formatting.txt | 4 ++--
tp/tests/layout/res_parser/formatting_latex/formatting.tex | 4 ++--
.../layout/res_parser/formatting_macro_expand/formatting.texi | 4 ++--
tp/tests/layout/res_parser/formatting_xml/formatting.xml | 4 ++--
7 files changed, 26 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0727fd9..530d7e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2021-08-24 Patrice Dumas <pertusus@free.fr>
+ * tp/Texinfo/Convert/HTML.pm (output_internal_links):
+ do not use 'key' for index entries, as it may be different
+ from the index entry to be used for sorting.
+
+2021-08-24 Patrice Dumas <pertusus@free.fr>
+
* tp/Texinfo/Convert/Text.pm (%ignored_brace_commands),
tp/Texinfo/Convert/NodeNameNormalization.pm
(%ignored_brace_commands): ignore sortas, seealso, seeentry.
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index d723e6e..0714e8c 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -7222,13 +7222,22 @@ sub output_internal_links($)
}
}
if ($self->{'parser'}) {
+ my %options = Texinfo::Common::_convert_text_options($self);
foreach my $index_name (sort(keys
(%{$self->{'index_entries_by_letter'}}))) {
foreach my $letter_entry
(@{$self->{'index_entries_by_letter'}->{$index_name}}) {
foreach my $index_entry (@{$letter_entry->{'entries'}}) {
my $href;
my $key;
$href = $self->command_href($index_entry->{'command'}, '');
- $key = $index_entry->{'key'};
+ #$key = $index_entry->{'key'};
+ # 'key' is used for sorting, so it may be obtained from
+ # @sortas, it may have been modified according to txiindex*ignore,
+ # and also use sort_string which may lose some information.
+ # Convert to text
+ my $converter_options = {%options};
+ $converter_options->{'code'} = $index_entry->{'in_code'};
+ $key = Texinfo::Convert::Text::convert_to_text(
+ {'contents' => $index_entry->{'content'}}, $converter_options);
if (defined($key) and $key =~ /\S/) {
$out_string .= $href if (defined($href));
$out_string .= "\t$index_name\t";
diff --git a/tp/tests/layout/formatting.texi b/tp/tests/layout/formatting.texi
index b1cfbfb..c3efeb8 100644
--- a/tp/tests/layout/formatting.texi
+++ b/tp/tests/layout/formatting.texi
@@ -95,9 +95,9 @@ In example.
@findex f---aaa @seeentry{f---bbb}
@findex @seealso{f---ccc} f---ddd
-@cindex aaa @sortas{A} @subentry @sortas{B} bbb
+@cindex aaa @sortas{A---S} @subentry @sortas{B---S1} bbb
-@findex xxx @sortas{X} @subentry @sortas{X} zzz
+@findex xxx @sortas{X---S} @subentry @sortas{X---S1} zzz
@cindex
@findex @w{}
diff --git
a/tp/tests/layout/res_parser/formatting/internal_links_formatting.txt
b/tp/tests/layout/res_parser/formatting/internal_links_formatting.txt
index 40983f8..a7aa47e 100644
--- a/tp/tests/layout/res_parser/formatting/internal_links_formatting.txt
+++ b/tp/tests/layout/res_parser/formatting/internal_links_formatting.txt
@@ -17,7 +17,7 @@ formatting.html#index-_002d_002doption-1 cp -option
formatting.html#index-_002e cp .
formatting.html#index-_003f cp ?
formatting.html#index-a cp a
-formatting.html#index-aaa cp A
+formatting.html#index-aaa cp aaa
formatting.html#index-a_002d_002d_002da cp a--a
formatting.html#index-copying-a_002d_002dasis cp a--asis
formatting.html#index-titlepage-a_002d_002dasis cp a--asis
@@ -259,7 +259,7 @@ formatting.html#index-truc fn truc
formatting.html#index-truc-1 fn truc
formatting.html#index-truc-2 fn truc
formatting.html#index-truc-3 fn truc
-formatting.html#index-xxx fn X
+formatting.html#index-xxx fn xxx
formatting.html#index-copying-d_002d_002deftp_005fname tp d--eftp_name
formatting.html#index-titlepage-d_002d_002deftp_005fname tp
d--eftp_name
formatting.html#index-d_002d_002deftp_005fname tp d--eftp_name
diff --git a/tp/tests/layout/res_parser/formatting_latex/formatting.tex
b/tp/tests/layout/res_parser/formatting_latex/formatting.tex
index f9445f1..18e8d8d 100644
--- a/tp/tests/layout/res_parser/formatting_latex/formatting.tex
+++ b/tp/tests/layout/res_parser/formatting_latex/formatting.tex
@@ -5194,9 +5194,9 @@ Various deff lines
\index[fn]{f--aaa@\texttt{f{-}{-}{-}aaa}|see{f---bbb}}%
\index[fn]{f--ddd@\texttt{f{-}{-}{-}ddd}|seealso{f---ccc}}%
-\index[cp]{A@aaa!B@bbb}%
+\index[cp]{A---S@aaa!B---S1@bbb}%
-\index[fn]{X@\texttt{xxx}!X@\texttt{zzz}}%
+\index[fn]{X---S@\texttt{xxx}!X---S1@\texttt{zzz}}%
\index[fn]{@\texttt{\hbox{}}}%
diff --git a/tp/tests/layout/res_parser/formatting_macro_expand/formatting.texi
b/tp/tests/layout/res_parser/formatting_macro_expand/formatting.texi
index d7df218..e98801c 100644
--- a/tp/tests/layout/res_parser/formatting_macro_expand/formatting.texi
+++ b/tp/tests/layout/res_parser/formatting_macro_expand/formatting.texi
@@ -4670,9 +4670,9 @@ Various deff lines
@findex f---aaa @seeentry{f---bbb}
@findex @seealso{f---ccc} f---ddd
-@cindex aaa @sortas{A} @subentry @sortas{B} bbb
+@cindex aaa @sortas{A---S} @subentry @sortas{B---S1} bbb
-@findex xxx @sortas{X} @subentry @sortas{X} zzz
+@findex xxx @sortas{X---S} @subentry @sortas{X---S1} zzz
@cindex
@findex @w{}
diff --git a/tp/tests/layout/res_parser/formatting_xml/formatting.xml
b/tp/tests/layout/res_parser/formatting_xml/formatting.xml
index 88a539d..57b3b98 100644
--- a/tp/tests/layout/res_parser/formatting_xml/formatting.xml
+++ b/tp/tests/layout/res_parser/formatting_xml/formatting.xml
@@ -4646,9 +4646,9 @@ Various deff lines
<findex index="fn" spaces=" "><indexterm index="fn"
number="174">f&textmdash;aaa<seeentry>f&textmdash;bbb</seeentry></indexterm></findex>
<findex index="fn" spaces=" "><indexterm index="fn"
number="174"><seealso>f&textmdash;ccc</seealso>
f&textmdash;ddd</indexterm></findex>
-<cindex index="cp" spaces=" "><indexterm index="cp"
number="38">aaa<sortas>A</sortas></indexterm></cindex><subentry spaces="
"><sortas>B</sortas> bbb</subentry>
+<cindex index="cp" spaces=" "><indexterm index="cp"
number="38">aaa<sortas>A&textmdash;S</sortas></indexterm></cindex><subentry
spaces=" "><sortas>B&textmdash;S1</sortas> bbb</subentry>
-<findex index="fn" spaces=" "><indexterm index="fn"
number="174">xxx<sortas>X</sortas></indexterm></findex><subentry spaces="
"><sortas>X</sortas> zzz</subentry>
+<findex index="fn" spaces=" "><indexterm index="fn"
number="174">xxx<sortas>X---S</sortas></indexterm></findex><subentry spaces="
"><sortas>X&textmdash;S1</sortas> zzz</subentry>
<cindex></cindex>
<findex index="fn" spaces=" "><indexterm index="fn"
number="175"><w></w></indexterm></findex>