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, 6 Jan 2024 05:58:24 -0500 (EST)

branch: master
commit dade8fc98eec58b4e39e55ae242bafe8a419d760
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Jan 6 11:58:23 2024 +0100

    * tp/Texinfo/options_data.txt (CSS_REFS): set type to char_string_list
    as it is decoded in the main program.
    
    * tp/maintain/regenerate_C_options_info.pl: fix the name of
    char_string_list.
    
    * tp/Texinfo/XS/convert/convert_html.c
    (html_default_format_css_lines): fix output and css_element_classes can
    be 0.
    
    * tp/Texinfo/XS/convert/convert_html.c (format_css_lines): use
    html_default_format_css_lines.
---
 ChangeLog                                | 15 ++++++++++++++
 tp/Texinfo/XS/convert/convert_html.c     | 34 ++++++++++++++++++++------------
 tp/Texinfo/options_data.txt              |  2 +-
 tp/maintain/regenerate_C_options_info.pl |  4 ++--
 4 files changed, 39 insertions(+), 16 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 91b0e06a52..442619422b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2024-01-06  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/options_data.txt (CSS_REFS): set type to char_string_list
+       as it is decoded in the main program.
+
+       * tp/maintain/regenerate_C_options_info.pl: fix the name of
+       char_string_list.
+
+       * tp/Texinfo/XS/convert/convert_html.c
+       (html_default_format_css_lines): fix output and css_element_classes can
+       be 0.
+
+       * tp/Texinfo/XS/convert/convert_html.c (format_css_lines): use
+       html_default_format_css_lines.
+
 2024-01-06  Patrice Dumas  <pertusus@free.fr>
 
        XS interface for getting/setting CSS information
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index c5202d4f69..16d94d570e 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -2545,6 +2545,7 @@ format_comment (CONVERTER *self, const char *text)
 
 static const char *reserved_unreserved_percent = "-_.!~*'()$&+,/:;=?@[]#%";
 
+/* NOTE the input string should be UTF-8 encoded */
 static char *
 url_protect_url_text (CONVERTER *self, const char *input_string)
 {
@@ -6727,30 +6728,38 @@ html_default_format_css_lines (CONVERTER *self, const 
char *filename,
   css_import_lines = html_css_get_info (self, CI_css_info_imports);
   css_rule_lines = html_css_get_info (self, CI_css_info_rules);
 
-  if (css_import_lines->number <= 0 && css_element_classes->number <= 0
+  if (css_import_lines->number <= 0
+      && (!css_element_classes || css_element_classes->number <= 0)
       && css_rule_lines->number <= 0
       && (!css_refs || css_refs->number <= 0))
     return;
 
   text_append (result, "<style type=\"text/css\">\n<!--\n");
-  for (i = 0; i < css_import_lines->number; i++)
+
+  if (css_import_lines->number > 0)
     {
-      text_append (result, css_import_lines->list[i]);
+      for (i = 0; i < css_import_lines->number; i++)
+        text_append (result, css_import_lines->list[i]);
       text_append_n (result, "\n", 1);
     }
 
-  for (i = 0; i < css_element_classes->number; i++)
+  if (css_element_classes && css_element_classes->number > 0)
     {
-      const char *selector = css_element_classes->list[i];
-      CSS_SELECTOR_STYLE *selector_style
-       = find_css_selector_style (&self->css_element_class_styles, selector);
-      if (selector_style->style)
-        text_printf (result, "%s {%s}\n", selector, selector_style->style);
+      for (i = 0; i < css_element_classes->number; i++)
+        {
+          const char *selector = css_element_classes->list[i];
+          CSS_SELECTOR_STYLE *selector_style
+           = find_css_selector_style (&self->css_element_class_styles,
+                                      selector);
+          if (selector_style->style)
+            text_printf (result, "%s {%s}\n", selector, selector_style->style);
+        }
     }
 
-  for (i = 0; i < css_rule_lines->number; i++)
+  if (css_rule_lines->number > 0)
     {
-      text_append (result, css_rule_lines->list[i]);
+      for (i = 0; i < css_rule_lines->number; i++)
+        text_append (result, css_rule_lines->list[i]);
       text_append_n (result, "\n", 1);
     }
 
@@ -6778,13 +6787,12 @@ format_css_lines (CONVERTER *self, const char 
*filename, TEXT *result)
 {
   FORMATTING_REFERENCE *formatting_reference
    = &self->current_formatting_references[FR_format_css_lines];
-  /*
+
   if (formatting_reference->status == FRS_status_default_set)
     {
       html_default_format_css_lines (self, filename, result);
     }
   else
-   */
     {
       char *css_lines
         = call_formatting_function_format_css_lines (self,
diff --git a/tp/Texinfo/options_data.txt b/tp/Texinfo/options_data.txt
index 249af3932b..ae39b8a41b 100644
--- a/tp/Texinfo/options_data.txt
+++ b/tp/Texinfo/options_data.txt
@@ -337,7 +337,7 @@ PASSIVE_ICONS                      converter_other undef   
icons
 # --css-include
 CSS_FILES            array_cmdline  undef   bytes_string_list
 # --css-ref
-CSS_REFS             array_cmdline  undef   bytes_string_list
+CSS_REFS             array_cmdline  undef   char_string_list
 # --if*
 EXPANDED_FORMATS     array_cmdline  undef   bytes_string_list
 # -I
diff --git a/tp/maintain/regenerate_C_options_info.pl 
b/tp/maintain/regenerate_C_options_info.pl
index 5f188fc125..eecae4ad02 100755
--- a/tp/maintain/regenerate_C_options_info.pl
+++ b/tp/maintain/regenerate_C_options_info.pl
@@ -316,7 +316,7 @@ foreach my $category (sort(keys(%option_categories))) {
       my $dir_string_arg = 'svt_byte';
       if ($type eq 'file_string_list') {
         $dir_string_arg = 'svt_dir';
-      } elsif ($type eq 'file_string_char') {
+      } elsif ($type eq 'char_string_list') {
         $dir_string_arg = 'svt_char';
       }
       print GET "      clear_strings_list (options->$option.strlist);
@@ -373,7 +373,7 @@ foreach my $category (sort(keys(%option_categories))) {
       my $dir_string_arg = 'svt_byte';
       if ($type eq 'file_string_list') {
         $dir_string_arg = 'svt_dir';
-      } elsif ($type eq 'file_string_char') {
+      } elsif ($type eq 'char_string_list') {
         $dir_string_arg = 'svt_char';
       }
       print GET "    {



reply via email to

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