[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/tp texi2any.pl Texinfo/Common.pm Texinf...
From: |
Patrice Dumas |
Subject: |
texinfo/tp texi2any.pl Texinfo/Common.pm Texinf... |
Date: |
Sun, 16 Jan 2011 01:24:21 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 11/01/16 01:24:21
Modified files:
tp : texi2any.pl
tp/Texinfo : Common.pm Parser.pm Report.pm Structuring.pm
tp/Texinfo/Convert: Info.pm Line.pm Paragraph.pm Plaintext.pm
UnFilled.pm
tp/t : paragraph.t test_utils.pl
Log message:
Handle all the command-line options.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/texi2any.pl?cvsroot=texinfo&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Common.pm?cvsroot=texinfo&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.177&r2=1.178
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Report.pm?cvsroot=texinfo&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Structuring.pm?cvsroot=texinfo&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Info.pm?cvsroot=texinfo&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Line.pm?cvsroot=texinfo&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Paragraph.pm?cvsroot=texinfo&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Plaintext.pm?cvsroot=texinfo&r1=1.50&r2=1.51
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/UnFilled.pm?cvsroot=texinfo&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/paragraph.t?cvsroot=texinfo&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/test_utils.pl?cvsroot=texinfo&r1=1.62&r2=1.63
Patches:
Index: texi2any.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/texi2any.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- texi2any.pl 15 Jan 2011 11:57:01 -0000 1.4
+++ texi2any.pl 16 Jan 2011 01:24:20 -0000 1.5
@@ -90,6 +90,12 @@
return Locale::Messages::dgettext($messages_textdomain, $msgid);
}
+sub __p($$) {
+ my $context = shift;
+ my $msgid = shift;
+ return Locale::Messages::dpgettext($messages_textdomain, $context, $msgid);
+}
+
#Â FIXME use something else than srcdir?
my $srcdir = defined $ENV{'srcdir'} ? $ENV{'srcdir'} : dirname $0;
#Â FIXME
@@ -149,6 +155,7 @@
push @program_config_dirs, "$sysconfdir/$program_name" if
(defined($sysconfdir));
push @program_config_dirs, "$datadir/$program_name" if (defined($datadir));
address@hidden = @program_config_dirs;
foreach my $texinfo_config_dir (@language_config_dirs) {
push @program_init_dirs, "${texinfo_config_dir}/init";
}
@@ -157,6 +164,24 @@
{
package Texinfo::Config;
+my @document_settable_at_commands =
+ ('everyheading', 'everyfooting', 'evenheading',
+ 'evenfooting', 'oddheading', 'oddfooting', 'headings',
+ 'allowcodebreaks', 'frenchspacing', 'exampleindent',
+ 'firstparagraphindent', 'paragraphindent', 'clickstyle',
+ 'documentlanguage');
+
+# those should be unique
+my @document_global_at_commands = ('contents', 'shortcontents',
+ 'setcontentsaftertitlepage', 'setshortcontentsaftertitlepage',
+ 'footnotestyle', 'novalidate', 'kbdinputstyle', 'documentencoding',
+ 'setfilename', 'today', 'documentdescription',
+ 'everyheadingmarks','everyfootingmarks',
+
'evenheadingmarks','oddheadingmarks','evenfootingmarks','oddfootingmarks',
+ 'fonttextsize', 'pagesizes', 'setchapternewpage'
+ );
+
+
my @command_line_settables = ('FILLCOLUMN', 'SPLIT', 'SPLIT_SIZE',
'HEADERS',
'MACRO_EXPAND', 'NUMBER_SECTIONS',
@@ -195,25 +220,26 @@
'TEXI2DVI');
my %valid_options;
-foreach my $var (address@hidden, @document_global_at_commands,
+foreach my $var (@document_settable_at_commands, @document_global_at_commands,
@command_line_settables, @variable_settables) {
$valid_options{$var} = 1;
}
-my ($cmdline_options, $options);
+my $cmdline_options;
+our $options;
sub _load_config ($) {
$cmdline_options = $_[0];
}
-sub load_init_file($$) {
- my $self = shift;
+sub _load_init_file($) {
my $file = shift;
eval { require($file) ;};
- if ($@ ne '') {
- $self->document_warn(sprintf(main::__("error loading %s: %s\n"),
- $file, $@));
+ my $e = $@;
+ if ($e ne '') {
+ main::document_warn(sprintf(main::__("error loading %s: %s\n"),
+ $file, $e));
}
}
@@ -234,7 +260,7 @@
my $value = shift;
delete $options->{$var};
if (!$valid_options{$var}) {
- warn (sprintf(__('Unknown variable %s'), $var));
+ warn (sprintf(main::__('Unknown variable %s'), $var));
return 0;
}
$cmdline_options->{$var} = $value;
@@ -255,6 +281,42 @@
}
+# file: file name to locate. It can be a file path.
+# directories: a reference on a array containing a list of directories to
+# search the file in.
+# all_files: if true collect all the files with that name, otherwise stop
+# at first match.
+sub locate_init_file($$$)
+{
+ my $file = shift;
+ my $directories = shift;
+ my $all_files = shift;
+
+ if ($file =~ /^\//) {
+ return $file if (-e $file and -r $file);
+ } else {
+ my @files;
+ foreach my $dir (@$directories) {
+ next unless (-d "$dir");
+ if ($all_files) {
+ push (@files, "$dir/$file") if (-e "$dir/$file" and -r "$dir/$file");
+ } else {
+ return "$dir/$file" if (-e "$dir/$file" and -r "$dir/$file");
+ }
+ }
+ return @files if ($all_files);
+ }
+ return undef;
+}
+
+
+# read initialization files
+foreach my $file (locate_init_file($conf_file_name,
+ [ reverse(@program_config_dirs) ], 1)) {
+ Texinfo::Config::_load_init_file($file);
+}
+
+
sub set_from_cmdline ($$) {
return &Texinfo::Config::set_from_cmdline(@_);
}
@@ -276,11 +338,13 @@
my @conf_dirs = ();
my @include_dirs = ();
my @prepend_dirs = ();
+my @css_files = ();
+my @css_refs = ();
my $converter_default_options = {};
-my $parser_default_options = {'expanded_formats' => []};
+my $parser_default_options = {'expanded_formats' => [], 'values' => {}};
-Texinfo::Config::_load_config($parser_default_options);
+Texinfo::Config::_load_config($converter_default_options);
sub set_expansion($$) {
my $region = shift;
@@ -296,11 +360,16 @@
}
}
+sub document_warn ($) {
+ return if (get_conf('NO_WARN'));
+ my $text = shift;
+ chomp ($text);
+ warn sprintf(__p("warning: warning_message", "warning: %s\n"), $text);
+}
my $result_options = Getopt::Long::GetOptions (
- 'macro-expand|E=s' => sub { push @texi2dvi_args, '-E'; $macro_expand = $_[1];
},
- 'error-limit|e=i' => sub { set_from_cmdline('ERROR_LIMIT', $_[1]); },
- 'no-warn' => sub { set_from_cmdline('NO_WARN', $_[1]); },
+ 'macro-expand|E=s' => sub { push @texi2dvi_args, '-E';
+ $macro_expand = $_[1]; },
'ifhtml' => sub { set_expansion('html', $_[1]); },
'ifinfo' => sub { set_expansion('info', $_[1]); },
'ifxml' => sub { set_expansion('xml', $_[1]); },
@@ -312,9 +381,115 @@
'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' => sub { set_from_cmdline('NUMBER_SECTIONS', $_[1]); },
- 'plaintext' => sub {$format = 'plaintext';},
+ 'number-footnotes' => sub { set_from_cmdline('NUMBER_FOOTNOTES', $_[1]); },
+ 'node-files' => sub { set_from_cmdline('NODE_FILES', $_[1]); },
+ 'footnote-style=s' => sub {
+ if ($_[1] eq 'end' or $_[1] eq 'separate') {
+ set_from_cmdline('footnotestyle', $_[1]);
+ } else {
+ die sprintf(__("%s: --footnote-style arg must be `separate' or `end',
not `%s'.\n"), $real_command_name, $_[1]);
+ }
+ },
+ 'split=s' => sub { set_from_cmdline('SPLIT', $_[1]); },
+ 'no-split' => sub { set_from_cmdline('SPLIT', '');
+ set_from_cmdline('SPLIT_SIZE', undef);},
+ 'headers' => sub { set_from_cmdline('HEADERS', $_[1]);
+ set_from_cmdline('SHOW_MENU', $_[1]);
+ $parser_default_options->{'menus'} = 0;
+ $format = 'plaintext' if (!$_[1] and $format eq 'info'); },
+ 'output|out|o=s' => sub {
+ my $var = 'OUTFILE';
+ if ($_[1] =~ m:/$: or -d $_[1]) {
+ $var = 'SUBDIR';
+ }
+ set_from_cmdline($var, $_[1]);
+ set_from_cmdline('OUT', $_[1]);
+ push @texi2dvi_args, '-o', $_[1];
+ },
+ 'no-validate|no-pointer-validate' => sub {
+ set_from_cmdline('novalidate',$_[1]);
+ $parser_default_options->{'novalidate'} = $_[1];
+ },
+ 'no-warn' => sub { set_from_cmdline('NO_WARN', $_[1]); },
+ #Â FIXME pass to parser? What could it mean in parser?
+ 'verbose|v' => sub {set_from_cmdline('VERBOSE', $_[1]);
+ push @texi2dvi_args, '--verbose'; },
+ 'document-language=s' => sub {
+ set_from_cmdline('documentlanguage', $_[1]);
+ $parser_default_options->{'documentlanguage'} = $_[1];
+ my @messages
+ = Texinfo::Common::warn_unknown_language($_[1], \&__);
+ foreach my $message (@messages) {
+ document_warn($message);
+ }
+ },
+ 'D=s' => sub {$parser_default_options->{'values'}->{$_[1]} = 1;},
+ 'U=s' => sub {delete $parser_default_options->{'values'}->{$_[1]};},
+ 'init-file=s' => sub {
+ my $file = locate_init_file($_[1], [ @conf_dirs, @program_init_dirs ], 0);
+ if (defined($file)) {
+ Texinfo::Config::_load_init_file($file);
+ } else {
+ document_warn (sprintf(__("Can't read init file %s"), $_[1]));
+ }
+ },
+ 'set-init-variable=s' => sub {
+ my $var_val = $_[1];
+ if ($var_val =~ s/^(\w+)\s*=?\s*//) {
+ my $var = $1;
+ my $value = $var_val;
+ if ($value =~ /^undef$/i) {
+ $value = undef;
+ }
+ set_from_cmdline ($var, $value);
+ }
+ },
+ 'css-include=s' => address@hidden,
+ 'css-ref=s' => address@hidden,
+ 'transliterate-file-names' =>
+ sub {set_from_cmdline ('TRANSLITERATE_FILE_NAMES', $_[1]);},
+ 'error-limit|e=i' => sub { set_from_cmdline('ERROR_LIMIT', $_[1]); },
+ 'split-size=s' => sub {set_from_cmdline('SPLIT_SIZE', $_[1])},
+ 'paragraph-indent|p=s' => sub {
+ my $value = $_[1];
+ if ($value =~ /^([0-9]+)$/ or $value eq 'none' or $value eq 'asis') {
+ set_from_cmdline('paragraphindent', $_[1]);
+ } else {
+ die sprintf(__("%s: --paragraph-indent arg must be
numeric/`none'/`asis', not `%s'.\n"),
+ $real_command_name, $value);
+ }
+ },
+ 'fill-column|f=i' => sub {set_from_cmdline('FILLCOLUMN',$_[1]);},
+ 'enable-encoding' => sub {set_from_cmdline('ENABLE_ENCODING',$_[1]);
+ $parser_default_options->{'ENABLE_ENCODING'} = $_[1];},
+ 'disable-encoding' => sub {set_from_cmdline('ENABLE_ENCODING', 0);
+ $parser_default_options->{'ENABLE_ENCODING'} = 0;},
+ 'internal-links=s' => sub {set_from_cmdline('INTERNAL_LINKS', $_[1]);},
+ 'force|F' => sub {set_from_cmdline('FORCE', $_[1]);},
+ 'commands-in-node-names' => sub { ;},
+ 'output-indent=i' => sub { ;},
+ 'reference-limit=i' => sub { ;},
+ 'Xopt' => address@hidden,
+ 'batch' => sub {set_from_cmdline('BATCH', $_[1]);
+ push @texi2dvi_args, '--'.$_[0];},
+ 'silent|quiet' => sub {set_from_cmdline('SILENT', $_[1]);
+ push @texi2dvi_args, '--'.$_[0];},
+
+ 'plaintext' => sub {$format = $_[0];},
+ 'html' => sub {$format = $_[0];},
+ 'info' => sub {$format = $_[0];},
+ 'docbook' => sub {$format = $_[0];},
+ 'xml' => sub {$format = $_[0];},
+ 'dvi' => sub {$format = $_[0]; push @texi2dvi_args, '--'.$_[0];},
+ 'ps' => sub {$format = $_[0]; push @texi2dvi_args, '--'.$_[0];},
+ 'pdf' => sub {$format = $_[0]; push @texi2dvi_args, '--'.$_[0];},
+ 'debug=i' => sub {set_from_cmdline('DEBUG', $_[1]);
+ $parser_default_options->{'DEBUG'} = $_[1];
+ push @texi2dvi_args, '--'.$_[0]; },
);
+exit 1 if (!$result_options);
+
my %formats_table = (
'info' => {
'nodes_tree' => 1,
@@ -425,8 +600,9 @@
}
$error_count = handle_errors($parser, $error_count);
- my $converter_options = { %$converter_default_options };
- if (get_conf('OUTFILE') and $file_number == 0) {
+ my $converter_options = { %$converter_default_options,
+ %$Texinfo::Config::options };
+ if (defined(get_conf('OUTFILE')) and $file_number == 0) {
$converter_options->{'outfile'} = get_conf('OUTFILE');
}
$converter_options->{'parser'} = $parser;
Index: Texinfo/Common.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Common.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- Texinfo/Common.pm 30 Dec 2010 17:36:51 -0000 1.8
+++ Texinfo/Common.pm 16 Jan 2011 01:24:20 -0000 1.9
@@ -22,6 +22,8 @@
use strict;
+use Texinfo::Documentlanguages;
+
require Exporter;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
@ISA = qw(Exporter);
@@ -501,4 +503,29 @@
return $filehandle;
}
+sub warn_unknown_language($$) {
+ my $lang = shift;
+ my $gettext = shift;
+
+ my @messages = ();
+ my $lang_code = $lang;
+ my $region_code;
+
+ if ($lang =~ /^([a-z]+)_([A-Z]+)/) {
+ $lang_code = $1;
+ $region_code = $2;
+ }
+
+ if (! $Texinfo::Documentlanguages::language_codes{$lang_code}) {
+ push @messages, sprintf(&$gettext("%s is not a valid language code"),
+ $lang_code);
+ }
+ if (defined($region_code)
+ and ! $Texinfo::Documentlanguages::region_codes{$region_code}) {
+ push @messages, sprintf(&$gettext("%s is not a valid region code"),
+ $region_code);
+ }
+ return @messages;
+}
+
1;
Index: Texinfo/Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.177
retrieving revision 1.178
diff -u -b -r1.177 -r1.178
--- Texinfo/Parser.pm 15 Jan 2011 11:57:01 -0000 1.177
+++ Texinfo/Parser.pm 16 Jan 2011 01:24:20 -0000 1.178
@@ -83,6 +83,8 @@
# i18n
+my $DEFAULT_LANGUAGE = 'en';
+
# we want a reliable way to switch locale, so we don't use the system
# gettext.
Locale::Messages->select_package ('gettext_pp');
@@ -124,6 +126,7 @@
# FIXME do that in the converters when @documentlanguage is found.
my $lang = $self->{'documentlanguage'};
+ $lang = $DEFAULT_LANGUAGE if (!defined($lang));
my @langs = ($lang);
if ($lang =~ /^([a-z]+)_([A-Z]+)/) {
my $main_lang = $1;
@@ -179,8 +182,8 @@
}
}
# FIXME reuse a parser?
- if ($self->{'debug'}) {
- $parser_conf->{'debug'} = 1;
+ if ($self->{'DEBUG'}) {
+ $parser_conf->{'DEBUG'} = 1;
print STDERR "GDT $result\n";
}
my $parser = parser($parser_conf);
@@ -209,7 +212,7 @@
# initialized to values given by the user.
my %default_configuration = (
'test' => 0,
- 'debug' => 0,
+ 'DEBUG' => 0,
'menus' => 1, # if false no menu error related.
'gettext' => sub {return $_[0];},
'expanded_formats' => [],
@@ -236,9 +239,10 @@
'novalidate' => 0, # same as setting @novalidate.
'encoding' => undef, # Current encoding set by @documentencoding
# and normalized
- 'documentlanguage' => 'en', # Current documentlanguage set by
- # @documentlanguage or at initialization
- 'enable_encoding' => 1 # corresponds to --enable-encoding.
+ 'documentlanguage' => undef,
+ # Current documentlanguage set by
+ # @documentlanguage
+ 'ENABLE_ENCODING' => 1 # corresponds to --enable-encoding.
);
# The commands in initialization_overrides are not set in the document if
@@ -904,7 +908,7 @@
$self->line_error(sprintf($self->__("Bad syntax for address@hidden"),
$command),
$line_nr);
}
- print STDERR "MACRO address@hidden $macro_name\n" if ($self->{'debug'});
+ print STDERR "MACRO address@hidden $macro_name\n" if ($self->{'DEBUG'});
$macro->{'args'} = [
{ 'type' => 'macro_name', 'text' => $macro_name,
@@ -961,7 +965,7 @@
{ 'type' => 'paragraph', 'parent' => $current, 'contents' => [] };
$current->{'contents'}->[-1]->{'extra'}->{$indent} = 1 if ($indent);
$current = $current->{'contents'}->[-1];
- print STDERR "PARAGRAPH\n" if ($self->{'debug'});
+ print STDERR "PARAGRAPH\n" if ($self->{'DEBUG'});
return $current;
}
return 0;
@@ -1004,7 +1008,7 @@
$current = _close_brace_command($self, $current->{'parent'}, $line_nr);
}
if ($current->{'type'} and $current->{'type'} eq 'paragraph') {
- print STDERR "CLOSE PARA\n" if ($self->{'debug'});
+ print STDERR "CLOSE PARA\n" if ($self->{'DEBUG'});
$current = $current->{'parent'};
}
return $current;
@@ -1167,10 +1171,10 @@
and $current->{'contents'}->[-1]->{'text'} !~ /\n/
and !$no_merge_with_following_text) {
$current->{'contents'}->[-1]->{'text'} .= $text;
- print STDERR "MERGED TEXT: $text|||\n" if ($self->{'debug'});
+ print STDERR "MERGED TEXT: $text|||\n" if ($self->{'DEBUG'});
} else {
push @{$current->{'contents'}}, { 'text' => $text, 'parent' => $current };
- print STDERR "NEW TEXT: $text|||\n" if ($self->{'debug'});
+ print STDERR "NEW TEXT: $text|||\n" if ($self->{'DEBUG'});
}
return $current;
}
@@ -1299,17 +1303,17 @@
}
$arguments->[-1] .= $protected_char;
- print STDERR "MACRO ARG: $separator: $protected_char\n" if
($self->{'debug'});
+ print STDERR "MACRO ARG: $separator: $protected_char\n" if
($self->{'DEBUG'});
} else {
$arguments->[-1] .= '\\';
- print STDERR "MACRO ARG: $separator\n" if ($self->{'debug'});
+ print STDERR "MACRO ARG: $separator\n" if ($self->{'DEBUG'});
}
} elsif ($separator eq ',') {
if ($braces_level == 1) {
if (scalar(@$arguments) < $args_total) {
push @$arguments, '';
$line =~ s/^\s*//;
- print STDERR "MACRO NEW ARG\n" if ($self->{'debug'});
+ print STDERR "MACRO NEW ARG\n" if ($self->{'DEBUG'});
} else {
# implicit quoting when there is one argument.
if ($args_total != 1) {
@@ -1330,7 +1334,7 @@
$arguments->[-1] .= $separator;
}
} else {
- print STDERR "MACRO ARG end of line\n" if ($self->{'debug'});
+ print STDERR "MACRO ARG end of line\n" if ($self->{'DEBUG'});
$arguments->[-1] .= $line;
($line, $line_nr) = _new_line($self, $line_nr);
@@ -1346,7 +1350,7 @@
$name), $line_nr);
}
print STDERR "END MACRO ARGS EXPANSION(".scalar(@$arguments)."): ".
- join("|\n", @$arguments) ."|\n" if ($self->{'debug'});
+ join("|\n", @$arguments) ."|\n" if ($self->{'DEBUG'});
return ($arguments, $line, $line_nr);
}
@@ -1402,7 +1406,7 @@
and ($current->{'contents'}->[-1]->{'type'} eq 'empty_line'
or $current->{'contents'}->[-1]->{'type'} eq
'empty_spaces_before_argument'
or $current->{'contents'}->[-1]->{'type'} eq
'empty_line_after_command')) {
- print STDERR "ABORT EMPTY additional text $additional_text, current
$current->{'contents'}->[-1]->{'text'}|)\n" if ($self->{'debug'});
+ print STDERR "ABORT EMPTY additional text $additional_text, current
$current->{'contents'}->[-1]->{'text'}|)\n" if ($self->{'DEBUG'});
$current->{'contents'}->[-1]->{'text'} .= $additional_text;
if ($current->{'contents'}->[-1]->{'text'} eq '') {
pop @{$current->{'contents'}}
@@ -1735,7 +1739,7 @@
if ($current->{'contents'} and @{$current->{'contents'}}
and $current->{'contents'}->[-1]->{'type'}
and $current->{'contents'}->[-1]->{'type'} eq 'empty_line') {
- print STDERR "END EMPTY LINE\n" if ($self->{'debug'});
+ print STDERR "END EMPTY LINE\n" if ($self->{'DEBUG'});
if ($current->{'type'} and $current->{'type'} eq 'paragraph') {
my $empty_line = pop @{$current->{'contents'}};
$current = _end_paragraph($self, $current, $line_nr);
@@ -1754,7 +1758,7 @@
'parent' => $current,
'contents' => [] };
$current = $current->{'contents'}->[-1];
- print STDERR "MENU: END DESCRIPTION, OPEN COMMENT\n" if
($self->{'debug'});
+ print STDERR "MENU: END DESCRIPTION, OPEN COMMENT\n" if
($self->{'DEBUG'});
} elsif (!$no_paragraph_contexts{$self->{'context_stack'}->[-1]}) {
# FIXME remove this if an empty line in a brace command
# is acceptable
@@ -1786,7 +1790,7 @@
# we abort the menu entry if there is no node name
if ($empty_menu_entry_node
or $current->{'type'} eq 'menu_entry_name') {
- print STDERR "FINALLY NOT MENU ENTRY\n" if ($self->{'debug'});
+ print STDERR "FINALLY NOT MENU ENTRY\n" if ($self->{'DEBUG'});
my $menu = $current->{'parent'}->{'parent'};
my $menu_entry = pop @{$menu->{'contents'}};
if (@{$menu->{'contents'}} and $menu->{'contents'}->[-1]->{'type'}
@@ -1797,7 +1801,7 @@
'parent' => $menu,
'contents' => [] };
$current = $menu->{'contents'}->[-1];
- print STDERR "THEN MENU_COMMENT OPEN\n" if ($self->{'debug'});
+ print STDERR "THEN MENU_COMMENT OPEN\n" if ($self->{'DEBUG'});
}
while (@{$menu_entry->{'args'}}) {
my $arg = shift @{$menu_entry->{'args'}};
@@ -1820,7 +1824,7 @@
}
$menu_entry = undef;
} else {
- print STDERR "MENU ENTRY END LINE\n" if ($self->{'debug'});
+ print STDERR "MENU ENTRY END LINE\n" if ($self->{'DEBUG'});
$current = $current->{'parent'};
push @{$current->{'args'}}, { 'type' => 'menu_entry_description',
'contents' => [], 'parent' => $current };
@@ -2029,7 +2033,7 @@
$current = $current->{'parent'};
my $misc_cmd = $current;
my $command = $current->{'cmdname'};
- print STDERR "MISC END address@hidden" if ($self->{'debug'});
+ print STDERR "MISC END address@hidden" if ($self->{'DEBUG'});
if ($self->{'misc_commands'}->{$command} =~ /^\d$/) {
my $args = _parse_line_command_args ($self, $current, $line_nr);
$current->{'extra'}->{'misc_args'} = $args if (defined($args));
@@ -2048,7 +2052,7 @@
$included_file = 1;
binmode($filehandle, ":encoding($self->{'encoding'})")
if (defined($self->{'encoding'}));
- print STDERR "Included $file($filehandle)\n" if
($self->{'debug'});
+ print STDERR "Included $file($filehandle)\n" if
($self->{'DEBUG'});
$included_file = 1;
unshift @{$self->{'input'}}, {
'name' => $file,
@@ -2078,16 +2082,23 @@
if (!$self->{'set'}->{'encoding'}) {
$self->{'encoding'} = $encoding;
- print STDERR "Using encoding $encoding\n" if ($self->{'debug'});
+ print STDERR "Using encoding $encoding\n" if ($self->{'DEBUG'});
foreach my $input (@{$self->{'input'}}) {
binmode($input->{'fh'}, ":encoding($encoding)") if
($input->{'fh'});
}
}
}
- } elsif ($command eq 'documentlanguage' and
!$self->{'set'}->{'documentlanguage'}) {
+ } elsif ($command eq 'documentlanguage') {
+ my @messages = Texinfo::Common::warn_unknown_language($text,
+ $self->{'gettext'});
+ foreach my $message(@messages) {
+ $self->line_warn ($message, $line_nr);
+ }
+ if (!$self->{'set'}->{'documentlanguage'}) {
$self->{'documentlanguage'} = $text;
}
}
+ }
} elsif ($command eq 'node') {
foreach my $arg (@{$current->{'args'}}) {
my $node = _parse_node_manual($arg);
@@ -2180,7 +2191,7 @@
# empty line after a @menu. Reparent to the menu
if ($current->{'type'}
and $current->{'type'} eq 'menu_comment') {
- print STDERR "EMPTY LINE AFTER MENU\n" if ($self->{'debug'});
+ print STDERR "EMPTY LINE AFTER MENU\n" if ($self->{'DEBUG'});
my $empty_line = pop @{$current->{'contents'}};
$empty_line->{'parent'} = $current->{'parent'};
unshift @{$current->{'parent'}->{'contents'}}, $empty_line;
@@ -2192,7 +2203,7 @@
if ($self->{'context_stack'}->[-1] eq 'line'
or $self->{'context_stack'}->[-1] eq 'def') {
print STDERR "Still opened line command
$self->{'context_stack'}->[-1]:"._print_current($current)
- if ($self->{'debug'});
+ if ($self->{'DEBUG'});
if ($self->{'context_stack'}->[-1] eq 'def') {
while ($current->{'parent'} and !($current->{'parent'}->{'type'}
and $current->{'parent'}->{'type'} eq 'def_line')) {
@@ -2360,7 +2371,7 @@
($line, $line_nr) = _next_text($self, $line_nr);
last if (!defined($line));
- if ($self->{'debug'}) {
+ if ($self->{'DEBUG'}) {
$current->{'HERE !!!!'} = 1; # marks where we are in the tree
local $Data::Dumper::Indent = 1;
local $Data::Dumper::Purity = 1;
@@ -2383,7 +2394,7 @@
)
# not def line
and $self->{'context_stack'}->[-1] ne 'def') {
- print STDERR "BEGIN LINE\n" if ($self->{'debug'});
+ print STDERR "BEGIN LINE\n" if ($self->{'DEBUG'});
$line =~ s/^([^\S\n]*)//;
push @{$current->{'contents'}}, { 'type' => 'empty_line',
'text' => $1,
@@ -2455,12 +2466,12 @@
# Ignore until end of line
if ($line !~ /\n/) {
($line, $line_nr) = _new_line($self, $line_nr);
- print STDERR "IGNORE CLOSE line: $line" if ($self->{'debug'});
+ print STDERR "IGNORE CLOSE line: $line" if ($self->{'DEBUG'});
}
- print STDERR "CLOSED conditional $end_command\n" if
($self->{'debug'});
+ print STDERR "CLOSED conditional $end_command\n" if
($self->{'DEBUG'});
last;
} else {
- print STDERR "CLOSED raw $end_command\n" if ($self->{'debug'});
+ print STDERR "CLOSED raw $end_command\n" if ($self->{'DEBUG'});
$line = _start_empty_line_after_command($line, $current);
}
} else {
@@ -2495,11 +2506,11 @@
push @{$current->{'contents'}},
{ 'text' => $1, 'type' => 'raw', 'parent' => $current }
if ($1 ne '');
- print STDERR "END VERB\n" if ($self->{'debug'});
+ print STDERR "END VERB\n" if ($self->{'DEBUG'});
} else {
push @{$current->{'contents'}},
{ 'text' => $line, 'type' => 'raw', 'parent' => $current };
- print STDERR "LINE VERB: $line" if ($self->{'debug'});
+ print STDERR "LINE VERB: $line" if ($self->{'DEBUG'});
last;
}
}
@@ -2510,7 +2521,7 @@
while ($line eq '')
{
print STDERR "END OF TEXT not at end of line\n"
- if ($self->{'debug'});
+ if ($self->{'DEBUG'});
($line, $line_nr) = _next_text($self, $line_nr);
if (!defined($line)) {
# end of the file
@@ -2560,14 +2571,14 @@
my $expanded = _expand_macro_body ($self, $expanded_macro,
$arguments, $line_nr);
print STDERR "MACROBODY: $expanded".'||||||'."\n"
- if ($self->{'debug'});
+ if ($self->{'DEBUG'});
# empty result. It is ignored here.
next if ($expanded eq '');
my $expanded_lines = _text_to_lines($expanded);
chomp ($expanded_lines->[-1]);
pop @$expanded_lines if ($expanded_lines->[-1] eq '');
print STDERR "MACRO EXPANSION LINES: ".join('|', @$expanded_lines)
- ."|\nEND LINES\n" if ($self->{'debug'});
+ ."|\nEND LINES\n" if ($self->{'DEBUG'});
next if (address@hidden);
my $new_lines = _complete_line_nr($expanded_lines,
$line_nr->{'line_nr'}, $line_nr->{'file_name'},
@@ -2607,7 +2618,7 @@
$current->{'cmdname'},
$current->{'parent'}->{'parent'}->{'cmdname'}),
$line_nr);
} else {
- print STDERR "FOR PARENT
address@hidden>{'parent'}->{'parent'}->{'cmdname'} command_as_argument
$current->{'cmdname'}\n" if ($self->{'debug'});
+ print STDERR "FOR PARENT
address@hidden>{'parent'}->{'parent'}->{'cmdname'} command_as_argument
$current->{'cmdname'}\n" if ($self->{'DEBUG'});
$current->{'type'} = 'command_as_argument';
$current->{'parent'}->{'parent'}->{'extra'}->{'command_as_argument'}
= $current->{'cmdname'};
@@ -2634,7 +2645,7 @@
$current = $current->{'parent'};
} elsif ($line =~ s/^(.)//o) {
print STDERR "ACCENT address@hidden>{'cmdname'}\n"
- if ($self->{'debug'});
+ if ($self->{'DEBUG'});
# FIXME this is different than usual tree, no content here
$current->{'args'} = [ { 'text' => $1, 'parent' => $current } ];
if ($current->{'cmdname'} =~ /^[a-zA-Z]/) {
@@ -2644,7 +2655,7 @@
$current = $current->{'parent'};
} else { # The accent is at end of line
# whitespace for commands with letter.
- print STDERR "STRANGE ACC address@hidden>{'cmdname'}\n" if
($self->{'debug'});
+ print STDERR "STRANGE ACC address@hidden>{'cmdname'}\n" if
($self->{'DEBUG'});
$self->line_warn (sprintf($self->
__("Accent command address@hidden' must not be followed by new
line"),
$current->{'cmdname'}), $line_nr);
@@ -2664,7 +2675,7 @@
and $current->{'contents'}->[-1]->{'type'}
and $current->{'contents'}->[-1]->{'type'} eq 'empty_line'
and $current->{'contents'}->[-1]->{'text'} eq '') {
- print STDERR "MENU STAR\n" if ($self->{'debug'});
+ print STDERR "MENU STAR\n" if ($self->{'DEBUG'});
_abort_empty_line ($self, $current);
$line =~ s/^\*//;
push @{$current->{'contents'}}, { 'type' => 'menu_star',
@@ -2674,7 +2685,7 @@
and @{$current->{'contents'}}
and $current->{'contents'}->[-1]->{'type'}
and $current->{'contents'}->[-1]->{'type'} eq 'menu_star') {
- print STDERR "MENU ENTRY (certainly)\n" if ($self->{'debug'});
+ print STDERR "MENU ENTRY (certainly)\n" if ($self->{'DEBUG'});
# this is the menu star collected previously
pop @{$current->{'contents'}};
$line =~ s/^(\s+)//;
@@ -2702,7 +2713,7 @@
} elsif ($current->{'contents'} and @{$current->{'contents'}}
and $current->{'contents'}->[-1]->{'type'}
and $current->{'contents'}->[-1]->{'type'} eq 'menu_star') {
- print STDERR "ABORT MENU STAR ($line)\n" if ($self->{'debug'});
+ print STDERR "ABORT MENU STAR ($line)\n" if ($self->{'DEBUG'});
delete $current->{'contents'}->[-1]->{'type'};
# after a separator in menu
} elsif ($current->{'args'} and @{$current->{'args'}}
@@ -2725,7 +2736,7 @@
$current->{'args'}->[-1]->{'text'} .= $1;
# now handle the menu part that was closed
} elsif ($separator =~ /^::/) {
- print STDERR "MENU NODE no entry $separator\n" if ($self->{'debug'});
+ print STDERR "MENU NODE no entry $separator\n" if ($self->{'DEBUG'});
# it was previously registered as menu_entry_name, it is
# changed to node
$current->{'args'}->[-2]->{'type'} = 'menu_entry_node';
@@ -2736,14 +2747,14 @@
$current = $current->{'args'}->[-1];
# end of the menu entry name
} elsif ($separator =~ /^:/) {
- print STDERR "MENU ENTRY $separator\n" if ($self->{'debug'});
+ print STDERR "MENU ENTRY $separator\n" if ($self->{'DEBUG'});
push @{$current->{'args'}}, { 'type' => 'menu_entry_node',
'contents' => [],
'parent' => $current };
$current = $current->{'args'}->[-1];
# anything else is the end of the menu node following a menu_entry_name
} else {
- print STDERR "MENU NODE $separator\n" if ($self->{'debug'});
+ print STDERR "MENU NODE $separator\n" if ($self->{'DEBUG'});
push @{$current->{'args'}}, { 'type' => 'menu_entry_description',
'contents' => [],
'parent' => $current };
@@ -2756,7 +2767,7 @@
my $command = $1;
$command = $self->{'aliases'}->{$command}
if (exists($self->{'aliases'}->{$command}));
- print STDERR "COMMAND $command\n" if ($self->{'debug'});
+ print STDERR "COMMAND $command\n" if ($self->{'DEBUG'});
if ($command eq 'value') {
if ($line =~ s/^{([\w\-]+)}//) {
@@ -2868,7 +2879,7 @@
$current = _merge_text ($self, $current, "address@hidden
$end_command");
last;
}
- print STDERR "END BLOCK $end_command\n" if ($self->{'debug'});
+ print STDERR "END BLOCK $end_command\n" if ($self->{'DEBUG'});
if ($block_commands{$end_command} eq 'conditional') {
if (@{$self->{'conditionals_stack'}}
and $self->{'conditionals_stack'}->[-1] eq $end_command) {
@@ -2994,7 +3005,7 @@
# itemize or enumerate
if ($parent = _item_container_parent($current)) {
if ($command eq 'item') {
- print STDERR "ITEM_CONTAINER\n" if ($self->{'debug'});
+ print STDERR "ITEM_CONTAINER\n" if ($self->{'DEBUG'});
$parent->{'items_count'}++;
$misc = { 'cmdname' => $command, 'parent' => $parent,
'contents' => [],
@@ -3008,7 +3019,7 @@
# *table
} elsif ($parent = _item_line_parent($current)) {
if ($command eq 'item' or $command eq 'itemx') {
- print STDERR "ITEM_LINE\n" if ($self->{'debug'});
+ print STDERR "ITEM_LINE\n" if ($self->{'DEBUG'});
$current = $parent;
$misc = { 'cmdname' => $command, 'parent' => $current };
push @{$current->{'contents'}}, $misc;
@@ -3038,10 +3049,10 @@
{'cell_number' => $row->{'cells_count'}} };
push @{$row->{'contents'}}, $misc;
$current = $row->{'contents'}->[-1];
- print STDERR "TAB\n" if ($self->{'debug'});
+ print STDERR "TAB\n" if ($self->{'DEBUG'});
}
} else {
- print STDERR "ROW\n" if ($self->{'debug'});
+ print STDERR "ROW\n" if ($self->{'DEBUG'});
$parent->{'rows_count'}++;
my $row = { 'type' => 'row', 'contents' => [],
'cells_count' => 1,
@@ -3175,7 +3186,7 @@
and $command eq 'ifclear')) {
$ifvalue_true = 1;
}
- print STDERR "CONDITIONAL address@hidden $name:
$ifvalue_true\n" if ($self->{'debug'});
+ print STDERR "CONDITIONAL address@hidden $name:
$ifvalue_true\n" if ($self->{'DEBUG'});
} else {
$self->line_error (sprintf($self->__("%c%s requires a name"),
ord('@'), $command), $line_nr);
@@ -3185,13 +3196,13 @@
#Â exception as explained in the texinfo manual
or ($1 eq 'info'
and $self->{'expanded_formats_hash'}->{'plaintext'}));
- print STDERR "CONDITIONAL address@hidden format $1:
$ifvalue_true\n" if ($self->{'debug'});
+ print STDERR "CONDITIONAL address@hidden format $1:
$ifvalue_true\n" if ($self->{'DEBUG'});
} else {
die unless ($command =~ /^if(.*)/);
$ifvalue_true = 1 if ($self->{'expanded_formats_hash'}->{$1}
or ($1 eq 'info'
and
$self->{'expanded_formats_hash'}->{'plaintext'}));
- print STDERR "CONDITIONAL address@hidden format $1:
$ifvalue_true\n" if ($self->{'debug'});
+ print STDERR "CONDITIONAL address@hidden format $1:
$ifvalue_true\n" if ($self->{'DEBUG'});
}
if ($ifvalue_true) {
push @{$self->{'conditionals_stack'}}, $command;
@@ -3279,7 +3290,7 @@
'parent' => $current,
'contents' => [] };
$current = $current->{'contents'}->[-1];
- print STDERR "MENU_COMMENT OPEN\n" if ($self->{'debug'});
+ print STDERR "MENU_COMMENT OPEN\n" if ($self->{'DEBUG'});
}
}
@@ -3329,7 +3340,7 @@
} elsif ($line =~ s/^([{}@,:\t.])//) {
my $separator = $1;
- print STDERR "SEPARATOR: $separator\n" if ($self->{'debug'});
+ print STDERR "SEPARATOR: $separator\n" if ($self->{'DEBUG'});
if ($separator eq '@') {
# this may happen with a @ at the very end of a file, therefore
# not followed by anything.
@@ -3398,7 +3409,7 @@
print STDERR "OPENED address@hidden>{'parent'}->{'cmdname'},
remaining: "
.(defined($current->{'parent'}->{'remaining_args'}) ?
"remaining: $current->{'parent'}->{'remaining_args'}, " : '')
.($current->{'type'} ? "type: $current->{'type'}" : '')."\n"
- if ($self->{'debug'});
+ if ($self->{'DEBUG'});
} elsif (($current->{'parent'}
and (($current->{'parent'}->{'cmdname'}
and $current->{'parent'}->{'cmdname'} eq
'multitable')
@@ -3409,7 +3420,7 @@
{ 'type' => 'bracketed', 'contents' => [],
'parent' => $current };
$current = $current->{'contents'}->[-1];
- print STDERR "BRACKETED\n" if ($self->{'debug'});
+ print STDERR "BRACKETED\n" if ($self->{'DEBUG'});
} else {
$self->line_error (sprintf($self->__("Misplaced %c"),
ord('{')), $line_nr);
@@ -3443,7 +3454,7 @@
# Remove empty arguments, as far as possible
_remove_empty_content_arguments($current);
}
- print STDERR "CLOSING address@hidden>{'parent'}->{'cmdname'}\n" if
($self->{'debug'});
+ print STDERR "CLOSING address@hidden>{'parent'}->{'cmdname'}\n" if
($self->{'DEBUG'});
delete $current->{'parent'}->{'remaining_args'};
if ($current->{'parent'}->{'cmdname'} eq 'anchor') {
$current->{'parent'}->{'line_nr'} = $line_nr;
@@ -3467,7 +3478,7 @@
my $context_command = pop @{$self->{'context_stack'}};
die "BUG: def_context $context_command
"._print_current($current)
if ($context_command ne $current->{'parent'}->{'cmdname'});
- print STDERR "CLOSING address@hidden>{'parent'}->{'cmdname'}\n"
if ($self->{'debug'});
+ print STDERR "CLOSING address@hidden>{'parent'}->{'cmdname'}\n"
if ($self->{'DEBUG'});
$current = $current->{'parent'}->{'parent'};
}
} else {
@@ -3520,7 +3531,7 @@
$current = _merge_text ($self, $current, $new_text);
# end of line
} else {
- if ($self->{'debug'}) {
+ if ($self->{'DEBUG'}) {
print STDERR "END LINE: ". _print_current($current)."\n";
}
if ($line =~ s/^(\n)//) {
@@ -3580,7 +3591,7 @@
if ($line =~ /^\s+([[:alnum:]][[:alnum:]\-]*)/) {
$args = [$1];
delete $self->{'macros'}->{$1};
- print STDERR "UNMACRO $1\n" if ($self->{'debug'});
+ print STDERR "UNMACRO $1\n" if ($self->{'DEBUG'});
} else {
$self->line_error (sprintf($self->
__("%c%s requires a name"), ord('@'), $command), $line_nr);
@@ -3635,7 +3646,7 @@
my $command = $line_command->{'cmdname'};
my $arg = $line_command->{'args'}->[0];
- if ($self->{'debug'}) {
+ if ($self->{'DEBUG'}) {
print STDERR "MISC ARGS address@hidden";
if (@{$arg->{'contents'}}) {
my $idx = 0;
@@ -3686,7 +3697,7 @@
if ($line =~
s/^([[:alnum:]][[:alnum:]\-]*)\s*,\s*([^\s,]+)\s*,\s*([^\s,]+)$//) {
$args = [$1, $2, $3 ];
$self->{'definfoenclose'}->{$1} = [ $2, $3 ];
- print STDERR "DEFINFOENCLOSE address@hidden: $2, $3\n" if
($self->{'debug'});
+ print STDERR "DEFINFOENCLOSE address@hidden: $2, $3\n" if
($self->{'DEBUG'});
} else {
$self->line_error (sprintf($self->
__("Bad argument to address@hidden"), $command),
$line_nr);
Index: Texinfo/Report.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Report.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- Texinfo/Report.pm 30 Dec 2010 17:36:51 -0000 1.3
+++ Texinfo/Report.pm 16 Jan 2011 01:24:20 -0000 1.4
@@ -87,7 +87,7 @@
$warn_line = sprintf($self->__("%s:%d: warning: %s\n"),
$file, $line_number->{'line_nr'}, $text);
}
- warn $warn_line if ($self->{'debug'});
+ warn $warn_line if ($self->{'DEBUG'});
push @{$self->{'errors_warnings'}},
{ 'type' => 'warning', 'text' => $text, 'error_line' => $warn_line,
%{$line_number} };
@@ -108,7 +108,7 @@
$macro_text = " (possibly involving address@hidden>{'macro'})"
if ($line_number->{'macro'} ne '');
my $error_text = "$file:$line_number->{'line_nr'}: $text$macro_text\n";
- warn "$error_text" if ($self->{'debug'});
+ warn "$error_text" if ($self->{'DEBUG'});
my $type = 'error';
$type = 'error continuation' if ($continuation);
push @{$self->{'errors_warnings'}},
Index: Texinfo/Structuring.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Structuring.pm,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- Texinfo/Structuring.pm 15 Jan 2011 11:57:02 -0000 1.28
+++ Texinfo/Structuring.pm 16 Jan 2011 01:24:20 -0000 1.29
@@ -288,7 +288,7 @@
}
$previous_section = $content;
- if ($self->{'debug'}) {
+ if ($self->{'DEBUG'}) {
my $number = '';
$number = $content->{'number'} if defined($content->{'number'});
print STDERR
"($content->{'level'}|$level|$command_structuring_level{$content->{'cmdname'}})[$command_numbers[$content->{'level'}]]($in_appendix)
$number address@hidden>{'cmdname'}
".Texinfo::Convert::Text::convert($content->{'args'}->[0])."\n";
@@ -587,7 +587,7 @@
my $self = shift;
my $index_entries = shift;
my $options = {'sort_string' => 1};
- if ($self->{'enable_encoding'} and $self->{'encoding'}) {
+ if ($self->{'ENABLE_ENCODING'} and $self->{'encoding'}) {
$options->{'enabled_encoding'} = $self->{'encoding'};
}
foreach my $index_name (keys(%$index_entries)) {
Index: Texinfo/Convert/Info.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Info.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- Texinfo/Convert/Info.pm 15 Jan 2011 11:57:02 -0000 1.10
+++ Texinfo/Convert/Info.pm 16 Jan 2011 01:24:20 -0000 1.11
@@ -85,9 +85,9 @@
my $node = shift @nodes;
my ($node_text) = $self->_convert_node($node);
print $fh $node_text;
- if (defined($self->{'split_size'})
+ if (defined($self->{'SPLIT_SIZE'})
and $self->{'file_bytes_count'} >
- $out_file_nr * $self->{'split_size'} and @nodes) {
+ $out_file_nr * $self->{'SPLIT_SIZE'} and @nodes) {
close ($fh);
if ($out_file_nr == 1) {
unless (rename ($self->{'output_file'},
Index: Texinfo/Convert/Line.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Line.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- Texinfo/Convert/Line.pm 4 Dec 2010 12:11:11 -0000 1.10
+++ Texinfo/Convert/Line.pm 16 Jan 2011 01:24:20 -0000 1.11
@@ -69,7 +69,7 @@
$line->{'line_beginning'} = 1;
$line->{'space'} = '';
$line->{'lines_counter'}++;
- print STDERR "END_LINE\n" if ($line->{'debug'});
+ print STDERR "END_LINE\n" if ($line->{'DEBUG'});
return "$result\n";
}
@@ -83,16 +83,16 @@
if ($line->{'line_beginning'}) {
if ($line->{'indent_length'}) {
$result .= ' ' x ($line->{'indent_length'} - $line->{'counter'});
- print STDERR "INDENT($line->{'counter'})\n" if ($line->{'debug'});
+ print STDERR "INDENT($line->{'counter'})\n" if ($line->{'DEBUG'});
}
$line->{'line_beginning'} = 0;
} elsif ($line->{'space'}) {
$result .= $line->{'space'};
- print STDERR "ADD_SPACES\n" if ($line->{'debug'});
+ print STDERR "ADD_SPACES\n" if ($line->{'DEBUG'});
}
$line->{'space'} = '';
$result .= $line->{'word'};
- print STDERR "ADD_WORD[$line->{'word'}]\n" if ($line->{'debug'});
+ print STDERR "ADD_WORD[$line->{'word'}]\n" if ($line->{'DEBUG'});
$line->{'word'} = undef;
}
return $result;
@@ -104,7 +104,7 @@
my $line = shift;
my $result = $line->add_pending_word();
$result .= $line->{'space'};
- print STDERR "END_LINE\n" if ($line->{'debug'});
+ print STDERR "END_LINE\n" if ($line->{'DEBUG'});
return $result;
}
@@ -120,7 +120,7 @@
if (defined($word)) {
$line->{'word'} = '' if (!defined($line->{'word'}));
$line->{'word'} .= $word;
- print STDERR "WORD+ $word -> $line->{'word'}\n" if ($line->{'debug'});
+ print STDERR "WORD+ $word -> $line->{'word'}\n" if ($line->{'DEBUG'});
}
if (defined($space)) {
$result .= $line->add_pending_word();
@@ -174,14 +174,14 @@
my $result = '';
while ($text ne '') {
- if ($line->{'debug'}) {
+ if ($line->{'DEBUG'}) {
my $word = 'UNDEF';
$word = $line->{'word'} if (defined($line->{'word'}));
print STDERR "s `$line->{'space'}', w `$word'\n";
}
if ($text =~ s/^([^\S\n]+)//) {
my $spaces = $1;
- print STDERR "SPACES\n" if ($line->{'debug'});
+ print STDERR "SPACES\n" if ($line->{'DEBUG'});
my $added_word = $line->{'word'};
$result .= $line->add_pending_word();
if ($line->{'protect_spaces'}) {
@@ -210,7 +210,7 @@
$result .= $line->end_line();
} elsif ($text =~ s/^(\p{Unicode::EastAsianWidth::InFullwidth})//) {
my $added = $1;
- print STDERR "EAST_ASIAN\n" if ($line->{'debug'});
+ print STDERR "EAST_ASIAN\n" if ($line->{'DEBUG'});
$line->{'word'} = '' if (!defined($line->{'word'}));
$line->{'word'} .= $added;
$result .= $line->add_pending_word();
Index: Texinfo/Convert/Paragraph.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Paragraph.pm,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- Texinfo/Convert/Paragraph.pm 1 Jan 2011 16:42:05 -0000 1.11
+++ Texinfo/Convert/Paragraph.pm 16 Jan 2011 01:24:20 -0000 1.12
@@ -74,7 +74,7 @@
delete $paragraph->{'indent_length_next'};
}
$paragraph->{'lines_counter'}++;
- print STDERR "END_LINE\n" if ($paragraph->{'debug'});
+ print STDERR "END_LINE\n" if ($paragraph->{'DEBUG'});
return "\n";
}
@@ -89,18 +89,18 @@
$result .= ' ' x ($paragraph->{'indent_length'} -
$paragraph->{'counter'});
$paragraph->{'counter'} = $paragraph->{'indent_length'};
print STDERR
"INDENT($paragraph->{'counter'}+$paragraph->{'word_counter'})\n"
- if ($paragraph->{'debug'});
+ if ($paragraph->{'DEBUG'});
} elsif ($paragraph->{'space'}) {
$result .= $paragraph->{'space'};
$paragraph->{'counter'} += length($paragraph->{'space'});
print STDERR
"ADD_SPACES($paragraph->{'counter'}+$paragraph->{'word_counter'})\n"
- if ($paragraph->{'debug'});
+ if ($paragraph->{'DEBUG'});
}
$result .= $paragraph->{'word'};
$paragraph->{'counter'} += $paragraph->{'word_counter'};
print STDERR "ADD_WORD[$paragraph->{'word'}]+$paragraph->{'word_counter'}
($paragraph->{'counter'})\n"
- if ($paragraph->{'debug'});
+ if ($paragraph->{'DEBUG'});
$paragraph->{'word'} = undef;
$paragraph->{'word_counter'} = 0;
$paragraph->{'space'} = '';
@@ -112,7 +112,7 @@
sub end($)
{
my $paragraph = shift;
- print STDERR "PARA END\n" if ($paragraph->{'debug'});
+ print STDERR "PARA END\n" if ($paragraph->{'DEBUG'});
my $result = $paragraph->add_pending_word();
if ($paragraph->{'counter'} != 0) {
$result .= "\n";
@@ -134,7 +134,7 @@
$paragraph->{'word'} = '' if (!defined($paragraph->{'word'}));
$paragraph->{'word'} .= $word;
$paragraph->{'word_counter'} += length($word);
- print STDERR "WORD+ $word -> $paragraph->{'word'}\n" if
($paragraph->{'debug'});
+ print STDERR "WORD+ $word -> $paragraph->{'word'}\n" if
($paragraph->{'DEBUG'});
# The $paragraph->{'counter'} != 0 is here to avoid having an
# additional line output when the text is longer than the max.
if ($paragraph->{'counter'} != 0 and
@@ -199,14 +199,14 @@
my $result = '';
while ($text ne '') {
- if ($paragraph->{'debug'}) {
+ if ($paragraph->{'DEBUG'}) {
my $word = 'UNDEF';
$word = $paragraph->{'word'} if (defined($paragraph->{'word'}));
print STDERR "($paragraph->{'counter'}+$paragraph->{'word_counter'}) s
`$paragraph->{'space'}', w `$word'\n";
}
if ($text =~ s/^(\s+)//) {
my $spaces = $1;
- print STDERR "SPACES($paragraph->{'counter'})\n" if
($paragraph->{'debug'});
+ print STDERR "SPACES($paragraph->{'counter'})\n" if
($paragraph->{'DEBUG'});
my $added_word = $paragraph->{'word'};
$result .= $paragraph->add_pending_word();
if ($paragraph->{'protect_spaces'}) {
@@ -238,7 +238,7 @@
}
} elsif ($text =~ s/^(\p{Unicode::EastAsianWidth::InFullwidth})//) {
my $added = $1;
- print STDERR "EAST_ASIAN\n" if ($paragraph->{'debug'});
+ print STDERR "EAST_ASIAN\n" if ($paragraph->{'DEBUG'});
$paragraph->{'word'} = '' if (!defined($paragraph->{'word'}));
$paragraph->{'word'} .= $added;
$paragraph->{'word_counter'} += 2;
Index: Texinfo/Convert/Plaintext.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Plaintext.pm,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -b -r1.50 -r1.51
--- Texinfo/Convert/Plaintext.pm 15 Jan 2011 11:57:02 -0000 1.50
+++ Texinfo/Convert/Plaintext.pm 16 Jan 2011 01:24:20 -0000 1.51
@@ -229,7 +229,7 @@
'frenchspacing' => 'off',
'paragraphindent' => 3,
'firstparagraphindent' => 'none',
- 'enable_encoding' => 1,
+ 'ENABLE_ENCODING' => 1,
'footnotestyle' => 'end',
'fillcolumn' => 72,
# 'documentencoding' => 'us-ascii',
@@ -239,15 +239,15 @@
'encoding' => undef,
'output_encoding' => undef,
'output_file' => undef,
- 'documentlanguage' => 'en',
- 'number_footnotes' => 1,
+ 'documentlanguage' => undef,
+ 'NUMBER_FOOTNOTES' => 1,
'file_bytes_count' => 0,
- 'split_size' => 300000,
+ 'SPLIT_SIZE' => 300000,
'expanded_formats' => undef,
'include_directories' => undef,
'NUMBER_SECTIONS' => 1,
- 'debug' => 0,
+ 'DEBUG' => 0,
'test' => 0,
);
@@ -356,7 +356,8 @@
}
foreach my $key (keys(%$conf)) {
if (!exists($defaults{$key})) {
- warn "$key not a possible configuration in $name\n";
+ # many things may be passed down
+ #warn "$key not a possible configuration in $name\n";
} else {
$converter->{$key} = $conf->{$key};
$converter->{'set'}->{$key} = 1;
@@ -497,7 +498,7 @@
my $text = $command->{'text'};
$text = uc($text) if ($self->{'formatters'}->[-1]->{'upper_case'});
- if ($self->{'enable_encoding'} and $self->{'documentencoding'}
+ if ($self->{'ENABLE_ENCODING'} and $self->{'documentencoding'}
and $self->{'documentencoding'} eq 'utf-8') {
return Texinfo::Convert::Unicode($self, $command);
} elsif (!$context->{'code'} and !$context->{'preformatted'}) {
@@ -527,7 +528,7 @@
$container_conf->{'frenchspacing'} = 1 if ($self->{'frenchspacing'} eq 'on');
$container_conf->{'counter'} = $self->{'format_context'}->[-1]->{'counter'}
if (defined($self->{'format_context'}->[-1]->{'counter'}));
- $container_conf->{'debug'} = 1 if ($self->{'debug'});
+ $container_conf->{'DEBUG'} = 1 if ($self->{'DEBUG'});
if ($conf) {
foreach my $key (keys(%$conf)) {
$container_conf->{$key} = $conf->{$key};
@@ -606,7 +607,7 @@
#my $category = Texinfo::Convert::Texinfo::convert($arg_category->[0]);
#my $class = Texinfo::Convert::Texinfo::convert($arg_class->[0]);
#print STDERR "DEFINITION CATEGORY($style): $category $class\n"
- # if ($self->{'debug'});
+ # if ($self->{'DEBUG'});
if ($style eq 'f') {
#return Texinfo::Parser::parse_texi_line (undef, "$category on $class");
return $self->gdt('{category} on {class}', { 'category' => $arg_category,
@@ -985,7 +986,7 @@
#if (@{$self->{'formatters'}}) {
my $formatter = $self->{'formatters'}->[-1];
#}
- if ($self->{'debug'}) {
+ if ($self->{'DEBUG'}) {
my $empty_lines_count = '';
$empty_lines_count = $self->{'empty_lines_count'} if
defined($self->{'empty_lines_count'});
print STDERR "ROOT
(@{$self->{'context'}}|@{$self->{'format_context'}},$empty_lines_count)";
@@ -1010,7 +1011,7 @@
if (($root->{'type'} and $self->{'ignored_types'}->{$root->{'type'}})
or ($root->{'cmdname'}
and $self->{'ignored_commands'}->{$root->{'cmdname'}})) {
- print STDERR "IGNORED\n" if ($self->{'debug'});
+ print STDERR "IGNORED\n" if ($self->{'DEBUG'});
return '';
}
my $result = '';
@@ -1035,7 +1036,7 @@
}
if ($root->{'extra'} and $root->{'extra'}->{'invalid_nesting'}) {
- print STDERR "INVALID_NESTING\n" if ($self->{'debug'});
+ print STDERR "INVALID_NESTING\n" if ($self->{'DEBUG'});
return '';
}
@@ -1180,7 +1181,7 @@
}
}
my $footnote_number;
- if ($self->{'number_footnotes'}) {
+ if ($self->{'NUMBER_FOOTNOTES'}) {
$self->{'footnote_index'}++ unless ($multiple_pass);
$footnote_number = $self->{'footnote_index'};
} else {
@@ -1345,12 +1346,12 @@
my ($formatted_prototype) = $self->convert_line($prototype,
{'indent_length' =>
0});
print STDERR " MULTITABLE_PROTO {$formatted_prototype}\n"
- if ($self->{'debug'});
+ if ($self->{'DEBUG'});
push @$columnsize,
2+Texinfo::Convert::Unicode::string_width($formatted_prototype);
}
}
- print STDERR "MULTITABLE_SIZES @$columnsize\n" if ($self->{'debug'});
+ print STDERR "MULTITABLE_SIZES @$columnsize\n" if ($self->{'DEBUG'});
$self->{'format_context'}->[-1]->{'columns_size'} = $columnsize;
} elsif ($root->{'cmdname'} eq 'float' and $root->{'extra'}
and $root->{'extra'}->{'normalized'}) {
@@ -1431,7 +1432,7 @@
$bytes_count += $self->count_bytes($result);
$lines_count += 1;
print STDERR "
$root->{'parent'}->{'cmdname'}($root->{'extra'}->{'item_number'}) ->
|$result|\n"
- if ($self->{'debug'});
+ if ($self->{'DEBUG'});
pop @{$self->{'formatters'}};
$self->{'format_context'}->[-1]->{'counter'} +=
Texinfo::Convert::Unicode::string_width($result);
@@ -1443,7 +1444,7 @@
$self->{'format_context'}->[-1]->{'item_command'} = $root->{'cmdname'}
if ($root->{'cmdname'} ne 'tab');
print STDERR "CELL [$root->{'extra'}->{'cell_number'}]:
address@hidden>{'cmdname'}. Width: $cell_width\n"
- if ($self->{'debug'});
+ if ($self->{'DEBUG'});
die if (!defined($cell_width));
push @{$self->{'format_context'}},
{ 'cmdname' => $root->{'cmdname'},
@@ -1636,7 +1637,7 @@
$self->{'format_context'}->[-1]->{'paragraph_count'}++;
} elsif ($root->{'type'} eq 'empty_line') {
print STDERR "EMPTY_LINE ($self->{'empty_lines_count'})\n"
- if ($self->{'debug'});
+ if ($self->{'DEBUG'});
delete $self->{'format_context'}->[-1]->{'counter'};
$self->{'empty_lines_count'}++;
if ($self->{'empty_lines_count'} <= 1
@@ -1688,7 +1689,7 @@
pop @{$self->{'formatters'}};
$self->{'empty_lines_count'} = 0;
- print STDERR " --> $result" if ($self->{'debug'});
+ print STDERR " --> $result" if ($self->{'DEBUG'});
}
} elsif ($root->{'type'} eq 'menu_entry') {
#Â an end of line is ensured for the last argument.
@@ -1771,7 +1772,7 @@
push @{$cell_updated_locations->[$cell_idx]->{$location->{'lines'}}},
$location;
print STDERR "MULTITABLE anchor
$location->{'root'}->{'extra'}->{'normalized'}: c $cell_idx, l
$location->{'lines'} ($location->{'bytes'})\n"
- if ($self->{'debug'});
+ if ($self->{'DEBUG'});
$max_lines = $location->{'lines'}+1
if ($location->{'lines'}+1 > $max_lines);
}
@@ -1779,7 +1780,7 @@
}
print STDERR "ROW, max_lines $max_lines, indent_len $indent_len\n"
- if ($self->{'debug'});
+ if ($self->{'DEBUG'});
# this is used to keep track of the last cell with content.
my $max_cell = scalar(@{$self->{'format_context'}->[-1]->{'row'}});
@@ -1795,7 +1796,7 @@
or
defined($cell_updated_locations->[$cell_idx]->{$line_idx}));
}
print STDERR " L(last_cell $last_cell): $line_idx\n"
- if ($self->{'debug'});
+ if ($self->{'DEBUG'});
for (my $cell_idx = 0; $cell_idx < $last_cell; $cell_idx++) {
my $cell_text = $cell_lines[$cell_idx]->[$line_idx];
@@ -1805,7 +1806,7 @@
$line = ' ' x $indent_len;
$bytes_count += $self->count_bytes($line);
}
- print STDERR " C($cell_idx) `$cell_text'\n" if ($self->{'debug'});
+ print STDERR " C($cell_idx) `$cell_text'\n" if ($self->{'DEBUG'});
$line .= $cell_text;
$bytes_count += $self->count_bytes($cell_text);
$line_width += Texinfo::Convert::Unicode::string_width($cell_text);
@@ -1813,7 +1814,7 @@
if (defined($cell_updated_locations->[$cell_idx]->{$line_idx})) {
foreach my $location
(@{$cell_updated_locations->[$cell_idx]->{$line_idx}}) {
print STDERR "MULTITABLE UPDATE ANCHOR (l $line_idx, c
$cell_idx): $location->{'root'}->{'extra'}->{'normalized'}:
$location->{'bytes'} -> $bytes_count\n"
- if ($self->{'debug'});
+ if ($self->{'DEBUG'});
$location->{'bytes'} = $bytes_count;
}
}
@@ -1867,7 +1868,7 @@
if ($root->{'cmdname'}) {
if ($root->{'cmdname'} eq 'float') {
- if ($self->{'debug'}) {
+ if ($self->{'DEBUG'}) {
my $type_texi = '';
$type_texi = Texinfo::Convert::Texinfo::convert({'contents' =>
$root->{'extra'}->{'type'}->{'content'}})
if ($root->{'extra'} and $root->{'extra'}->{'type'});
@@ -1884,7 +1885,7 @@
} elsif ($root->{'extra'}->{'shortcaption'}) {
$caption = $root->{'extra'}->{'shortcaption'};
}
- #if ($self->{'debug'}) {
+ #if ($self->{'DEBUG'}) {
# my $caption_texi =
# Texinfo::Convert::Texinfo::convert({ 'contents' =>
$caption->{'contents'}});
# print STDERR " CAPTION: $caption_texi\n";
Index: Texinfo/Convert/UnFilled.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/UnFilled.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- Texinfo/Convert/UnFilled.pm 4 Dec 2010 12:11:12 -0000 1.4
+++ Texinfo/Convert/UnFilled.pm 16 Jan 2011 01:24:21 -0000 1.5
@@ -64,7 +64,7 @@
$line->{'leading_spaces'} = '';
$line->{'only_spaces'} = 1;
$line->{'lines_counter'}++;
- print STDERR "END_LINE\n" if ($line->{'debug'});
+ print STDERR "END_LINE\n" if ($line->{'DEBUG'});
return "\n";
}
@@ -76,7 +76,7 @@
if ($line->{'indent_length'}) {
$line->{'leading_spaces'} .=
' ' x ($line->{'indent_length'} - $line->{'counter'});
- print STDERR "INDENT($line->{'counter'})\n" if ($line->{'debug'});
+ print STDERR "INDENT($line->{'counter'})\n" if ($line->{'DEBUG'});
}
$line->{'line_beginning'} = 0;
}
Index: t/paragraph.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/paragraph.t,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- t/paragraph.t 1 Jan 2011 16:42:05 -0000 1.13
+++ t/paragraph.t 16 Jan 2011 01:24:21 -0000 1.14
@@ -30,7 +30,7 @@
my $conf = shift;
my $result = '';
- #$conf = {'debug' => 1} if (!defined($conf));
+ #$conf = {'DEBUG' => 1} if (!defined($conf));
$conf = {} if (!defined($conf));
my $para = Texinfo::Convert::Paragraph->new($conf);
foreach my $arg (@$args) {
@@ -350,7 +350,7 @@
my $conf = shift;
my $result = '';
- #$conf = {'debug' => 1} if (!defined($conf));
+ #$conf = {'DEBUG' => 1} if (!defined($conf));
$conf = {} if (!defined($conf));
my $line = Texinfo::Convert::Line->new($conf);
foreach my $arg (@$args) {
Index: t/test_utils.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/test_utils.pl,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -b -r1.62 -r1.63
--- t/test_utils.pl 19 Dec 2010 17:25:07 -0000 1.62
+++ t/test_utils.pl 16 Jan 2011 01:24:21 -0000 1.63
@@ -109,7 +109,7 @@
my $generate = shift;
my $debug = shift;
my $test = {'name' => $name, 'generate' => $generate,
- 'debug' => $debug};
+ 'DEBUG' => $debug};
if ($generate) {
mkdir "t/results/$name" if (! -d "t/results/$name");
@@ -177,7 +177,7 @@
my $tree = shift;
my $parser = shift;
my $converter =
- Texinfo::Convert::Plaintext::converter({'debug' => $self->{'debug'},
+ Texinfo::Convert::Plaintext::converter({'DEBUG' => $self->{'DEBUG'},
'parser' => $parser });
my $result = $converter->convert($tree);
my ($errors, $error_nrs) = $converter->errors();
@@ -209,7 +209,7 @@
my $parser = Texinfo::Parser->parser({'test' => 1,
'include_directories' =>
['t/include/'],
- 'debug' => $self->{'debug'},
+ 'DEBUG' => $self->{'DEBUG'},
%$parser_options});
# take the initial values to record only if there is something new
my ($initial_index_names, $initial_merged_indices)
@@ -217,7 +217,7 @@
# do a copy to compare the values and not the references
$initial_index_names = { %{$initial_index_names} };
$initial_merged_indices = { %{$initial_merged_indices} };
- print STDERR " TEST $test_name\n" if ($self->{'debug'});
+ print STDERR " TEST $test_name\n" if ($self->{'DEBUG'});
my $result;
if (ref($test_case) eq 'ARRAY') {
$result = $parser->parse_texi_text($test_text, 1);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- texinfo/tp texi2any.pl Texinfo/Common.pm Texinf...,
Patrice Dumas <=