[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: Protect node names with comma in node pointers
From: |
Patrice Dumas |
Subject: |
branch master updated: Protect node names with comma in node pointers |
Date: |
Tue, 16 Aug 2022 07:02:48 -0400 |
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 bb47bd3481 Protect node names with comma in node pointers
bb47bd3481 is described below
commit bb47bd348168bf09fa9b35aa6da914abd88e34c8
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Aug 16 13:02:37 2022 +0200
Protect node names with comma in node pointers
* tp/Texinfo/Convert/Info.pm (format_node): protect node names
with comma in node pointers, and warn about node name containing
a comma only for external nodes, internal nodes should have been
warned when defined with @node.
---
ChangeLog | 9 +
tp/Texinfo/Convert/Info.pm | 22 +-
tp/t/input_files/nodequote.texi | 4 +-
.../formats_encodings/at_commands_in_refs.pl | 52 +--
.../res_info/at_commands_in_refs_latin1.info | Bin 7992 -> 8004 bytes
.../res_info/at_commands_in_refs_utf8.info | Bin 8400 -> 8404 bytes
.../res_info/colons_in_index_entries_and_node.info | Bin 1568 -> 1572 bytes
.../info_tests/invalid_node_name_no_warning.pl | 8 +-
.../info_tests/invalid_node_name_warning.pl | 8 +-
tp/t/results/info_tests/quote_node_names_info.pl | 411 +++++++++++----------
.../quote_node_names_info/res_info/nodequote.info | 8 +-
tp/t/results/morecoverage/formatting_fr.pl | 10 +-
tp/t/results/morecoverage/texi_formatting.pl | 10 +-
tp/t/results/plaintext_tests/quote_node_names.pl | 411 +++++++++++----------
.../sectioning/character_and_spaces_in_refs.pl | 2 +-
15 files changed, 505 insertions(+), 450 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 842797cf31..0440ff5caa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2022-08-15 Patrice Dumas <pertusus@free.fr>
+
+ Protect node names with comma in node pointers
+
+ * tp/Texinfo/Convert/Info.pm (format_node): protect node names
+ with comma in node pointers, and warn about node name containing
+ a comma only for external nodes, internal nodes should have been
+ warned when defined with @node.
+
2022-08-16 Gavin Smith <gavinsmith0123@gmail.com>
* doc/texinfo.texi (@xref): Raise level of subsections and
diff --git a/tp/Texinfo/Convert/Info.pm b/tp/Texinfo/Convert/Info.pm
index f143f4b4e5..8a45ba26c2 100644
--- a/tp/Texinfo/Convert/Info.pm
+++ b/tp/Texinfo/Convert/Info.pm
@@ -485,9 +485,29 @@ sub format_node($$)
{'text' => ')'}]});
}
if ($node_direction->{'extra'}->{'node_content'}) {
+ my $pre_quote = '';
+ my $post_quote = '';
my ($node_text, $byte_count) = $self->node_line($node_direction);
$self->{'count_context'}->[-1]->{'bytes'} += $byte_count;
- $result .= $node_text;
+ # Up may not strictly need protection, as it is the last direction,
+ # but we protect consistently
+ if ($node_text =~ /,/) {
+ if ($self->{'info_special_chars_warning'}
+ # warn only for external nodes, internal nodes should already
+ # trigger a warning when defined
+ and $node_direction->{'extra'}->{'manual_content'}) {
+ $self->line_warn($self, sprintf(__(
+ "\@node %s name should not contain `,': %s"),
+ $direction, $node_text),
+ $node->{'source_info'});
+ }
+ if ($self->{'info_special_chars_quote'}) {
+ $pre_quote = "\x{7f}";
+ $post_quote = $pre_quote;
+ $self->{'count_context'}->[-1]->{'bytes'} += 2;
+ }
+ }
+ $result .= $pre_quote . $node_text . $post_quote;
}
} elsif ($direction eq 'Up' and $node->{'extra'}->{'normalized'} eq 'Top')
{
# add an up direction for Top node
diff --git a/tp/t/input_files/nodequote.texi b/tp/t/input_files/nodequote.texi
index 624c1dfe3e..06967d8854 100644
--- a/tp/t/input_files/nodequote.texi
+++ b/tp/t/input_files/nodequote.texi
@@ -47,12 +47,12 @@ stuff here.
@node blumpty.fump
@chapter blumpty.fump
-@node normal node
+@node normal node, (man@comma{}u:a.l)direction, (man_ual)direct@comma{}ion,
(man_ual)direct::i.on
@chapter normal node
@node @asis{secret,node}
@chapter @asis{secret,node}
-@node top secret node, (man@comma{}u:a.l)direction,
(man_ual)direct@comma{}ion, (man_ual)direct::i.on
+@node top secret node
stuff here.
diff --git a/tp/t/results/formats_encodings/at_commands_in_refs.pl
b/tp/t/results/formats_encodings/at_commands_in_refs.pl
index fd537c2e21..f800326073 100644
--- a/tp/t/results/formats_encodings/at_commands_in_refs.pl
+++ b/tp/t/results/formats_encodings/at_commands_in_refs.pl
@@ -23669,7 +23669,7 @@ File: , Node: !
***************
-File: , Node: @ { } \\ #, Next: LaTeX TeX • , © ... ..., Prev: !
+File: , Node: @ { } \\ #, Next: LaTeX TeX • , © ... ..., Prev: !
. . ? @, Up: Top
3 @ { } \\ #
@@ -23682,7 +23682,7 @@ File: , Node: LaTeX TeX • , © ... ..., Next: ≡
error→ € ¡ ↦ −,
*************************
-File: , Node: ≡ error→ € ¡ ↦ −, Next: ≥ ≤ →, Prev: LaTeX TeX • , © ... ...,
Up: Top
+File: , Node: ≡ error→ € ¡ ↦ −, Next: ≥ ≤ →, Prev: LaTeX TeX • , © ...
..., Up: Top
5 ≡ error→ € ¡ ↦ −
******************
@@ -23883,30 +23883,30 @@ Node: { }873
Node: !
. . ? @952
Node: @ { } \\ #1057
-Node: LaTeX TeX • , © ... ...1177
-Node: ≡ error→ € ¡ ↦ −1344
-Node: ≥ ≤ →1505
-Node: ª º ★ £ ⊣ ¿ ®1635
-Node: ⇒ ° a b a sunny day å1782
-Node: Å æ œ Æ Œ ø Ø ß ł Ł Ð ð Þ þ1970
-Node: ä ẽ î â à é ç ē e̊ e̋ ę2193
-Node: ė ĕ e̲ ẹ ě j e͡e2404
-Node: ı Ḕ Ḉ2565
-Node: “ ” ‘ ’ „ ‚2692
-Node: « » « » ‹ ›2834
-Node: `` \'\' --- -- ` \'2978
-Node: AAA (fff) AAA BBB3120
-Node: CCC (rrr) CCC DDD3260
-Node: the someone <someone@somewher> <no_explain@there>3433
-Node: [f--ile1] [image src="f--ile.png" alt="alt" text="Image
description\\"\\"\\\\."