texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/texi2any.c (main): load HTML Perl


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/texi2any.c (main): load HTML Perl module based on init files being loaded but also based on customization variables values requiring Perl, using the same rules as in build_html_perl_info.c html_pass_conversion_initialization. Determine if CONVERT_TO_LATEX_IN_MATH will be set as in html_initialize_output_state.
Date: Wed, 25 Dec 2024 06:39:56 -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 4f08a2a340 * tp/Texinfo/XS/texi2any.c (main): load HTML Perl module 
based on init files being loaded but also based on customization variables 
values requiring Perl, using the same rules as in build_html_perl_info.c 
html_pass_conversion_initialization.  Determine if CONVERT_TO_LATEX_IN_MATH 
will be set as in html_initialize_output_state.
4f08a2a340 is described below

commit 4f08a2a3409b2f90e377e1b72723a08b46616759
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Dec 25 12:39:51 2024 +0100

    * tp/Texinfo/XS/texi2any.c (main): load HTML Perl module based on init
    files being loaded but also based on customization variables values
    requiring Perl, using the same rules as in build_html_perl_info.c
    html_pass_conversion_initialization.  Determine if
    CONVERT_TO_LATEX_IN_MATH will be set as in
    html_initialize_output_state.
---
 ChangeLog                                       |  9 +++++
 tp/Texinfo/XS/convert/call_html_perl_function.c |  1 +
 tp/Texinfo/XS/texi2any.c                        | 46 +++++++++++++++++++++----
 3 files changed, 50 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 495be5bc79..28c85be707 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-12-25  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/texi2any.c (main): load HTML Perl module based on init
+       files being loaded but also based on customization variables values
+       requiring Perl, using the same rules as in build_html_perl_info.c
+       html_pass_conversion_initialization.  Determine if
+       CONVERT_TO_LATEX_IN_MATH will be set as in
+       html_initialize_output_state.
+
 2024-12-25  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Config.pm (%XS_overrides), tp/Texinfo/XS/main/ConfigXS.xs
diff --git a/tp/Texinfo/XS/convert/call_html_perl_function.c 
b/tp/Texinfo/XS/convert/call_html_perl_function.c
index 89a5feaf1e..3707c6a441 100644
--- a/tp/Texinfo/XS/convert/call_html_perl_function.c
+++ b/tp/Texinfo/XS/convert/call_html_perl_function.c
@@ -2355,6 +2355,7 @@ call_latex_convert_to_latex_math (CONVERTER *self, const 
ELEMENT *element)
     {
       /* NOTE this case should never happen.  If it does, we could set the
          options here dynamically */
+      fprintf (stderr, "BUG: no options_latex_math in %p\n", self->hv);
       options_latex_math = newSV (0);
     }
 
diff --git a/tp/Texinfo/XS/texi2any.c b/tp/Texinfo/XS/texi2any.c
index 7ed408d0d5..da3ddb3fc2 100644
--- a/tp/Texinfo/XS/texi2any.c
+++ b/tp/Texinfo/XS/texi2any.c
@@ -811,8 +811,10 @@ main (int argc, char *argv[], char *env[])
   OPTION *test_option;
   OPTION *no_warn_option;
   OPTION *format_menu_option;
+  OPTION *debug_option;
   int no_warn = 0;
   int test_mode_set = 0;
+  int debug = 0;
   size_t i;
   STRING_LIST input_files;
   STRING_LIST opened_files;
@@ -1681,6 +1683,10 @@ main (int argc, char *argv[], char *env[])
   if (no_warn_option && no_warn_option->o.integer > 0)
     no_warn = 1;
 
+  debug_option = GNUT_get_conf (program_options.options->DEBUG.number);
+  if (debug_option && debug_option->o.integer > 0)
+    debug = 1;
+
   if(test_mode_set)
     {
       add_option_value (&program_options, "PACKAGE_VERSION", 0, "");
@@ -1767,19 +1773,47 @@ main (int argc, char *argv[], char *env[])
     {
       if (!strcmp (converted_format, "html"))
         {
-          if (loaded_init_files_nr > 0)
+          OPTION *internal_links_option
+            = GNUT_get_conf (program_options.options->INTERNAL_LINKS.number);
+          /* setup of need_latex to be kept in sync with setup of
+             CONVERT_TO_LATEX_IN_MATH in html_initialize_output_state
+             based on HTML_MATH */
+          int need_latex = 0;
+          OPTION *convert_to_latex_in_math_option
+            = GNUT_get_conf (
+              program_options.options->CONVERT_TO_LATEX_IN_MATH.number);
+          if (!convert_to_latex_in_math_option
+              || convert_to_latex_in_math_option->o.integer < 0)
+            {
+              OPTION *option_html_math
+                = GNUT_get_conf (program_options.options->HTML_MATH.number);
+              if (option_html_math && option_html_math->o.string)
+                need_latex = 1;
+            }
+
+          /* to be kept in sync with build_html_perl_info.c
+              html_pass_conversion_initialization */
+          /* internal links code is in Perl */
+          if (loaded_init_files_nr > 0
+              || need_latex || (internal_links_option
+                                && internal_links_option->o.string))
             external_module = format_specification->module;
         }
       else
         external_module = format_specification->module;
 
-      if (external_module && !embedded_interpreter)
+      if (external_module)
         {
-          fprintf (stderr, "ERROR: no interpreter for %s\n",
-                   external_module);
-          exit (EXIT_FAILURE);
+          if (!embedded_interpreter)
+            {
+              fprintf (stderr, "ERROR: no interpreter for %s\n",
+                       external_module);
+              exit (EXIT_FAILURE);
+            }
+          else if (debug)
+            fprintf (stderr, "ctexi2any: loading module: %s\n", 
external_module);
         }
-     }
+    }
 
   /* corresponds to eval "require $module"; in texi2any.pl */
   txi_converter_output_format_setup (converted_format, external_module);



reply via email to

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