texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Convert/HTML.pm (%XS_conversion_over


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Convert/HTML.pm (%XS_conversion_overrides): add missed override for footnote_location_href.
Date: Fri, 16 Feb 2024 03:57:18 -0500

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 7c5abda2c8 * tp/Texinfo/Convert/HTML.pm (%XS_conversion_overrides): 
add missed override for footnote_location_href.
7c5abda2c8 is described below

commit 7c5abda2c8259aea835fda790b109654807e6e0f
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Feb 16 09:57:09 2024 +0100

    * tp/Texinfo/Convert/HTML.pm (%XS_conversion_overrides): add missed
    override for footnote_location_href.
    
    * tp/Texinfo/Convert/HTML.pm (from_element_direction): use the
    current_filename function.
    
    * tp/Texinfo/XS/convert/build_html_perl_state.c
    (build_html_formatting_state): do not pass current_filename anymore,
    it is not needed, the current_filename function should be used instead.
    
    * tp/Texinfo/Common.pm (debug_print_element): remove useless end of
    lines.
---
 ChangeLog                                     | 15 +++++++++++++++
 tp/Texinfo/Common.pm                          |  4 ++--
 tp/Texinfo/Convert/HTML.pm                    | 13 ++++++++++---
 tp/Texinfo/XS/convert/build_html_perl_state.c | 16 ----------------
 tp/Texinfo/XS/convert/convert_html.c          | 11 -----------
 tp/Texinfo/XS/main/utils.h                    |  4 +++-
 6 files changed, 30 insertions(+), 33 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 87d8280eb6..6758192794 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2024-02-16  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/HTML.pm (%XS_conversion_overrides): add missed
+       override for footnote_location_href.
+
+       * tp/Texinfo/Convert/HTML.pm (from_element_direction): use the
+       current_filename function.
+
+       * tp/Texinfo/XS/convert/build_html_perl_state.c
+       (build_html_formatting_state): do not pass current_filename anymore,
+       it is not needed, the current_filename function should be used instead.
+
+       * tp/Texinfo/Common.pm (debug_print_element): remove useless end of
+       lines.
+
 2024-02-15  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/HTML.pm (current_filename): set $self.
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index fb326ab170..f5212a028f 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -2646,10 +2646,10 @@ sub debug_print_element($;$)
   my $print_parent = shift;
 
   if (!defined($current)) {
-    return "debug_print_element: UNDEF\n";
+    return "debug_print_element: UNDEF";
   }
   if (ref($current) ne 'HASH') {
-    return "debug_print_element: $current not a hash\n";
+    return "debug_print_element: $current not a hash";
   }
   my $type = '';
   my $cmd = '';
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 06aa6b309c..f10f2daf12 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -139,6 +139,8 @@ my %XS_conversion_overrides = (
    => "Texinfo::Convert::ConvertXS::html_command_contents_target",
   "Texinfo::Convert::HTML::footnote_location_target"
    => "Texinfo::Convert::ConvertXS::html_footnote_location_target",
+  "Texinfo::Convert::HTML::footnote_location_href"
+   => "Texinfo::Convert::ConvertXS::html_footnote_location_href",
   "Texinfo::Convert::HTML::command_filename"
    => "Texinfo::Convert::ConvertXS::html_command_filename",
   "Texinfo::Convert::HTML::command_root_element_command"
@@ -218,7 +220,7 @@ my %XS_conversion_overrides = (
   "Texinfo::Convert::HTML::in_align"
    => "Texinfo::Convert::ConvertXS::html_in_align",
   "Texinfo::Convert::HTML::current_filename"
-    => "Texinfo::Convert::ConvertXS::html_current_filename",
+   => "Texinfo::Convert::ConvertXS::html_current_filename",
 
   "Texinfo::Convert::HTML::count_elements_in_filename"
    => "Texinfo::Convert::ConvertXS::html_count_elements_in_filename",
@@ -1587,8 +1589,13 @@ sub from_element_direction($$$;$$$)
   my $command;
 
   $source_unit = $self->{'current_output_unit'} if (!defined($source_unit));
-  $source_filename = $self->{'current_filename'} if 
(!defined($source_filename));
-
+  # NOTE $source_filename is only used for a command_href call.  If with XS,
+  # if source_filename remains undef, the command_href XS code will set the
+  # source_filename to the current filename in XS. Therefore undef
+  # current_filename in that case leads to the same output as set
+  # current_filename.
+  # We still set it correctly in case it becomes used in other codes.
+  $source_filename = $self->current_filename() if (!defined($source_filename));
   if (!$valid_direction_return_type{$type}) {
     print STDERR "Incorrect type $type in from_element_direction call\n";
     return undef;
diff --git a/tp/Texinfo/XS/convert/build_html_perl_state.c 
b/tp/Texinfo/XS/convert/build_html_perl_state.c
index 44d27b7101..0fcb1b7bfa 100644
--- a/tp/Texinfo/XS/convert/build_html_perl_state.c
+++ b/tp/Texinfo/XS/convert/build_html_perl_state.c
@@ -407,22 +407,6 @@ build_html_formatting_state (CONVERTER *converter, 
unsigned long flags)
            newRV_inc ((SV *) converter->current_output_unit->hv));
     }
 
-  /* for scalars corresponding to value that can be found in get_info
-     the value associated to the key in the 'converter_info' hash is
-     a reference to the value in the converter, such as
-     \$converter->{"current_filename"}.
-     *current_filename_sv corresponds to $converter->{"current_filename"},
-     the value should be changed, but the SV should not be replaced */
-  if (flags & HMSF_current_filename)
-    {
-      SV **current_filename_sv;
-      current_filename_sv = hv_fetch (hv, "current_filename",
-                                      strlen ("current_filename"), 1);
-      sv_setpv (*current_filename_sv, converter->current_filename.filename);
-      if (converter->current_filename.filename)
-        SvUTF8_on (*current_filename_sv);
-    }
-
   if (flags & HMSF_multiple_pass)
     {
       SV **multiple_pass_sv;
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 6b4be38ec9..27ada18700 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -8268,12 +8268,10 @@ html_prepare_node_redirection_page (CONVERTER *self, 
const ELEMENT *element,
 
   self->current_filename.filename = filename;
   self->current_filename.file_number = 0;
-  self->modified_state |= HMSF_current_filename;
 
   result = format_node_redirection_page (self, element, filename);
 
   self->current_filename.filename = 0;
-  self->modified_state |= HMSF_current_filename;
 
   return result;
 }
@@ -18207,7 +18205,6 @@ html_convert_convert (CONVERTER *self, const ELEMENT 
*root,
 
   self->current_filename.filename = "";
   self->current_filename.file_number = 1;
-  self->modified_state |= HMSF_current_filename;
 
   if (!output_units || !output_units->number)
     {
@@ -18242,7 +18239,6 @@ html_convert_convert (CONVERTER *self, const ELEMENT 
*root,
         }
     }
   self->current_filename.filename = 0;
-  self->modified_state |= HMSF_current_filename;
 
   return result.text;
 }
@@ -18260,7 +18256,6 @@ convert_output_output_unit_internal (CONVERTER *self,
   char *output_unit_filename = output_unit->unit_filename;
 
   self->current_filename.filename = output_unit_filename;
-  self->modified_state |= HMSF_current_filename;
 
   text_reset (text);
   text_append (text, "");
@@ -18428,11 +18423,8 @@ html_prepare_title_titlepage (CONVERTER *self, int 
output_units_descriptor,
       self->current_filename.file_number = 1;
     }
 
-  self->modified_state |= HMSF_current_filename;
-
   self->title_titlepage = format_title_titlepage (self);
   memset (&self->current_filename, 0, sizeof (FILE_NUMBER_NAME));
-  self->modified_state |= HMSF_current_filename;
 }
 
 char *
@@ -18486,7 +18478,6 @@ html_convert_output (CONVERTER *self, const ELEMENT 
*root,
 
       self->current_filename.filename = output_filename;
       self->current_filename.file_number = 1;
-      self->modified_state |= HMSF_current_filename;
 
       text_append (&text, "");
 
@@ -18542,7 +18533,6 @@ html_convert_output (CONVERTER *self, const ELEMENT 
*root,
           free (file_end);
         }
       self->current_filename.filename = 0;
-      self->modified_state |= HMSF_current_filename;
     }
   else
     {
@@ -18589,7 +18579,6 @@ html_convert_output (CONVERTER *self, const ELEMENT 
*root,
             }
         }
       memset (&self->current_filename, 0, sizeof (FILE_NUMBER_NAME));
-      self->modified_state |= HMSF_current_filename;
     }
 
  out:
diff --git a/tp/Texinfo/XS/main/utils.h b/tp/Texinfo/XS/main/utils.h
index 668c36ed29..f722cfbfeb 100644
--- a/tp/Texinfo/XS/main/utils.h
+++ b/tp/Texinfo/XS/main/utils.h
@@ -110,7 +110,9 @@ enum command_location {
  */
 #define HMSF_current_node            0x0200
 #define HMSF_current_output_unit     0x0400
-#define HMSF_current_filename        0x0800
+/*
+#define HMSF_        0x0800
+*/
 #define HMSF_converter_state         0x1000
 #define HMSF_multiple_pass           0x2000
 #define HMSF_translations            0x4000



reply via email to

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