texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Makefile.tres, tp/t/html_tests.t (end_of_lin


From: Patrice Dumas
Subject: branch master updated: * tp/Makefile.tres, tp/t/html_tests.t (end_of_line_in_uref): add test of end of line in uref.
Date: Tue, 23 Jan 2024 07:37:19 -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 161fade14b * tp/Makefile.tres, tp/t/html_tests.t 
(end_of_line_in_uref): add test of end of line in uref.
161fade14b is described below

commit 161fade14bfab6474749dd443045c1ee5ddc024e
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Jan 23 13:37:09 2024 +0100

    * tp/Makefile.tres, tp/t/html_tests.t (end_of_line_in_uref): add test
    of end of line in uref.
    
    * tp/Texinfo/XS/convert/convert_html.c (url_protect_url_text)
    (url_protect_file_text), tp/Texinfo/XS/main/utils.c
    (encode_with_iconv): pad x percent format with 0.
---
 ChangeLog                                      |   9 ++
 tp/Makefile.tres                               |   1 +
 tp/Texinfo/Convert/HTML.pm                     |   3 +
 tp/Texinfo/XS/convert/convert_html.c           |   4 +-
 tp/Texinfo/XS/main/utils.c                     |   4 +-
 tp/t/html_tests.t                              |   3 +
 tp/t/results/html_tests/end_of_line_in_uref.pl | 112 +++++++++++++++++++++++++
 7 files changed, 132 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 04859ca57f..b487182d22 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-01-22  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Makefile.tres, tp/t/html_tests.t (end_of_line_in_uref): add test
+       of end of line in uref.
+
+       * tp/Texinfo/XS/convert/convert_html.c (url_protect_url_text)
+       (url_protect_file_text), tp/Texinfo/XS/main/utils.c
+       (encode_with_iconv): pad x percent format with 0.
+
 2024-01-22  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Makefile.tres, tp/t/html_tests.t
diff --git a/tp/Makefile.tres b/tp/Makefile.tres
index 71bff4cf88..95ef8ead37 100644
--- a/tp/Makefile.tres
+++ b/tp/Makefile.tres
@@ -628,6 +628,7 @@ test_files_generated_list = 
$(test_tap_files_generated_list) \
   t/results/html_tests/empty_node_in_html_title_no_sec_name.pl \
   t/results/html_tests/empty_node_in_html_title_no_sec_name/res_html \
   t/results/html_tests/empty_titlefont.pl \
+  t/results/html_tests/end_of_line_in_uref.pl \
   t/results/html_tests/file_name_case_insensitive_conflict_node.pl \
   t/results/html_tests/file_name_case_insensitive_conflict_node/res_html \
   
t/results/html_tests/file_name_case_insensitive_conflict_node_no_redirections.pl
 \
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 13d1094f72..37756d380e 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -8923,6 +8923,9 @@ sub convert_tree($$;$)
 # a format_* function?
 # protect an url, in which characters with specific meaning in url are 
considered
 # to have their specific meaning
+# TODO turn end of lines to spaces?  Currently, an end of line is percent
+# protected, it is most likely not what the author intended.  Tested in
+# html_tests.t end_of_line_in_uref
 sub url_protect_url_text($$)
 {
   my $self = shift;
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 58d22fe5c8..30fbaf4cdc 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -2596,7 +2596,7 @@ url_protect_url_text (CONVERTER *self, const char 
*input_string)
             /* the reason for forcing (unsigned char) is that the %x modifier
                expects an unsigned int parameter and a char will usually be
                promoted to an int when passed to a varargs function */
-                  text_printf (&text, "%%%2x", (unsigned char)*p);
+                  text_printf (&text, "%%%02x", (unsigned char)*p);
                   p += 1;
                 }
             }
@@ -2655,7 +2655,7 @@ url_protect_file_text (CONVERTER *self, const char 
*input_string)
             /* the reason for forcing (unsigned char) is that the %x modifier
                expects an unsigned int parameter and a char will usually be
                promoted to an int when passed to a varargs function */
-                  text_printf (&text, "%%%2x", (unsigned char)*p);
+                  text_printf (&text, "%%%02x", (unsigned char)*p);
                   p += 1;
                 }
             }
