texinfo-commits
[Top][All Lists]
Advanced

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

[5279] * tp/Texinfo/Convert/TexinfoXML.pm(_xml_attributes):


From: Patrice Dumas
Subject: [5279] * tp/Texinfo/Convert/TexinfoXML.pm(_xml_attributes):
Date: Tue, 06 Aug 2013 21:55:42 +0000

Revision: 5279
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5279
Author:   pertusus
Date:     2013-08-06 21:55:41 +0000 (Tue, 06 Aug 2013)
Log Message:
-----------
        * tp/Texinfo/Convert/TexinfoXML.pm(_xml_attributes):
        do not protect \f and \ in spaces or trailingspaces attributes.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/tp/Texinfo/Convert/TexinfoXML.pm

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2013-08-06 20:52:37 UTC (rev 5278)
+++ trunk/ChangeLog     2013-08-06 21:55:41 UTC (rev 5279)
@@ -1,5 +1,10 @@
 2013-08-06  Patrice Dumas  <address@hidden>
 
+       * tp/Texinfo/Convert/TexinfoXML.pm(_xml_attributes):
+       do not protect \f and \ in spaces or trailingspaces attributes.
+
+2013-08-06  Patrice Dumas  <address@hidden>
+
        * Texinfo/Parser.pm: keep form-feed in @set value.
        * util/texinfo.dtd, util/txixml2texi.pl, 
        tp/Texinfo/Convert/TexinfoXML.pm(_protect_text): output form-feed

Modified: trunk/tp/Texinfo/Convert/TexinfoXML.pm
===================================================================
--- trunk/tp/Texinfo/Convert/TexinfoXML.pm      2013-08-06 20:52:37 UTC (rev 
5278)
+++ trunk/tp/Texinfo/Convert/TexinfoXML.pm      2013-08-06 21:55:41 UTC (rev 
5279)
@@ -161,9 +161,12 @@
     # and even in xml 1.1 in contrast to what is said on internet.
     # maybe this is a limitation of libxml?
     #$text =~ s/\f/&#12;/g;
-    $text =~ s/\f/&attrformfeed;/g;
-    # &attrformfeed; resolves to \f so \ are doubled
-    $text =~ s/\\/\\\\/g;
+    if ($attributes->[$i] ne 'spaces' 
+        and $attributes->[$i] ne 'trailingspaces') {
+      $text =~ s/\f/&attrformfeed;/g;
+      # &attrformfeed; resolves to \f so \ are doubled
+      $text =~ s/\\/\\\\/g;
+    }
     $result .= " $attributes->[$i]=\"".$text."\"";
   }
   return $result;
@@ -567,7 +570,7 @@
   return $self->_convert($root);
 }
 
-sub _protect_end_of_lines($)
+sub _protect_in_spaces($)
 {
   my $text = shift;
   $text =~ s/\n/\\n/g;
@@ -580,7 +583,7 @@
   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', _protect_end_of_lines(
+    return ('spaces', _protect_in_spaces(
          $root->{'extra'}->{'spaces_after_command'}->{'text'}));
   } else {
     return ();
@@ -593,7 +596,7 @@
   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', _protect_end_of_lines(
+    return ('spaces', _protect_in_spaces(
                  $root->{'extra'}->{'spaces_before_argument'}->{'text'}));
   } else {
     return ();
@@ -648,7 +651,7 @@
   if (defined($spaces[1])) {
     chomp($spaces[1]);
     if ($spaces[1] ne '') {
-      return ('trailingspaces', _protect_end_of_lines($spaces[1]));
+      return ('trailingspaces', _protect_in_spaces($spaces[1]));
     }
   }
   return ();
@@ -662,7 +665,7 @@
   my @result = ();
   my @spaces = $self->_collect_leading_trailing_spaces_arg($root);
   if (defined($spaces[0]) and $spaces[0] ne '') {
-    @result = ('spaces', _protect_end_of_lines($spaces[0]));
+    @result = ('spaces', _protect_in_spaces($spaces[0]));
   }
   return @result;
 }
@@ -675,12 +678,12 @@
   my @result;
   my @spaces = $self->_collect_leading_trailing_spaces_arg($root);
   if (defined($spaces[0]) and $spaces[0] ne '') {
-    push @result, ('spaces', _protect_end_of_lines($spaces[0]));
+    push @result, ('spaces', _protect_in_spaces($spaces[0]));
   }
   if (defined($spaces[1])) {
     chomp($spaces[1]);
     if ($spaces[1] ne '') {
-      push @result, ('trailingspaces', _protect_end_of_lines($spaces[1]));
+      push @result, ('trailingspaces', _protect_in_spaces($spaces[1]));
     }
   }
   return @result;




reply via email to

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