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/cov...


From: Patrice Dumas
Subject: texinfo/tp Texinfo/Convert/XML.pm t/results/cov...
Date: Thu, 08 Sep 2011 22:25:46 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/09/08 22:25:46

Modified files:
        tp/Texinfo/Convert: XML.pm 
        tp/t/results/coverage: item_container.pl 
        tp/t/results/xml_tests: comments_on_block_command_lines.pl 

Log message:
        Add <prepend> in @item of @itemize for prepended stuff.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/XML.pm?cvsroot=texinfo&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/coverage/item_container.pl?cvsroot=texinfo&r1=1.40&r2=1.41
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/xml_tests/comments_on_block_command_lines.pl?cvsroot=texinfo&r1=1.4&r2=1.5

Patches:
Index: Texinfo/Convert/XML.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/XML.pm,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- Texinfo/Convert/XML.pm      7 Sep 2011 23:17:45 -0000       1.21
+++ Texinfo/Convert/XML.pm      8 Sep 2011 22:25:46 -0000       1.22
@@ -470,7 +470,7 @@
     }
     return $result;
   }
-  my $close_element;
+  my @close_elements;
   if ($root->{'cmdname'}) {
     if (defined($xml_commands_formatting{$root->{'cmdname'}})) {
       if ($root->{'cmdname'} eq 'click' 
@@ -493,7 +493,16 @@
           and ($root->{'parent'}->{'cmdname'} eq 'itemize'
                or $root->{'parent'}->{'cmdname'} eq 'enumerate')) {
         $result .= "<item>";
-        $close_element = 'item';
+        if ($root->{'parent'}->{'cmdname'} eq 'itemize'
+            and $root->{'parent'}->{'extra'} 
+            and $root->{'parent'}->{'extra'}->{'block_command_line_contents'}
+            and 
$root->{'parent'}->{'extra'}->{'block_command_line_contents'}->[0]) {
+          $result .= "<prepend>"
+            .$self->_convert({'contents' 
+        => $root->{'parent'}->{'extra'}->{'block_command_line_contents'}->[0]})
+            ."</prepend>";
+        }
+        unshift @close_elements, 'item';
       } elsif (($root->{'cmdname'} eq 'item' or $root->{'cmdname'} eq 'itemx')
                and $root->{'parent'}->{'type'} 
                and $root->{'parent'}->{'type'} eq 'table_term') {
@@ -534,7 +543,7 @@
         }
         
         $result .= "<entry command=\"$root->{'cmdname'}\">";
-        $close_element = 'entry';
+        unshift @close_elements, 'entry';
       }
     } elsif ($root->{'type'} and $root->{'type'} eq 'index_entry_command') {
       my $element;
@@ -796,12 +805,15 @@
                   and 
defined($default_args_code_style{$root->{'cmdname'}}->[$arg_index]));
               $self->{'document_context'}->[-1]->{'code'}++ if ($in_code);
               my $arg;
+              if ($arg_index+1 eq scalar(@{$root->{'args'}})) {
               ($arg, $end_line) 
                 = 
$self->_convert_argument_and_end_line($root->{'args'}->[$arg_index]);
+              } else {
+                $arg = $self->_convert($root->{'args'}->[$arg_index]);
+              }
               if ($arg ne '') {
                 $result .= "<$element>$arg</$element>";
               }
-              #$result .= "\n";
               $self->{'document_context'}->[-1]->{'code'}-- if ($in_code);
             } else {
               last;
@@ -843,7 +855,7 @@
       $result .= $end_line;
       #chomp($result);
       #$result .= "\n";
-      $close_element = $root->{'cmdname'};
+      unshift @close_elements, $root->{'cmdname'};
     }
   }
   if ($root->{'type'}) {
@@ -944,8 +956,8 @@
          and (!$root->{'parent'}->{'type'} or
               ($root->{'parent'}->{'type'} ne 'block_line_arg'
                and $root->{'parent'}->{'type'} ne 'misc_line_arg')));
-  if ($close_element) {
-    $result .= "</$close_element>";
+  foreach my $element (@close_elements) {
+    $result .= "</$element>";
   }
   if ($root->{'cmdname'} 
       and exists($Texinfo::Common::block_commands{$root->{'cmdname'}})) {

Index: t/results/coverage/item_container.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/results/coverage/item_container.pl,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -b -r1.40 -r1.41
--- t/results/coverage/item_container.pl        3 Sep 2011 07:26:52 -0000       
1.40
+++ t/results/coverage/item_container.pl        8 Sep 2011 22:25:46 -0000       
1.41
@@ -491,4 +491,20 @@
 </li></ul>
 ';
 
+
+$result_converted{'xml'}->{'item_container'} = '
+<itemize><itemprepend>+</itemprepend>
+<item><prepend>+</prepend><para>i&textndash;tem +
+</para></item></itemize>
+
+<itemize commandarg="@bullet"><itemprepend>&bullet;</itemprepend>
+<item><prepend>&bullet;</prepend>
+<para>b&textndash;ullet
+</para></item></itemize>
+
+<itemize commandarg="@bullet">
+<item><prepend>&bullet;</prepend><para>no itemize argument
+</para></item></itemize>
+';
+
 1;

Index: t/results/xml_tests/comments_on_block_command_lines.pl
===================================================================
RCS file: 
/sources/texinfo/texinfo/tp/t/results/xml_tests/comments_on_block_command_lines.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- t/results/xml_tests/comments_on_block_command_lines.pl      7 Sep 2011 
23:17:46 -0000       1.4
+++ t/results/xml_tests/comments_on_block_command_lines.pl      8 Sep 2011 
22:25:46 -0000       1.5
@@ -2457,15 +2457,15 @@
 
 
 $result_converted{'xml'}->{'comments_on_block_command_lines'} = '<itemize 
commandarg="@bullet"><!--  comm -->
-<item><para>itemize it
+<item><prepend>&bullet;</prepend><para>itemize it
 </para></item></itemize>
 
 <itemize><itemprepend>x </itemprepend><!--  comm -->
-<item><para>itemize xit
+<item><prepend>x</prepend><para>itemize xit
 </para></item></itemize>
 
 <itemize commandarg="@bullet"><itemprepend>&bullet; </itemprepend><!--  comm 
-->
-<item><para>itemize bulletit
+<item><prepend>&bullet;</prepend><para>itemize bulletit
 </para></item></itemize>
 
 <enumerate first="1"><!--  comm -->



reply via email to

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