texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp TODO Texinfo/Convert/Converter.pm Te...


From: Patrice Dumas
Subject: texinfo/tp TODO Texinfo/Convert/Converter.pm Te...
Date: Sat, 28 May 2011 23:27:40 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/05/28 23:27:39

Modified files:
        tp             : TODO 
        tp/Texinfo/Convert: Converter.pm HTML.pm Info.pm 
        tp/t           : 03coverage_braces.t 08misc_commands.t 

Log message:
        Generic _create_destination_directory.
        No undef warning with brace commands without braces.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/TODO?cvsroot=texinfo&r1=1.125&r2=1.126
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Converter.pm?cvsroot=texinfo&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/HTML.pm?cvsroot=texinfo&r1=1.61&r2=1.62
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Info.pm?cvsroot=texinfo&r1=1.53&r2=1.54
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/03coverage_braces.t?cvsroot=texinfo&r1=1.34&r2=1.35
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/08misc_commands.t?cvsroot=texinfo&r1=1.19&r2=1.20

Patches:
Index: TODO
===================================================================
RCS file: /sources/texinfo/texinfo/tp/TODO,v
retrieving revision 1.125
retrieving revision 1.126
diff -u -b -r1.125 -r1.126
--- TODO        2 May 2011 07:04:22 -0000       1.125
+++ TODO        28 May 2011 23:27:39 -0000      1.126
@@ -1,3 +1,10 @@
+
+Test to add (warning when --html):
+
address@hidden strong}
address@hidden blah.
+
+
 LINKS_BUTTONS as config, check and document.
 
 API HTML:

Index: Texinfo/Convert/Converter.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Converter.pm,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- Texinfo/Convert/Converter.pm        17 Apr 2011 07:27:57 -0000      1.16
+++ Texinfo/Convert/Converter.pm        28 May 2011 23:27:39 -0000      1.17
@@ -468,6 +468,21 @@
   return $result;
 }
 
