texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: * tp/Texinfo/Convert/LaTeX.pm (index_entry): Stri


From: Gavin D. Smith
Subject: branch master updated: * tp/Texinfo/Convert/LaTeX.pm (index_entry): Strip | from sort key as otherwise there can be manged output in the .idx file with a "hyperindexformat" string that appears to be added by the hyperref package. * tp/t/latex_tests.t (vbar_in_index): New test.
Date: Sun, 02 Oct 2022 10:28:56 -0400

This is an automated email from the git hooks/post-receive script.

gavin pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new c99eef15d6 * tp/Texinfo/Convert/LaTeX.pm (index_entry): Strip | from 
sort key as otherwise there can be manged output in the .idx file with a 
"hyperindexformat" string that appears to be added by the hyperref package. * 
tp/t/latex_tests.t (vbar_in_index): New test.
c99eef15d6 is described below

commit c99eef15d66ba6f3d69c8e5e1a4cdc4bb97254f6
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sun Oct 2 15:28:30 2022 +0100

    * tp/Texinfo/Convert/LaTeX.pm (index_entry): Strip | from
    sort key as otherwise there can be manged output in the .idx
    file with a "hyperindexformat" string that appears to be added
    by the hyperref package.
    * tp/t/latex_tests.t (vbar_in_index): New test.
---
 ChangeLog                                 |   8 ++
 tp/Texinfo/Convert/LaTeX.pm               |   2 +
 tp/t/latex_tests.t                        |   4 +
 tp/t/results/latex_tests/vbar_in_index.pl | 167 ++++++++++++++++++++++++++++++
 4 files changed, 181 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index fd4bc727e8..85c1d1453e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-10-01  Gavin Smith  <gavinsmith0123@gmail.com>
+
+       * tp/Texinfo/Convert/LaTeX.pm (index_entry): Strip | from
+       sort key as otherwise there can be manged output in the .idx
+       file with a "hyperindexformat" string that appears to be added
+       by the hyperref package.
+       * tp/t/latex_tests.t (vbar_in_index): New test.
+
 2022-10-02  Patrice Dumas  <pertusus@free.fr>
 
        Warn if @-commands other than accent, glyphs and symbols appear in @w
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index 17fffff30a..f536f27136 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -2139,6 +2139,8 @@ sub _index_entry($$)
       }
       my $result = '';
       if (defined($sortas)) {
+        # | in sort key breaks with hyperref
+        $sortas =~ s/\|//g;
         $result = _protect_text($self, $sortas).'@';
         $result =~ s/\\[{}]//g; # cannot have unmatched braces in index entry
       }
diff --git a/tp/t/latex_tests.t b/tp/t/latex_tests.t
index 51eb0b63de..47db7abb37 100644
--- a/tp/t/latex_tests.t
+++ b/tp/t/latex_tests.t
@@ -682,6 +682,10 @@ Describe @error{}.
 CCC
 @end defun
 '],
+['vbar_in_index',
+'@findex A|B
+@cindex C|D
+']
 );
 
 foreach my $test (@test_cases) {
diff --git a/tp/t/results/latex_tests/vbar_in_index.pl 
b/tp/t/results/latex_tests/vbar_in_index.pl
new file mode 100644
index 0000000000..48192cdf78
--- /dev/null
+++ b/tp/t/results/latex_tests/vbar_in_index.pl
@@ -0,0 +1,167 @@
+use vars qw(%result_texis %result_texts %result_trees %result_errors 
+   %result_indices %result_sectioning %result_nodes %result_menus
+   %result_floats %result_converted %result_converted_errors 
+   %result_elements %result_directions_text %result_indices_sort_strings);
+
+use utf8;
+
+$result_trees{'vbar_in_index'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'contents' => [],
+          'parent' => {},
+          'type' => 'preamble_before_content'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'parent' => {},
+                  'text' => 'A|B'
+                }
+              ],
+              'extra' => {
+                'spaces_after_argument' => '
+'
+              },
+              'parent' => {},
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'findex',
+          'extra' => {
+            'index_entry' => {
+              'content_normalized' => [],
+              'entry_content' => [],
+              'entry_element' => {},
+              'entry_number' => 1,
+              'in_code' => 1,
+              'index_at_command' => 'findex',
+              'index_ignore_chars' => {},
+              'index_name' => 'fn',
+              'index_type_command' => 'findex'
+            },
+            'spaces_before_argument' => ' '
+          },
+          'parent' => {},
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 1,
+            'macro' => ''
+          },
+          'type' => 'index_entry_command'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'parent' => {},
+                  'text' => 'C|D'
+                }
+              ],
+              'extra' => {
+                'spaces_after_argument' => '
+'
+              },
+              'parent' => {},
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'cindex',
+          'extra' => {
+            'index_entry' => {
+              'content_normalized' => [],
+              'entry_content' => [],
+              'entry_element' => {},
+              'entry_number' => 1,
+              'in_code' => 0,
+              'index_at_command' => 'cindex',
+              'index_ignore_chars' => {},
+              'index_name' => 'cp',
+              'index_type_command' => 'cindex'
+            },
+            'spaces_before_argument' => ' '
+          },
+          'parent' => {},
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 2,
+            'macro' => ''
+          },
+          'type' => 'index_entry_command'
+        }
+      ],
+      'parent' => {},
+      'type' => 'before_node_section'
+    }
+  ],
+  'type' => 'document_root'
+};
+$result_trees{'vbar_in_index'}{'contents'}[0]{'contents'}[0]{'parent'} = 
$result_trees{'vbar_in_index'}{'contents'}[0];
+$result_trees{'vbar_in_index'}{'contents'}[0]{'contents'}[1]{'args'}[0]{'contents'}[0]{'parent'}
 = $result_trees{'vbar_in_index'}{'contents'}[0]{'contents'}[1]{'args'}[0];
