[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: When creating a node protect for all the contexts
From: |
Patrice Dumas |
Subject: |
branch master updated: When creating a node protect for all the contexts |
Date: |
Wed, 24 Aug 2022 09:10:36 -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 7a1bad32bb When creating a node protect for all the contexts
7a1bad32bb is described below
commit 7a1bad32bb41f8538ef0748fb2d7dadee7a7ce6b
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Aug 24 15:10:23 2022 +0200
When creating a node protect for all the contexts
* tp/Texinfo/Transformations.pm (_new_node): protect in node tree
for all the contexts, as the node name should be the same in the
different contexts, even if some protections are not needed for the
parsing.
---
ChangeLog | 9 +++++++++
tp/Texinfo/Transformations.pm | 15 ++++++++++++++-
tp/t/automatic_nodes.t | 4 +++-
3 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 68ca59e45a..6977aa8e7f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2022-08-24 Patrice Dumas <pertusus@free.fr>
+
+ When creating a node protect for all the contexts
+
+ * tp/Texinfo/Transformations.pm (_new_node): protect in node tree
+ for all the contexts, as the node name should be the same in the
+ different contexts, even if some protections are not needed for the
+ parsing.
+
2022-08-24 Patrice Dumas <pertusus@free.fr>
Add IGNORE_REF_TO_TOP_NODE_UP to ignore (dir), set for EPUB
diff --git a/tp/Texinfo/Transformations.pm b/tp/Texinfo/Transformations.pm
index f4bc085d17..29e322fe58 100644
--- a/tp/Texinfo/Transformations.pm
+++ b/tp/Texinfo/Transformations.pm
@@ -201,9 +201,22 @@ sub _new_node($$$$)
my $targets_list = shift;
my $labels = shift;
+ # We protect for all the contexts, as the node name should be
+ # the same in the different contexts, even if some protections
+ # are not needed for the parsing. Also, this way the node tree
+ # can be directly reused in the menus for example, without
+ # additional protection, some parts could be double protected
+ # otherwise, those that are protected with @asis.
+ #
+ # needed in nodes lines, @*ref and in menus with a label
$node_tree = Texinfo::Common::protect_comma_in_tree($node_tree);
+ # always
$node_tree->{'contents'}
- = Texinfo::Common::protect_first_parenthesis($node_tree->{'contents'});
+ = Texinfo::Common::protect_first_parenthesis($node_tree->{'contents'});
+ # in menu entry without label
+ $node_tree = Texinfo::Common::protect_colon_in_tree($node_tree);
+ # in menu entry with label
+ $node_tree = Texinfo::Common::protect_node_after_label_in_tree($node_tree);
$node_tree = reference_to_arg_in_tree($node_tree);
my $empty_node = 0;
diff --git a/tp/t/automatic_nodes.t b/tp/t/automatic_nodes.t
index 8d13fd4a5d..756544e98e 100644
--- a/tp/t/automatic_nodes.t
+++ b/tp/t/automatic_nodes.t
@@ -5,7 +5,7 @@ use Test::More;
use lib '.';
use Texinfo::ModulePath (undef, undef, undef, 'updirs' => 2);
-BEGIN { plan tests => 24; }
+BEGIN { plan tests => 27; }
use Texinfo::Parser;
use Texinfo::Transformations;
@@ -73,6 +73,8 @@ test_new_node ('changed @ref{ @code{node}} and (@pxref{ ,, ,
@samp{file}})',
'ref in new node');
test_new_node ('@asis{}', '-1', '@node @asis{} 1
', 'empty node');
+test_new_node ('a::b c', 'a_003a_003ab-c', '@node a@asis{::}b@asis{ } c
+', 'with colon and tab');
my $parser = Texinfo::Parser::parser();
my $tree = $parser->parse_texi_piece('@node a node
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: When creating a node protect for all the contexts,
Patrice Dumas <=