[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Convert/HTML.pm (_convert_anchor_com
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Convert/HTML.pm (_convert_anchor_command): get id only if it will be used. |
Date: |
Fri, 22 Dec 2023 16:17:27 -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 579f7c2796 * tp/Texinfo/Convert/HTML.pm (_convert_anchor_command): get
id only if it will be used.
579f7c2796 is described below
commit 579f7c2796791469db2f82f561a87dfa9764ffc2
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Dec 22 22:17:24 2023 +0100
* tp/Texinfo/Convert/HTML.pm (_convert_anchor_command): get id only if
it will be used.
* tp/Texinfo/XS/convert/convert_html.c (convert_anchor_command)
(commands_internal_conversion_table): implement convert_anchor_command
in C.
---
ChangeLog | 9 +++++++++
tp/Texinfo/Convert/HTML.pm | 11 ++++++-----
tp/Texinfo/XS/convert/convert_html.c | 18 ++++++++++++++++++
3 files changed, 33 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 35fa5f3b94..774a549b94 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2023-12-22 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/HTML.pm (_convert_anchor_command): get id only if
+ it will be used.
+
+ * tp/Texinfo/XS/convert/convert_html.c (convert_anchor_command)
+ (commands_internal_conversion_table): implement convert_anchor_command
+ in C.
+
2023-12-22 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/HTML.pm (_convert_explained_command): remove
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index bf518370b1..f46fe286b7 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -3370,11 +3370,12 @@ sub _convert_anchor_command($$$$)
my $command = shift;
my $args = shift;
- my $id = $self->command_id($command);
- if (defined($id) and $id ne '' and !in_multi_expanded($self)
- and !in_string($self)) {
- return &{$self->formatting_function('format_separate_anchor')}($self,
- $id, 'anchor');
+ if (!in_multi_expanded($self) and !in_string($self)) {
+ my $id = $self->command_id($command);
+ if (defined($id) and $id ne '') {
+ return &{$self->formatting_function('format_separate_anchor')}($self,
+ $id, 'anchor');
+ }
}
return '';
}
diff --git a/tp/Texinfo/XS/convert/convert_html.c
b/tp/Texinfo/XS/convert/convert_html.c
index 88e19cff9c..63a2e59c2d 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -8392,6 +8392,23 @@ convert_explained_command (CONVERTER *self, const enum
command_id cmd,
}
}
+void
+convert_anchor_command (CONVERTER *self, const enum command_id cmd,
+ const ELEMENT *element,
+ const HTML_ARGS_FORMATTED *args_formatted,
+ const char *content, TEXT *result)
+{
+
+ if (!html_in_multi_expanded (self) && !html_in_string (self))
+ {
+ char *id = html_command_id (self, element);
+ if (id && strlen (id))
+ {
+ format_separate_anchor (self, id, "anchor", result);
+ }
+ }
+}
+
void
convert_indicateurl_command (CONVERTER *self, const enum command_id cmd,
const ELEMENT *element,
@@ -9883,6 +9900,7 @@ static COMMAND_INTERNAL_CONVERSION
commands_internal_conversion_table[] = {
{CM_email, &convert_email_command},
{CM_abbr, &convert_explained_command},
{CM_acronym, &convert_explained_command},
+ {CM_anchor, &convert_anchor_command},
/* note that if indicateurl had been in self->style_formatted_cmd this
would have prevented indicateurl to be associated to
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Convert/HTML.pm (_convert_anchor_command): get id only if it will be used.,
Patrice Dumas <=