[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Convert/HTML.pm (_prepare_converted_
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Convert/HTML.pm (_prepare_converted_output_info) (output), tp/Texinfo/XS/convert/convert_html.c (html_prepare_converted_output_info): move call of structure handler to the beginning of _prepare_converted_output_info out of output. |
Date: |
Tue, 01 Oct 2024 11:53:18 -0400 |
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 5bf4875620 * tp/Texinfo/Convert/HTML.pm
(_prepare_converted_output_info) (output), tp/Texinfo/XS/convert/convert_html.c
(html_prepare_converted_output_info): move call of structure handler to the
beginning of _prepare_converted_output_info out of output.
5bf4875620 is described below
commit 5bf4875620d50602b844d76ef2975b9d814a2e68
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Jul 24 15:18:30 2024 +0200
* tp/Texinfo/Convert/HTML.pm (_prepare_converted_output_info)
(output), tp/Texinfo/XS/convert/convert_html.c
(html_prepare_converted_output_info): move call of structure handler
to the beginning of _prepare_converted_output_info out of output.
* tp/Texinfo/Convert/HTML.pm (_finish_output, output): move code
occuring at the end of output to a new function, _finish_output.
---
ChangeLog | 10 +++++
tp/Texinfo/Convert/HTML.pm | 71 ++++++++++++++++++++++++------------
tp/Texinfo/XS/convert/convert_html.c | 8 ++++
3 files changed, 65 insertions(+), 24 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 46a0a09472..85b09fb8b5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,16 @@
(call_formatting_function_format_single_footnote): check and reset
flags in build_html_formatting_state.
+2024-07-24 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/HTML.pm (_prepare_converted_output_info)
+ (output), tp/Texinfo/XS/convert/convert_html.c
+ (html_prepare_converted_output_info): move call of structure handler
+ to the beginning of _prepare_converted_output_info out of output.
+
+ * tp/Texinfo/Convert/HTML.pm (_finish_output, output): move code
+ occuring at the end of output to a new function, _finish_output.
+
2024-07-24 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/Converter.pm (XS_get_unclosed_stream): rename
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 92a9bb2560..d7f3b32faf 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -12889,6 +12889,18 @@ sub _prepare_converted_output_info($$$$)
my $output_filename = shift;
my $output_units = shift;
+ my $stage_handlers = $self->{'stage_handlers'};
+ my $document = $self->{'document'};
+
+ my $structure_status = $self->run_stage_handlers($stage_handlers,
+ $document, 'structure');
+ my $handler_fatal_error_level = $self->get_conf('HANDLER_FATAL_ERROR_LEVEL');
+
+ unless ($structure_status < $handler_fatal_error_level
+ and $structure_status > -$handler_fatal_error_level) {
+ return 0;
+ }
+
my $default_document_language = $self->get_conf('documentlanguage');
$self->set_global_document_commands('preamble', ['documentlanguage']);
@@ -13005,9 +13017,8 @@ sub _prepare_converted_output_info($$$$)
# TODO document that this stage handler is called with end of preamble
# documentlanguage when it is certain that this will not change ever.
- my $init_status = $self->run_stage_handlers($self->{'stage_handlers'},
- $self->{'document'}, 'init');
- my $handler_fatal_error_level = $self->get_conf('HANDLER_FATAL_ERROR_LEVEL');
+ my $init_status = $self->run_stage_handlers($stage_handlers,
+ $document, 'init');
unless ($init_status < $handler_fatal_error_level
and $init_status > -$handler_fatal_error_level) {
return 0;
@@ -13497,6 +13508,36 @@ sub _setup_output($)
$document_name];
}
+sub _finish_output($$$$)
+{
+ my $self = shift;
+ my $output_file = shift;
+ my $destination_directory = shift;
+ my $files_source_info = shift;
+
+ _do_js_files($self, $destination_directory);
+
+ my $stage_handlers = $self->{'stage_handlers'};
+ my $handler_fatal_error_level = $self->get_conf('HANDLER_FATAL_ERROR_LEVEL');
+ my $finish_status = $self->run_stage_handlers($stage_handlers,
+ $self->{'document'}, 'finish');
+ unless ($finish_status < $handler_fatal_error_level
+ and $finish_status > -$handler_fatal_error_level) {
+ return 0;
+ }
+
+ # undef status means an error occured, we should return immediately after
+ # calling $self->conversion_finalization() in that case.
+ my $node_redirections_status = _node_redirections($self, $output_file,
+ $destination_directory, $files_source_info);
+
+ if (!defined($node_redirections_status)) {
+ return 0;
+ }
+
+ return 1;
+}
+
# Main function for outputting a manual in HTML.
# $SELF is the output converter object of class Texinfo::Convert::HTML (this
# module), and $DOCUMENT is the parsed document from the parser and structuring
@@ -13528,18 +13569,6 @@ sub output($$)
$output_file, $destination_directory, $output_filename,
$document_name);
- my $stage_handlers = $self->{'stage_handlers'};
-
- my $structure_status = $self->run_stage_handlers($stage_handlers,
- $document, 'structure');
- my $handler_fatal_error_level = $self->get_conf('HANDLER_FATAL_ERROR_LEVEL');
-
- unless ($structure_status < $handler_fatal_error_level
- and $structure_status > -$handler_fatal_error_level) {
- $self->conversion_finalization();
- return undef;
- }
-
my $succeeded = _prepare_converted_output_info($self, $output_file,
$output_filename, $output_units);
if (!$succeeded) {
@@ -13568,20 +13597,14 @@ sub output($$)
return $text_output;
}
- $self->_do_js_files($destination_directory);
+ my $finish_succeeded = _finish_output($self, $output_file,
+ $destination_directory, $files_source_info);
- my $finish_status = $self->run_stage_handlers($stage_handlers,
- $document, 'finish');
- unless ($finish_status < $handler_fatal_error_level
- and $finish_status > -$handler_fatal_error_level) {
+ if (!$finish_succeeded) {
$self->conversion_finalization();
return undef;
}
- # undef status means an error occured, we should return immediately after
- # calling $self->conversion_finalization() in that case.
- my $node_redirections_status = _node_redirections($self, $output_file,
- $destination_directory, $files_source_info);
$self->conversion_finalization();
return undef;
}
diff --git a/tp/Texinfo/XS/convert/convert_html.c
b/tp/Texinfo/XS/convert/convert_html.c
index 3f7c355b6c..b27bc86f4d 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -16569,6 +16569,14 @@ html_prepare_converted_output_info (CONVERTER *self,
const char *output_file,
int handler_fatal_error_level
= self->conf->HANDLER_FATAL_ERROR_LEVEL.o.integer;
+ int structure_handler_status = run_stage_handlers (self,
HSHT_type_structure);
+
+ if (structure_handler_status < handler_fatal_error_level
+ && structure_handler_status > -handler_fatal_error_level)
+ {}
+ else
+ return 0;
+
if (self->conf->documentlanguage.o.string)
default_document_language = strdup (self->conf->documentlanguage.o.string);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Convert/HTML.pm (_prepare_converted_output_info) (output), tp/Texinfo/XS/convert/convert_html.c (html_prepare_converted_output_info): move call of structure handler to the beginning of _prepare_converted_output_info out of output.,
Patrice Dumas <=