texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Thu, 18 Apr 2024 14:53:25 -0400 (EDT)

branch: master
commit f9d9a1e74013a49076cf47c02645a3d6efc936b6
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Apr 17 22:36:38 2024 +0200

    * tp/Texinfo/Convert/HTML.pm (_internal_command_text)
    (convert_tree_new_formatting_context, _noticed_line_warn),
    tp/Texinfo/XS/convert/build_html_perl_state.c
    (build_html_formatting_state), tp/Texinfo/XS/convert/convert_html.c
    (noticed_line_warn, convert_tree_new_formatting_context)
    (html_internal_command_text, html_conversion_finalization),
    tp/Texinfo/XS/main/converter_types.h (CONVERTER): rename ignore_notice
    as multiple_conversions.
    
    * tp/ext/epub3.pm (epub_convert_image_command): use
    converter_line_warn instead of _noticed_line_warn, but note that
    multiple_conversions should be taken into account.
---
 ChangeLog                                     | 15 ++++++++++++
 tp/Texinfo/Convert/HTML.pm                    | 21 +++++++++--------
 tp/Texinfo/XS/convert/build_html_perl_state.c |  6 ++---
 tp/Texinfo/XS/convert/convert_html.c          | 33 ++++++++++++++-------------
 tp/Texinfo/XS/main/converter_types.h          |  2 +-
 tp/Texinfo/XS/main/utils.h                    |  2 +-
 tp/ext/epub3.pm                               |  7 +++---
 7 files changed, 52 insertions(+), 34 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9f749c146e..77cc974a5b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2024-04-17  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/HTML.pm (_internal_command_text)
+       (convert_tree_new_formatting_context, _noticed_line_warn),
+       tp/Texinfo/XS/convert/build_html_perl_state.c
+       (build_html_formatting_state), tp/Texinfo/XS/convert/convert_html.c
+       (noticed_line_warn, convert_tree_new_formatting_context)
+       (html_internal_command_text, html_conversion_finalization),
+       tp/Texinfo/XS/main/converter_types.h (CONVERTER): rename ignore_notice
+       as multiple_conversions.
+
+       * tp/ext/epub3.pm (epub_convert_image_command): use
+       converter_line_warn instead of _noticed_line_warn, but note that
+       multiple_conversions should be taken into account.
+
 2024-04-17  Patrice Dumas  <pertusus@free.fr>
 
        * Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm (_accessorize),
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 90cb2e053e..6e29b7e92e 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -1393,12 +1393,12 @@ sub _internal_command_text($$$)
       $tree_root = $selected_tree;
     }
 
-    $self->{'ignore_notice'}++;
+    $self->{'multiple_conversions'}++;
 
     _push_referred_command_stack_command($self, $command);
     $target->{$type} = $self->_convert($tree_root, $explanation);
     _pop_referred_command_stack($self);
-    $self->{'ignore_notice'}--;
+    $self->{'multiple_conversions'}--;
 
     $self->_pop_document_context();
     return $target->{$type};
@@ -2380,7 +2380,7 @@ sub convert_tree_new_formatting_context($$$;$$$)
   my $multiple_pass_str = '';
 
   if ($multiple_pass) {
-    $self->{'ignore_notice'}++;
+    $self->{'multiple_conversions'}++;
     push @{$self->{'multiple_pass'}}, $multiple_pass;
     $multiple_pass_str = '|M'
   }
@@ -2390,7 +2390,7 @@ sub convert_tree_new_formatting_context($$$;$$$)
   my $result = $self->convert_tree($tree, "new_fmt_ctx ${context_string_str}");
 
   if ($multiple_pass) {
-    $self->{'ignore_notice'}--;
+    $self->{'multiple_conversions'}--;
     pop @{$self->{'multiple_pass'}};
   }
 
@@ -3059,14 +3059,14 @@ foreach my $explained_command 
(keys(%explained_commands)) {
      = [['normal'], ['normal', 'string']];
 }
 
-# intercept warning and error messages to take 'ignore_notice' into
+# intercept warning and error messages to take 'multiple_conversions' into
 # account
 sub _noticed_line_warn($$$)
 {
   my $self = shift;
   my $text = shift;
   my $line_nr = shift;
-  return if ($self->{'ignore_notice'});
+  return if ($self->{'multiple_conversions'});
   $self->converter_line_warn($text, $line_nr);
 }
 
