[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Convert/HTML.pm (_convert_inline_com
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Convert/HTML.pm (_convert_inline_command): do not modify $args. |
Date: |
Sat, 30 Dec 2023 15:37:47 -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 e7e489ed3a * tp/Texinfo/Convert/HTML.pm (_convert_inline_command): do
not modify $args.
e7e489ed3a is described below
commit e7e489ed3a7fb01222d91348878097c95c7d9537
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Dec 30 21:37:44 2023 +0100
* tp/Texinfo/Convert/HTML.pm (_convert_inline_command): do not modify
$args.
* tp/Texinfo/XS/convert/converter.c (convert_inline_command)
(commands_internal_conversion_table): implement
convert_inline_command.
---
ChangeLog | 9 +++++++
tp/Texinfo/Convert/HTML.pm | 16 +++++------
tp/Texinfo/XS/convert/convert_html.c | 52 +++++++++++++++++++++++++++++++++++-
3 files changed, 68 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 9c3efb93a2..b0b3cf8a44 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2023-12-30 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/HTML.pm (_convert_inline_command): do not modify
+ $args.
+
+ * tp/Texinfo/XS/convert/converter.c (convert_inline_command)
+ (commands_internal_conversion_table): implement
+ convert_inline_command.
+
2023-12-30 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/HTML.pm, tp/Texinfo/XS/convert/converter.c:
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 4751f9e601..b98425d084 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -4958,24 +4958,24 @@ sub _convert_inline_command($$$$)
my $command = shift;
my $args = shift;
- my $format_arg = shift @$args;
-
my $format;
- if (defined($format_arg)) {
- $format = $format_arg->{'monospacetext'};
+ if ($args and $args->[0] and defined($args->[0]->{'monospacetext'})
+ and $args->[0]->{'monospacetext'} ne '') {
+ $format = $args->[0]->{'monospacetext'};
+ } else {
+ return '';
}
- return '' if (!defined($format) or $format eq '');
my $arg_index = undef;
if ($inline_format_commands{$cmdname}) {
if ($cmdname eq 'inlinefmtifelse' and !$self->is_format_expanded($format))
{
- $arg_index = 1;
+ $arg_index = 2;
} elsif ($self->is_format_expanded($format)) {
- $arg_index = 0;
+ $arg_index = 1;
}
} elsif (defined($command->{'extra'})
and defined($command->{'extra'}->{'expand_index'})) {
- $arg_index = 0;
+ $arg_index = 1;
}
if (defined($arg_index) and $arg_index < scalar(@$args)) {
my $text_arg = $args->[$arg_index];
diff --git a/tp/Texinfo/XS/convert/convert_html.c
b/tp/Texinfo/XS/convert/convert_html.c
index a9bd84a24a..342804339f 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -9859,6 +9859,51 @@ convert_raw_command (CONVERTER *self, const enum
command_id cmd,
format_protect_text (self, content, result);
}
+void
+convert_inline_command (CONVERTER *self, const enum command_id cmd,
+ const ELEMENT *element,
+ const HTML_ARGS_FORMATTED *args_formatted,
+ const char *content, TEXT *result)
+{
+ char *format;
+ int arg_index = 0;
+
+ if (args_formatted && args_formatted->number > 0
+ && args_formatted->args[0].formatted[AFT_type_monospacetext]
+ && strlen (args_formatted->args[0].formatted[AFT_type_monospacetext]))
+ format = args_formatted->args[0].formatted[AFT_type_monospacetext];
+ else
+ return;
+
+ if (command_other_flags (element) & CF_inline_format)
+ {
+ if (cmd == CM_inlinefmtifelse
+ && !format_expanded_p (self->expanded_formats, format))
+ arg_index = 2;
+ else if (format_expanded_p (self->expanded_formats, format))
+ arg_index = 1;
+ }
+ else
+ {
+ int status;
+ int expand_index = lookup_extra_integer (element, "expand_index",
+ &status);
+ if (expand_index > 0)
+ arg_index = 1;
+ }
+ if (arg_index > 0 && arg_index < args_formatted->number)
+ {
+ if (args_formatted->args[arg_index].formatted[AFT_type_normal])
+ {
+ text_append (result,
+ args_formatted->args[arg_index].formatted[AFT_type_normal]);
+ }
+ else if (args_formatted->args[arg_index].formatted[AFT_type_raw])
+ text_append (result,
+ args_formatted->args[arg_index].formatted[AFT_type_raw]);
+ }
+}
+
void
convert_xref_commands (CONVERTER *self, const enum command_id cmd,
const ELEMENT *element,
@@ -10697,12 +10742,17 @@ static COMMAND_INTERNAL_CONVERSION
commands_internal_conversion_table[] = {
{CM_math, &convert_math_command},
{CM_titlefont, &convert_titlefont_command},
{CM_U, &convert_U_command},
-
/* note that if indicateurl had been in self->style_formatted_cmd this
would have prevented indicateurl to be associated to
convert_style_command */
{CM_indicateurl, &convert_indicateurl_command},
+ {CM_inlineraw, &convert_inline_command},
+ {CM_inlinefmt, &convert_inline_command},
+ {CM_inlinefmtifelse, &convert_inline_command},
+ {CM_inlineifclear, &convert_inline_command},
+ {CM_inlineifset, &convert_inline_command},
+
{CM_contents, &convert_contents_command},
{CM_shortcontents, &convert_contents_command},
{CM_summarycontents, &convert_contents_command},
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Convert/HTML.pm (_convert_inline_command): do not modify $args.,
Patrice Dumas <=