+sub _create_destination_directory($)
+{
+  my $self = shift;
+  if (defined($self->{'destination_directory'})
+      and ! -d $self->{'destination_directory'}) {
+    if (!mkdir($self->{'destination_directory'}, oct(755))) {
+      $self->document_error(sprintf($self->__(
+             "Can't create directories `%s': %s"), 
+             $self->{'destination_directory'}, $!));
+      return undef;
+    }
+  }
+  return 1;
+}
+
 sub xml_protect_text($$)
 {
   my $self = shift;

Index: Texinfo/Convert/HTML.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/HTML.pm,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -b -r1.61 -r1.62
--- Texinfo/Convert/HTML.pm     23 May 2011 23:34:57 -0000      1.61
+++ Texinfo/Convert/HTML.pm     28 May 2011 23:27:39 -0000      1.62
@@ -1088,6 +1088,12 @@
   my $args = shift;
 
   my $text = $args->[0]->{'normal'};
+  if (!defined($text)) {
+    # happens with bogus @-commands without argument, like @strong something
+    #cluck "text not defined in _convert_style_command";
+    #print STDERR Texinfo::Structuring::_print_current($command);
+    return '';
+  }
 
   my $attribute_hash = {};
   if ($self->in_preformatted()) {
@@ -1100,7 +1106,7 @@
       my ($style, $class, $attribute_text)
         = _parse_attribute ($attribute_hash->{$cmdname}->{'attribute'});
       $text = $self->attribute_class($style, $class) . "$attribute_text>" 
-              . "$text" . "</$style>";
+              . $text . "</$style>";
     }
     if (defined($attribute_hash->{$cmdname}->{'quote'})) {
       $text = $self->get_conf('OPEN_QUOTE_SYMBOL') . $text
@@ -2245,8 +2251,8 @@
   my $command = shift;
   my $content = shift;
 
-  return $command->{'extra'}->{'begin'} . $content
-         .$command->{'extra'}->{'end'};
+  return $self->xml_protect_text($command->{'extra'}->{'begin'}) . $content
+         .$self->xml_protect_text($command->{'extra'}->{'end'});
 }
 
 $default_types_conversion{'definfoenclose_command'} 
@@ -2533,7 +2539,8 @@
   #$result =~ s/^\s*//;
   # if there is no element, the parent should not be an element
   if (defined($self->get_conf('DEFAULT_RULE'))
-      and (!$command->{'parent'}->{'type'}
+      and (!$command->{'parent'} 
+           or !$command->{'parent'}->{'type'}
            or $command->{'parent'}->{'type'} ne 'element')) {
     $result .= $self->get_conf('DEFAULT_RULE') ."\n",
       if $self->get_conf('PROGRAM_NAME_IN_FOOTER');
@@ -3238,8 +3245,13 @@
   my $page = shift;
   my $filename = shift;
 
+# FIXME directory should be the file name!
   $page->{'filename'} = $filename;
+  if (defined($self->{'destination_directory'})) {
   $page->{'out_filename'} = $self->{'destination_directory'} . $filename;
+  } else {
+    $page->{'out_filename'} = $filename;
+  }
 }
 
 sub _get_page($$);
@@ -4295,6 +4307,7 @@
   # this sets OUTFILE, to be used if not split, but also
   # 'destination_directory' and 'output_filename' that are useful when split.
   $self->_set_outfile();
+  return undef unless $self->_create_destination_directory();
 
   # This should return undef if called on a tree without node or sections.
   my ($elements, $special_elements, $special_pages) 
@@ -4439,7 +4452,7 @@
     $output .= _output_text($header, $fh);
     if ($elements and @$elements) {
       foreach my $element (@$elements) {
-        my $element_text = $self->_element($element);
+        my $element_text = $self->_convert($element);
         $output .= _output_text($element_text, $fh);
       }
     } else {

Index: Texinfo/Convert/Info.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Info.pm,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -b -r1.53 -r1.54
--- Texinfo/Convert/Info.pm     13 Apr 2011 20:14:29 -0000      1.53
+++ Texinfo/Convert/Info.pm     28 May 2011 23:27:39 -0000      1.54
@@ -68,15 +68,8 @@
                                      'locations' => []};
   my $header = $self->_info_header();
   pop @{$self->{'count_context'}};
-  if (defined($self->{'destination_directory'})
-      and ! -d $self->{'destination_directory'}) {
-    if (!mkdir($self->{'destination_directory'}, oct(755))) {
-      $self->document_error(sprintf($self->__(
-             "Can't create directories `%s': %s"), 
-             $self->{'destination_directory'}, $!));
-      return undef;
-    }
-  }
+  return undef unless $self->_create_destination_directory();
+
   my $header_bytes = $self->count_bytes($header);
   my $elements = Texinfo::Structuring::split_by_node($root);
 

Index: t/03coverage_braces.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/03coverage_braces.t,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- t/03coverage_braces.t       5 Apr 2011 00:01:46 -0000       1.34
+++ t/03coverage_braces.t       28 May 2011 23:27:39 -0000      1.35
@@ -195,7 +195,9 @@
 );
 
 my @test_invalid = (
-['no_brace', '@TeX and @code code and @footnote footnote '],
+['no_brace', '@TeX and @code code and @footnote footnote ', 
+#,,{'test_formats' => ['html']}],
+],
 ['no_brace_space_end_line',
 '@code {c}.
 

Index: t/08misc_commands.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/08misc_commands.t,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- t/08misc_commands.t 27 Mar 2011 08:24:55 -0000      1.19
+++ t/08misc_commands.t 28 May 2011 23:27:39 -0000      1.20
@@ -440,6 +440,7 @@
 
 foreach my $test (@converted_test_cases) {
   $test->[2]->{'test_formats'} = ['plaintext'];
+  #push @{$test->[2]->{'test_formats'}}, 'html';
   push @{$test->[2]->{'test_formats'}}, 'info' if ($info_tests{$test->[0]});
 }
 



reply via email to

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