texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Fri, 16 Feb 2024 17:52:05 -0500 (EST)

branch: master
commit 655ae49c56efef409c0afa436563dfb19b332636
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Feb 16 17:32:59 2024 +0100

    * tp/Texinfo/Convert/HTML.pm (html_convert_css_string),
    tp/Texinfo/XS/convert/convert_html.c (html_convert_css_string): make
    third argument mandatory and consider it to be a context string.
    Update html_convert_css_string in C to lead to the same context and
    explanation strings as in Perl.
---
 ChangeLog                            |  8 ++++++++
 tp/TODO                              |  3 ---
 tp/Texinfo/Convert/HTML.pm           | 10 +++++-----
 tp/Texinfo/XS/convert/convert_html.c | 23 ++++++++++++++++++++---
 4 files changed, 33 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 99def22440..673e5b6a12 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-02-16  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/HTML.pm (html_convert_css_string),
+       tp/Texinfo/XS/convert/convert_html.c (html_convert_css_string): make
+       third argument mandatory and consider it to be a context string.
+       Update html_convert_css_string in C to lead to the same context and
+       explanation strings as in Perl.
+
 2024-02-16  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/convert/ConvertXS.xs (html_current_filename): handle
diff --git a/tp/TODO b/tp/TODO
index f2e73aeebb..979b08e954 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -14,9 +14,6 @@ Before next release
 Bugs
 ====
 
-Check html_convert_css_string probable misuse of multiple_formatted
-argument.
-
 
 HTML API
 ========
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index dd8df26e32..fc404d7bd8 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -621,11 +621,11 @@ my %default_css_string_commands_conversion;
 my %default_css_string_types_conversion;
 my %default_css_string_formatting_references;
 
-sub html_convert_css_string($$;$)
+sub html_convert_css_string($$$)
 {
   my $self = shift;
   my $element = shift;
-  my $explanation = shift;
+  my $context_str = shift;
 
   my $saved_commands = {};
   my $saved_types = {};
@@ -651,8 +651,7 @@ sub html_convert_css_string($$;$)
   my $result
    = $self->convert_tree_new_formatting_context({'type' => '_string',
                                                  'contents' => [$element]},
-                                                'css_string',
-                                                $explanation);
+                                                'CSS string '.$context_str);
   foreach my $cmdname (keys (%default_css_string_commands_conversion)) {
     $self->{'commands_conversion'}->{$cmdname} = $saved_commands->{$cmdname};
   }
@@ -8399,7 +8398,8 @@ sub 
_reset_unset_no_arg_commands_formatting_context($$$$;$)
                                           'contents' => [$translated_tree]},
                                                      $context_str);
     } elsif ($reset_context eq 'css_string') {
-      $translation_result = $self->html_convert_css_string($translated_tree);
+      $translation_result = $self->html_convert_css_string($translated_tree,
+                                                           $context_str);
     }
     $no_arg_command_context->{'text'}
       = $translation_result;
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 428b9807f9..630088800a 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -11363,8 +11363,12 @@ convert_cartouche_command (CONVERTER *self, const enum 
command_id cmd,
    that can be called are perl functions that do not call formatting/conversion
    functions or the formatting/conversion functions for HTML will be used. */
 char *
-html_convert_css_string (CONVERTER *self, const ELEMENT *element, char 
*explanation)
+html_convert_css_string (CONVERTER *self, const ELEMENT *element,
+                         char *context_str)
 {
+  char *css_string_context_str;
+  char *context_string_str;
+  char *explanation;
   char *result;
   HTML_DOCUMENT_CONTEXT *top_document_ctx;
 
@@ -11385,7 +11389,15 @@ html_convert_css_string (CONVERTER *self, const 
ELEMENT *element, char *explanat
     = &self->css_string_type_conversion_function[0];
   self->current_format_protect_text = &default_css_string_format_protect_text;
 
-  html_new_document_context (self, "css_string", 0, 0);
+  if (context_str)
+    xasprintf (&css_string_context_str, "CSS string %s");
+  else
+    css_string_context_str = "CSS string ";
+
+  xasprintf (&context_string_str, "C(%s)", css_string_context_str);
+  xasprintf (&explanation, "new_fmt_ctx %s", context_string_str);
+
+  html_new_document_context (self, css_string_context_str, 0, 0);
   top_document_ctx = html_top_document_context (self);
   top_document_ctx->string_ctx++;
 
@@ -11393,6 +11405,11 @@ html_convert_css_string (CONVERTER *self, const 
ELEMENT *element, char *explanat
 
   html_pop_document_context (self);
 
+  free (explanation);
+  free (context_string_str);
+  if (context_str)
+    free (css_string_context_str);
+
   self->current_formatting_references = saved_formatting_references;
   self->current_commands_conversion_function
     = saved_commands_conversion_function;
@@ -17112,7 +17129,7 @@ reset_unset_no_arg_commands_formatting_context 
(CONVERTER *self,
       else if (reset_context == HCC_type_css_string)
         {
           translation_result = html_convert_css_string (self, translated_tree,
-                                                        0);
+                                                        context);
         }
       free (explanation);
       free (context);



reply via email to

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