texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: Do not set INDEX_SPECIAL_CHARS_WARNING with INFO_


From: Patrice Dumas
Subject: branch master updated: Do not set INDEX_SPECIAL_CHARS_WARNING with INFO_SPECIAL_CHARS_QUOTE
Date: Sat, 13 Aug 2022 15:54:41 -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 d4048b3366 Do not set INDEX_SPECIAL_CHARS_WARNING with 
INFO_SPECIAL_CHARS_QUOTE
d4048b3366 is described below

commit d4048b3366a48ddafe82a1e07b0a0e561ee251e7
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Aug 13 21:54:31 2022 +0200

    Do not set INDEX_SPECIAL_CHARS_WARNING with INFO_SPECIAL_CHARS_QUOTE
    
    * doc/texinfo.texi (Other Customization Variables),
    tp/Texinfo/Convert/Plaintext.pm (%defaults, converter_initialize):
    Set default of INFO_SPECIAL_CHARS_WARNING to be undef.  If undef,
    set if INFO_SPECIAL_CHARS_QUOTE is not set.
    
    * tp/Texinfo/Convert/Info.pm, tp/Texinfo/Convert/Plaintext.pm:
    cache get_conf call result of INDEX_SPECIAL_CHARS_WARNING and
    INFO_SPECIAL_CHARS_QUOTE.
---
 ChangeLog                       | 13 ++++++++
 doc/texinfo.texi                |  5 +--
 tp/Texinfo/Convert/Info.pm      |  4 +--
 tp/Texinfo/Convert/Plaintext.pm | 70 ++++++++++++++++++++++++++---------------
 4 files changed, 63 insertions(+), 29 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9ef53cadc9..9864d327a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2022-08-13  Patrice Dumas  <pertusus@free.fr>
+
+       Do not set INDEX_SPECIAL_CHARS_WARNING with INFO_SPECIAL_CHARS_QUOTE
+
+       * doc/texinfo.texi (Other Customization Variables),
+       tp/Texinfo/Convert/Plaintext.pm (%defaults, converter_initialize):
+       Set default of INFO_SPECIAL_CHARS_WARNING to be undef.  If undef,
+       set if INFO_SPECIAL_CHARS_QUOTE is not set.
+
+       * tp/Texinfo/Convert/Info.pm, tp/Texinfo/Convert/Plaintext.pm:
+       cache get_conf call result of INDEX_SPECIAL_CHARS_WARNING and
+       INFO_SPECIAL_CHARS_QUOTE.
+
 2022-08-13  Gavin Smith  <gavinsmith0123@gmail.com>
 
        * tp/Texinfo/Convert/LaTeX.pm: Add unbalanced braces in
diff --git a/doc/texinfo.texi b/doc/texinfo.texi
index adc18f524b..5e5e044292 100644
--- a/doc/texinfo.texi
+++ b/doc/texinfo.texi
@@ -16888,8 +16888,9 @@ construct where they appear with quoting characters, as 
described in
 
 @item INFO_SPECIAL_CHARS_WARNING
 If set, warn about problematic constructs for Info output (such as the
-string @samp{::}) in node names, menu items, and cross-references;
-default true.  Similar warnings in index entries are covered by
+string @samp{::}) in node names, menu items, and cross-references.
+If not defined, set unless @code{INFO_SPECIAL_CHARS_QUOTE} is set.
+Default is not defined. Similar warnings in index entries are covered by
 @code{INDEX_SPECIAL_CHARS_WARNING}.
 
 @item INPUT_FILE_NAME_ENCODING
