texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp Texinfo/Convert/XML.pm t/results/xml...


From: Patrice Dumas
Subject: texinfo/tp Texinfo/Convert/XML.pm t/results/xml...
Date: Tue, 28 Aug 2012 18:05:45 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        12/08/28 18:05:45

Modified files:
        tp/Texinfo/Convert: XML.pm 
        tp/t/results/xml_tests: brace_commands_spaces_end_of_lines.pl 
                                image_inline_or_not.pl 

Log message:
        Protect end of lines as \n in xml spaces attributes.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/XML.pm?cvsroot=texinfo&r1=1.75&r2=1.76
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/xml_tests/brace_commands_spaces_end_of_lines.pl?cvsroot=texinfo&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/xml_tests/image_inline_or_not.pl?cvsroot=texinfo&r1=1.14&r2=1.15

Patches:
Index: Texinfo/Convert/XML.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/XML.pm,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -b -r1.75 -r1.76
--- Texinfo/Convert/XML.pm      27 Aug 2012 22:04:34 -0000      1.75
+++ Texinfo/Convert/XML.pm      28 Aug 2012 18:05:44 -0000      1.76
@@ -364,12 +364,20 @@
   return $self->_convert($root);
 }
 
+sub _protect_end_of_lines($)
+{
+  my $text = shift;
+  $text =~ s/\n/\\n/g;
+  return $text;
+}
+
 sub _leading_spaces($)
 {
   my $root = shift;
   if ($root->{'extra'} and $root->{'extra'}->{'spaces_after_command'}
       and $root->{'extra'}->{'spaces_after_command'}->{'type'} eq 
'empty_spaces_after_command') {
-    return " spaces=\"$root->{'extra'}->{'spaces_after_command'}->{'text'}\"";
+    return " spaces=\""._protect_end_of_lines(
+         $root->{'extra'}->{'spaces_after_command'}->{'text'})."\"";
   } else {
     return '';
   }
@@ -381,7 +389,8 @@
   if ($root->{'extra'} and $root->{'extra'}->{'spaces_before_argument'}
       and $root->{'extra'}->{'spaces_before_argument'}->{'type'} eq 
'empty_spaces_before_argument'
       and $root->{'extra'}->{'spaces_before_argument'}->{'text'} ne '') {
-    return " 
spaces=\"$root->{'extra'}->{'spaces_before_argument'}->{'text'}\"";
+    return " spaces=\""._protect_end_of_lines(
+                 $root->{'extra'}->{'spaces_before_argument'}->{'text'})."\"";
   } else {
     return '';
   }
@@ -425,7 +434,7 @@
   my $result = '';
   my @spaces = $self->_collect_leading_trailing_spaces_arg($root);
   if (defined($spaces[0]) and $spaces[0] ne '') {
-    $result .= " spaces=\"$spaces[0]\"";
+    $result .= " spaces=\""._protect_end_of_lines($spaces[0])."\"";
   }
   return $result;
 }
@@ -438,7 +447,7 @@
   my $result = '';
   my @spaces = $self->_collect_leading_trailing_spaces_arg($root);
   if (defined($spaces[0]) and $spaces[0] ne '') {
-    $result .= " spaces=\"$spaces[0]\"";
+    $result .= " spaces=\""._protect_end_of_lines($spaces[0])."\"";
   }
   if (defined($spaces[1])) {
     chomp($spaces[1]);

Index: t/results/xml_tests/brace_commands_spaces_end_of_lines.pl
===================================================================
RCS file: 
/sources/texinfo/texinfo/tp/t/results/xml_tests/brace_commands_spaces_end_of_lines.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- t/results/xml_tests/brace_commands_spaces_end_of_lines.pl   27 Aug 2012 
22:10:49 -0000      1.1
+++ t/results/xml_tests/brace_commands_spaces_end_of_lines.pl   28 Aug 2012 
18:05:44 -0000      1.2
@@ -431,23 +431,17 @@
 
 
 
-$result_converted{'xml'}->{'brace_commands_spaces_end_of_lines'} = '<image 
spaces="
-"><imagefile>a</imagefile></image>
+$result_converted{'xml'}->{'brace_commands_spaces_end_of_lines'} = '<image 
spaces="\\n"><imagefile>a</imagefile></image>
 
-<image spaces=" 
-"><imagefile>a</imagefile></image>
+<image spaces=" \\n"><imagefile>a</imagefile></image>
 
-<image><imagefile>a</imagefile><imagewidth spaces="
-">b</imagewidth></image>
+<image><imagefile>a</imagefile><imagewidth spaces="\\n">b</imagewidth></image>
 
-<image><imagefile>a</imagefile><imagewidth spaces=" 
-">b</imagewidth></image>
+<image><imagefile>a</imagefile><imagewidth spaces=" \\n">b</imagewidth></image>
 
-<image><imagefile>a</imagefile><imagewidth spaces="
-"> b</imagewidth></image>
+<image><imagefile>a</imagefile><imagewidth spaces="\\n"> b</imagewidth></image>
 
-<image><imagefile>a</imagefile><imagewidth spaces=" 
-"> b</imagewidth></image>
+<image><imagefile>a</imagefile><imagewidth spaces=" \\n"> 
b</imagewidth></image>
 ';
 
 1;

Index: t/results/xml_tests/image_inline_or_not.pl
===================================================================
RCS file: 
/sources/texinfo/texinfo/tp/t/results/xml_tests/image_inline_or_not.pl,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- t/results/xml_tests/image_inline_or_not.pl  27 Aug 2012 22:04:49 -0000      
1.14
+++ t/results/xml_tests/image_inline_or_not.pl  28 Aug 2012 18:05:45 -0000      
1.15
@@ -2469,8 +2469,7 @@
 <chapter spaces=" "><sectiontitle><image 
where="inline"><imagefile>in_chapter_arg</imagefile></image></sectiontitle>
 
 
-<para>T<footnote spaces="
-"><image where="inline"><imagefile>in_footnote</imagefile></image>
+<para>T<footnote spaces="\\n"><image 
where="inline"><imagefile>in_footnote</imagefile></image>
 </footnote>
 </para>
 <float name="g" type="F" spaces=" 
"><floattype>F</floattype><floatname>g</floatname>



reply via email to

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