texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/Pod-Simple-Texinfo pod2texi.pl lib/Pod/...


From: Patrice Dumas
Subject: texinfo/Pod-Simple-Texinfo pod2texi.pl lib/Pod/...
Date: Fri, 20 Jan 2012 22:49:29 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        12/01/20 22:49:29

Modified files:
        Pod-Simple-Texinfo: pod2texi.pl 
        Pod-Simple-Texinfo/lib/Pod/Simple: Texinfo.pm 

Log message:
        Output utf8.
        
        Accumulate in every case.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/Pod-Simple-Texinfo/pod2texi.pl?cvsroot=texinfo&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/texinfo/Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm?cvsroot=texinfo&r1=1.2&r2=1.3

Patches:
Index: pod2texi.pl
===================================================================
RCS file: /sources/texinfo/texinfo/Pod-Simple-Texinfo/pod2texi.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- pod2texi.pl 19 Jan 2012 20:38:11 -0000      1.2
+++ pod2texi.pl 20 Jan 2012 22:49:29 -0000      1.3
@@ -129,6 +129,8 @@
     open (OUT, ">$outfile") or die "Open $outfile: $!\n";
     $fh = *OUT;
   }
+  # FIXME should use =encoding
+  binmode($fh, ':encoding(utf8)');
   my $new = Pod::Simple::Texinfo->new();
   $new->output_fh($fh);
   $new->texinfo_sectioning_base_level($base_level);
@@ -163,6 +165,7 @@
   print $fh '\input texinfo'."\n";
   print $fh '@setfilename '
     .Pod::Simple::Texinfo::_protect_text ($outfile_name)."\n\n";
+  print $fh '@documentencoding utf-8'."\n\n";
   print $fh "address@hidden Top\n";
   # not escaped on purpose, user may want to use @-commands
   print $fh "address@hidden $top\n\n";

Index: lib/Pod/Simple/Texinfo.pm
===================================================================
RCS file: 
/sources/texinfo/texinfo/Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- lib/Pod/Simple/Texinfo.pm   19 Jan 2012 20:38:11 -0000      1.2
+++ lib/Pod/Simple/Texinfo.pm   20 Jan 2012 22:49:29 -0000      1.3
@@ -172,6 +172,8 @@
       $setfilename .= '.info';
       print $fh "address@hidden $setfilename\n\n"
     }
+    # FIXME depend on =encoding
+    print $fh '@documentencoding utf-8'."\n\n";
 
     my $title = $self->get_title();
     if (defined($title) and $title =~ m/\S/) {
@@ -347,20 +349,22 @@
       } elsif ($tag_commands{$tagname}) {
         _output($fh, address@hidden, "address@hidden");
       } elsif ($tagname eq 'Verbatim') {
-        print $fh '@verbatim'."\n";
+        _output($fh, address@hidden, '@verbatim'."\n");
         push @format_stack, 'verbatim';
       } elsif ($environment_commands{$tagname}) {
-        print $fh "address@hidden";
+        _output($fh, address@hidden, "address@hidden");
       } elsif ($tagname eq 'for') {
         my $target = $token->attr('target');
         push @format_stack, $target;
         if ($self->{'texinfo_raw_format_commands'}->{$target}) {
-          print $fh 
"address@hidden>{'texinfo_raw_format_commands'}->{$target}\n";
+          _output($fh, address@hidden, 
+             "address@hidden>{'texinfo_raw_format_commands'}->{$target}\n");
         } elsif ($self->{'texinfo_if_format_commands'}->{$target}) {
-          print $fh 
"address@hidden>{'texinfo_if_format_commands'}->{$target}\n";
+          _output($fh, address@hidden, 
+             "address@hidden>{'texinfo_if_format_commands'}->{$target}\n");
         }
       } elsif ($line_commands{$tagname}) {
-        print $fh "address@hidden ";
+        _output($fh, address@hidden,"address@hidden ");
       } elsif ($tagname eq 'L') {
         my $linktype = $token->attr('type');
         my $content_implicit = $token->attr('content-implicit');
@@ -388,7 +392,7 @@
             $url_arg = '';
           }
           $replacement_arg = _protect_text($replacement_arg);
-          _output($fh, address@hidden, "address@hidden,,$replacement_arg}");
+          _output($fh, address@hidden, "address@hidden,, $replacement_arg}");
         } else {
           if ($linktype eq 'url') {
             # NOTE: the .'' is here to force the $token->attr to be a real
@@ -434,7 +438,7 @@
         #}
         #print STDERR $token->dump."\n";
       } elsif ($tagname eq 'X') {
-        print $fh '@cindex ';
+        _output($fh, address@hidden, "address@hidden ");
       }
     } elsif ($type eq 'text') {
       my $text;
@@ -464,14 +468,15 @@
           my $command;
           $command 
             = $self->{'texinfo_head_commands'}->{$tagname};
-          print $fh "address@hidden $command_result\n";
+          _output($fh, address@hidden, "address@hidden $command_result\n");
         } else {
-          print $fh "address@hidden $command_result\n";
+          _output($fh, address@hidden, 
+                  "address@hidden $command_result\n");
         }
-        print $fh "address@hidden";
-        print $fh "\n" if ($head_commands_level{$tagname});
+        _output($fh, address@hidden, "address@hidden");
+        _output($fh, address@hidden, "\n") if ($head_commands_level{$tagname});
       } elsif ($tagname eq 'Para') {
-        print $fh "\n\n";
+        _output($fh, address@hidden, "\n\n");
         #my $next_token = $self->get_token();
         #if ($next_token) {
         #  if ($next_token->type() ne 'start' 
@@ -484,20 +489,22 @@
         _output($fh, address@hidden, "}");
       } elsif ($tagname eq 'Verbatim') {
         pop @format_stack;
-        print $fh "\n".'@end verbatim'."\n\n";
+        _output($fh, address@hidden, "\n".'@end verbatim'."\n\n");
       } elsif ($environment_commands{$tagname}) {
         my $tag = $environment_commands{$tagname};
         $tag =~ s/ .*//;
-        print $fh "address@hidden $tag\n\n";
+        _output($fh, address@hidden, "address@hidden $tag\n\n");
       } elsif ($tagname eq 'for') {
         my $target = pop @format_stack;
         if ($self->{'texinfo_raw_format_commands'}->{$target}) {
-          print $fh "address@hidden 
$self->{'texinfo_raw_format_commands'}->{$target}\n";
+          _output($fh, address@hidden, 
+                  "address@hidden 
$self->{'texinfo_raw_format_commands'}->{$target}\n");
         } elsif ($self->{'texinfo_if_format_commands'}->{$target}) {
-          print $fh "address@hidden 
if$self->{'texinfo_if_format_commands'}->{$target}\n";
+          _output($fh, address@hidden, 
+                  "address@hidden 
if$self->{'texinfo_if_format_commands'}->{$target}\n");
         }
       } elsif ($line_commands{$tagname}) {
-        print $fh "\n";
+        _output($fh, address@hidden, "\n");
       } elsif ($tagname eq 'L') {
         my $result = pop @accumulated_output;
         my $format = pop @format_stack;
@@ -534,7 +541,7 @@
         my $next_token = $self->get_token();
         if ($next_token) {
           if ($next_token->type() eq 'text') {
-            print $fh "\n";
+            _output($fh, address@hidden, "\n");
           }
           $self->unget_token($next_token);
         }



reply via email to

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