texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp TODO Texinfo/Parser.pm Texinfo/Conve...


From: Patrice Dumas
Subject: texinfo/tp TODO Texinfo/Parser.pm Texinfo/Conve...
Date: Mon, 26 Sep 2011 18:03:33 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/09/26 18:03:33

Modified files:
        tp             : TODO 
        tp/Texinfo     : Parser.pm 
        tp/Texinfo/Convert: XML.pm 
        tp/t/results/xml_tests: raw.pl 

Log message:
        Remove the last newline in XML raw text and the newline after @end xml.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/TODO?cvsroot=texinfo&r1=1.174&r2=1.175
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.302&r2=1.303
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/XML.pm?cvsroot=texinfo&r1=1.38&r2=1.39
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/xml_tests/raw.pl?cvsroot=texinfo&r1=1.2&r2=1.3

Patches:
Index: TODO
===================================================================
RCS file: /sources/texinfo/texinfo/tp/TODO,v
retrieving revision 1.174
retrieving revision 1.175
diff -u -b -r1.174 -r1.175
--- TODO        26 Sep 2011 17:15:46 -0000      1.174
+++ TODO        26 Sep 2011 18:03:32 -0000      1.175
@@ -2,23 +2,6 @@
 perl -w t/02coverage.t -o
 xmllint --nonet --noout --valid commands.xml
 
-xml_tests/raw
-
- Para
- @xml
- <in>
- @end xml
-
-leads to
-
- <para>Para
- <in>
- </para>
-
-should be 
- <para>Para
- <in></para>
-
 @appendix should stop @part. Right now it do not do that.
 Cf sectioning_part_appendix.
 
@@ -138,6 +121,9 @@
   information that there is only one section to the functions formatting
   the page header and page footer.
 
+Should more Converter ignore the last new line (with type 
+last_raw_newline) of a raw block format?
+
 Test tree leading to non empty preamble_before_setfilename.  Currently there
 are none in the test suite, maybe require a real file as input.
 

Index: Texinfo/Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.302
retrieving revision 1.303
diff -u -b -r1.302 -r1.303
--- Texinfo/Parser.pm   26 Sep 2011 17:15:46 -0000      1.302
+++ Texinfo/Parser.pm   26 Sep 2011 18:03:32 -0000      1.303
@@ -5544,10 +5544,14 @@
 
 An empty line.
 
-=item Z<>raw
+=item raw
 
 Text in an environment where it should be kept as is (in C<@verbatim>,
-C<@verb>, C<@macro> body).
+C<@verb>, C<@html>, C<@macro> body).
+
+=item last_raw_newline
+
+The last end of line in a raw block (except for C<@verbatim>).
 
 =item empty_line_after_command
 

Index: Texinfo/Convert/XML.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/XML.pm,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- Texinfo/Convert/XML.pm      17 Sep 2011 22:31:55 -0000      1.38
+++ Texinfo/Convert/XML.pm      26 Sep 2011 18:03:33 -0000      1.39
@@ -381,12 +381,19 @@
   my $result = '';
   if (defined($root->{'text'})) {
     if ($self->{'document_context'}->[-1]->{'raw'}) {
-      # ignore the newline at the end of the @xml line
-      if ($root->{'type'} and $root->{'type'} eq 'empty_line_after_command') {
+      # ignore the newline at the end of the @xml line, and the last in xml
+      if ($root->{'type'} and ($root->{'type'} eq 'empty_line_after_command'
+                               or $root->{'type'} eq 'last_raw_newline')) {
         return '';
       } else {
         return $root->{'text'};
       }
+    } elsif ($root->{'type'} eq 'empty_line_after_command') {
+      my $command = $root->{'extra'}->{'command'};
+      if ($self->{'expanded_formats_hash'}->{$command->{'cmdname'}}
+          and $command->{'cmdname'} eq 'xml') {
+        return '';
+      }
     }
     $result = $self->xml_protect_text($root->{'text'});
     if (! defined($root->{'type'}) or $root->{'type'} ne 'raw') {
@@ -921,8 +928,6 @@
     my $end_command = $root->{'extra'}->{'end_command'}; 
     if ($self->{'expanded_formats_hash'}->{$root->{'cmdname'}}
         and $root->{'cmdname'} eq 'xml') {
-      chomp ($result);
-      chomp ($result);
     } else {
       my $end_line;
       if ($end_command) {

Index: t/results/xml_tests/raw.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/results/xml_tests/raw.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- t/results/xml_tests/raw.pl  26 Sep 2011 17:15:54 -0000      1.2
+++ t/results/xml_tests/raw.pl  26 Sep 2011 18:03:33 -0000      1.3
@@ -152,7 +152,6 @@
 
 
 <para>Para
-<in>
-</para>';
+<in></para>';
 
 1;



reply via email to

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