[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/tp TODO Texinfo/Convert/Converter.pm Te...
From: |
Patrice Dumas |
Subject: |
texinfo/tp TODO Texinfo/Convert/Converter.pm Te... |
Date: |
Sun, 06 Nov 2011 00:55:29 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 11/11/06 00:55:28
Modified files:
tp : TODO
tp/Texinfo/Convert: Converter.pm DocBook.pm HTML.pm Info.pm
Plaintext.pm Text.pm XML.pm
tp/init : tex4ht.pm
Log message:
Distinguish OUTFILE, an option and output_file the output file to be
used
if not split.
Use the correct out file if split and there are no elements.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/TODO?cvsroot=texinfo&r1=1.216&r2=1.217
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Converter.pm?cvsroot=texinfo&r1=1.62&r2=1.63
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/DocBook.pm?cvsroot=texinfo&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/HTML.pm?cvsroot=texinfo&r1=1.203&r2=1.204
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Info.pm?cvsroot=texinfo&r1=1.72&r2=1.73
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Plaintext.pm?cvsroot=texinfo&r1=1.186&r2=1.187
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Text.pm?cvsroot=texinfo&r1=1.78&r2=1.79
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/XML.pm?cvsroot=texinfo&r1=1.52&r2=1.53
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/init/tex4ht.pm?cvsroot=texinfo&r1=1.6&r2=1.7
Patches:
Index: TODO
===================================================================
RCS file: /sources/texinfo/texinfo/tp/TODO,v
retrieving revision 1.216
retrieving revision 1.217
diff -u -b -r1.216 -r1.217
--- TODO 5 Nov 2011 17:10:20 -0000 1.216
+++ TODO 6 Nov 2011 00:55:27 -0000 1.217
@@ -13,7 +13,7 @@
the subsection that is both below and next the section, because it is
next in menu. Bug or not?
-When there is a top node without sectioning command and USE_NODE is false
+(A) When there is a top node without sectioning command and USE_NODE is false
and a sectioning command follows with an associated node:
* the Top node ends up in the same element as the sectioning command and
second node
Index: Texinfo/Convert/Converter.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Converter.pm,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -b -r1.62 -r1.63
--- Texinfo/Convert/Converter.pm 1 Nov 2011 16:08:19 -0000 1.62
+++ Texinfo/Convert/Converter.pm 6 Nov 2011 00:55:27 -0000 1.63
@@ -384,7 +384,6 @@
# the name of the document, which is more or less the basename, without
# extension
my $document_name;
- my $set_outfile = $self->get_conf('OUTFILE');
# determine output file and output file name
my $outfile;
if (!defined($self->get_conf('OUTFILE'))) {
@@ -411,17 +410,18 @@
if (defined($self->get_conf('SUBDIR')) and $outfile ne '') {
$outfile = $self->get_conf('SUBDIR')."/$outfile";
}
- $self->set_conf('OUTFILE', $outfile);
+ #$self->set_conf('OUTFILE', $outfile);
} else {
$document_name = $self->get_conf('OUTFILE');
$document_name =~ s/\.[^\.]*$//;
+ $outfile = $self->get_conf('OUTFILE');
}
# the output file without directories part.
- my $output_filename = $self->get_conf('OUTFILE');
+ my $output_filename = $outfile;
# this is a case that should happen rarely: one wants to get
# the result in a string and there is a setfilename.
- if ($self->get_conf('OUTFILE') eq '' and defined($setfilename)
+ if ($outfile eq '' and defined($setfilename)
and !$self->get_conf('NO_USE_SETFILENAME')) {
$output_filename = $setfilename;
$document_name = $setfilename;
@@ -432,7 +432,7 @@
$output_filename =~ s/^.*\///;
$self->{'output_filename'} = $output_filename;
if ($self->get_conf('SPLIT')) {
- if (defined($set_outfile)) {
+ if (defined($self->get_conf('OUTFILE'))) {
$self->{'destination_directory'} = $self->get_conf('OUTFILE');
} elsif (defined($self->get_conf('SUBDIR'))) {
$self->{'destination_directory'} = $self->get_conf('SUBDIR');
@@ -440,7 +440,7 @@
$self->{'destination_directory'} = $document_name;
}
} else {
- my $output_dir = $self->get_conf('OUTFILE');
+ my $output_dir = $outfile;
$output_dir =~ s|[^/]*$||;
if ($output_dir ne '') {
$self->{'destination_directory'} = $output_dir;
@@ -451,6 +451,7 @@
$self->{'destination_directory'} =~ s/\/*$//;
$self->{'destination_directory'} .= '/';
}
+ $self->{'output_file'} = $outfile;
}
# This is not used as code, but used to mark months as strings to be
Index: Texinfo/Convert/DocBook.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/DocBook.pm,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- Texinfo/Convert/DocBook.pm 1 Nov 2011 16:08:20 -0000 1.29
+++ Texinfo/Convert/DocBook.pm 6 Nov 2011 00:55:28 -0000 1.30
@@ -301,11 +301,11 @@
return undef unless $self->_create_destination_directory();
my $fh;
- if (! $self->get_conf('OUTFILE') eq '') {
- $fh = $self->Texinfo::Common::open_out ($self->get_conf('OUTFILE'));
+ if (! $self->{'output_file'} eq '') {
+ $fh = $self->Texinfo::Common::open_out ($self->{'output_file'});
if (!$fh) {
$self->document_error(sprintf($self->__("Could not open %s for writing:
%s"),
- $self->get_conf('OUTFILE'), $!));
+ $self->{'output_file'}, $!));
return undef;
}
}
@@ -313,7 +313,7 @@
$self->_set_global_multiple_commands(-1);
my $id;
- if ($self->get_conf('OUTFILE') ne '') {
+ if ($self->{'output_file'} ne '') {
my $output_filename = $self->{'output_filename'};
$id = " id=\"".$self->xml_protect_text($output_filename)."\"";
} else {
Index: Texinfo/Convert/HTML.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/HTML.pm,v
retrieving revision 1.203
retrieving revision 1.204
diff -u -b -r1.203 -r1.204
--- Texinfo/Convert/HTML.pm 4 Nov 2011 00:09:27 -0000 1.203
+++ Texinfo/Convert/HTML.pm 6 Nov 2011 00:55:28 -0000 1.204
@@ -4058,7 +4058,7 @@
my $next_is_special = (defined($element->{'element_next'})
and $element->{'element_next'}->{'extra'}->{'special_element'});
# no 'parent' defined happens if there are no pages, and there are elements
- # which should only happen when called with $self->get_conf('OUTFILE')
+ # which should only happen when called with $self->{'output_file'}
# set to ''.
#print STDERR "$element $element->{'filename'}
$self->{'file_counters'}->{$element->{'filename'}}\n";
#print STDERR "next: $element->{'element_next'}->{'filename'}\n" if
($element->{'element_next'});
@@ -4828,32 +4828,9 @@
}
}
-sub _set_pages_files($$)
+sub _top_node_filename($)
{
my $self = shift;
- my $elements = shift;
- my $special_elements = shift;
-
- # Ensure that the document has pages
- return undef if (!defined($elements) or address@hidden);
-
- my $extension = '';
- $extension = '.'.$self->get_conf('EXTENSION')
- if (defined($self->get_conf('EXTENSION'))
- and $self->get_conf('EXTENSION') ne '');
-
- if (!$self->get_conf('SPLIT')) {
- foreach my $element (@$elements) {
- if (!defined($element->{'filename'})) {
- $element->{'filename'} = $self->{'document_name'}.$extension;
- $element->{'out_filename'} = $self->get_conf('OUTFILE');
- }
- }
- } else {
- my $node_top;
- #my $section_top;
- $node_top = $self->{'labels'}->{'Top'} if ($self->{'labels'});
- #$section_top = $self->{'extra'}->{'top'} if ($self->{'extra'});
my $top_node_filename;
if (defined($self->get_conf('TOP_FILE'))
@@ -4881,6 +4858,37 @@
if (defined($top_node_extension) and $top_node_extension ne '');
}
}
+ return $top_node_filename;
+}
+
+sub _set_pages_files($$)
+{
+ my $self = shift;
+ my $elements = shift;
+ my $special_elements = shift;
+
+ # Ensure that the document has pages
+ return undef if (!defined($elements) or address@hidden);
+
+ my $extension = '';
+ $extension = '.'.$self->get_conf('EXTENSION')
+ if (defined($self->get_conf('EXTENSION'))
+ and $self->get_conf('EXTENSION') ne '');
+
+ if (!$self->get_conf('SPLIT')) {
+ foreach my $element (@$elements) {
+ if (!defined($element->{'filename'})) {
+ $element->{'filename'} = $self->{'document_name'}.$extension;
+ $element->{'out_filename'} = $self->{'output_file'};
+ }
+ }
+ } else {
+ my $node_top;
+ #my $section_top;
+ $node_top = $self->{'labels'}->{'Top'} if ($self->{'labels'});
+ #$section_top = $self->{'extra'}->{'top'} if ($self->{'extra'});
+
+ my $top_node_filename = $self->_top_node_filename();
# first determine the top node file name.
if ($self->get_conf('NODE_FILENAMES') and $node_top
and defined($top_node_filename)) {
@@ -6307,7 +6315,7 @@
# determine file names associated with the different pages, and setup
# the counters for special element pages.
- if ($self->get_conf('OUTFILE') ne '') {
+ if ($self->{'output_file'} ne '') {
$self->_set_pages_files($elements, $special_elements);
}
@@ -6435,13 +6443,22 @@
my $output = '';
if (!$elements or !defined($elements->[0]->{'filename'})) {
# no page
- if ($self->get_conf('OUTFILE') ne '') {
- print STDERR "DO No pages, output in ".$self->get_conf('OUTFILE')."\n"
+ if ($self->{'output_file'} ne '') {
+ my $outfile;
+ if ($self->get_conf('SPLIT')) {
+ $outfile = $self->_top_node_filename();
+ if (defined($self->{'destination_directory'})) {
+ $outfile = $self->{'destination_directory'} . $outfile;
+ }
+ } else {
+ $outfile = $self->{'output_file'};
+ }
+ print STDERR "DO No pages, output in $outfile\n"
if ($self->get_conf('DEBUG'));
- $fh = $self->Texinfo::Common::open_out ($self->get_conf('OUTFILE'));
+ $fh = $self->Texinfo::Common::open_out ($outfile);
if (!$fh) {
$self->document_error(sprintf($self->__("Could not open %s for
writing: %s"),
- $self->get_conf('OUTFILE'), $!));
+ $outfile, $!));
return undef;
}
} else {
@@ -6461,7 +6478,7 @@
$output .= $self->_output_text($self->_convert($root), $fh);
}
$output .= $self->_output_text(&{$self->{'format_end_file'}}($self), $fh);
- return $output if ($self->get_conf('OUTFILE') eq '');
+ return $output if ($self->{'output_file'} eq '');
} else {
# output with pages
print STDERR "DO Elements with filenames\n"
@@ -6520,7 +6537,7 @@
# do node redirection pages
$self->{'current_filename'} = undef;
if ($self->get_conf('NODE_FILES')
- and $self->{'labels'} and $self->get_conf('OUTFILE') ne '') {
+ and $self->{'labels'} and $self->{'output_file'} ne '') {
foreach my $label (keys (%{$self->{'labels'}})) {
my $node = $self->{'labels'}->{$label};
my $target = $self->_get_target($node);
@@ -6565,7 +6582,7 @@
}
}
if ($self->{'renamed_nodes'}
- and $self->{'labels'} and $self->get_conf('OUTFILE') ne '') {
+ and $self->{'labels'} and $self->{'output_file'} ne '') {
# do a fresh parser, to avoid, for example adding new labels if renamed
# nodes incorrectly define anchors...
my $parser_for_renamed_nodes;
Index: Texinfo/Convert/Info.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Info.pm,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -b -r1.72 -r1.73
--- Texinfo/Convert/Info.pm 4 Nov 2011 19:02:29 -0000 1.72
+++ Texinfo/Convert/Info.pm 6 Nov 2011 00:55:28 -0000 1.73
@@ -60,8 +60,8 @@
$self->{'input_basename'} = $STDIN_DOCU_NAME if ($self->{'input_basename'}
eq '-');
# no splitting when writing to the null device or to stdout
- if ($Texinfo::Common::null_device_file{$self->get_conf('OUTFILE')}
- or $self->get_conf('OUTFILE') eq '-') {
+ if ($Texinfo::Common::null_device_file{$self->{'output_file'}}
+ or $self->{'output_file'} eq '-') {
$self->force_conf('SPLIT_SIZE', undef);
}
@@ -76,11 +76,11 @@
my $elements = Texinfo::Structuring::split_by_node($root);
my $fh;
- if (! $self->get_conf('OUTFILE') eq '') {
- $fh = $self->Texinfo::Common::open_out ($self->get_conf('OUTFILE'));
+ if (! $self->{'output_file'} eq '') {
+ $fh = $self->Texinfo::Common::open_out ($self->{'output_file'});
if (!$fh) {
$self->document_error(sprintf($self->__("Could not open %s for writing:
%s"),
- $self->get_conf('OUTFILE'), $!));
+ $self->{'output_file'}, $!));
return undef;
}
}
@@ -125,24 +125,24 @@
and @nodes and $fh) {
close ($fh);
if ($out_file_nr == 1) {
- unless (rename ($self->get_conf('OUTFILE'),
- $self->get_conf('OUTFILE').'-'.$out_file_nr)) {
+ unless (rename ($self->{'output_file'},
+ $self->{'output_file'}.'-'.$out_file_nr)) {
$self->document_error(sprintf($self->__("Rename %s failed: %s"),
- $self->get_conf('OUTFILE'), $!));
+ $self->{'output_file'}, $!));
}
push @{$self->{'opened_files'}},
- $self->get_conf('OUTFILE').'-'.$out_file_nr;
+ $self->{'output_file'}.'-'.$out_file_nr;
push @indirect_files, [$self->{'output_filename'}.'-'.$out_file_nr,
$first_node_bytes_count];
#print STDERR join(' --> ', @{$indirect_files[-1]}) ."\n";
}
$out_file_nr++;
$fh = $self->Texinfo::Common::open_out (
- $self->get_conf('OUTFILE').'-'.$out_file_nr);
+ $self->{'output_file'}.'-'.$out_file_nr);
if (!$fh) {
$self->document_error(sprintf(
$self->__("Could not open %s for writing: %s"),
- $self->get_conf('OUTFILE').'-'.$out_file_nr, $!));
+ $self->{'output_file'}.'-'.$out_file_nr, $!));
return undef;
}
print $fh $header;
@@ -156,11 +156,11 @@
my $tag_text = '';
if ($out_file_nr > 1) {
close ($fh);
- $fh = $self->Texinfo::Common::open_out($self->get_conf('OUTFILE'));
+ $fh = $self->Texinfo::Common::open_out($self->{'output_file'});
if (!$fh) {
$self->document_error(sprintf(
$self->__("Could not open %s for writing: %s"),
- $self->get_conf('OUTFILE'), $!));
+ $self->{'output_file'}, $!));
return undef;
}
$tag_text = $header;
Index: Texinfo/Convert/Plaintext.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Plaintext.pm,v
retrieving revision 1.186
retrieving revision 1.187
diff -u -b -r1.186 -r1.187
--- Texinfo/Convert/Plaintext.pm 5 Nov 2011 16:36:49 -0000 1.186
+++ Texinfo/Convert/Plaintext.pm 6 Nov 2011 00:55:28 -0000 1.187
@@ -408,8 +408,8 @@
my $root = shift;
my $outfile = '-';
- if (defined($self->get_conf('OUTFILE'))) {
- $outfile = $self->get_conf('OUTFILE');
+ if (defined($self->{'output_file'})) {
+ $outfile = $self->{'output_file'};
}
my $fh = $self->Texinfo::Common::open_out ($outfile);
Index: Texinfo/Convert/Text.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Text.pm,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -b -r1.78 -r1.79
--- Texinfo/Convert/Text.pm 3 Nov 2011 23:40:37 -0000 1.78
+++ Texinfo/Convert/Text.pm 6 Nov 2011 00:55:28 -0000 1.79
@@ -591,8 +591,8 @@
if ($self->{'extra'} and $self->{'extra'}->{'setfilename'}
and $self->{'extra'}->{'setfilename'}->{'extra'}
and
defined($self->{'extra'}->{'setfilename'}->{'extra'}->{'text_arg'}));
- if (!defined($self->{'OUTFILE'})) {
my $outfile;
+ if (!defined($self->{'OUTFILE'})) {
if (defined($setfilename)) {
$outfile = $setfilename;
$outfile =~ s/\.[^\.]*$//;
@@ -601,12 +601,13 @@
}
if (defined($outfile)) {
$outfile .= '.txt';
- $self->{'OUTFILE'} = $outfile;
}
+ } else {
+ $outfile = $self->{'OUTFILE'};
}
my $fh;
- if (defined($self->{'OUTFILE'})) {
- $fh = $self->Texinfo::Common::open_out ($self->{'OUTFILE'});
+ if (defined($outfile)) {
+ $fh = $self->Texinfo::Common::open_out ($outfile);
return undef if (!$fh);
}
my $result = _convert($tree);
Index: Texinfo/Convert/XML.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/XML.pm,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -b -r1.52 -r1.53
--- Texinfo/Convert/XML.pm 2 Nov 2011 12:13:57 -0000 1.52
+++ Texinfo/Convert/XML.pm 6 Nov 2011 00:55:28 -0000 1.53
@@ -256,11 +256,11 @@
return undef unless $self->_create_destination_directory();
my $fh;
- if (! $self->get_conf('OUTFILE') eq '') {
- $fh = $self->Texinfo::Common::open_out ($self->get_conf('OUTFILE'));
+ if (! $self->{'output_file'} eq '') {
+ $fh = $self->Texinfo::Common::open_out ($self->{'output_file'});
if (!$fh) {
$self->document_error(sprintf($self->__("Could not open %s for writing:
%s"),
- $self->get_conf('OUTFILE'), $!));
+ $self->{'output_file'}, $!));
return undef;
}
}
@@ -269,7 +269,7 @@
my $header = '<?xml version="1.0"?>
<!DOCTYPE texinfo PUBLIC "-//GNU//DTD TexinfoML V4.12//EN"
"http://www.gnu.org/software/texinfo/dtd/4.12/texinfo.dtd">
<texinfo xml:lang="' . $self->get_conf('documentlanguage') ."\">\n";
- if ($self->get_conf('OUTFILE') ne '') {
+ if ($self->{'output_file'} ne '') {
my $output_filename = $self->{'output_filename'};
$header .= "<filename file=\"".$self->xml_protect_text($output_filename)
."\"></filename>\n";
Index: init/tex4ht.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/init/tex4ht.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- init/tex4ht.pm 2 Nov 2011 00:41:05 -0000 1.6
+++ init/tex4ht.pm 6 Nov 2011 00:55:28 -0000 1.7
@@ -204,7 +204,7 @@
}
}
-sub tex4ht_convert ($)
+sub tex4ht_convert($)
{
my $self = shift;
unless (chdir $tex4ht_out_dir) {
@@ -224,7 +224,7 @@
}
}
-sub tex4ht_process_command ($$) {
+sub tex4ht_process_command($$) {
my $self = shift;
my $command = shift;
- texinfo/tp TODO Texinfo/Convert/Converter.pm Te...,
Patrice Dumas <=