[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/tp texi2any.pl Texinfo/Parser.pm Texinf...
From: |
Patrice Dumas |
Subject: |
texinfo/tp texi2any.pl Texinfo/Parser.pm Texinf... |
Date: |
Tue, 11 Jan 2011 22:59:56 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 11/01/11 22:59:55
Modified files:
tp : texi2any.pl
tp/Texinfo : Parser.pm
tp/Texinfo/Convert: Info.pm
Log message:
Handle more options.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/texi2any.pl?cvsroot=texinfo&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.175&r2=1.176
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Info.pm?cvsroot=texinfo&r1=1.8&r2=1.9
Patches:
Index: texi2any.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/texi2any.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- texi2any.pl 11 Jan 2011 00:49:16 -0000 1.2
+++ texi2any.pl 11 Jan 2011 22:59:55 -0000 1.3
@@ -162,20 +162,59 @@
my $option_error_limit = 100;
my $option_no_warn = 0;
my $format = 'info';
+#Â this is the format associated with the output format, which is replaced
+#Â when the output format changes. It may also be removed if there is the
+#Â corresponding --no-ifformat.
+my $default_expanded_format = [ $format ];
+my @conf_dirs = ();
+my @include_dirs = ();
+my @prepend_dirs = ();
+
my $converter_default_options = {};
+my $parser_default_options = {'expanded_formats' => []};
+sub set_expansion($$) {
+ my $region = shift;
+ my $set = shift;
+ $set = 1 if (!defined($set));
+ if ($set) {
+ push @{$parser_default_options->{'expanded_formats'}}, $region
+ unless (grep {$_ eq $region}
@{$parser_default_options->{'expanded_formats'}})
+ } else {
+ @{$parser_default_options->{'expanded_formats'}} =
+ grep {$_ ne $region} @{$parser_default_options->{'expanded_formats'}};
+ grep {$_ ne $region} @{$default_expanded_format};
+ }
+}
my $result_options = Getopt::Long::GetOptions (
- 'macro-expand|E=s' => sub {push @texi2dvi_args, '-E'; $macro_expand = $_[1];
},
+ 'macro-expand|E=s' => sub { push @texi2dvi_args, '-E'; $macro_expand = $_[1];
},
'error-limit|e=i' => \$option_error_limit,
'no-warn' => \$option_no_warn,
+ 'ifhtml' => sub { set_expansion('html', $_[1]); },
+ 'ifinfo' => sub { set_expansion('info', $_[1]); },
+ 'ifxml' => sub { set_expansion('xml', $_[1]); },
+ 'ifdocbook' => sub { set_expansion('docbook', $_[1]); },
+ 'iftex' => sub { set_expansion('tex', $_[1]); },
+ 'ifplaintext' => sub { set_expansion('plaintext', $_[1]); },
+ 'I=s' => sub { push @texi2dvi_args, ('-'.$_[0], $_[1]);
+ push @include_dirs, split(/$quoted_path_separator/, $_[1]); },
+ 'conf-dir=s' => sub { push @conf_dirs, split(/$quoted_path_separator/,
$_[1]); },
+ 'P=s' => sub { unshift @prepend_dirs, split(/$quoted_path_separator/, $_[1]);
},
+# 'number-sections' =>
);
my %formats_table = (
- 'info' => { 'nodes_tree' => 1,
+ 'info' => {
+ 'nodes_tree' => 1,
'floats' => 1,
'converter' => sub{Texinfo::Convert::Info->converter(@_)},
},
+ 'plaintext' => {
+ 'nodes_tree' => 1,
+ 'floats' => 1,
+ 'converter' => sub{Texinfo::Convert::Plaintext->converter(@_)},
+ },
);
# Main processing, process all the files given on the command line
@@ -221,10 +260,21 @@
if ($input_file_name =~ /(.*\/)/) {
$input_directory = $1;
}
+
my $input_file_base = $input_file_name;
$input_file_base =~ s/\.te?x(i|info)?$//;
- my $parser = Texinfo::Parser::parser({'gettext' => \&__});
+ my $parser_options = { %$parser_default_options };
+
+ $parser_options->{'include_directories'} = address@hidden;
+ my @prependended_include_directories = ('.');
+ push @prependended_include_directories, $input_directory
+ if ($input_directory ne '.');
+ unshift @{$parser_options->{'include_directories'}},
@prependended_include_directories;
+ unshift @{$parser_options->{'include_directories'}}, @prepend_dirs;
+
+ $parser_options->{'gettext'} = \&__;
+ my $parser = Texinfo::Parser::parser($parser_options);
my $tree = $parser->parse_texi_file($input_file_name);
my $error_count = 0;
Index: Texinfo/Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.175
retrieving revision 1.176
diff -u -b -r1.175 -r1.176
--- Texinfo/Parser.pm 11 Jan 2011 22:29:39 -0000 1.175
+++ Texinfo/Parser.pm 11 Jan 2011 22:59:55 -0000 1.176
@@ -234,7 +234,7 @@
# in the `HTML Xref' node. Value should be
# a node/anchor or float in the tree.
'novalidate' => 0, # same as setting @novalidate.
- 'encoding' => 'us-ascii', # Current encoding set by @documentencoding
+ 'encoding' => undef, # Current encoding set by @documentencoding
# and normalized
'documentlanguage' => 'en', # Current documentlanguage set by
# @documentlanguage or at initialization
Index: Texinfo/Convert/Info.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Info.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- Texinfo/Convert/Info.pm 1 Jan 2011 14:28:00 -0000 1.8
+++ Texinfo/Convert/Info.pm 11 Jan 2011 22:59:55 -0000 1.9
@@ -259,34 +259,6 @@
}
}
-sub _align_lines($$$)
-{
- my $text = shift;
- my $max_column = shift;
- my $direction = shift;
- my $result = '';
- foreach my $line (split /^/, $text) {
- chomp($line);
- $line =~ s/^\s*//;
- $line =~ s/\s*$//;
- my $line_width = Texinfo::Convert::Unicode::string_width($line);
- if ($line_width == 0) {
- $result .= "\n";
- } else {
- my $spaces_prepended;
- if ($line_width > $max_column) {
- $spaces_prepended = 0;
- } elsif ($direction eq 'center') {
- $spaces_prepended = (($max_column -1 - $line_width) /2);
- } else {
- $spaces_prepended = ($max_column -1 - $line_width);
- }
- $result .= ' ' x$spaces_prepended . $line ."\n";
- }
- }
- return $result;
-}
-
#sub _flush_paragraph($$)
#{
# my $self = shift;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- texinfo/tp texi2any.pl Texinfo/Parser.pm Texinf...,
Patrice Dumas <=