[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/ConvertXS.xs (html_prepare_converted_output_info), tp/Texinfo/XS/convert/convert_html.c (html_prepare_converted_output_info): move code from output, before and after _prepare_converted_output_info to _prepare_converted_output_info, including call of prepare_title_titlepage. Add arguments for prepare_title_titlepage. Update XS override and C code. |
Date: |
Tue, 01 Oct 2024 11:24:55 -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 63b471a4b7 * tp/Texinfo/Convert/HTML.pm
(_prepare_converted_output_info) (output), tp/Texinfo/XS/convert/ConvertXS.xs
(html_prepare_converted_output_info), tp/Texinfo/XS/convert/convert_html.c
(html_prepare_converted_output_info): move code from output, before and after
_prepare_converted_output_info to _prepare_converted_output_info, including
call of prepare_title_titlepage. Add arguments for prepare_title_titlepage.
Update XS override and C code.
63b471a4b7 is described below
commit 63b471a4b74703a8789825b6df50659aafbcbe88
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Jul 24 14:09:49 2024 +0200
* tp/Texinfo/Convert/HTML.pm (_prepare_converted_output_info)
(output), tp/Texinfo/XS/convert/ConvertXS.xs
(html_prepare_converted_output_info),
tp/Texinfo/XS/convert/convert_html.c
(html_prepare_converted_output_info): move code from output, before
and after _prepare_converted_output_info to
_prepare_converted_output_info, including call of
prepare_title_titlepage. Add arguments for prepare_title_titlepage.
Update XS override and C code.
---
ChangeLog | 12 ++++++
tp/Texinfo/Convert/HTML.pm | 83 ++++++++++++++++++++----------------
tp/Texinfo/XS/convert/ConvertXS.xs | 15 +++++--
tp/Texinfo/XS/convert/convert_html.c | 43 ++++++++++++++++++-
tp/Texinfo/XS/convert/convert_html.h | 4 +-
5 files changed, 115 insertions(+), 42 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 05f5f136cf..a0a330ef37 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,18 @@
(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/ConvertXS.xs
+ (html_prepare_converted_output_info),
+ tp/Texinfo/XS/convert/convert_html.c
+ (html_prepare_converted_output_info): move code from output, before
+ and after _prepare_converted_output_info to
+ _prepare_converted_output_info, including call of
+ prepare_title_titlepage. Add arguments for prepare_title_titlepage.
+ Update XS override and C code.
+
2024-07-24 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/convert/ConvertXS.xs (html_conversion_finalization)
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 85d94937e0..ced8d9ab78 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -12882,9 +12882,27 @@ sub _do_js_files($$)
}
}
-sub _prepare_converted_output_info($)
+sub _prepare_converted_output_info($$$$)
{
my $self = shift;
+ my $output_file = shift;
+ my $output_filename = shift;
+ my $output_units = shift;
+
+ my $default_document_language = $self->get_conf('documentlanguage');
+
+ $self->set_global_document_commands('preamble', ['documentlanguage']);
+
+ my $preamble_document_language = $self->get_conf('documentlanguage');
+
+ if (not (!defined($default_document_language)
+ and !defined($preamble_document_language))
+ and (!defined($default_document_language)
+ or !defined($preamble_document_language)
+ or $default_document_language ne $preamble_document_language)) {
+ $self->_translate_names();
+ }
+
# prepare title. fulltitle uses more possibility than simpletitle for
# title, including @-commands found in @titlepage only. Therefore
# simpletitle is more in line with what makeinfo in C did.
@@ -12984,6 +13002,31 @@ sub _prepare_converted_output_info($)
$self->{'converter_info'}->{'documentdescription_string'}
= $documentdescription_string;
}
+
+ # 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');
+ unless ($init_status < $handler_fatal_error_level
+ and $init_status > -$handler_fatal_error_level) {
+ return 0;
+ }
+
+ $self->_prepare_title_titlepage($output_file, $output_filename,
+ $output_units);
+
+ $self->set_global_document_commands('before', ['documentlanguage']);
+
+ if (not (!defined($default_document_language)
+ and !defined($preamble_document_language))
+ and (!defined($default_document_language)
+ or !defined($preamble_document_language)
+ or $default_document_language ne $preamble_document_language)) {
+ $self->_translate_names();
+ }
+
+ return 1;
}
# units or root conversion
@@ -13497,45 +13540,13 @@ sub output($$)
return undef;
}
- my $default_document_language = $self->get_conf('documentlanguage');
-
- $self->set_global_document_commands('preamble', ['documentlanguage']);
-
- my $preamble_document_language = $self->get_conf('documentlanguage');
-
- if (not (!defined($default_document_language)
- and !defined($preamble_document_language))
- and (!defined($default_document_language)
- or !defined($preamble_document_language)
- or $default_document_language ne $preamble_document_language)) {
- $self->_translate_names();
- }
-
- $self->_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($stage_handlers,
- $document, 'init');
- unless ($init_status < $handler_fatal_error_level
- and $init_status > -$handler_fatal_error_level) {
+ my $succeeded = _prepare_converted_output_info($self, $output_file,
+ $output_filename, $output_units);
+ if (!$succeeded) {
$self->conversion_finalization();
return undef;
}
- $self->_prepare_title_titlepage($output_file, $output_filename,
- $output_units);
-
- $self->set_global_document_commands('before', ['documentlanguage']);
-
- if (not (!defined($default_document_language)
- and !defined($preamble_document_language))
- and (!defined($default_document_language)
- or !defined($preamble_document_language)
- or $default_document_language ne $preamble_document_language)) {
- $self->_translate_names();
- }
-
# conversion
my $text_output = $self->_html_convert_output($output_file,
$destination_directory, $output_filename,
$document_name,
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs
b/tp/Texinfo/XS/convert/ConvertXS.xs
index bc034f58a9..3e21c8c246 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -2279,15 +2279,24 @@ html_prepare_simpletitle (SV *converter_in)
html_prepare_simpletitle (self);
}
-void
-html_prepare_converted_output_info (SV *converter_in)
+int
+html_prepare_converted_output_info (SV *converter_in, output_file,
output_filename, ...)
+ const char *output_file = (char *)SvPVutf8_nolen($arg);
+ const char *output_filename = (char *)SvPVutf8_nolen($arg);
+ PROTOTYPE: $$$$
PREINIT:
CONVERTER *self = 0;
+ int status = 0;
CODE:
self = get_sv_converter (converter_in,
"html_prepare_converted_output_info");
if (self)
- html_prepare_converted_output_info (self);
+ status = html_prepare_converted_output_info (self, output_file,
+ output_filename);
+ RETVAL = status;
+ OUTPUT:
+ RETVAL
+
# $output_units
void
diff --git a/tp/Texinfo/XS/convert/convert_html.c
b/tp/Texinfo/XS/convert/convert_html.c
index 1db6eef070..3f7c355b6c 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -16556,12 +16556,32 @@ const static enum command_id fulltitle_cmds[] =
{CM_settitle, CM_title, CM_shorttitlepage, CM_top, 0};
-void
-html_prepare_converted_output_info (CONVERTER *self)
+int
+html_prepare_converted_output_info (CONVERTER *self, const char *output_file,
+ const char *output_filename)
{
int i;
ELEMENT *fulltitle_tree = 0;
char *html_title_string = 0;
+ char *default_document_language = 0;
+ char *preamble_document_language = 0;
+ int init_handler_status;
+ int handler_fatal_error_level
+ = self->conf->HANDLER_FATAL_ERROR_LEVEL.o.integer;
+
+ if (self->conf->documentlanguage.o.string)
+ default_document_language = strdup (self->conf->documentlanguage.o.string);
+
+ set_global_document_commands (self, CL_preamble, conf_for_documentlanguage);
+
+ if (self->conf->documentlanguage.o.string)
+ preamble_document_language = strdup
(self->conf->documentlanguage.o.string);
+
+ if (! (!default_document_language && !preamble_document_language)
+ && (!default_document_language || !preamble_document_language
+ || strcmp (default_document_language, preamble_document_language)))
+ html_translate_names (self);
+
/*
prepare title. fulltitle uses more possibility than simpletitle for
title, including @-commands found in @titlepage only. Therefore
@@ -16689,6 +16709,25 @@ html_prepare_converted_output_info (CONVERTER *self)
self->documentdescription_string = documentdescription_string;
}
+
+ init_handler_status = run_stage_handlers (self, HSHT_type_init);
+
+ if (init_handler_status < handler_fatal_error_level
+ && init_handler_status > -handler_fatal_error_level)
+ {}
+ else
+ return 0;
+
+ html_prepare_title_titlepage (self, output_file, output_filename);
+
+ set_global_document_commands (self, CL_before, conf_for_documentlanguage);
+
+ if (! (!default_document_language && !preamble_document_language)
+ && (!default_document_language || !preamble_document_language
+ || strcmp (default_document_language, preamble_document_language)))
+ html_translate_names (self);
+
+ return 1;
}
void
diff --git a/tp/Texinfo/XS/convert/convert_html.h
b/tp/Texinfo/XS/convert/convert_html.h
index 6109206034..b85af597b4 100644
--- a/tp/Texinfo/XS/convert/convert_html.h
+++ b/tp/Texinfo/XS/convert/convert_html.h
@@ -231,7 +231,9 @@ const OUTPUT_UNIT *html_find_direction_name_global_unit
(const CONVERTER *self,
void html_translate_names (CONVERTER *self);
void html_prepare_simpletitle (CONVERTER *self);
-void html_prepare_converted_output_info (CONVERTER *self);
+int html_prepare_converted_output_info (CONVERTER *self,
+ const char *output_file,
+ const char *output_filename);
void html_prepare_title_titlepage (CONVERTER *self, const char *output_file,
const char *output_filename);
[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/ConvertXS.xs (html_prepare_converted_output_info), tp/Texinfo/XS/convert/convert_html.c (html_prepare_converted_output_info): move code from output, before and after _prepare_converted_output_info to _prepare_converted_output_info, including call of prepare_title_titlepage. Add arguments for prepare_title_titlepage. Update XS override and C code.,
Patrice Dumas <=