+$result_trees{'vbar_in_index'}{'contents'}[0]{'contents'}[1]{'args'}[0]{'parent'}
 = $result_trees{'vbar_in_index'}{'contents'}[0]{'contents'}[1];
+$result_trees{'vbar_in_index'}{'contents'}[0]{'contents'}[1]{'extra'}{'index_entry'}{'content_normalized'}
 = 
$result_trees{'vbar_in_index'}{'contents'}[0]{'contents'}[1]{'args'}[0]{'contents'};
+$result_trees{'vbar_in_index'}{'contents'}[0]{'contents'}[1]{'extra'}{'index_entry'}{'entry_content'}
 = 
$result_trees{'vbar_in_index'}{'contents'}[0]{'contents'}[1]{'args'}[0]{'contents'};
+$result_trees{'vbar_in_index'}{'contents'}[0]{'contents'}[1]{'extra'}{'index_entry'}{'entry_element'}
 = $result_trees{'vbar_in_index'}{'contents'}[0]{'contents'}[1];
+$result_trees{'vbar_in_index'}{'contents'}[0]{'contents'}[1]{'parent'} = 
$result_trees{'vbar_in_index'}{'contents'}[0];
+$result_trees{'vbar_in_index'}{'contents'}[0]{'contents'}[2]{'args'}[0]{'contents'}[0]{'parent'}
 = $result_trees{'vbar_in_index'}{'contents'}[0]{'contents'}[2]{'args'}[0];
+$result_trees{'vbar_in_index'}{'contents'}[0]{'contents'}[2]{'args'}[0]{'parent'}
 = $result_trees{'vbar_in_index'}{'contents'}[0]{'contents'}[2];
+$result_trees{'vbar_in_index'}{'contents'}[0]{'contents'}[2]{'extra'}{'index_entry'}{'content_normalized'}
 = 
$result_trees{'vbar_in_index'}{'contents'}[0]{'contents'}[2]{'args'}[0]{'contents'};
+$result_trees{'vbar_in_index'}{'contents'}[0]{'contents'}[2]{'extra'}{'index_entry'}{'entry_content'}
 = 
$result_trees{'vbar_in_index'}{'contents'}[0]{'contents'}[2]{'args'}[0]{'contents'};
+$result_trees{'vbar_in_index'}{'contents'}[0]{'contents'}[2]{'extra'}{'index_entry'}{'entry_element'}
 = $result_trees{'vbar_in_index'}{'contents'}[0]{'contents'}[2];
+$result_trees{'vbar_in_index'}{'contents'}[0]{'contents'}[2]{'parent'} = 
$result_trees{'vbar_in_index'}{'contents'}[0];
+$result_trees{'vbar_in_index'}{'contents'}[0]{'parent'} = 
$result_trees{'vbar_in_index'};
+
+$result_texis{'vbar_in_index'} = '@findex A|B
+@cindex C|D
+';
+
+
+$result_texts{'vbar_in_index'} = '';
+
+$result_errors{'vbar_in_index'} = [
+  {
+    'error_line' => 'warning: entry for index `fn\' outside of any node
+',
+    'file_name' => '',
+    'line_nr' => 1,
+    'macro' => '',
+    'text' => 'entry for index `fn\' outside of any node',
+    'type' => 'warning'
+  },
+  {
+    'error_line' => 'warning: entry for index `cp\' outside of any node
+',
+    'file_name' => '',
+    'line_nr' => 2,
+    'macro' => '',
+    'text' => 'entry for index `cp\' outside of any node',
+    'type' => 'warning'
+  }
+];
+
+
+$result_floats{'vbar_in_index'} = {};
+
+
+$result_indices_sort_strings{'vbar_in_index'} = {
+  'cp' => [
+    'C|D'
+  ],
+  'fn' => [
+    'A|B'
+  ]
+};
+
+
+
+$result_converted{'latex_text'}->{'vbar_in_index'} = '\\begin{document}
+\\index[fn]{AB@\\texttt{A"|B}}%
+\\index[cp]{C"|D}%
+';
+
+1;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]