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: Mon, 16 Apr 2012 22:08:16 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        12/04/16 22:08:15

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

Log message:
        Output utf8 for main file too.
        Add a debug option.
        Remove end of lines in prepended manual names.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/Pod-Simple-Texinfo/pod2texi.pl?cvsroot=texinfo&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/texinfo/Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm?cvsroot=texinfo&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/texinfo/Pod-Simple-Texinfo/t/Pod-Simple-Texinfo.t?cvsroot=texinfo&r1=1.12&r2=1.13

Patches:
Index: pod2texi.pl
===================================================================
RCS file: /sources/texinfo/texinfo/Pod-Simple-Texinfo/pod2texi.pl,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- pod2texi.pl 13 Mar 2012 22:55:57 -0000      1.14
+++ pod2texi.pl 16 Apr 2012 22:08:15 -0000      1.15
@@ -74,6 +74,7 @@
 
 Options:
     --base-level=NUM|NAME   level of the head1 commands.
+    --debug=NUM             set debugging level
     --no-fill-section-gaps  do not fill sectioning gaps.
     --no-section-nodes      use anchors for sections instead of nodes.
     --output=NAME           output to <NAME> for the first or the main manual
@@ -91,6 +92,7 @@
 my $subdir;
 my $section_nodes = 1;
 my $fill_sectioning_gaps = 1;
+my $debug = 0;
 
 my $result_options = Getopt::Long::GetOptions (
   'help|h' => sub { print pod2texi_help(); exit 0; },
@@ -116,6 +118,7 @@
   'top=s' => \$top,
   'section-nodes!' => \$section_nodes,
   'fill-section-gaps!' => \$fill_sectioning_gaps,
+  'debug=i' => \$debug,
 );
 
 exit 1 if (!$result_options);
@@ -182,13 +185,16 @@
   my $section_nodes = shift;
   my $fill_gaps_in_sectioning = shift;
   my $do_master_menu = shift;
+
   my $parser = Texinfo::Parser::parser();
   my $tree = $parser->parse_texi_text($manual_texi);
+
   if ($fill_gaps_in_sectioning) {
     $tree->{'contents'} 
       = Texinfo::Structuring::fill_gaps_in_sectioning($tree);
     $tree->{'contents'}
-      = Texinfo::Structuring::insert_nodes_for_sectioning_commands($parser, 
$tree);
+      = Texinfo::Structuring::insert_nodes_for_sectioning_commands($parser, 
$tree)
+        if ($section_nodes);
   }
   my $structure = Texinfo::Structuring::sectioning_structure($parser, $tree);
   Texinfo::Structuring::complete_tree_nodes_menus($parser, $tree) 
@@ -220,6 +226,7 @@
 }
 
 my $file_nr = 0;
+# Full manual is collected to generate the top node menu.
 my $full_manual = '';
 my @included;
 foreach my $file (@processed_files) {
@@ -274,9 +281,18 @@
     $new->texinfo_internal_pod_manuals(address@hidden);
   }
   
+  print STDERR "processing $file -> $outfile ($name)\n" if ($debug);
   $new->parse_file($file);
 
   if ($section_nodes or $fill_sectioning_gaps) {
+    if ($debug > 4) {
+      # print to a file
+      open (DBGFILE, ">$outfile-dbg") or die sprintf(__("%s: Open %s: %s.\n"), 
+                                      $real_command_name, "$outfile-dbg", $!);
+      binmode(DBGFILE, ':encoding(utf8)');
+      print DBGFILE $manual_texi;
+      
+    }
     $manual_texi = _fix_texinfo_manual($manual_texi, $section_nodes, 
                                        $fill_sectioning_gaps);
     $full_manual .= $manual_texi if ($section_nodes);
@@ -327,6 +343,10 @@
   } else {
     $fh = *STDOUT;
   }
+
+  # FIXME should use =encoding
+  binmode($fh, ':encoding(utf8)');
+
   my $outfile_name = $output;
 
   $outfile_name = $STDOUT_DOCU_NAME if ($outfile_name eq '-');
@@ -406,6 +426,10 @@
 file.  Therefore if you want to have each pod file as a chapter, you should
 use C<section> as the base level.
 
+=item B<--debug>=I<NUM>
+
+Set debugging level to I<NUM>.
+
 =item B<--output>=I<NAME>
 
 Name for the first manual, or the main manual if there is a main manual.

Index: lib/Pod/Simple/Texinfo.pm
===================================================================
RCS file: 
/sources/texinfo/texinfo/Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- lib/Pod/Simple/Texinfo.pm   4 Mar 2012 23:23:44 -0000       1.15
+++ lib/Pod/Simple/Texinfo.pm   16 Apr 2012 22:08:15 -0000      1.16
@@ -302,7 +302,7 @@
   my $base_level = shift;
 
   if (defined($manual) and $base_level > 0) {
-    return "$manual $section";
+    return _protect_text($manual, 1). " $section";
   } else {
     return $section;
   }

Index: t/Pod-Simple-Texinfo.t
===================================================================
RCS file: /sources/texinfo/texinfo/Pod-Simple-Texinfo/t/Pod-Simple-Texinfo.t,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- t/Pod-Simple-Texinfo.t      4 Mar 2012 23:23:45 -0000       1.12
+++ t/Pod-Simple-Texinfo.t      16 Apr 2012 22:08:15 -0000      1.13
@@ -6,20 +6,29 @@
 # change 'tests => 1' to 'tests => last_test_to_print';
 
 use Test::More;
-BEGIN { plan tests => 15 };
+BEGIN { plan tests => 16 };
 use Pod::Simple::Texinfo;
 ok(1); # If we made it this far, we're ok.
 
 #########################
 
-sub run_test($$$)
+sub run_test($$$;$$)
 {
   my $in = shift;
   my $out = shift;
   my $name = shift;
+  my $test_nodes = shift;
+  my $sectioning_base_level = shift;
 
   my $parser = Pod::Simple::Texinfo->new();
   $parser->set_source(\$in);
+  $parser->texinfo_section_nodes(1)
+    if ($test_nodes);
+  if (defined($sectioning_base_level)) {
+    $parser->texinfo_sectioning_base_level($sectioning_base_level);
+    my $short_title = $parser->get_short_title();
+    $parser->texinfo_short_title($short_title);
+  }
   my $result;
   $parser->output_string(\$result);
   $parser->bare_output(1);
@@ -41,6 +50,15 @@
 
 ', 'index in head');
 
+run_test ('=head1 NAME
+X<aaa>
+',
+'@node NAME aaa NAME
address@hidden NAME
address@hidden aaa
+
+', 'index in head node', 1, 2);
+
 run_test ('=head1 T
 
 Para X<bb>



reply via email to

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