texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Report.pm (line_warn, line_error, d


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Report.pm (line_warn, line_error, document_warn) (document_error, file_line_warn, file_line_error), tp/Texinfo/Convert/HTML.pm (noticed_line_warn) (noticed_line_error): do not handle 'ignore_notice' in Texinfo::Report, this is internal converter information. Instead use the new function noticed_line_warn() in converter in in relevant places to intercept messages and ignore them if 'ignore_notice' is set.
Date: Sun, 29 Aug 2021 08:57:40 -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 46fb7844 * tp/Texinfo/Report.pm (line_warn, line_error, document_warn) 
(document_error, file_line_warn, file_line_error), tp/Texinfo/Convert/HTML.pm 
(noticed_line_warn) (noticed_line_error): do not handle 'ignore_notice' in 
Texinfo::Report, this is internal converter information. Instead use the new 
function noticed_line_warn() in converter in in relevant places to intercept 
messages and ignore them if 'ignore_notice' is set.
46fb7844 is described below

commit 46fb7844cf9eb54a913a125133941b06f2f523fe
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Aug 29 14:57:24 2021 +0200

    * tp/Texinfo/Report.pm (line_warn, line_error, document_warn)
    (document_error, file_line_warn, file_line_error),
    tp/Texinfo/Convert/HTML.pm (noticed_line_warn)
    (noticed_line_error): do not handle 'ignore_notice' in
    Texinfo::Report, this is internal converter information.
    Instead use the new function noticed_line_warn() in converter
    in in relevant places to intercept messages and ignore them
    if 'ignore_notice' is set.
    
    * tp/Texinfo/Report.pm (gdt): do not pass 'gettext' it is not
    set not used anywhere.
---
 ChangeLog                  | 14 ++++++++++++++
 tp/Texinfo/Convert/HTML.pm | 24 +++++++++++++++++++++---
 tp/Texinfo/Report.pm       | 21 +++++++++------------
 3 files changed, 44 insertions(+), 15 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 70cd175..fdb727a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2021-08-29  Patrice Dumas  <pertusus@free.fr>
 
+       * tp/Texinfo/Report.pm (line_warn, line_error, document_warn)
+       (document_error, file_line_warn, file_line_error),
+       tp/Texinfo/Convert/HTML.pm (noticed_line_warn)
+       (noticed_line_error): do not handle 'ignore_notice' in
+       Texinfo::Report, this is internal converter information.
+       Instead use the new function noticed_line_warn() in converter
+       in in relevant places to intercept messages and ignore them
+       if 'ignore_notice' is set.
+
+       * tp/Texinfo/Report.pm (gdt): do not pass 'gettext' it is not
+       set not used anywhere.
+
+2021-08-29  Patrice Dumas  <pertusus@free.fr>
+
        * tp/Texinfo/Structuring.pm (setup_index_entry_keys_formatting)
        (do_index_keys, sort_indices, sort_indices_by_letter),
        tp/Texinfo/Convert/LaTeX.pm, tp/init/chm.pm,
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 3b4c30e..6adc656 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -688,6 +688,24 @@ sub get_value($$)
   }
 }
 
+# intercept warning and error messages to take 'ignore_notice' into
+# account
+sub noticed_line_warn
+{
+  my $self = shift;
+  return if ($self->{'ignore_notice'});
+  return $self->line_warn(@_);
+}
+
+# does not seems to be used
+sub noticed_line_error
+{
+  my $self = shift;
+  return if ($self->{'ignore_notice'});
+  return $self->line_error(@_);
+}
+
+
 # This function should be used in formatting functions when some
 # Texinfo tree need to be converted.
 sub convert_tree_new_formatting_context($$;$$)
@@ -1824,7 +1842,7 @@ sub _convert_image_command($$$$)
         $image_file = "$basefile.jpg";
       }
       #cluck "err ($self->{'ignore_notice'})";
