[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/tp/Texinfo Common.pm Parser.pm Convert/...
From: |
Patrice Dumas |
Subject: |
texinfo/tp/Texinfo Common.pm Parser.pm Convert/... |
Date: |
Sun, 15 Jan 2012 15:08:00 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 12/01/15 15:08:00
Modified files:
tp/Texinfo : Common.pm Parser.pm
tp/Texinfo/Convert: Converter.pm Text.pm
Log message:
Clean up lists of commands settable as options, and avoid duplicating
between the Parser and Common definitions.
Texinfo/Convert/Text.pm: separate converter and output more similarly
with Texinfo/Convert/Converter.pm, and set more options for output.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Common.pm?cvsroot=texinfo&r1=1.114&r2=1.115
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.352&r2=1.353
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Converter.pm?cvsroot=texinfo&r1=1.72&r2=1.73
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Text.pm?cvsroot=texinfo&r1=1.91&r2=1.92
Patches:
Index: Common.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Common.pm,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -b -r1.114 -r1.115
--- Common.pm 6 Jan 2012 00:20:25 -0000 1.114
+++ Common.pm 15 Jan 2012 15:08:00 -0000 1.115
@@ -80,23 +80,36 @@
$null_device_file{'NUL'} = 1;
}
+# command-line options
+#my @command_line_settable_at_commands = ('footnotestyle', 'novalidate',
+# 'documentlanguage', 'paragraphindent');
+
+
+# FIXME maybe this should better be set as texinfo passed to texi2any as
+# texi2dvi --command
+
# configuration options
-my @document_settable_at_commands =
- ('everyheading', 'everyfooting', 'evenheading',
- 'evenfooting', 'oddheading', 'oddfooting', 'headings',
- 'allowcodebreaks', 'frenchspacing', 'exampleindent',
- 'firstparagraphindent', 'paragraphindent', 'clickstyle',
- 'documentlanguage', 'xrefautomaticsectiontitle',
- 'deftypefnnewline');
+our @document_settable_at_commands =
+ (
+ 'allowcodebreaks', 'clickstyle', 'codequotebacktick',
+ 'codequoteundirected', 'contents', 'deftypefnnewline',
+ 'documentencoding', 'documentlanguage', 'exampleindent',
+ 'firstparagraphindent', 'frenchspacing', 'headings',
+ 'kbdinputstyle', 'paragraphindent',
+ 'shortcontents', 'urefbreakstyle', 'xrefautomaticsectiontitle',
+ );
# 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'
+our @document_settable_unique_at_commands = (
+ 'documentdescription', # FIXME this does not work
+ 'evenfootingmarks', 'evenheadingmarks',
+ 'everyfootingmarks', 'everyheadingmarks',
+ 'fonttextsize', 'footnotestyle', 'novalidate',
+ 'oddfootingmarks','oddheadingmarks',
+ 'pagesizes', 'setchapternewpage',
+ 'setcontentsaftertitlepage',
+ 'setfilename', # FIXME this does not work
+ 'setshortcontentsaftertitlepage',
);
@@ -172,7 +185,8 @@
);
my %valid_options;
-foreach my $var (@document_settable_at_commands, @document_global_at_commands,
+foreach my $var (@document_settable_at_commands,
+ @document_settable_unique_at_commands,
@command_line_settables, @variable_settables, @parser_options,
@obsolete_variables, @variable_settables_not_used) {
$valid_options{$var} = 1;
Index: Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.352
retrieving revision 1.353
diff -u -b -r1.352 -r1.353
--- Parser.pm 13 Jan 2012 18:58:13 -0000 1.352
+++ Parser.pm 15 Jan 2012 15:08:00 -0000 1.353
@@ -284,27 +284,18 @@
}
my %global_multiple_commands;
-foreach my $global_multiple_command ('author', 'documentlanguage',
- 'documentencoding', 'insertcopying',
- 'subtitle', 'contents', 'shortcontents', 'summarycontents',
- 'kbdinputstyle', 'paragraphindent', 'firstparagraphindent',
- 'frenchspacing', 'hyphenation', 'urefbreakstyle',
- 'xrefautomaticsectiontitle', 'codequoteundirected',
- 'codequotebacktick', 'titlefont', 'footnote', 'printindex',
- 'deftypefnnewline') {
+foreach my $global_multiple_command (
+ 'author', 'footnote', 'hyphenation', 'insertcopying', 'printindex',
+ 'subtitle','titlefont',
+ @Texinfo::Common::document_settable_at_commands, ) {
$global_multiple_commands{$global_multiple_command} = 1;
}
my %global_unique_commands;
-foreach my $global_unique_command ('title',
- 'shorttitlepage', 'settitle', 'copying', 'documentdescription',
- 'novalidate', 'titlepage',
- 'setfilename', 'setcontentsaftertitlepage',
- 'setshortcontentsaftertitlepage', 'footnotestyle',
- 'documentencoding', 'everyheadingmarks','everyfootingmarks',
- 'evenheadingmarks', 'oddheadingmarks', 'evenfootingmarks', 'oddfootingmarks',
- 'fonttextsize', 'pagesizes', 'setchapternewpage', 'top'
-) {
+foreach my $global_unique_command (
+ 'copying', 'documentdescription', 'settitle',
+ 'shorttitlepage', 'title', 'titlepage', 'top',
+ @Texinfo::Common::document_settable_unique_at_commands, ) {
$global_unique_commands{$global_unique_command} = 1;
}
@@ -944,6 +935,9 @@
my $command = shift;
my $current = shift;
my $line_nr = shift;
+ if ($command eq 'summarycontents' and
!$self->{'global_commands'}->{$command}) {
+ $command = 'shortcontents';
+ }
if ($self->{'global_commands'}->{$command} and $command ne 'author') {
push @{$self->{'extra'}->{$command}}, $current;
return 1;
Index: Convert/Converter.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Converter.pm,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -b -r1.72 -r1.73
--- Convert/Converter.pm 6 Jan 2012 00:20:31 -0000 1.72
+++ Convert/Converter.pm 15 Jan 2012 15:08:00 -0000 1.73
@@ -92,6 +92,7 @@
'translated_commands' => {'error' => 'address@hidden',},
);
+# For translation of in document string.
if (0) {
my $self;
$self->gdt('address@hidden');
@@ -496,6 +497,8 @@
$self->{'output_file'} = $outfile;
}
+#sub output
+
# This is not used as code, but used to mark months as strings to be
# translated
if (0) {
Index: Convert/Text.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Text.pm,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -b -r1.91 -r1.92
--- Convert/Text.pm 6 Jan 2012 00:20:33 -0000 1.91
+++ Convert/Text.pm 15 Jan 2012 15:08:00 -0000 1.92
@@ -574,6 +574,32 @@
if ($conf) {
%{$converter} = %{$conf};
}
+
+ my $expanded_formats = $converter->{'expanded_formats'};;
+ if ($converter->{'parser'}) {
+ $converter->{'info'} = $converter->{'parser'}->global_informations();
+ $converter->{'extra'} =
$converter->{'parser'}->global_commands_information();
+ foreach my $global_command ('documentencoding') {
+ if (defined($converter->{'extra'}->{$global_command})) {
+ my $root = $converter->{'extra'}->{$global_command}->[0];
+ if ($global_command eq 'documentencoding'
+ and defined($root->{'extra'})
+ and defined($root->{'extra'}->{'perl_encoding'})) {
+ $converter->{'encoding_name'} = $root->{'extra'}->{'encoding_name'};
+ $converter->{'perl_encoding'} = $root->{'extra'}->{'perl_encoding'};
+ }
+ }
+ }
+ if (!$expanded_formats and $converter->{'parser'}->{'expanded_formats'}) {
+ $expanded_formats = $converter->{'parser'}->{'expanded_formats'};
+ }
+ }
+ if ($expanded_formats) {
+ foreach my $expanded_format(@$expanded_formats) {
+ $converter->{'expanded_formats_hash'}->{$expanded_format} = 1;
+ }
+ }
+
bless $converter;
return $converter;
}
@@ -593,25 +619,6 @@
my $self = shift;
my $tree = shift;
#print STDERR "OUTPUT\n";
- my $expanded_formats = $self->{'expanded_formats'};;
- if ($self and $self->{'parser'}) {
- my $parser = $self->{'parser'};
- $self->{'info'} = $self->{'parser'}->global_informations();
- $self->{'extra'} = $self->{'parser'}->global_commands_information();
- if (!$expanded_formats and $self->{'parser'}->{'expanded_formats'}) {
- $expanded_formats = $self->{'parser'}->{'expanded_formats'};
- }
- }
- my $expanded_formats_hash;
- if ($expanded_formats) {
- foreach my $expanded_format(@$expanded_formats) {
- $expanded_formats_hash->{$expanded_format} = 1;
- }
- }
- my %options;
- if ($expanded_formats_hash) {
- $options{'expanded_formats_hash'} = $expanded_formats_hash;
- }
my $input_basename;
if (defined($self->{'info'}->{'input_file_name'})) {
$input_basename = $self->{'info'}->{'input_file_name'};
@@ -648,6 +655,7 @@
$fh = $self->Texinfo::Common::open_out($outfile);
return undef if (!$fh);
}
+ my %options = $self->Texinfo::Common::_convert_text_options();
my $result = _convert($tree, \%options);
if ($fh) {
print $fh $result;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- texinfo/tp/Texinfo Common.pm Parser.pm Convert/...,
Patrice Dumas <=