[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Convert/Converter.pm (set_tree_unit_
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Convert/Converter.pm (set_tree_unit_file) (_set_tree_units_files, output), tp/Texinfo/Convert/HTML.pm (_html_set_pages_files, output): set 'out_filepaths' in the parser to associate file names without output file paths and not 'out_filepath' in the elements. |
Date: |
Sat, 08 Jan 2022 06:41:06 -0500 |
This is an automated email from the git hooks/post-receive script.
pertusus pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new 6abeae2578 * tp/Texinfo/Convert/Converter.pm (set_tree_unit_file)
(_set_tree_units_files, output), tp/Texinfo/Convert/HTML.pm
(_html_set_pages_files, output): set 'out_filepaths' in the parser to associate
file names without output file paths and not 'out_filepath' in the elements.
6abeae2578 is described below
commit 6abeae2578b7967e11a7c2377aff0fe130a9e62d
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Jan 8 12:40:56 2022 +0100
* tp/Texinfo/Convert/Converter.pm (set_tree_unit_file)
(_set_tree_units_files, output), tp/Texinfo/Convert/HTML.pm
(_html_set_pages_files, output): set 'out_filepaths'
in the parser to associate file names without output file
paths and not 'out_filepath' in the elements.
---
ChangeLog | 8 ++++++++
tp/Texinfo/Convert/Converter.pm | 23 +++++++++++++----------
tp/Texinfo/Convert/HTML.pm | 24 ++++++++++++++----------
3 files changed, 35 insertions(+), 20 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8f09b8b794..9c6d4d8b20 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-01-08 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/Converter.pm (set_tree_unit_file)
+ (_set_tree_units_files, output), tp/Texinfo/Convert/HTML.pm
+ (_html_set_pages_files, output): set 'out_filepaths'
+ in the parser to associate file names without output file
+ paths and not 'out_filepath' in the elements.
+
2022-01-08 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/Converter.pm (set_tree_unit_file)
diff --git a/tp/Texinfo/Convert/Converter.pm b/tp/Texinfo/Convert/Converter.pm
index 24bc854145..6642ca29f3 100644
--- a/tp/Texinfo/Convert/Converter.pm
+++ b/tp/Texinfo/Convert/Converter.pm
@@ -547,6 +547,7 @@ sub node_information_filename($$)
return $filename;
}
+# sets out_filepaths converter state
sub set_tree_unit_file($$$$)
{
my $self = shift;
@@ -570,10 +571,10 @@ sub set_tree_unit_file($$$$)
}
$tree_unit->{'structure'}->{'unit_filename'} = $filename;
if (defined($destination_directory) and $destination_directory ne '') {
- $tree_unit->{'out_filepath'} =
+ $self->{'out_filepaths'}->{$filename} =
File::Spec->catfile($destination_directory, $filename);
} else {
- $tree_unit->{'out_filepath'} = $filename;
+ $self->{'out_filepaths'}->{$filename} = $filename;
}
}
@@ -622,6 +623,8 @@ sub _get_root_element($$)
}
}
+# set file_counters converter state
+# sets out_filepaths converter state
sub _set_tree_units_files($$$$$$)
{
my $self = shift;
@@ -643,7 +646,7 @@ sub _set_tree_units_files($$$$$$)
foreach my $tree_unit (@$tree_units) {
if (!defined($tree_unit->{'structure'}->{'unit_filename'})) {
$tree_unit->{'structure'}->{'unit_filename'} = $output_filename;
- $tree_unit->{'out_filepath'} = $output_file;
+ $self->{'out_filepaths'}->{$output_filename} = $output_file;
}
}
} else {
@@ -718,8 +721,6 @@ sub _set_tree_units_files($$$$$$)
}
$tree_unit->{'structure'}->{'unit_filename'}
=
$tree_unit->{'extra'}->{'first_in_page'}->{'structure'}->{'unit_filename'};
- $tree_unit->{'out_filepath'}
- = $tree_unit->{'extra'}->{'first_in_page'}->{'out_filepath'};
}
}
@@ -735,6 +736,7 @@ sub _set_tree_units_files($$$$$$)
# In general, converters override this method, but simple
# converters can use it. It is used for the plaintext
# output format.
+# use file_counters and out_filepaths converter states.
sub output($$)
{
my $self = shift;
@@ -836,16 +838,17 @@ sub output($$)
foreach my $tree_unit (@$tree_units) {
my $tree_unit_filename = $tree_unit->{'structure'}->{'unit_filename'};
+ my $out_filepath = $self->{'out_filepaths'}->{$tree_unit_filename};
my $file_fh;
# open the file and output the elements
if (!$files{$tree_unit_filename}->{'fh'}) {
$file_fh = Texinfo::Common::output_files_open_out(
$self->output_files_information(), $self,
- $tree_unit->{'out_filepath'});
+ $out_filepath);
if (!$file_fh) {
$self->document_error($self,
sprintf(__("could not open %s for writing: %s"),
- $tree_unit->{'out_filepath'}, $!));
+ $out_filepath, $!));
return undef;
}
$files{$tree_unit_filename}->{'fh'} = $file_fh;
@@ -857,13 +860,13 @@ sub output($$)
$self->{'file_counters'}->{$tree_unit_filename}--;
if ($self->{'file_counters'}->{$tree_unit_filename} == 0) {
# NOTE do not close STDOUT here to avoid a perl warning
- if ($tree_unit->{'out_filepath'} ne '-') {
+ if ($out_filepath ne '-') {
Texinfo::Common::output_files_register_closed(
- $self->output_files_information(), $tree_unit->{'out_filepath'});
+ $self->output_files_information(), $out_filepath);
if (!close($file_fh)) {
$self->document_error($self,
sprintf(__("error on closing %s: %s"),
- $tree_unit->{'out_filepath'}, $!));
+ $out_filepath, $!));
return undef;
}
}
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index bda5b303fc..2ea20738cf 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -6067,6 +6067,12 @@ sub _load_htmlxref_files {
# target information hash references described above before
# the API functions used to access those informations.
# htmlxref
+# out_filepaths
+# file_counters
+# paragraph_symbol
+# line_break_element
+#
+# commands_conversion
sub converter_initialize($)
{
@@ -6792,7 +6798,7 @@ sub _html_set_pages_files($$$$$$$$)
foreach my $tree_unit (@$tree_units) {
if (!defined($tree_unit->{'structure'}->{'unit_filename'})) {
$tree_unit->{'structure'}->{'unit_filename'} = $output_filename;
- $tree_unit->{'out_filepath'} = $output_file;
+ $self->{'out_filepaths'}->{$output_filename} = $output_file;
}
}
} else {
@@ -6874,8 +6880,6 @@ sub _html_set_pages_files($$$$$$$$)
}
$tree_unit->{'structure'}->{'unit_filename'}
=
$tree_unit->{'extra'}->{'first_in_page'}->{'structure'}->{'unit_filename'};
- $tree_unit->{'out_filepath'}
- = $tree_unit->{'extra'}->{'first_in_page'}->{'out_filepath'};
}
}
@@ -8472,7 +8476,6 @@ sub output($$)
if (!defined($special_element->{'structure'}->{'unit_filename'})) {
$special_element->{'structure'}->{'unit_filename'}
= $tree_units->[0]->{'structure'}->{'unit_filename'};
- $special_element->{'out_filepath'} =
$tree_units->[0]->{'out_filepath'};
$self->{'file_counters'}->{$special_element->{'structure'}->{'unit_filename'}}++;
}
}
@@ -8652,7 +8655,7 @@ sub output($$)
# this can be used in init file when there are no tree units.
# FIXME use an API? Set in $self->{'no_page'}?
$self->{'structure'}->{'unit_filename'} = $no_page_output_filename;
- $self->{'out_filepath'} = $no_page_out_filepath;
+ $self->{'out_filepaths'}->{$no_page_output_filename} =
$no_page_out_filepath;
$self->{'current_filename'} = $no_page_output_filename;
} else {
@@ -8707,6 +8710,7 @@ sub output($$)
$special_elements = [] if (!defined($special_elements));
foreach my $element (@$tree_units, @$special_elements) {
my $element_filename = $element->{'structure'}->{'unit_filename'};
+ my $out_filepath = $self->{'out_filepaths'}->{$element_filename};
$self->{'current_filename'} = $element_filename;
$self->{'counter_in_file'}->{$element_filename}++;
if ($self->{'counter_in_file'}->{$element_filename} == 1) {
@@ -8749,11 +8753,11 @@ sub output($$)
my $file_element = $files{$element_filename}->{'first_element'};
my $file_fh = Texinfo::Common::output_files_open_out(
$self->output_files_information(), $self,
- $file_element->{'out_filepath'});
+ $out_filepath);
if (!$file_fh) {
$self->document_error($self,
sprintf(__("could not open %s for writing: %s"),
- $file_element->{'out_filepath'}, $!));
+ $out_filepath, $!));
return undef;
}
# do end file first in case it requires some CSS
@@ -8765,13 +8769,13 @@ sub output($$)
print $file_fh "". $end_file;
# NOTE do not close STDOUT here to avoid a perl warning
- if ($file_element->{'out_filepath'} ne '-') {
+ if ($out_filepath ne '-') {
Texinfo::Common::output_files_register_closed(
- $self->output_files_information(),
$file_element->{'out_filepath'});
+ $self->output_files_information(), $out_filepath);
if (!close($file_fh)) {
$self->document_error($self,
sprintf(__("error on closing %s: %s"),
- $file_element->{'out_filepath'}, $!));
+ $out_filepath, $!));
return undef;
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Convert/Converter.pm (set_tree_unit_file) (_set_tree_units_files, output), tp/Texinfo/Convert/HTML.pm (_html_set_pages_files, output): set 'out_filepaths' in the parser to associate file names without output file paths and not 'out_filepath' in the elements.,
Patrice Dumas <=
- Prev by Date:
branch master updated: * tp/Texinfo/Convert/Converter.pm (set_tree_unit_file) (_set_tree_units_files, output), tp/Texinfo/Convert/HTML.pm (command_filename, command_href, _default_format_element_header) (_convert_special_element_type, _default_format_element_footer) (_html_set_pages_files, output), tp/Texinfo/Structuring.pm (elements_file_directions), tp/init/book.pm, tp/init/chm.pm, tp/init/epub3.pm, tp/t/init/t2h_singular.init: put 'unit_filename' in 'structure' hash reference.
- Next by Date:
branch master updated: Fix changelog entry to mention the converter and not the parser
- Previous by thread:
branch master updated: * tp/Texinfo/Convert/Converter.pm (set_tree_unit_file) (_set_tree_units_files, output), tp/Texinfo/Convert/HTML.pm (command_filename, command_href, _default_format_element_header) (_convert_special_element_type, _default_format_element_footer) (_html_set_pages_files, output), tp/Texinfo/Structuring.pm (elements_file_directions), tp/init/book.pm, tp/init/chm.pm, tp/init/epub3.pm, tp/t/init/t2h_singular.init: put 'unit_filename' in 'structure' hash reference.
- Next by thread:
branch master updated: Fix changelog entry to mention the converter and not the parser
- Index(es):