[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Tue, 24 Dec 2024 10:27:07 -0500 (EST) |
branch: master
commit 433097655af2155ddd4353498bdccc4ea4551aec
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Nov 24 00:48:58 2024 +0100
* tp/Texinfo/Convert/Text.pm (_convert): check line_commands instead
of converted_formattable_line_commands. Remove
%converted_formattable_line_commands.
* tp/Texinfo/XS/main/convert_to_text.c (convert_to_text_internal):
modify code to be more similar to corresponding Perl code.
* tp/maintain/regenerate_commands_perl_info.pl: remove unused
%converter_flag variable.
---
ChangeLog | 12 ++++
tp/Texinfo/Convert/Text.pm | 13 +---
tp/Texinfo/XS/main/convert_to_text.c | 92 ++++++++++++++--------------
tp/maintain/regenerate_commands_perl_info.pl | 8 ---
4 files changed, 59 insertions(+), 66 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 96d4426215..5332766de9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-11-23 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/Text.pm (_convert): check line_commands instead
+ of converted_formattable_line_commands. Remove
+ %converted_formattable_line_commands.
+
+ * tp/Texinfo/XS/main/convert_to_text.c (convert_to_text_internal):
+ modify code to be more similar to corresponding Perl code.
+
+ * tp/maintain/regenerate_commands_perl_info.pl: remove unused
+ %converter_flag variable.
+
2024-11-23 Patrice Dumas <pertusus@free.fr>
remove remaining args from line commands and from Texinfo tree
diff --git a/tp/Texinfo/Convert/Text.pm b/tp/Texinfo/Convert/Text.pm
index 5ca3b12c7b..7476717201 100644
--- a/tp/Texinfo/Convert/Text.pm
+++ b/tp/Texinfo/Convert/Text.pm
@@ -118,17 +118,6 @@ my %line_commands = %Texinfo::Commands::line_commands;
# 'page' is a formatted_line_commands and therefore is replaced by an empty
# line.
-my %converted_formattable_line_commands;
-foreach my $command ('verbatiminclude', 'sp') {
- $converted_formattable_line_commands{$command} = 1;
-}
-
-foreach my $command (keys(%def_commands)) {
- if ($Texinfo::Commands::line_commands{$command}) {
- $converted_formattable_line_commands{$command} = 1;
- }
-}
-
my %ignored_types;
foreach my $type ('postamble_after_end',
'preamble_before_beginning', 'argument') {
@@ -724,7 +713,7 @@ sub _convert($$)
$result .= "\n";
return $result;
}
- } elsif ($converted_formattable_line_commands{$data_cmdname}) {
+ } elsif ($line_commands{$data_cmdname}) {
if ($def_commands{$cmdname}) {
$result = _convert_def_line($options, $element);
} elsif ($cmdname eq 'sp') {
diff --git a/tp/Texinfo/XS/main/convert_to_text.c
b/tp/Texinfo/XS/main/convert_to_text.c
index 2f02c83d2e..9d1caa3d73 100644
--- a/tp/Texinfo/XS/main/convert_to_text.c
+++ b/tp/Texinfo/XS/main/convert_to_text.c
@@ -930,7 +930,6 @@ convert_to_text_internal (const ELEMENT *element,
TEXT_OPTIONS *text_options,
if (!(builtin_command_data[data_cmd].flags & CF_root))
return;
}
- /* TODO check if different from Perl and use similar code if not */
else if (builtin_command_data[data_cmd].other_flags & CF_formatted_line)
{
if (data_cmd != CM_node)
@@ -948,57 +947,58 @@ convert_to_text_internal (const ELEMENT *element,
TEXT_OPTIONS *text_options,
return;
}
}
- else if (builtin_command_data[data_cmd].flags & CF_line
- && builtin_command_data[data_cmd].flags & CF_def)
+ else if (builtin_command_data[data_cmd].flags & CF_line)
{
- convert_def_line (element, text_options, result);
- return;
- }
- else if (data_cmd == CM_sp)
- {
- const STRING_LIST *misc_args
- = lookup_extra_misc_args (element, AI_key_misc_args);
- /* misc_args can be 0 with invalid args */
- if (misc_args && misc_args->number > 0)
+ if (builtin_command_data[data_cmd].flags & CF_def)
{
- const char *sp_arg = misc_args->list[0];
- int sp_nr = strtoul (sp_arg, NULL, 10);
- int i;
- if (sp_nr > 0)
- for (i = 0; i < sp_nr; i++)
- ADD("\n");
+ convert_def_line (element, text_options, result);
}
- return;
- }
- else if (data_cmd == CM_verbatiminclude)
- {
- ELEMENT *verbatim_include_verbatim = 0;
- ERROR_MESSAGE_LIST *error_messages = 0;
- if (text_options->converter)
- error_messages = &text_options->converter->error_messages;
-
- if (text_options->other_converter_options) {
- verbatim_include_verbatim
- = expand_verbatiminclude (error_messages,
+ else if (data_cmd == CM_sp)
+ {
+ const STRING_LIST *misc_args
+ = lookup_extra_misc_args (element, AI_key_misc_args);
+ /* misc_args can be 0 with invalid args */
+ if (misc_args && misc_args->number > 0)
+ {
+ const char *sp_arg = misc_args->list[0];
+ int sp_nr = strtoul (sp_arg, NULL, 10);
+ int i;
+ if (sp_nr > 0)
+ for (i = 0; i < sp_nr; i++)
+ ADD("\n");
+ }
+ }
+ else if (data_cmd == CM_verbatiminclude)
+ {
+ ELEMENT *verbatim_include_verbatim = 0;
+ ERROR_MESSAGE_LIST *error_messages = 0;
+ if (text_options->converter)
+ error_messages = &text_options->converter->error_messages;
+
+ if (text_options->other_converter_options) {
+ verbatim_include_verbatim
+ = expand_verbatiminclude (error_messages,
text_options->other_converter_options,
0, element);
- } else {
- GLOBAL_INFO *global_information = 0;
- if (text_options->document_descriptor) {
- DOCUMENT *document
- = retrieve_document (text_options->document_descriptor);
- if (document)
- global_information = &document->global_info;
- }
- verbatim_include_verbatim
- = expand_verbatiminclude (0,
text_options->self_converter_options,
+ } else {
+ GLOBAL_INFO *global_information = 0;
+ if (text_options->document_descriptor) {
+ DOCUMENT *document
+ = retrieve_document (text_options->document_descriptor);
+ if (document)
+ global_information = &document->global_info;
+ }
+ verbatim_include_verbatim
+ = expand_verbatiminclude (0,
+ text_options->self_converter_options,
global_information, element);
- }
- if (verbatim_include_verbatim)
- {
- convert_to_text_internal (verbatim_include_verbatim,
- text_options, result);
- destroy_element_and_children (verbatim_include_verbatim);
+ }
+ if (verbatim_include_verbatim)
+ {
+ convert_to_text_internal (verbatim_include_verbatim,
+ text_options, result);
+ destroy_element_and_children (verbatim_include_verbatim);
+ }
}
return;
}
diff --git a/tp/maintain/regenerate_commands_perl_info.pl
b/tp/maintain/regenerate_commands_perl_info.pl
index 0e64e90cd1..08d4a5a0ec 100755
--- a/tp/maintain/regenerate_commands_perl_info.pl
+++ b/tp/maintain/regenerate_commands_perl_info.pl
@@ -120,14 +120,6 @@ foreach my $category (sort(keys(%command_categories))) {
print OUT "\n";
print OUT "# flag hashes\n";
-# for those flags, the information of multi category commands is
-# duplicated. So, for example, item_LINE has the formatted_line flag
-# associated, it will be associated to item.
-my %converter_flag = (
- 'formatted_line' => 1,
- 'formattable_line' => 1,
-);
-
foreach my $hash_flag (sort(keys(%flags_hashes))) {
# happens for 'txiinternalvalue', which is in internal category but also
# has the brace flag set. This information cannot be kept, this command