[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Fri, 22 Dec 2023 12:13:04 -0500 (EST) |
branch: master
commit 22107405a2e6d53eb809b14f64ffb378d3c62525
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Dec 22 13:55:25 2023 +0100
* tp/Texinfo/Convert/HTML.pm (_convert_explained_command): convert
explanation string only once, where it appears initially and reuse the
string instead of re-converting when an explanation is needed.
---
ChangeLog | 6 ++++++
tp/Texinfo/Convert/HTML.pm | 25 ++++++-------------------
2 files changed, 12 insertions(+), 19 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 9c84cda8fe..00c4cbbaaf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-12-22 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/HTML.pm (_convert_explained_command): convert
+ explanation string only once, where it appears initially and reuse the
+ string instead of re-converting when an explanation is needed.
+
2023-12-22 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/convert/convert_html.c (direction_a): rename
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 18fc2947cc..62c06ddd86 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -3332,31 +3332,18 @@ sub _convert_explained_command($$$$)
# for recursively-defined acronyms.
$explanation_result = $self->convert_tree($args->[1]->{'tree'},
"convert $cmdname explanation");
- $explained_commands->{$cmdname}->{$normalized_type} =
- $command->{'args'}->[1];
- } elsif ($element_explanation_content->{$command}) {
+ $explained_commands->{$cmdname}->{$normalized_type} = $explanation_string;
+ } elsif (exists($element_explanation_content->{$command})) {
# if an acronym element is formatted more than once, this ensures that
# only the first explanation (including a lack of explanation) is reused.
# Note that this means that acronyms converted first on a sectioning
# command line for a direction text may not get the explanation
# from acronyms appearing later on in the document but before
# the sectioning command.
- if ($element_explanation_content->{$command}->{'contents'}
- and scalar(@{$element_explanation_content->{$command}->{'contents'}})) {
- $explanation_string = $self->convert_tree_new_formatting_context(
- {'type' => '_string',
- 'contents' => [$element_explanation_content->{$command}]},
- $cmdname, $cmdname);
- }
+ $explanation_string = $element_explanation_content->{$command};
} elsif ($explained_commands->{$cmdname}->{$normalized_type}) {
- $explanation_string = $self->convert_tree_new_formatting_context(
- {'type' => '_string',
- 'contents' => [$explained_commands
- ->{$cmdname}->{$normalized_type}]},
- $cmdname, $cmdname);
-
- $element_explanation_content->{$command}
- = $explained_commands->{$cmdname}->{$normalized_type};
+ $explanation_string = $explained_commands->{$cmdname}->{$normalized_type};
+ $element_explanation_content->{$command} = $explanation_string;
} else {
# Avoid ever giving an explanation for this element, even if an
# explanation could appear later on, for instance if acronym is
@@ -3366,7 +3353,7 @@ sub _convert_explained_command($$$$)
# @acronym within the explanation could end up referring to the
# containing @acronym.
- $element_explanation_content->{$command} = {};
+ $element_explanation_content->{$command} = undef;
}
my $result = '';
if ($args and defined($args->[0])) {