@@ -6661,7 +6661,7 @@ sub _convert_printindex_command($$$$)
               and not $main_entry_element->{'extra'}->{'element_region'}
               and $formatted_index_entry_nr == 1) {
          # NOTE _noticed_line_warn is not used as printindex should not
-         # happen in multiple tree parsing that lead to ignore_notice being 
set,
+         # happen in multiple tree conversion with multiple_conversions set,
          # but the error message is printed only for the first entry 
formatting.
             $self->converter_line_warn(
                              sprintf(
@@ -6691,8 +6691,9 @@ sub _convert_printindex_command($$$$)
                 and not $main_entry_element->{'extra'}->{'element_region'}
                 and $formatted_index_entry_nr == 1) {
           # NOTE _noticed_line_warn is not used as printindex should not
-          # happen in multiple tree parsing that lead to ignore_notice being 
set,
-          # but the error message is printed only for the first entry 
formatting.
+          # happen in multiple tree conversions and multiple_conversions
+          # being set, but the error message is printed only for the first
+          # entry formatting.
           # NOTE the index entry may be associated to a node in that case.
               $self->converter_line_warn(
                                sprintf(
@@ -8740,7 +8741,7 @@ sub _load_htmlxref_files {
 #  document_units
 #  out_filepaths          (partially common with Texinfo::Converter)
 #  seen_ids
-#  ignore_notice
+#  multiple_conversions
 #  options_latex_math
 #  htmlxref
 #  check_htmlxref_already_warned
diff --git a/tp/Texinfo/XS/convert/build_html_perl_state.c 
b/tp/Texinfo/XS/convert/build_html_perl_state.c
index 96fa930970..47242cd720 100644
--- a/tp/Texinfo/XS/convert/build_html_perl_state.c
+++ b/tp/Texinfo/XS/convert/build_html_perl_state.c
@@ -378,10 +378,10 @@ build_html_formatting_state (CONVERTER *converter, 
unsigned long flags)
 #define FETCH(key) key##_sv = hv_fetch (hv, #key, strlen (#key), 0);
 #define STORE(key, value) hv_store (hv, key, strlen (key), value, 0)
 
-  if (flags & HMSF_ignore_notice)
+  if (flags & HMSF_multiple_conversions)
     {
-      STORE("ignore_notice",
-        newSViv (converter->ignore_notice));
+      STORE("multiple_conversions",
+        newSViv (converter->multiple_conversions));
     }
 
   if (flags & HMSF_current_root)
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 3f83bdacfc..cf745276e6 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -2169,7 +2169,7 @@ set_root_commands_targets_node_files (CONVERTER *self)
 }
 
 /*
-intercept warning and error messages to take 'ignore_notice' into
+intercept warning and error messages to take 'multiple_conversions' into
 account
  */
 static void
@@ -2178,7 +2178,7 @@ noticed_line_warn (CONVERTER *self, const ELEMENT 
*element,
 {
   va_list v;
 
-  if (self->ignore_notice)
+  if (self->multiple_conversions)
     return;
 
   va_start (v, format);
@@ -2816,9 +2816,9 @@ convert_tree_new_formatting_context (CONVERTER *self, 
const ELEMENT *tree,
 
   if (multiple_pass)
     {
-      self->ignore_notice++;
+      self->multiple_conversions++;
       push_string_stack_string (&self->multiple_pass, multiple_pass);
-      self->modified_state |= HMSF_multiple_pass | HMSF_ignore_notice;
+      self->modified_state |= HMSF_multiple_pass | HMSF_multiple_conversions;
       multiple_pass_str = "|M";
     }
 
@@ -2833,9 +2833,9 @@ convert_tree_new_formatting_context (CONVERTER *self, 
const ELEMENT *tree,
 
   if (multiple_pass)
     {
-      self->ignore_notice--;
+      self->multiple_conversions--;
       pop_string_stack (&self->multiple_pass);
-      self->modified_state |= HMSF_multiple_pass | HMSF_ignore_notice;
+      self->modified_state |= HMSF_multiple_pass | HMSF_multiple_conversions;
     }
 
   free (context_string_str);
@@ -3986,16 +3986,16 @@ html_internal_command_text (CONVERTER *self, const 
ELEMENT *command,
           else
             tree_root = selected_tree;
 
-          self->ignore_notice++;
+          self->multiple_conversions++;
           push_element_reference_stack_element (&self->referred_command_stack,
                                                 command, command->hv);
-          self->modified_state |= HMSF_ignore_notice;
+          self->modified_state |= HMSF_multiple_conversions;
           target_info->command_text[type]
             = html_convert_tree (self, tree_root, explanation);
           free (explanation);
           pop_element_reference_stack (&self->referred_command_stack);
-          self->ignore_notice--;
-          self->modified_state |= HMSF_ignore_notice;
+          self->multiple_conversions--;
+          self->modified_state |= HMSF_multiple_conversions;
 
           html_pop_document_context (self);
 
@@ -13159,7 +13159,7 @@ convert_printindex_command (CONVERTER *self, const enum 
command_id cmd,
                           if (!element_region)
                             {
      /* NOTE _noticed_line_warn is not used as printindex should not
-        happen in multiple tree parsing that lead to ignore_notice being set,
+        happen in multiple tree conversion with multiple_conversions set,
         but the error message is printed only for the first entry formatting. 
*/
                               message_list_command_warn (&self->error_messages,
                                       self->conf,
@@ -13198,8 +13198,9 @@ convert_printindex_command (CONVERTER *self, const enum 
command_id cmd,
                               if (!element_region)
                                 {
       /* NOTE _noticed_line_warn is not used as printindex should not
-         happen in multiple tree parsing that lead to ignore_notice being set,
-         but the error message is printed only for the first entry formatting.
+         happen in multiple tree conversions and multiple_conversions
+         being set, but the error message is printed only for the first
+         entry formatting.
          NOTE the index entry may be associated to a node in that case. */
                               message_list_command_warn (&self->error_messages,
                                       self->conf,
@@ -16949,9 +16950,9 @@ html_conversion_finalization (CONVERTER *self)
       if (self->document_global_context)
         fprintf (stderr, "BUG: document_global_context: %d\n",
                          self->document_global_context);
-      if (self->ignore_notice)
-        fprintf (stderr, "BUG: ignore_notice: %d\n",
-                         self->ignore_notice);
+      if (self->multiple_conversions)
+        fprintf (stderr, "BUG: multiple_conversions: %d\n",
+                         self->multiple_conversions);
     }
 
 }
diff --git a/tp/Texinfo/XS/main/converter_types.h 
b/tp/Texinfo/XS/main/converter_types.h
index 4a2000b3f8..26450edf89 100644
--- a/tp/Texinfo/XS/main/converter_types.h
+++ b/tp/Texinfo/XS/main/converter_types.h
@@ -813,7 +813,7 @@ typedef struct CONVERTER {
 
     /* state common with perl converter */
     int document_global_context;
-    int ignore_notice;
+    int multiple_conversions;
     const ELEMENT *current_root_command;
     const ELEMENT *current_node;
     const OUTPUT_UNIT *current_output_unit;
diff --git a/tp/Texinfo/XS/main/utils.h b/tp/Texinfo/XS/main/utils.h
index bd6525d84d..9f947da641 100644
--- a/tp/Texinfo/XS/main/utils.h
+++ b/tp/Texinfo/XS/main/utils.h
@@ -113,7 +113,7 @@ enum command_location {
 #define HMSF_     0x0400
 #define HMSF_        0x0800
 */
-#define HMSF_ignore_notice           0x1000
+#define HMSF_multiple_conversions           0x1000
 #define HMSF_multiple_pass           0x2000
 #define HMSF_translations            0x4000
 /*
diff --git a/tp/ext/epub3.pm b/tp/ext/epub3.pm
index 51d706c36a..a05e1206b2 100644
--- a/tp/ext/epub3.pm
+++ b/tp/ext/epub3.pm
@@ -267,10 +267,11 @@ sub epub_convert_image_command($$$$)
     my ($image_file, $image_extension, $image_path, $image_path_encoding)
       = $self->html_image_file_location_name($cmdname, $command,
                                              $image_basefile, $args);
+
+    # FIXME do only if !$self->{'multiple_conversions'}, ie do not do it more 
than
+    # once
     if (not defined($image_path)) {
-      # FIXME using an internal function.  Also not clear if it is correct to
-      # use it, as it is not used for other messages
-      $self->_noticed_line_warn(sprintf(
+      $self->converter_line_warn(sprintf(
               __("\@image file `%s' (for HTML) not found, using `%s'"),
                  $image_basefile, $image_file), $command->{'source_info'});
     }



reply via email to

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