[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * doc/texi2any_api.texi (Conversion General Infor
From: |
Patrice Dumas |
Subject: |
branch master updated: * doc/texi2any_api.texi (Conversion General Information), tp/Texinfo/Convert/HTML.p (%available_converter_info) (_convert_heading_command), tp/init/book.pm: add expanded_formats to available_converter_info. |
Date: |
Tue, 26 Dec 2023 03:17:56 -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 fab7dba9ef * doc/texi2any_api.texi (Conversion General Information),
tp/Texinfo/Convert/HTML.p (%available_converter_info)
(_convert_heading_command), tp/init/book.pm: add expanded_formats to
available_converter_info.
fab7dba9ef is described below
commit fab7dba9efa19d59c43caee8d65c15f8e955c607
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Dec 26 09:17:51 2023 +0100
* doc/texi2any_api.texi (Conversion General Information),
tp/Texinfo/Convert/HTML.p (%available_converter_info)
(_convert_heading_command), tp/init/book.pm: add expanded_formats to
available_converter_info.
* tp/Texinfo/Convert/HTML.pm (%default_shared_conversion_states),
tp/Texinfo/XS/convert/convert_html.c (html_initialize_output_state)
(html_reset_converter), tp/Texinfo/XS/convert/get_html_perl_info.c
(html_set_shared_conversion_state, html_get_shared_conversion_state)
(get_expanded_formats), tp/Texinfo/XS/main/converter_types.h
(HTML_SHARED_CONVERSION_STATE): remove expanded_format_raw shared
conversion state.
---
ChangeLog | 15 ++++++++
doc/texi2any_api.texi | 7 ++++
tp/Texinfo/Convert/HTML.pm | 20 ++---------
tp/Texinfo/XS/convert/convert_html.c | 4 ---
tp/Texinfo/XS/convert/get_html_perl_info.c | 55 +++++++++---------------------
tp/Texinfo/XS/main/converter_types.h | 3 --
tp/init/book.pm | 16 +--------
7 files changed, 42 insertions(+), 78 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e407cd1a17..5c718bf380 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2023-12-26 Patrice Dumas <pertusus@free.fr>
+
+ * doc/texi2any_api.texi (Conversion General Information),
+ tp/Texinfo/Convert/HTML.p (%available_converter_info)
+ (_convert_heading_command), tp/init/book.pm: add expanded_formats to
+ available_converter_info.
+
+ * tp/Texinfo/Convert/HTML.pm (%default_shared_conversion_states),
+ tp/Texinfo/XS/convert/convert_html.c (html_initialize_output_state)
+ (html_reset_converter), tp/Texinfo/XS/convert/get_html_perl_info.c
+ (html_set_shared_conversion_state, html_get_shared_conversion_state)
+ (get_expanded_formats), tp/Texinfo/XS/main/converter_types.h
+ (HTML_SHARED_CONVERSION_STATE): remove expanded_format_raw shared
+ conversion state.
+
2023-12-25 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/convert/get_html_perl_info.c (find_element_from_sv):
diff --git a/doc/texi2any_api.texi b/doc/texi2any_api.texi
index 014a13f3c2..da699e1755 100644
--- a/doc/texi2any_api.texi
+++ b/doc/texi2any_api.texi
@@ -1785,6 +1785,13 @@ string needs to be encoded. @xref{Encoding File Path
Strings}.
(@pxref{@code{@@documentdescription},,, texinfo, Texinfo}). @xref{Init File
Expansion Contexts}.
+@item expanded_formats
+Information on output formats such as @samp{html} or @samp{tex}
+expansion (@pxref{Conditional Commands,,, texinfo, Texinfo}). An
+hash reference with format names as key and a true value as value if
+the format is expanded, according to command-line and init file
+information.
+
@item floats
Information on floats. Gathered from the Texinfo parsing result.
@xref{Texinfo::Document $float_types = floats_information($document),,
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index f2ec7623a9..42b78c1962 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -1964,8 +1964,7 @@ sub get_value($$)
}
my %default_shared_conversion_states = (
- 'top' => {'in_skipped_node_top' => ['integer'],
- 'expanded_format_raw' => ['string', 'integer']},
+ 'top' => {'in_skipped_node_top' => ['integer'],},
'abbr' => {'explained_commands' => ['string', 'string']},
'acronym' => {'explained_commands' => ['string', 'string']},
'footnote' => {'footnote_number' => ['integer'],
@@ -2288,6 +2287,7 @@ sub get_file_information($$;$)
my %available_converter_info;
foreach my $converter_info ('copying_comment', 'current_filename',
'destination_directory', 'document_name', 'documentdescription_string',
+ 'expanded_formats',
'floats', 'global_commands',
'index_entries', 'index_entries_by_letter', 'indices_information',
'jslicenses', 'identifiers_target',
@@ -4781,23 +4781,9 @@ sub _convert_heading_command($$$$$)
} else {
my $use_next_heading = 0;
if ($self->get_conf('USE_NEXT_HEADING_FOR_LONE_NODE')) {
- my $expanded_format_raw
- = $self->get_shared_conversion_state('top',
'expanded_format_raw');
- # if no format is expanded, the formats will be checked each time
- # but this is very unlikely, as html is always expanded.
- if (!defined($expanded_format_raw)
- or !scalar(keys(%$expanded_format_raw))) {
- foreach my $output_format_command
- (keys(%Texinfo::Common::texinfo_output_formats)) {
- if ($self->is_format_expanded($output_format_command)) {
- $self->set_shared_conversion_state('top',
'expanded_format_raw',
- $output_format_command, 1);
- }
- }
- }
my $next_heading
= Texinfo::Convert::Utils::find_root_command_next_heading_command(
- $element, $expanded_format_raw,
+ $element, $self->get_info('expanded_formats'),
($self->get_conf('CONTENTS_OUTPUT_LOCATION') eq
'inline'));
if ($next_heading) {
$use_next_heading = 1;
diff --git a/tp/Texinfo/XS/convert/convert_html.c
b/tp/Texinfo/XS/convert/convert_html.c
index f7b647bb4c..41ecc05507 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -11198,9 +11198,6 @@ html_initialize_output_state (CONVERTER *self, char
*context)
}
free (sorted_index_names);
}
-
- self->shared_conversion_state.expanded_format_raw
- = new_expanded_formats ();
}
void
@@ -11301,7 +11298,6 @@ html_reset_converter (CONVERTER *self)
}
free (self->shared_conversion_state.footnote_id_numbers);
- free (self->shared_conversion_state.expanded_format_raw);
if (self->document->index_names)
{
diff --git a/tp/Texinfo/XS/convert/get_html_perl_info.c
b/tp/Texinfo/XS/convert/get_html_perl_info.c
index fd5556797f..f173a23eb8 100644
--- a/tp/Texinfo/XS/convert/get_html_perl_info.c
+++ b/tp/Texinfo/XS/convert/get_html_perl_info.c
@@ -1570,15 +1570,6 @@ html_set_shared_conversion_state (CONVERTER *converter,
SV *converter_in,
if (target_info)
target_info->formatted_nodedescription_nr = number;
}
- else if (!strcmp (state_name, "expanded_format_raw"))
- {
- char *format = (char *)SvPVutf8_nolen(args_sv[0]);
- int expanded = SvIV (args_sv[1]);
- if (expanded)
- add_expanded_format
- (converter->shared_conversion_state.expanded_format_raw,
- format);
- }
else if (!strcmp (state_name, "in_skipped_node_top"))
{
int in_skipped_node_top = SvIV (args_sv[0]);
@@ -1641,38 +1632,24 @@ html_get_shared_conversion_state (CONVERTER *converter,
SV *converter_in,
if (target_info && target_info->formatted_nodedescription_nr > 0)
return newSViv (target_info->formatted_nodedescription_nr);
}
- else if (!strcmp (state_name, "expanded_format_raw"))
- {
- char *format;
+ else if (!strcmp (state_name, "in_skipped_node_top"))
+ return newSViv(converter->shared_conversion_state.in_skipped_node_top);
+ return newSV (0);
+}
- if (args_nr == 0)
- {
- int i;
- HV *expanded_hv = newHV ();
- for (i = 0; i < expanded_formats_number (); i++)
- {
- if (converter->shared_conversion_state
- .expanded_format_raw[i].expandedp)
- {
- char *format = converter->shared_conversion_state
- .expanded_format_raw[i].format;
- hv_store (expanded_hv, format, strlen (format),
- newSViv (1), 0);
- }
- }
- return newRV_noinc ((SV *)expanded_hv);
- }
- else if (args_nr > 0)
+SV *
+get_expanded_formats (EXPANDED_FORMAT *expanded_formats)
+{
+ int i;
+ HV *expanded_hv = newHV ();
+ for (i = 0; i < expanded_formats_number (); i++)
+ {
+ if (expanded_formats[i].expandedp)
{
- format = (char *)SvPVutf8_nolen(args_sv[0]);
- int expanded
- = format_expanded_p (
- converter->shared_conversion_state.expanded_format_raw,
- format);
- return newSViv(expanded);
+ char *format = expanded_formats[i].format;
+ hv_store (expanded_hv, format, strlen (format),
+ newSViv (1), 0);
}
}
- else if (!strcmp (state_name, "in_skipped_node_top"))
- return newSViv(converter->shared_conversion_state.in_skipped_node_top);
- return newSV (0);
+ return newRV_noinc ((SV *)expanded_hv);
}
diff --git a/tp/Texinfo/XS/main/converter_types.h
b/tp/Texinfo/XS/main/converter_types.h
index 88d2ce65b6..bb426af095 100644
--- a/tp/Texinfo/XS/main/converter_types.h
+++ b/tp/Texinfo/XS/main/converter_types.h
@@ -302,9 +302,6 @@ typedef struct FOOTNOTE_ID_NUMBER {
typedef struct HTML_SHARED_CONVERSION_STATE {
int in_skipped_node_top;
- /* not used in C, directly use expanded formats in the converter.
- Needed in perl as expanded formats are accessed per format in the API */
- EXPANDED_FORMAT *expanded_format_raw;
EXPLAINED_COMMAND_TYPE_LIST explained_commands;
/* explained_commands->{char $cmdname}->{char $normalized_type}
= explanation */
diff --git a/tp/init/book.pm b/tp/init/book.pm
index 55db5a1517..8d72a833ed 100644
--- a/tp/init/book.pm
+++ b/tp/init/book.pm
@@ -331,23 +331,9 @@ sub book_convert_heading_command($$$$$)
} else {
my $use_next_heading = 0;
if ($self->get_conf('USE_NEXT_HEADING_FOR_LONE_NODE')) {
- my $expanded_format_raw
- = $self->get_shared_conversion_state('top',
'expanded_format_raw');
- # if no format is expanded, the formats will be checked each time
- # but this is very unlikely, as html is always expanded.
- if (!defined($expanded_format_raw)
- or !scalar(keys(%$expanded_format_raw))) {
- foreach my $output_format_command
- (keys(%Texinfo::Common::texinfo_output_formats)) {
- if ($self->is_format_expanded($output_format_command)) {
- $self->set_shared_conversion_state('top',
'expanded_format_raw',
- $output_format_command, 1);
- }
- }
- }
my $next_heading
= Texinfo::Convert::Utils::find_root_command_next_heading_command(
- $element, $expanded_format_raw,
+ $element, $self->get_info('expanded_formats'),
($self->get_conf('CONTENTS_OUTPUT_LOCATION') eq
'inline'));
if ($next_heading) {
$use_next_heading = 1;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * doc/texi2any_api.texi (Conversion General Information), tp/Texinfo/Convert/HTML.p (%available_converter_info) (_convert_heading_command), tp/init/book.pm: add expanded_formats to available_converter_info.,
Patrice Dumas <=