texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp texi2any.pl Texinfo/Convert/Info.pm ...


From: Patrice Dumas
Subject: texinfo/tp texi2any.pl Texinfo/Convert/Info.pm ...
Date: Sun, 23 Jan 2011 23:46:16 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/01/23 23:46:16

Modified files:
        tp             : texi2any.pl 
        tp/Texinfo/Convert: Info.pm Plaintext.pm 

Log message:
        Handle better -o dir/.
        Create the output directory.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/texi2any.pl?cvsroot=texinfo&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Info.pm?cvsroot=texinfo&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Plaintext.pm?cvsroot=texinfo&r1=1.55&r2=1.56

Patches:
Index: texi2any.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/texi2any.pl,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- texi2any.pl 23 Jan 2011 21:18:26 -0000      1.8
+++ texi2any.pl 23 Jan 2011 23:46:16 -0000      1.9
@@ -441,11 +441,17 @@
      if ($value =~ /^undef$/i) {
        $value = undef;
      }
+
+     # this is very wrong, but a way to avoid a spurious warning.
+     {
+       no warnings 'once';
      if (set_from_cmdline ($var, $value) 
          and exists($Texinfo::Parser::default_configuration{$var})) {
        $parser_default_options->{$var} = $value;
      }
    }
+
+   }
  },
  'css-include=s' => address@hidden,
  'css-ref=s' => address@hidden,

Index: Texinfo/Convert/Info.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Info.pm,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- Texinfo/Convert/Info.pm     20 Jan 2011 00:38:31 -0000      1.14
+++ Texinfo/Convert/Info.pm     23 Jan 2011 23:46:16 -0000      1.15
@@ -60,6 +60,14 @@
                                      'locations' => []};
   my $header = $self->_info_header();
   pop @{$self->{'count_context'}};
+  if (defined($self->{'output_dir'}) and ! -d $self->{'output_dir'}) {
+    if (!mkdir($self->{'output_dir'}, oct(755))) {
+      $self->document_error(sprintf($self->__(
+             "Can't create directories `%s': %s"), 
+             $self->{'output_dir'}, $!));
+      return undef;
+    }
+  }
   my $header_bytes = $self->count_bytes($header);
   my $elements = Texinfo::Structuring::split_by_node($root);
 
@@ -176,7 +184,8 @@
   my $output_file;
   if (defined($self->{'OUTFILE'})) {
     $output_file = $self->{'OUTFILE'};
-  } elsif ($self->{'extra'} and $self->{'extra'}->{'setfilename'}
+  } else {
+    if ($self->{'extra'} and $self->{'extra'}->{'setfilename'}
            and $self->{'extra'}->{'setfilename'}->{'extra'}
            and 
defined($self->{'extra'}->{'setfilename'}->{'extra'}->{'text_arg'})) {
     $output_file = $self->{'extra'}->{'setfilename'}->{'extra'}->{'text_arg'};
@@ -187,10 +196,19 @@
   } else {
     $output_file = '';
   }
+    if (defined($self->{'SUBDIR'}) and $output_file ne '') {
+      $output_file = "$self->{'SUBDIR'}/$output_file";
+    }
+  }
   $self->{'output_file'} = $output_file if ($output_file ne '');
   my $output_basename = $output_file;
   $output_basename =~ s/^.*\///;
   $self->{'output_filename'} = $output_basename;
+  my $output_dir = $output_file;
+  $output_dir =~ s|[^/]*$||;
+  if ($output_dir ne '') {
+    $self->{'output_dir'} = $output_dir;
+  }
 
   # FIXME version/program
   my $text = "This is $output_basename, produced by makeinfo version 4.13 from 
$input_basename.";

Index: Texinfo/Convert/Plaintext.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Plaintext.pm,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -b -r1.55 -r1.56
--- Texinfo/Convert/Plaintext.pm        23 Jan 2011 21:18:26 -0000      1.55
+++ Texinfo/Convert/Plaintext.pm        23 Jan 2011 23:46:16 -0000      1.56
@@ -239,6 +239,7 @@
   'encoding'             => undef,
   'output_encoding'      => undef,
   'OUTFILE'              => undef,
+  'SUBDIR'               => undef,
   'documentlanguage'     => undef,
   'NUMBER_FOOTNOTES'     => 1,
   'empty_lines_count'    => 0,
@@ -1347,7 +1348,8 @@
     } elsif ($root->{'args'} and $root->{'args'}->[0] 
              and $root->{'args'}->[0]->{'type'}
              and $root->{'args'}->[0]->{'type'} eq 'brace_command_arg') {
-      die "Unhandled command with braces $root->{'cmdname'}\n";
+      warn "Unhandled command with braces $root->{'cmdname'}\n";
+      $result .= "!!!!! Unhandled command with braces $root->{'cmdname'} 
!!!!!\n";
     # block commands
     } elsif (exists($block_commands{$root->{'cmdname'}})) {
       # remark:
@@ -1662,7 +1664,8 @@
     #} els
     if ($unknown_command and !($root->{'extra'} 
                                and $root->{'extra'}->{'index_entry'})) {
-      die "Unhandled $root->{'cmdname'}\n";
+      warn "Unhandled $root->{'cmdname'}\n";
+      $result .= "!!!!!!!!! Unhandled $root->{'cmdname'} !!!!!!!!!\n";
     }
     
   }



reply via email to

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