[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm (_
From: |
Patrice Dumas |
Subject: |
branch master updated: * Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm (_normalize_texinfo_name): use parse_texi_piece(). Try to use a more robust code to find the anchor in the tree. |
Date: |
Sun, 09 Jan 2022 18:01:05 -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 b83acdeb76 * Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm
(_normalize_texinfo_name): use parse_texi_piece(). Try to use a more robust
code to find the anchor in the tree.
b83acdeb76 is described below
commit b83acdeb76758a175df0962cfdb287acce204bb8
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Jan 10 00:00:54 2022 +0100
* Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm
(_normalize_texinfo_name): use parse_texi_piece(). Try to use
a more robust code to find the anchor in the tree.
---
ChangeLog | 6 ++++++
Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm | 21 ++++++++++++++++-----
2 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a36ecf07e2..bc540a8ac9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2022-01-09 Patrice Dumas <pertusus@free.fr>
+
+ * Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm
+ (_normalize_texinfo_name): use parse_texi_piece(). Try to use
+ a more robust code to find the anchor in the tree.
+
2022-01-09 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/HTML.pm (output): use the last value in
diff --git a/Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm
b/Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm
index 34d0b954fc..4fa788617c 100644
--- a/Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm
+++ b/Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm
@@ -328,7 +328,7 @@ sub _normalize_texinfo_name($$)
$texinfo_text = "\@$command $name\n";
}
my $parser = Texinfo::Parser::parser();
- my $tree = $parser->parse_texi_text($texinfo_text);
+ my $tree = $parser->parse_texi_piece($texinfo_text);
if (!defined($tree)) {
my $texinfo_text_str = $texinfo_text;
chomp($texinfo_text_str);
@@ -345,11 +345,22 @@ sub _normalize_texinfo_name($$)
# FIXME Or undef, and callers check the return to be defined?
return '';
}
- # TODO this is dependent on the tree structure, this is not robust.
if ($command eq 'anchor') {
- #print STDERR "GGG
$tree->{'contents'}->[0]->{'contents'}->[0]->{'cmdname'}\n";
- $tree->{'contents'}->[0]->{'contents'}->[0]->{'args'}->[-0]->{'contents'}
- =
protect_first_parenthesis($tree->{'contents'}->[0]->{'contents'}->[0]->{'args'}->[-0]->{'contents'});
+ # FIXME this works to find the anchor command only if
+ # the tree structure always leads to the interesting
+ # elements being first in the contents.
+ my $current = $tree;
+ while ((not exists($current->{'cmdname'})
+ or $current->{'cmdname'} ne 'anchor')
+ and $current->{'contents'}
+ and scalar(@{$current->{'contents'}})) {
+ $current = $current->{'contents'}->[0];
+ }
+ if (not exists($current->{'cmdname'}) or $current->{'cmdname'} ne
'anchor') {
+ cluck "BUG: could not find anchor: $texinfo_text";
+ } else {
+ protect_first_parenthesis($current->{'args'}->[-0]->{'contents'});
+ }
}
my $fixed_text = Texinfo::Convert::Texinfo::convert_to_texinfo($tree, 1);
my $result = $fixed_text;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm (_normalize_texinfo_name): use parse_texi_piece(). Try to use a more robust code to find the anchor in the tree.,
Patrice Dumas <=