texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Convert/TexinfoXML.pm (_end_line_spa


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Convert/TexinfoXML.pm (_end_line_spaces): protect form feeds in spaces_after_argument.
Date: Tue, 30 Aug 2022 09:42:40 -0400

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 10da8c1bb4 * tp/Texinfo/Convert/TexinfoXML.pm (_end_line_spaces): 
protect form feeds in spaces_after_argument.
10da8c1bb4 is described below

commit 10da8c1bb4c69e8c5eb4da4efc6d5d62371b3480
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Aug 30 15:42:27 2022 +0200

    * tp/Texinfo/Convert/TexinfoXML.pm (_end_line_spaces): protect
    form feeds in spaces_after_argument.
---
 ChangeLog                                   |  5 +++++
 tp/Texinfo/Convert/TexinfoXML.pm            | 11 +++++++----
 tp/t/results/converters_tests/form_feeds.pl |  4 ++--
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 25c9cab338..85634d3fb1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-08-30  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/TexinfoXML.pm (_end_line_spaces): protect
+       form feeds in spaces_after_argument.
+
 2022-08-30  Gavin Smith  <gavinsmith0123@gmail.com>
 
        * tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line):
diff --git a/tp/Texinfo/Convert/TexinfoXML.pm b/tp/Texinfo/Convert/TexinfoXML.pm
index 050488e365..e906f03656 100644
--- a/tp/Texinfo/Convert/TexinfoXML.pm
+++ b/tp/Texinfo/Convert/TexinfoXML.pm
@@ -595,13 +595,16 @@ sub _leading_spaces_before_argument($)
 # format_comment_or_return_end_line
 sub _end_line_spaces
 {
+  my $self = shift;
   my $element = shift;
 
   my $end_spaces = '';
   if ($element->{'args'}->[-1]
       and $element->{'args'}->[-1]->{'extra'}
       and $element->{'args'}->[-1]->{'extra'}->{'spaces_after_argument'}) {
-    $end_spaces = 
$element->{'args'}->[-1]->{'extra'}->{'spaces_after_argument'};
+    # spaces and form feeds only, protection is needed for form feeds
+    $end_spaces = $self->protect_text(
+              $element->{'args'}->[-1]->{'extra'}->{'spaces_after_argument'});
     chomp $end_spaces;
   }
   return $end_spaces;
@@ -720,7 +723,7 @@ sub _convert_argument_and_end_line($$)
   my $element = shift;
 
   my $converted = $self->convert_tree($element->{'args'}->[-1]);
-  $converted .= _end_line_spaces($element);
+  $converted .= _end_line_spaces($self, $element);
   my $end_line = $self->format_comment_or_return_end_line($element);
   return ($converted, $end_line);
 }
@@ -1498,7 +1501,7 @@ sub _convert($$;$)
             } else {
               # get end of lines from @*table and block @-commands with
               # no argument that have a bogus argument.
-              $result .= _end_line_spaces($element);
+              $result .= _end_line_spaces($self, $element);
               $result .= $self->format_comment_or_return_end_line($element);
             }
           }
@@ -1653,7 +1656,7 @@ sub _convert($$;$)
     } else {
       my $end_command = $element->{'extra'}->{'end_command'};
       if ($end_command) {
-        $result .= _end_line_spaces($end_command);
+        $result .= _end_line_spaces($self, $end_command);
         $result .= $self->format_comment_or_return_end_line($end_command);
       }
     }
diff --git a/tp/t/results/converters_tests/form_feeds.pl 
b/tp/t/results/converters_tests/form_feeds.pl
index 490312881e..4cee86a2cc 100644
--- a/tp/t/results/converters_tests/form_feeds.pl
+++ b/tp/t/results/converters_tests/form_feeds.pl
@@ -1298,7 +1298,7 @@ $result_converted{'xml'}->{'form_feeds'} = '<node 
name="Top" spaces=" "><nodenam
 <pre xml:space="preserve">in example
 </pre></example>
 
-<center spaces=" \\f ">around center </center>
+<center spaces=" \\f ">around center &formfeed;</center>
 <center spaces=" ">in &formfeed;center</center>
 
 <para><indicateurl spaces=" \\f ">in indicateurl</indicateurl>
@@ -1310,7 +1310,7 @@ $result_converted{'xml'}->{'form_feeds'} = '<node 
name="Top" spaces=" "><nodenam
 <float type="" endspaces=" ">
 <para>a float
 </para><caption spaces="\\f "><para>within </para>&formfeed; <para>cation 
</para>&formfeed;</caption> &formfeed; <para>Toto
-</para></float> 
+</para></float> &formfeed;
 
 ';
 



reply via email to

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