diff --git a/tp/Texinfo/XS/main/utils.c b/tp/Texinfo/XS/main/utils.c
index ab870af220..82311881d1 100644
--- a/tp/Texinfo/XS/main/utils.c
+++ b/tp/Texinfo/XS/main/utils.c
@@ -444,11 +444,11 @@ encode_with_iconv (iconv_t our_iconv, char *s, const 
SOURCE_INFO *source_info)
         case EILSEQ:
         default:
           if (source_info)
-            fprintf(stderr, "%s:%d: encoding error at byte 0x%2x\n",
+            fprintf(stderr, "%s:%d: encoding error at byte 0x%02x\n",
               source_info->file_name, source_info->line_nr,
                                              *(unsigned char *)inptr);
           else
-            fprintf(stderr, "encoding error at byte 0x%2x\n",
+            fprintf(stderr, "encoding error at byte 0x%02x\n",
                     *(unsigned char *)inptr);
           inptr++; bytes_left--;
           break;
diff --git a/tp/t/html_tests.t b/tp/t/html_tests.t
index 5257835670..9a5608a516 100644
--- a/tp/t/html_tests.t
+++ b/tp/t/html_tests.t
@@ -725,6 +725,9 @@ In top.
 '
 @titlefont{}
 '],
+['end_of_line_in_uref',
+'See the @uref{https://gcc.gnu.org/codingconventions.html#Spelling
+Spelling, terminology and markup} section.'],
 ['spaces_in_line_break_in_verb_w',
 '@w{aaa  bb
 ccc}
diff --git a/tp/t/results/html_tests/end_of_line_in_uref.pl 
b/tp/t/results/html_tests/end_of_line_in_uref.pl
new file mode 100644
index 0000000000..5ddc9f74b0
--- /dev/null
+++ b/tp/t/results/html_tests/end_of_line_in_uref.pl
@@ -0,0 +1,112 @@
+use vars qw(%result_texis %result_texts %result_trees %result_errors 
+   %result_indices %result_sectioning %result_nodes %result_menus
+   %result_floats %result_converted %result_converted_errors 
+   %result_elements %result_directions_text %result_indices_sort_strings);
+
+use utf8;
+
+$result_trees{'end_of_line_in_uref'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'contents' => [
+            {
+              'text' => 'See the '
+            },
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 
'https://gcc.gnu.org/codingconventions.html#Spelling
+'
+                    },
+                    {
+                      'text' => 'Spelling'
+                    }
+                  ],
+                  'type' => 'brace_command_arg'
+                },
+                {
+                  'contents' => [
+                    {
+                      'text' => 'terminology and markup'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_before_argument' => {
+                      'text' => ' '
+                    }
+                  },
+                  'type' => 'brace_command_arg'
+                }
+              ],
+              'cmdname' => 'uref',
+              'source_info' => {
+                'line_nr' => 1
+              }
+            },
+            {
+              'text' => ' section.'
+            }
+          ],
+          'type' => 'paragraph'
+        }
+      ],
+      'type' => 'before_node_section'
+    }
+  ],
+  'type' => 'document_root'
+};
+
+$result_texis{'end_of_line_in_uref'} = 'See the 
@uref{https://gcc.gnu.org/codingconventions.html#Spelling
+Spelling, terminology and markup} section.';
+
+
+$result_texts{'end_of_line_in_uref'} = 'See the 
https://gcc.gnu.org/codingconventions.html#Spelling
+Spelling (terminology and markup) section.';
+
+$result_errors{'end_of_line_in_uref'} = [];
+
+
+$result_floats{'end_of_line_in_uref'} = {};
+
+
+
+$result_converted{'html'}->{'end_of_line_in_uref'} = '<!DOCTYPE html>
+<html>
+<!-- Created by texinfo, http://www.gnu.org/software/texinfo/ -->
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<title>Untitled Document</title>
+
+<meta name="description" content="Untitled Document">
+<meta name="keywords" content="Untitled Document">
+<meta name="resource-type" content="document">
+<meta name="distribution" content="global">
+<meta name="viewport" content="width=device-width,initial-scale=1">
+
+
+
+</head>
+
+<body lang="en">
+<p>See the <a class="uref" 
href="https://gcc.gnu.org/codingconventions.html#Spelling%0aSpelling";>terminology
 and markup</a> section.</p>
+
+
+</body>
+</html>
+';
+
+$result_converted_errors{'html'}->{'end_of_line_in_uref'} = [
+  {
+    'error_line' => 'warning: must specify a title with a title command or @top
+',
+    'text' => 'must specify a title with a title command or @top',
+    'type' => 'warning'
+  }
+];
+
+
+1;



reply via email to

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