texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Sat, 30 Mar 2024 05:57:23 -0400 (EDT)

branch: master
commit 73c1d0742bbadcdf7fb07383d6139ae5daba14d6
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Mar 28 22:58:34 2024 +0100

    * tp/Texinfo/Convert/HTML.pm (html_convert_css_string)
    (_reset_unset_no_arg_commands_formatting_context),
    tp/Texinfo/XS/convert/convert_html.c (html_convert_css_string)
    (reset_unset_no_arg_commands_formatting_context): set the string
    context directly instead of using a type _string in Perl.  In C, call
    html_set_string_context.  Call html_open_command_update_context and
    html_convert_command_update_context in C for
    reset_unset_no_arg_commands_formatting_context preformatted context,
    as in Perl.
---
 ChangeLog                            | 12 ++++++++++++
 tp/Texinfo/Convert/HTML.pm           | 25 ++++++++++++++-----------
 tp/Texinfo/XS/convert/convert_html.c | 33 ++++++---------------------------
 3 files changed, 32 insertions(+), 38 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 782c27f393..6b92a5596b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-03-28  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/HTML.pm (html_convert_css_string)
+       (_reset_unset_no_arg_commands_formatting_context),
+       tp/Texinfo/XS/convert/convert_html.c (html_convert_css_string)
+       (reset_unset_no_arg_commands_formatting_context): set the string
+       context directly instead of using a type _string in Perl.  In C, call
+       html_set_string_context.  Call html_open_command_update_context and
+       html_convert_command_update_context in C for
+       reset_unset_no_arg_commands_formatting_context preformatted context,
+       as in Perl.
+
 2024-03-28  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/HTML.pm (@global_directions): use the same order
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index b7af816712..db084037c0 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -651,11 +651,13 @@ sub html_convert_css_string($$$)
     $self->{'formatting_function'}->{$formatting_reference}
       = $default_css_string_formatting_references{$formatting_reference};
   }
-
+  my $css_string_context_str = 'CSS string '.$context_str;
+  $self->_new_document_context($css_string_context_str);
+  _set_string_context($self);
   my $result
-   = $self->convert_tree_new_formatting_context({'type' => '_string',
-                                                 'contents' => [$element]},
-                                                'CSS string '.$context_str);
+   = $self->convert_tree($element, "new_fmt_ctx C($css_string_context_str)");
+  $self->_pop_document_context();
+
   foreach my $cmdname (keys (%default_css_string_commands_conversion)) {
     $self->{'commands_conversion'}->{$cmdname} = $saved_commands->{$cmdname};
   }
@@ -8419,18 +8421,19 @@ sub 
_reset_unset_no_arg_commands_formatting_context($$$$;$)
         = $self->convert_tree($translated_tree, $explanation);
     } elsif ($reset_context eq 'preformatted') {
       # there does not seems to be anything simpler...
-      my $preformatted_command_name = 'example';
+      my $preformatted_cmdname = 'example';
       $self->_new_document_context($context_str);
-      _open_command_update_context($self, 'example');
+      _open_command_update_context($self, $preformatted_cmdname);
       $translation_result
         = $self->convert_tree($translated_tree, $explanation);
-      _convert_command_update_context($self, 'example');
+      _convert_command_update_context($self, $preformatted_cmdname);
       $self->_pop_document_context();
     } elsif ($reset_context eq 'string') {
-      $translation_result
-        = $self->convert_tree_new_formatting_context({'type' => '_string',
-                                          'contents' => [$translated_tree]},
-                                                     $context_str);
+      $self->_new_document_context($context_str);
+      _set_string_context($self);
+      $translation_result = $self->convert_tree($translated_tree,
+                                                $explanation);
+      $self->_pop_document_context();
     } elsif ($reset_context eq 'css_string') {
       $translation_result = $self->html_convert_css_string($translated_tree,
                                                            $context_str);
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index d0590537d9..2962e7bfde 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -11396,7 +11396,6 @@ html_convert_css_string (CONVERTER *self, const ELEMENT 
*element,
   char *context_string_str;
   char *explanation;
   char *result;
-  HTML_DOCUMENT_CONTEXT *top_document_ctx;
 
   void (* saved_current_format_protect_text) (const char *text, TEXT *result);
   FORMATTING_REFERENCE *saved_formatting_references
@@ -11424,8 +11423,7 @@ html_convert_css_string (CONVERTER *self, const ELEMENT 
*element,
   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++;
+  html_set_string_context (self);
 
   result = html_convert_tree (self, element, explanation);
 
@@ -17333,38 +17331,19 @@ reset_unset_no_arg_commands_formatting_context 
(CONVERTER *self,
         }
       else if (reset_context == HCC_type_preformatted)
         {
-          enum command_id preformated_cmd = CM_example;
-          HTML_DOCUMENT_CONTEXT *top_document_ctx;
-          html_new_document_context (self, context, 0, 0);
-
-          top_document_ctx = html_top_document_context (self);
-
+          enum command_id preformatted_cmd = CM_example;
           /* there does not seems to be anything simpler... */
-          push_command_or_type (&top_document_ctx->composition_context,
-                                preformated_cmd, 0);
-      /* should not be needed for at commands no brace translation strings */
-          push_command_or_type (&top_document_ctx->preformatted_classes,
-                         html_commands_data[preformated_cmd].pre_class_cmd, 0);
-          push_integer_stack_integer (&top_document_ctx->preformatted_context,
-                                      1);
-          top_document_ctx->inside_preformatted++;
-
+          html_new_document_context (self, context, 0, 0);
+          html_open_command_update_context (self, preformatted_cmd);
           translation_result = html_convert_tree (self, translated_tree,
                                                   explanation);
-          top_document_ctx->inside_preformatted--;
-          pop_integer_stack (&top_document_ctx->preformatted_context);
-          pop_command_or_type (&top_document_ctx->composition_context);
-          pop_command_or_type (&top_document_ctx->preformatted_classes);
+          html_convert_command_update_context (self, preformatted_cmd);
           html_pop_document_context (self);
         }
       else if (reset_context == HCC_type_string)
         {
-          HTML_DOCUMENT_CONTEXT *top_document_ctx;
-
           html_new_document_context (self, context, 0, 0);
-
-          top_document_ctx = html_top_document_context (self);
-          top_document_ctx->string_ctx++;
+          html_set_string_context (self);
 
           translation_result = html_convert_tree (self, translated_tree,
                                                   explanation);



reply via email to

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