diff --git a/tp/Texinfo/Convert/Info.pm b/tp/Texinfo/Convert/Info.pm
index d0692fe538..9c7cfc8c5f 100644
--- a/tp/Texinfo/Convert/Info.pm
+++ b/tp/Texinfo/Convert/Info.pm
@@ -452,12 +452,12 @@ sub format_node($$)
   my $pre_quote = '';
   my $post_quote = '';
   if ($node_text =~ /,/) {
-    if ($self->get_conf('INFO_SPECIAL_CHARS_WARNING')) {
+    if ($self->{'info_special_chars_warning'}) {
       $self->line_warn($self, sprintf(__(
                  "\@node name should not contain `,': %s"), $node_text),
                                $node->{'source_info'});
     }
-    if ($self->get_conf('INFO_SPECIAL_CHARS_QUOTE')) {
+    if ($self->{'info_special_chars_quote'}) {
       $pre_quote = "\x{7f}";
       $post_quote = $pre_quote;
       $self->{'count_context'}->[-1]->{'bytes'} += 2;
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index 0cdf0bb3b4..ce25946f3b 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -341,7 +341,7 @@ my %defaults = (
   #'EXTENSION'            => 'info',
   'EXTENSION'            => 'txt',
   #'USE_SETFILENAME_EXTENSION' => 1,
-  'INFO_SPECIAL_CHARS_WARNING' => 1,
+  'INFO_SPECIAL_CHARS_WARNING' => undef,
 
   #'OUTFILE'              => undef,
   'OUTFILE'              => '-',
@@ -449,6 +449,26 @@ sub converter_initialize($)
     $self->{'fillcolumn'} = $self->get_conf('FILLCOLUMN');
     # else it's already set via the defaults
   }
+
+  if ($self->get_conf('INFO_SPECIAL_CHARS_QUOTE')) {
+    $self->{'info_special_chars_quote'}
+       = $self->get_conf('INFO_SPECIAL_CHARS_QUOTE');
+    if (!defined($self->get_conf('INFO_SPECIAL_CHARS_WARNING'))) {
+      $self->set_conf('INFO_SPECIAL_CHARS_WARNING', 0);
+    }
+  } else {
+    $self->{'info_special_chars_quote'} = '';
+    if (!defined($self->get_conf('INFO_SPECIAL_CHARS_WARNING'))) {
+      $self->set_conf('INFO_SPECIAL_CHARS_WARNING', 1);
+    }
+  }
+  if ($self->get_conf('INFO_SPECIAL_CHARS_WARNING')) {
+    $self->{'info_special_chars_warning'}
+       = $self->get_conf('INFO_SPECIAL_CHARS_WARNING');
+  } else {
+    $self->{'info_special_chars_warning'} = '';
+  }
+
   # This needs to be here to take into account $self->{'fillcolumn'}.
   $self->push_top_formatter('_Root_context');
   # some caching to avoid calling get_conf
@@ -2066,14 +2086,14 @@ sub _convert($$)
              .get_pending($self->{'formatters'}->[-1]->{'container'});
           my $quoting_required = 0;
           if ($name_text_checked =~ /:/m) { 
-              if ($self->get_conf('INFO_SPECIAL_CHARS_WARNING')) {
-                $self->line_warn($self, sprintf(__(
-                   "\@%s cross-reference name should not contain `:'"),
-                                         $command), $element->{'source_info'});
-              }
-              if ($self->get_conf('INFO_SPECIAL_CHARS_QUOTE')) {
-                $quoting_required = 1;
-              }
+            if ($self->{'info_special_chars_warning'}) {
+              $self->line_warn($self, sprintf(__(
+                 "\@%s cross-reference name should not contain `:'"),
+                                       $command), $element->{'source_info'});
+            }
+            if ($self->{'info_special_chars_quote'}) {
+              $quoting_required = 1;
+            }
           }
           my $pre_quote = $quoting_required ? "\x{7f}" : '';
           my $post_quote = $pre_quote;
@@ -2104,14 +2124,14 @@ sub _convert($$)
           $node_text_checked =~ s/^\s*$maybe_file//;
           $quoting_required = 0;
           if ($node_text_checked =~ /([,\t\.])/m ) {
-              if ($self->get_conf('INFO_SPECIAL_CHARS_WARNING')) {
-                $self->line_warn($self, sprintf(__(
-                   "\@%s node name should not contain `%s'"), $command, $1),
-                                 $element->{'source_info'});
-              }
-              if ($self->get_conf('INFO_SPECIAL_CHARS_QUOTE')) {
-                $quoting_required = 1;
-              }
+            if ($self->{'info_special_chars_warning'}) {
+              $self->line_warn($self, sprintf(__(
+                 "\@%s node name should not contain `%s'"), $command, $1),
+                               $element->{'source_info'});
+            }
+            if ($self->{'info_special_chars_quote'}) {
+              $quoting_required = 1;
+            }
           }
           $pre_quote = $quoting_required ? "\x{7f}" : '';
           $post_quote = $pre_quote;
@@ -2137,12 +2157,12 @@ sub _convert($$)
              .get_pending($self->{'formatters'}->[-1]->{'container'});
           my $quoting_required = 0;
           if ($node_text_checked =~ /:/m) {
-            if ($self->get_conf('INFO_SPECIAL_CHARS_WARNING')) {
+            if ($self->{'info_special_chars_warning'}) {
               $self->line_warn($self, sprintf(__(
                  "\@%s node name should not contain `:'"), $command),
                                $element->{'source_info'});
             }
-            if ($self->get_conf('INFO_SPECIAL_CHARS_QUOTE')) {
+            if ($self->{'info_special_chars_quote'}) {
               $quoting_required = 1;
             }
           }
@@ -3017,23 +3037,23 @@ sub _convert($$)
           $pre_quote = $post_quote = '';
           if ($entry_name_seen) {
             if ($node_text =~ /([,\t]|\.\s)/) {
-              if ($self->get_conf('INFO_SPECIAL_CHARS_WARNING')) {
+              if ($self->{'info_special_chars_warning'}) {
                 $self->line_warn($self, sprintf(__(
                    "menu entry node name should not contain `%s'"), $1),
                                $element->{'source_info'});
               }
             }
-            if ($self->get_conf('INFO_SPECIAL_CHARS_QUOTE')) {
+            if ($self->{'info_special_chars_quote'}) {
               $pre_quote = $post_quote = "\x{7f}";
             }
           } else {
             if ($node_text =~ /:/) {
-              if ($self->get_conf('INFO_SPECIAL_CHARS_WARNING')) {
+              if ($self->{'info_special_chars_warning'}) {
                 $self->line_warn($self, __(
                  "menu entry node name should not contain `:'"),
                                $element->{'source_info'});
               }
-              if ($self->get_conf('INFO_SPECIAL_CHARS_QUOTE')) {
+              if ($self->{'info_special_chars_quote'}) {
                 $pre_quote = $post_quote = "\x{7f}";
               }
             }
@@ -3048,12 +3068,12 @@ sub _convert($$)
           $entry_name_seen = 1;
           $pre_quote = $post_quote = '';
           if ($entry_name =~ /:/) {
-            if ($self->get_conf('INFO_SPECIAL_CHARS_WARNING')) {
+            if ($self->{'info_special_chars_warning'}) {
               $self->line_warn($self, __(
                  "menu entry name should not contain `:'"),
                                $element->{'source_info'});
             }
-            if ($self->get_conf('INFO_SPECIAL_CHARS_QUOTE')) {
+            if ($self->{'info_special_chars_quote'}) {
               $pre_quote = $post_quote = "\x{7f}";
             }
           }



reply via email to

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