texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/ParserNonXS.pm (%set_flag_index_char


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/ParserNonXS.pm (%set_flag_index_char_ignore) (_enter_index_entry), tp/Texinfo/Structuring.pm (index_entry_sort_string): add the ignored characters based on txiindex*ignore values to index_entry dynamically in parser. Use these values. Inactive implementation, waiting for implementation in XS parser to activate. Design partly based on Gavin ideas.
Date: Mon, 06 Sep 2021 13:37:13 -0400

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 5594451  * tp/Texinfo/ParserNonXS.pm (%set_flag_index_char_ignore) 
(_enter_index_entry), tp/Texinfo/Structuring.pm (index_entry_sort_string): add 
the ignored characters based on txiindex*ignore values to index_entry 
dynamically in parser. Use these values.  Inactive implementation, waiting for 
implementation in XS parser to activate.  Design partly based on Gavin ideas.
5594451 is described below

commit 559445173a5a5d7f920a78102b3f3b8338b96dad
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Sep 6 19:37:05 2021 +0200

    * tp/Texinfo/ParserNonXS.pm (%set_flag_index_char_ignore)
    (_enter_index_entry), tp/Texinfo/Structuring.pm
    (index_entry_sort_string): add the ignored characters based
    on txiindex*ignore values to index_entry dynamically in parser.
    Use these values.  Inactive implementation, waiting for implementation
    in XS parser to activate.  Design partly based on Gavin ideas.
---
 ChangeLog                 |  9 +++++++++
 tp/Texinfo/ParserNonXS.pm | 16 ++++++++++++++++
 tp/Texinfo/Structuring.pm |  9 +++++++--
 3 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6bfe13b..6337dec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2021-09-06  Patrice Dumas  <pertusus@free.fr>
 
+       * tp/Texinfo/ParserNonXS.pm (%set_flag_index_char_ignore)
+       (_enter_index_entry), tp/Texinfo/Structuring.pm
+       (index_entry_sort_string): add the ignored characters based
+       on txiindex*ignore values to index_entry dynamically in parser.
+       Use these values.  Inactive implementation, waiting for implementation
+       in XS parser to activate.  Design partly based on Gavin ideas.
+
+2021-09-06  Patrice Dumas  <pertusus@free.fr>
+
        * tp/Texinfo/Convert/DocBook.pm (%defaults, convert, convert_tree)
        ($DEFAULT_LANG, output, _convert): set the default for
        documentlanguage as undef, but use $DEFAULT_LANG, set to 'en' as
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index d579607..6fb387e 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -258,6 +258,13 @@ my %set_flag_command_equivalent = (
 #  'txideftypefnnl'         => 'deftypefnnewline',
 );
 
+# could be moved to Texinfo::Common if needed more generally
+my %set_flag_index_char_ignore = (
+ 'txiindexatsignignore' => '@',
+ 'txiindexbackslashignore' => '\\',
+ 'txiindexlessthanignore' => '<',
+ 'txiindexhyphenignore' => '-',
+);
 
 # keep line information for those commands.
 my %keep_line_nr_brace_commands = %context_brace_commands;
@@ -2545,6 +2552,15 @@ sub _enter_index_entry($$$$$$$)
                       'command'              => $current,
                       'number'               => $number,
                     };
+  # gather set txiindex*ignore information
+  foreach my $set_variable (keys(%set_flag_index_char_ignore)) {
+    if (exists($self->{'values'}->{$set_variable})) {
+      my $ignored_char = $set_flag_index_char_ignore{$set_variable};
+      if (0) {
+      $index_entry->{'index_ignore_flags'}->{$ignored_char} = 1;
+      }
+    }
+  }
   if (defined $current->{'extra'}->{'sortas'}) {
     $index_entry->{'sortas'} = $current->{'extra'}->{'sortas'};
   }
diff --git a/tp/Texinfo/Structuring.pm b/tp/Texinfo/Structuring.pm
index 42f17b3..8c30264 100644
--- a/tp/Texinfo/Structuring.pm
+++ b/tp/Texinfo/Structuring.pm
@@ -1569,8 +1569,9 @@ sub setup_index_entry_keys_formatting($$)
   my $self = shift;
   my $configuration_informations = shift;
 
+  # TODO remove once 'index_ignore_flags' is implemented everywhere
   my $ignore_chars = '';
-
+#if (0){
   # '-' must come first to avoid e.g. [<-@] looking like a character range
   $ignore_chars .= '-'
     if defined $self->{'values'}->{'txiindexhyphenignore'};
@@ -1580,7 +1581,7 @@ sub setup_index_entry_keys_formatting($$)
     if defined $self->{'values'}->{'txiindexlessthanignore'};
   $ignore_chars .= '@'
     if defined $self->{'values'}->{'txiindexatsignignore'};
-
+#}
   my $options = {'sort_string' => 1,
    Texinfo::Convert::Text::copy_options_for_convert_text(
                                     $configuration_informations)};
@@ -1607,6 +1608,10 @@ sub index_entry_sort_string($$$$;$)
     $entry_key = Texinfo::Convert::Text::convert_to_text(
                           $entry_tree_element, $convert_to_text_options);
     # FIXME do that for sortas too?
+    if (exists($main_entry->{'index_ignore_flags'})) {
+      $ignore_chars
+         .= quotemeta(join('', keys(%{$main_entry->{'index_ignore_flags'}})));
+    }
     if (defined($ignore_chars) and $ignore_chars ne '') {
       $entry_key =~ s/[$ignore_chars]//g;
     }



reply via email to

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