-      $self->line_warn(sprintf(
+      $self->noticed_line_warn(sprintf(
               __("\@image file `%s' (for HTML) not found, using `%s'"), 
                                $basefile, $image_file), $command->{'line_nr'});
     }
@@ -2638,8 +2656,8 @@ sub _convert_raw_command($$$$)
   if ($cmdname eq $self->{'output_format'}) {
     return $content;
   }
-  $self->line_warn(sprintf(__("raw format %s is not converted"), 
-                           $cmdname), $command->{'line_nr'});
+  $self->noticed_line_warn(sprintf(__("raw format %s is not converted"), 
+                                   $cmdname), $command->{'line_nr'});
   return $self->protect_text($content);
 }
 
diff --git a/tp/Texinfo/Report.pm b/tp/Texinfo/Report.pm
index 3fdc8a1..a092399 100644
--- a/tp/Texinfo/Report.pm
+++ b/tp/Texinfo/Report.pm
@@ -67,7 +67,7 @@ sub line_warn($$$)
   my $text = shift;
   chomp ($text);
   my $line_number = shift;
-  return if (!defined($line_number) or $self->{'ignore_notice'});
+  return if (!defined($line_number));
   my $file = $line_number->{'file_name'};
   # otherwise out of source build fail since the file names are different
   my ($directories, $suffix);
@@ -96,7 +96,6 @@ sub line_error($$$)
   my $text = shift;
   chomp ($text);
   my $line_number = shift;
-  return if ($self->{'ignore_notice'});
   if (defined($line_number)) {
     my $file = $line_number->{'file_name'};
     my ($directories, $suffix);
@@ -118,7 +117,6 @@ sub document_warn($$)
 {
   my $self = shift;
   my $text = shift;
-  return if ($self->{'ignore_notice'});
   chomp($text);
 
   my $warn_line;
@@ -137,7 +135,6 @@ sub document_error($$)
 {
   my $self = shift;
   my $text = shift;
-  return if ($self->{'ignore_notice'});
   chomp($text);
   my $error_line;
   if (defined($self->get_conf('PROGRAM')) and $self->get_conf('PROGRAM') ne 
'') {
@@ -154,7 +151,6 @@ sub file_line_warn($$$;$)
 {
   my $self = shift;
   my $text = shift;
-  return if ($self->{'ignore_notice'});
   chomp($text);
   my $file = shift;
   my $line_nr = shift;
@@ -178,7 +174,6 @@ sub file_line_error($$$;$)
 {
   my $self = shift;
   my $text = shift;
-  return if ($self->{'ignore_notice'});
   chomp($text);
   my $file = shift;
   my $line_nr = shift;
@@ -296,8 +291,9 @@ sub gdt($$;$$)
     }
   }
 
-  # FIXME do this once when @documentlanguage changes (or at beginning)
-  # instead of here, each time that gdt is called?
+  # This needs to be dynamic in case there is an untranslated string
+  # from another language that needs to be translated.
+  # FIXME make it an argument
   my $lang = $self->get_conf('documentlanguage');
   $lang = $DEFAULT_LANGUAGE if (!defined($lang));
   my @langs = ($lang);
@@ -323,7 +319,6 @@ sub gdt($$;$$)
     }
   }
   $locales =~ s/:$//;
-  # END FIXME
 
   Locale::Messages::nl_putenv("LANGUAGE=$locales");
 
@@ -371,10 +366,10 @@ sub gdt($$;$$)
   }
 
   if ($current_parser) {
-    # not sure 'gettext' could in fact be useful in parser for
-    # translated fragments.  'TEST' can be used fot @today{} expansion.
+    # 'TEST' can be used fot @today{} expansion.
+    # FIXME use get_conf
     foreach my $duplicated_conf ('clickstyle', 'kbdinputstyle', 'DEBUG',
-                                 'TEST', 'gettext') {
+                                 'TEST') {
       $parser_conf->{$duplicated_conf} = $current_parser->{$duplicated_conf}
         if (defined($current_parser->{$duplicated_conf}));
     }
@@ -387,6 +382,8 @@ sub gdt($$;$$)
   }
 
   my $tree = $parser->parse_texi_line($translation_result);
+  # FIXME if at some point it becomes possible to reuse a parser
+  # this could bring in all the parser errors
   my ($errors, $errors_count) = $parser->errors();
   if ($errors_count) {
     warn "translation $errors_count error(s)\n";



reply via email to

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