texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/convert/convert_html.c (html_conv


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/convert/convert_html.c (html_converter_initialize), tp/Texinfo/options_data.txt (XS_EXTERNAL_CONVERSION) (XS_EXTERNAL_FORMATTING), tp/t/test_utils.pl, tp/texi2any.pl: add customization variables that can also be set through environment variables to have perl and not C code used for formatting functions, with XS_EXTERNAL_FORMATTING set, and for conversion functions, with XS_EXTERNAL_CONVERSION set. Not documented for now, not clear if this should be kept in the long term.
Date: Sat, 06 Jan 2024 18:29:49 -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 7e71ed5d97 * tp/Texinfo/XS/convert/convert_html.c 
(html_converter_initialize), tp/Texinfo/options_data.txt 
(XS_EXTERNAL_CONVERSION) (XS_EXTERNAL_FORMATTING), tp/t/test_utils.pl, 
tp/texi2any.pl: add customization variables that can also be set through 
environment variables to have perl and not C code used for formatting 
functions, with XS_EXTERNAL_FORMATTING set, and for conversion functions, with 
XS_EXTERNAL_CONVERSION set.  Not documented for now, not clear if this should 
be kep [...]
7e71ed5d97 is described below

commit 7e71ed5d97503d3b2b6bc0d7e7774402093e3821
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Jan 7 00:29:48 2024 +0100

    * tp/Texinfo/XS/convert/convert_html.c (html_converter_initialize),
    tp/Texinfo/options_data.txt (XS_EXTERNAL_CONVERSION)
    (XS_EXTERNAL_FORMATTING), tp/t/test_utils.pl, tp/texi2any.pl:
    add customization variables that can also be set through environment
    variables to have perl and not C code used for formatting functions,
    with XS_EXTERNAL_FORMATTING set, and for conversion functions, with
    XS_EXTERNAL_CONVERSION set.  Not documented for now, not clear if this
    should be kept in the long term.
---
 ChangeLog                            | 11 +++++++++++
 tp/TODO                              |  4 +---
 tp/Texinfo/XS/convert/convert_html.c | 14 +++++++++++---
 tp/Texinfo/options_data.txt          |  4 ++++
 tp/t/test_utils.pl                   | 10 ++++++++++
 tp/texi2any.pl                       |  9 +++++++++
 6 files changed, 46 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f974e1db04..9ccad3c6a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2024-01-06  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/convert/convert_html.c (html_converter_initialize),
+       tp/Texinfo/options_data.txt (XS_EXTERNAL_CONVERSION)
+       (XS_EXTERNAL_FORMATTING), tp/t/test_utils.pl, tp/texi2any.pl:
+       add customization variables that can also be set through environment
+       variables to have perl and not C code used for formatting functions,
+       with XS_EXTERNAL_FORMATTING set, and for conversion functions, with
+       XS_EXTERNAL_CONVERSION set.  Not documented for now, not clear if this
+       should be kept in the long term.
+
 2024-01-06  Gavin Smith <gavinsmith0123@gmail.com>
 
        * util/dir-example: Change Karl's email address to
diff --git a/tp/TODO b/tp/TODO
index 6bfa458270..5db2a0c266 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -10,9 +10,7 @@ This is the todo list for texi2any
 Before next release
 ===================
 
-Do a test that shows that accessing directly css_element_class_styles
-in perl in _collect_css_element_class and html_attribute_class is problematic
-with some perl/C mixing case.
+Keep/document *XS_EXTERNAL_FORMATTING *XS_EXTERNAL_CONVERSION?
 
 it is not documented that .info or .inf at the end of the @ref file name 
argument of the source cross reference command is ignored when doing the HTML 
cross ref.
 in HTML Cross-reference Link Basics:
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 6f3b91acf8..463490233c 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -15857,11 +15857,19 @@ html_converter_initialize (CONVERTER *self)
 
   sort_css_element_class_styles (self);
 
+  /* set to customization such that it is not replaced by C functions */
+  if (self->conf->XS_EXTERNAL_FORMATTING.integer > 0)
+    {
+      for (i = 0; i < FR_format_translate_message+1; i++)
+        if (self->formatting_references[i].status == FRS_status_default_set)
+          self->formatting_references[i].status = FRS_status_customization_set;
+    }
+
   /* remaining of the file is for the replacement of call to external
-     functions by internal functions in C.  Uncomment the next line
-     to prevent internal functions being used
-  return;
+     functions by internal functions in C.
    */
+  if (self->conf->XS_EXTERNAL_CONVERSION.integer > 0)
+    return;
 
   for (i = 0; types_internal_conversion_table[i].type_conversion; i++)
     {
diff --git a/tp/Texinfo/options_data.txt b/tp/Texinfo/options_data.txt
index ae39b8a41b..09a148b61d 100644
--- a/tp/Texinfo/options_data.txt
+++ b/tp/Texinfo/options_data.txt
@@ -319,6 +319,10 @@ WORDS_IN_PAGE                      converter_customization 
undef   integer
 XREF_USE_FLOAT_LABEL               converter_customization undef   integer
 XREF_USE_NODE_NAME_ARG             converter_customization undef   integer
 
+# Not documented for now.  If set, conversion/formatting not in C.
+# FIXME keep/document?
+XS_EXTERNAL_CONVERSION             converter_customization undef   integer
+XS_EXTERNAL_FORMATTING             converter_customization undef   integer
 
 # Not strings
 LINKS_BUTTONS                      converter_other undef   buttons
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index 0d411b1d3a..00930006bc 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -1211,7 +1211,17 @@ sub test($$)
 
   my %converted;
   my %converted_errors;
+
   $converter_options = {} if (!defined($converter_options));
+  if (defined($ENV{TEXINFO_XS_EXTERNAL_CONVERSION})
+      and $ENV{TEXINFO_XS_EXTERNAL_CONVERSION}) {
+    $converter_options->{'XS_EXTERNAL_CONVERSION'} = 1;
+  }
+  if (defined($ENV{TEXINFO_XS_EXTERNAL_FORMATTING})
+      and $ENV{TEXINFO_XS_EXTERNAL_FORMATTING}) {
+    $converter_options->{'XS_EXTERNAL_FORMATTING'} = 1;
+  }
+
   foreach my $format (@tested_formats) {
     if (defined($formats{$format})) {
       my $format_converter_options = {%$converter_options};
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index 0dd0d351b0..4ea5e3fc8f 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -1402,6 +1402,15 @@ my $XS_structuring = ((not defined($ENV{TEXINFO_XS})
                        and (not defined($ENV{TEXINFO_XS_STRUCTURE})
                             or $ENV{TEXINFO_XS_STRUCTURE} ne '0'));
 
+if (defined($ENV{TEXINFO_XS_EXTERNAL_CONVERSION})
+    and $ENV{TEXINFO_XS_EXTERNAL_CONVERSION}) {
+  set_from_cmdline('XS_EXTERNAL_CONVERSION', 1);
+}
+if (defined($ENV{TEXINFO_XS_EXTERNAL_FORMATTING})
+    and $ENV{TEXINFO_XS_EXTERNAL_FORMATTING}) {
+  set_from_cmdline('XS_EXTERNAL_FORMATTING', 1);
+}
+
 my $file_number = -1;
 my @opened_files = ();
 my %main_unclosed_files;



reply via email to

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