texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp/Texinfo/Convert XML.pm


From: Patrice Dumas
Subject: texinfo/tp/Texinfo/Convert XML.pm
Date: Wed, 04 Jan 2012 21:35:48 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        12/01/04 21:35:48

Modified files:
        tp/Texinfo/Convert: XML.pm 

Log message:
        Handle @inline* in XML.
        Treat all the expanded raw commands the same wether they are xml or not.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/XML.pm?cvsroot=texinfo&r1=1.57&r2=1.58

Patches:
Index: XML.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/XML.pm,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -b -r1.57 -r1.58
--- XML.pm      3 Jan 2012 18:26:59 -0000       1.57
+++ XML.pm      4 Jan 2012 21:35:48 -0000       1.58
@@ -183,6 +183,11 @@
                                                  "${explained_command}desc"];
 }
 
+foreach my $inline_command (keys(%Texinfo::Common::inline_format_commands)) {
+  $commands_args_elements{$inline_command} = ["${inline_command}format",
+                                              "${inline_command}content"];
+}
+
 my %commands_elements;
 foreach my $command (keys(%Texinfo::Common::brace_commands)) {
   $commands_elements{$command} = [$command];
@@ -235,9 +240,8 @@
   'before_item' => 'beforefirstitem',
 );
 
-my %context_block_commands = (
+my %default_context_block_commands = (
   'float' => 1,
-  'xml' => 1,
 );
 
 sub converter_defaults($)
@@ -250,6 +254,11 @@
   my $self = shift;
 
   $self->{'document_context'} = [{}];
+  $self->{'context_block_commands'} = {%default_context_block_commands};
+  foreach my $raw (keys (%Texinfo::Common::format_raw_commands)) {
+    $self->{'context_block_commands'}->{$raw} = 1
+         if $self->{'expanded_formats_hash'};
+  } 
 }
 
 sub output($$)
@@ -388,9 +397,10 @@
       }
     } elsif ($root->{'type'} 
              and $root->{'type'} eq 'empty_line_after_command') {
-      my $command = $root->{'extra'}->{'command'};
-      if ($self->{'expanded_formats_hash'}->{$command->{'cmdname'}}
-          and $command->{'cmdname'} eq 'xml') {
+      my $command_name = $root->{'extra'}->{'command'}->{'cmdname'};
+      
+      if ($Texinfo::Common::format_raw_commands{$command_name} and 
+          $self->{'expanded_formats_hash'}->{$command_name}) {
         return '';
       }
     }
@@ -681,6 +691,23 @@
       if ($Texinfo::Common::context_brace_commands{$root->{'cmdname'}}) {
         push @{$self->{'document_context'}}, {};
       }
+      if ($Texinfo::Common::inline_format_commands{$root->{'cmdname'}}
+          and $root->{'extra'} and $root->{'extra'}->{'format'}
+          and 
$self->{'expanded_formats_hash'}->{$root->{'extra'}->{'format'}}) {
+        if ($root->{'cmdname'} eq 'inlineraw') {
+          push @{$self->{'document_context'}}, {};
+          $self->{'document_context'}->[-1]->{'raw'} = 1;
+        }
+        if (scalar (@{$root->{'extra'}->{'brace_command_contents'}}) == 2
+            and defined($root->{'extra'}->{'brace_command_contents'}->[-1])) {
+          $result .= $self->_convert({'contents' 
+                        => 
$root->{'extra'}->{'brace_command_contents'}->[-1]});
+        }
+        if ($root->{'cmdname'} eq 'inlineraw') {
+          pop @{$self->{'document_context'}};
+        }
+        return $result;
+      }
       my @elements = @{$commands_elements{$root->{'cmdname'}}};
       my $command;
       if (scalar(@elements) > 1) {
@@ -725,7 +752,7 @@
         pop @{$self->{'document_context'}};
       }
     } elsif (exists($Texinfo::Common::block_commands{$root->{'cmdname'}})) {
-      if ($context_block_commands{$root->{'cmdname'}}) {
+      if ($self->{'context_block_commands'}->{$root->{'cmdname'}}) {
         push @{$self->{'document_context'}}, {};
       }
       my $prepended_elements = '';
@@ -961,7 +988,7 @@
       }
       $result .= $end_line;
     }
-    if ($context_block_commands{$root->{'cmdname'}}) {
+    if ($self->{'context_block_commands'}->{$root->{'cmdname'}}) {
       pop @{$self->{'document_context'}};
     }
   # The command is closed either when the corresponding tree element



reply via email to

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