[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Convert/HTML.pm, tp/Texinfo/Convert/
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Convert/HTML.pm, tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/Convert/Plaintext.pm, tp/Texinfo/Convert/Plaintext.pm, tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line), tp/Texinfo/XS/parsetexi/api.c (element_to_perl_hash), tp/Texinfo/XS/parsetexi/end_line.c (end_line_starting_block), tp/Texinfo/XS/parsetexi/extra.c (add_info_string_dup), tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line), tp/Texinfo/XS/parsetexi/tree.c (new_element, destroy_element): add an info hash [...] |
Date: |
Tue, 15 Nov 2022 17:33:13 -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 994c57c22c * tp/Texinfo/Convert/HTML.pm, tp/Texinfo/Convert/LaTeX.pm,
tp/Texinfo/Convert/Plaintext.pm, tp/Texinfo/Convert/Plaintext.pm,
tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line),
tp/Texinfo/XS/parsetexi/api.c (element_to_perl_hash),
tp/Texinfo/XS/parsetexi/end_line.c (end_line_starting_block),
tp/Texinfo/XS/parsetexi/extra.c (add_info_string_dup),
tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line),
tp/Texinfo/XS/parsetexi/tree.c (new_element, destroy_elemen [...]
994c57c22c is described below
commit 994c57c22cd081147327978bbe05fea122c06966
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Nov 15 23:33:01 2022 +0100
* tp/Texinfo/Convert/HTML.pm, tp/Texinfo/Convert/LaTeX.pm,
tp/Texinfo/Convert/Plaintext.pm, tp/Texinfo/Convert/Plaintext.pm,
tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line),
tp/Texinfo/XS/parsetexi/api.c (element_to_perl_hash),
tp/Texinfo/XS/parsetexi/end_line.c (end_line_starting_block),
tp/Texinfo/XS/parsetexi/extra.c (add_info_string_dup),
tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line),
tp/Texinfo/XS/parsetexi/tree.c (new_element, destroy_element):
add an info hash to the tree elements, for information that can not
be retrieved from the tree. As a first information moved from
extra to info, put the @value flag name for @value with unset flag.
---
ChangeLog | 14 ++++++++++
tp/Texinfo/Convert/HTML.pm | 2 +-
tp/Texinfo/Convert/LaTeX.pm | 2 +-
tp/Texinfo/Convert/Plaintext.pm | 2 +-
tp/Texinfo/Convert/Texinfo.pm | 2 +-
tp/Texinfo/ParserNonXS.pm | 30 ++++++++++++++++------
tp/Texinfo/XS/parsetexi/api.c | 1 +
tp/Texinfo/XS/parsetexi/end_line.c | 5 ++--
tp/Texinfo/XS/parsetexi/extra.c | 7 +++++
tp/Texinfo/XS/parsetexi/parser.c | 2 +-
tp/Texinfo/XS/parsetexi/parser.h | 1 +
tp/Texinfo/XS/parsetexi/tree.c | 2 ++
tp/Texinfo/XS/parsetexi/tree_types.h | 1 +
.../results/converters_tests/at_commands_in_raw.pl | 2 +-
tp/t/results/converters_tests/unknown_value.pl | 2 +-
.../manual_simple_latin1_with_error.pl | 2 +-
.../manual_simple_utf8_with_error.pl | 2 +-
tp/t/results/value/bad_syntax.pl | 2 +-
18 files changed, 61 insertions(+), 20 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 9730b98f6b..af8ffb4be1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2022-11-15 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/HTML.pm, tp/Texinfo/Convert/LaTeX.pm,
+ tp/Texinfo/Convert/Plaintext.pm, tp/Texinfo/Convert/Plaintext.pm,
+ tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line),
+ tp/Texinfo/XS/parsetexi/api.c (element_to_perl_hash),
+ tp/Texinfo/XS/parsetexi/end_line.c (end_line_starting_block),
+ tp/Texinfo/XS/parsetexi/extra.c (add_info_string_dup),
+ tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line),
+ tp/Texinfo/XS/parsetexi/tree.c (new_element, destroy_element):
+ add an info hash to the tree elements, for information that can not
+ be retrieved from the tree. As a first information moved from
+ extra to info, put the @value flag name for @value with unset flag.
+
2022-11-15 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/parsetexi/api.c (store_additional_info)
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 57bf49c4fa..f506e156ec 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -2913,7 +2913,7 @@ sub _convert_value_command($$$$)
my $args = shift;
return $self->convert_tree($self->gdt('@{No value for `{value}\'@}',
- {'value' => $command->{'extra'}->{'flag'}}));
+ {'value' => $command->{'info'}->{'flag'}}));
}
$default_commands_conversion{'value'} = \&_convert_value_command;
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index 7b0421992c..ca51cbd9b0 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -3192,7 +3192,7 @@ sub _convert($$)
return $result;
} elsif ($cmdname eq 'value') {
my $expansion = $self->gdt('@{No value for `{value}\'@}',
- {'value' => $element->{'extra'}->{'flag'}});
+ {'value' => $element->{'info'}->{'flag'}});
$expansion = {'type' => 'paragraph',
'contents' => [$expansion]};
$result .= _convert($self, $expansion);
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index b1a880ebbb..bc0c6ab946 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -2475,7 +2475,7 @@ sub _convert($$)
} elsif ($command eq 'value') {
my $expansion = $self->gdt('@{No value for `{value}\'@}',
- {'value' => $element->{'extra'}->{'flag'}});
+ {'value' => $element->{'info'}->{'flag'}});
if ($formatter->{'_top_formatter'}) {
$expansion = {'type' => 'paragraph',
'contents' => [$expansion]};
diff --git a/tp/Texinfo/Convert/Texinfo.pm b/tp/Texinfo/Convert/Texinfo.pm
index 8f48951f7c..cb45517663 100644
--- a/tp/Texinfo/Convert/Texinfo.pm
+++ b/tp/Texinfo/Convert/Texinfo.pm
@@ -229,7 +229,7 @@ sub _expand_cmd_args_to_texi($;$) {
$result .= $cmd->{'extra'}->{'spaces_before_argument'}
if $cmd->{'extra'} and $cmd->{'extra'}->{'spaces_before_argument'};
}
- $result .= '{'.$cmd->{'extra'}->{'flag'}.'}' if ($cmdname eq 'value');
+ $result .= '{'.$cmd->{'info'}->{'flag'}.'}' if ($cmdname eq 'value');
return $result;
}
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 79a25da5a9..8a354ecca0 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -4532,7 +4532,7 @@ sub _process_remaining_on_line($$$$)
# caller should expand something along
# gdt('@{No value for `{value}\'@}', {'value' => $value});
push @{$current->{'contents'}}, { 'cmdname' => $command,
- 'extra' => {'flag' => $value},
+ 'info' => {'flag' => $value},
'parent' => $current };
$self->_line_warn(
sprintf(__("undefined flag: %s"), $value), $source_info);
@@ -6963,9 +6963,17 @@ The user macro name the @-command is expanded from.
=back
+=item info
+
+A hash reference holding any other information that cannot be
+obtained otherwise from the tree.
+See L</Information available in the C<info> key>.
+
=item extra
-A hash reference holding any other information.
+A hash reference holding information that could also be obtained
+from the tree, but is directly associated to the element to simplify
+downstream code.
See L</Information available in the C<extra> key>.
=back
@@ -7330,6 +7338,18 @@ and C<@itemx>, in a I<table_term>.
=back
+=head2 Information available in the C<info> key
+
+=over
+
+=item flag
+
+C<@value> tree element argument string is in I<flag>. Only for a C<@value>
+command that is not expanded because there is no corresponding value set, as
+only those are present in the tree.
+
+=back
+
=head2 Information available in the C<extra> key
X<Texinfo tree element extra key>
@@ -7609,12 +7629,6 @@ The part preceding the command is in I<associated_part>.
If the level of the document was modified by C<@raisections>
or C<@lowersections>, the differential level is in I<sections_level>.
-=item C<@value>
-
-The value argument string is in I<flag>. Only for a C<@value> command
-that is not expanded because there is no corresponding value set, as
-only those are present in the tree.
-
=item C<@verb>
The delimiter is in I<delimiter>.
diff --git a/tp/Texinfo/XS/parsetexi/api.c b/tp/Texinfo/XS/parsetexi/api.c
index 048f0d472c..4f27c156ff 100644
--- a/tp/Texinfo/XS/parsetexi/api.c
+++ b/tp/Texinfo/XS/parsetexi/api.c
@@ -578,6 +578,7 @@ element_to_perl_hash (ELEMENT *e)
}
store_additional_info (e, e->extra_info, "extra");
+ store_additional_info (e, e->info_info, "info");
if (e->source_info.line_nr)
{
diff --git a/tp/Texinfo/XS/parsetexi/end_line.c
b/tp/Texinfo/XS/parsetexi/end_line.c
index 835b579822..60ba6b6c60 100644
--- a/tp/Texinfo/XS/parsetexi/end_line.c
+++ b/tp/Texinfo/XS/parsetexi/end_line.c
@@ -1028,9 +1028,10 @@ end_line_starting_block (ELEMENT *current)
memcpy (new, e, sizeof (ELEMENT));
new->type = ET_bracketed_multitable_prototype;
new->parent = 0;
- /* TODO the extra_info information in e is not copied over,
- at least leading/trailing spaces (something else?). */
+ /* TODO the extra_info/info_info information in e is not copied
+ over, at least leading/trailing spaces (something else?). */
new->extra_info = new_associated_info();
+ new->info_info = new_associated_info();
add_to_contents_as_array (prototypes, new);
}
else if (e->text.end > 0)
diff --git a/tp/Texinfo/XS/parsetexi/extra.c b/tp/Texinfo/XS/parsetexi/extra.c
index f9e67d3dd3..1fdf01f745 100644
--- a/tp/Texinfo/XS/parsetexi/extra.c
+++ b/tp/Texinfo/XS/parsetexi/extra.c
@@ -151,6 +151,13 @@ add_extra_string_dup (ELEMENT *e, char *key, char *value)
extra_string);
}
+void
+add_info_string_dup (ELEMENT *e, char *key, char *value)
+{
+ add_associated_info_key (e->info_info, key, (ELEMENT *) strdup (value),
+ extra_string);
+}
+
void
add_extra_integer (ELEMENT *e, char *key, long value)
{
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 8a85a14c2e..52bb538950 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -1695,7 +1695,7 @@ value_valid:
abort_empty_line (¤t, NULL);
value_elt = new_element (ET_NONE);
value_elt->cmd = CM_value;
- add_extra_string_dup (value_elt, "flag", flag);
+ add_info_string_dup (value_elt, "flag", flag);
add_to_element_contents (current, value_elt);
diff --git a/tp/Texinfo/XS/parsetexi/parser.h b/tp/Texinfo/XS/parsetexi/parser.h
index 7303a53357..6ed77cf044 100644
--- a/tp/Texinfo/XS/parsetexi/parser.h
+++ b/tp/Texinfo/XS/parsetexi/parser.h
@@ -223,6 +223,7 @@ void add_extra_float_type (ELEMENT *e, char *key,
EXTRA_FLOAT_TYPE *value);
void add_extra_string (ELEMENT *e, char *key, char *value);
void add_extra_string_dup (ELEMENT *e, char *key, char *value);
void add_extra_integer (ELEMENT *e, char *key, long value);
+void add_info_string_dup (ELEMENT *e, char *key, char *value);
KEY_PAIR *lookup_extra (ELEMENT *e, char *key);
/* In menus.c */
diff --git a/tp/Texinfo/XS/parsetexi/tree.c b/tp/Texinfo/XS/parsetexi/tree.c
index 1357c72e99..06e5aed778 100644
--- a/tp/Texinfo/XS/parsetexi/tree.c
+++ b/tp/Texinfo/XS/parsetexi/tree.c
@@ -54,6 +54,7 @@ new_element (enum element_type type)
e->parent = 0;
e->extra_info = new_associated_info();
+ e->info_info = new_associated_info();
return e;
}
@@ -170,6 +171,7 @@ destroy_element (ELEMENT *e)
free (e->args.list);
destroy_associated_info (e->extra_info);
+ destroy_associated_info (e->info_info);
free (e);
}
diff --git a/tp/Texinfo/XS/parsetexi/tree_types.h
b/tp/Texinfo/XS/parsetexi/tree_types.h
index cba51f3fde..eb6f5f2c20 100644
--- a/tp/Texinfo/XS/parsetexi/tree_types.h
+++ b/tp/Texinfo/XS/parsetexi/tree_types.h
@@ -74,6 +74,7 @@ typedef struct ELEMENT {
SOURCE_INFO source_info;
ASSOCIATED_INFO *extra_info;
+ ASSOCIATED_INFO *info_info;
/********* Used when building Perl tree only ********************/
void *hv;
diff --git a/tp/t/results/converters_tests/at_commands_in_raw.pl
b/tp/t/results/converters_tests/at_commands_in_raw.pl
index d2e97ee29a..b8f1c4be5b 100644
--- a/tp/t/results/converters_tests/at_commands_in_raw.pl
+++ b/tp/t/results/converters_tests/at_commands_in_raw.pl
@@ -424,7 +424,7 @@ $result_trees{'at_commands_in_raw'} = {
},
{
'cmdname' => 'value',
- 'extra' => {
+ 'info' => {
'flag' => 'flag'
}
},
diff --git a/tp/t/results/converters_tests/unknown_value.pl
b/tp/t/results/converters_tests/unknown_value.pl
index 82d93004d4..789fcc3d13 100644
--- a/tp/t/results/converters_tests/unknown_value.pl
+++ b/tp/t/results/converters_tests/unknown_value.pl
@@ -11,7 +11,7 @@ $result_trees{'unknown_value'} = {
'contents' => [
{
'cmdname' => 'value',
- 'extra' => {
+ 'info' => {
'flag' => 'unknown'
}
}
diff --git a/tp/t/results/formats_encodings/manual_simple_latin1_with_error.pl
b/tp/t/results/formats_encodings/manual_simple_latin1_with_error.pl
index 0876e8b0f0..e35105ca2d 100644
--- a/tp/t/results/formats_encodings/manual_simple_latin1_with_error.pl
+++ b/tp/t/results/formats_encodings/manual_simple_latin1_with_error.pl
@@ -239,7 +239,7 @@ $result_trees{'manual_simple_latin1_with_error'} = {
},
{
'cmdname' => 'value',
- 'extra' => {
+ 'info' => {
'flag' => "non_conn\x{f9}e"
}
},
diff --git a/tp/t/results/formats_encodings/manual_simple_utf8_with_error.pl
b/tp/t/results/formats_encodings/manual_simple_utf8_with_error.pl
index cbfb51e9f7..873f8af254 100644
--- a/tp/t/results/formats_encodings/manual_simple_utf8_with_error.pl
+++ b/tp/t/results/formats_encodings/manual_simple_utf8_with_error.pl
@@ -205,7 +205,7 @@ $result_trees{'manual_simple_utf8_with_error'} = {
},
{
'cmdname' => 'value',
- 'extra' => {
+ 'info' => {
'flag' => "non_conn\x{f9}e"
}
},
diff --git a/tp/t/results/value/bad_syntax.pl b/tp/t/results/value/bad_syntax.pl
index 78dd83beb0..3af5142d2e 100644
--- a/tp/t/results/value/bad_syntax.pl
+++ b/tp/t/results/value/bad_syntax.pl
@@ -103,7 +103,7 @@ $result_trees{'bad_syntax'} = {
},
{
'cmdname' => 'value',
- 'extra' => {
+ 'info' => {
'flag' => 'unknown'
}
},
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Convert/HTML.pm, tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/Convert/Plaintext.pm, tp/Texinfo/Convert/Plaintext.pm, tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line), tp/Texinfo/XS/parsetexi/api.c (element_to_perl_hash), tp/Texinfo/XS/parsetexi/end_line.c (end_line_starting_block), tp/Texinfo/XS/parsetexi/extra.c (add_info_string_dup), tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line), tp/Texinfo/XS/parsetexi/tree.c (new_element, destroy_element): add an info hash [...],
Patrice Dumas <=
- Prev by Date:
branch master updated: * tp/Texinfo/XS/parsetexi/api.c (store_additional_info) (element_to_perl_hash), tp/Texinfo/XS/parsetexi/end_line.c (end_line_starting_block), tp/Texinfo/XS/parsetexi/extra.c (add_associated_info_key, lookup_extra), tp/Texinfo/XS/parsetexi/tree.c (new_associated_info, new_element) (destroy_associated_info, destroy_element), tp/Texinfo/XS/parsetexi/tree_types.h (ASSOCIATED_INFO): instead of putting the extra array, the number and space directly in the element, use a specific structure, ASSOC [...]
- Next by Date:
branch master updated: * tp/Texinfo/Convert/Converter.pm, tp/Texinfo/Convert/Texinfo.pm, tp/Texinfo/Convert/TexinfoMarkup.pm, tp/Texinfo/Convert/TextContent.pm, tp/Texinfo/ParserNonXS.pm, tp/Texinfo/Structuring.pm, tp/Texinfo/XS/misc.c (xs_abort_empty_line), tp/Texinfo/XS/parsetexi/convert.c (expand_cmd_args_to_texi) (convert_to_texinfo_internal), tp/Texinfo/XS/parsetexi/handle_commands.c (handle_line_command), tp/Texinfo/XS/parsetexi/parser.c (abort_empty_line) (isolate_last_space_internal): move spaces_before_ [...]
- Previous by thread:
branch master updated: * tp/Texinfo/XS/parsetexi/api.c (store_additional_info) (element_to_perl_hash), tp/Texinfo/XS/parsetexi/end_line.c (end_line_starting_block), tp/Texinfo/XS/parsetexi/extra.c (add_associated_info_key, lookup_extra), tp/Texinfo/XS/parsetexi/tree.c (new_associated_info, new_element) (destroy_associated_info, destroy_element), tp/Texinfo/XS/parsetexi/tree_types.h (ASSOCIATED_INFO): instead of putting the extra array, the number and space directly in the element, use a specific structure, ASSOC [...]
- Next by thread:
branch master updated: * tp/Texinfo/Convert/Converter.pm, tp/Texinfo/Convert/Texinfo.pm, tp/Texinfo/Convert/TexinfoMarkup.pm, tp/Texinfo/Convert/TextContent.pm, tp/Texinfo/ParserNonXS.pm, tp/Texinfo/Structuring.pm, tp/Texinfo/XS/misc.c (xs_abort_empty_line), tp/Texinfo/XS/parsetexi/convert.c (expand_cmd_args_to_texi) (convert_to_texinfo_internal), tp/Texinfo/XS/parsetexi/handle_commands.c (handle_line_command), tp/Texinfo/XS/parsetexi/parser.c (abort_empty_line) (isolate_last_space_internal): move spaces_before_ [...]
- Index(es):