[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm, P
From: |
Patrice Dumas |
Subject: |
branch master updated: * Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm, Pod-Simple-Texinfo/pod2texi.pl: add comments to explain the issue with formatting section in L. Also add code in comment to show the Pod::Simple tree. |
Date: |
Sat, 08 Oct 2022 04:57:14 -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 62a5515595 * Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm,
Pod-Simple-Texinfo/pod2texi.pl: add comments to explain the issue with
formatting section in L. Also add code in comment to show the Pod::Simple tree.
62a5515595 is described below
commit 62a55155955c32c8ec1a08e28e872129c509c909
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Oct 8 10:57:01 2022 +0200
* Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm,
Pod-Simple-Texinfo/pod2texi.pl: add comments to explain the issue with
formatting section in L. Also add code in comment to show the Pod::Simple
tree.
---
ChangeLog | 7 +++++++
Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm | 27 ++++++++++++++++++++++++++-
Pod-Simple-Texinfo/pod2texi.pl | 6 ++++++
Pod-Simple-Texinfo/t/Pod-Simple-Texinfo.t | 12 +++++++++++-
4 files changed, 50 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5f82758323..026db4c183 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-10-08 Patrice Dumas <pertusus@free.fr>
+
+ * Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm,
+ Pod-Simple-Texinfo/pod2texi.pl: add comments to explain the issue with
+ formatting section in L. Also add code in comment to show the
Pod::Simple
+ tree.
+
2022-10-05 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Common.pm, tp/Texinfo/Commands.pod,
diff --git a/Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm
b/Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm
index 369838bd59..93b507b336 100644
--- a/Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm
+++ b/Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm
@@ -29,6 +29,9 @@ use Carp qw(cluck);
#use Pod::Simple::Debug (3);
use Pod::Simple::PullParser ();
+# for parselink()
+#use Pod::ParseLink;
+
use Texinfo::Convert::NodeNameNormalization qw(normalize_node);
use Texinfo::Parser qw(parse_texi_line parse_texi_text);
use Texinfo::Convert::Texinfo;
@@ -566,8 +569,10 @@ sub _convert_pod($)
if ($context_tags{$tagname}) {
if ($tagname eq 'L') {
my $linktype = $token->attr('type');
+ # set when the link text is redundant with the to argument.
my $content_implicit = $token->attr('content-implicit');
- #print STDERR " L: $linktype\n";
+ #print STDERR " L: $linktype CI: "
+ # .($content_implicit ? $content_implicit : 'NOCI')."\n";
#my @attrs = keys %{$token->attr_hash};
#print STDERR " @attrs\n";
#my $raw_L = $token->attr('raw').'';
@@ -607,11 +612,30 @@ sub _convert_pod($)
# string and not an object.
$url_arg = _protect_comma(_protect_text($token->attr('to').'', 0,
1));
} elsif ($linktype eq 'pod') {
+ # FIXME the section is available from $token->attr('section') as a
+ # tree (not a token, looks like the same output as
+ # Pod::Simple::SimpleTree), or as a plain text string with
formatting
+ # removed. The tokens obtained from the argument correspond,
depending
+ # on the cases, to 'name', or '"section" in name' (based on
perlpodspec)
+ # which is not practical for conversion to Texinfo as section and
+ # name should be available separately, both converted to Texinfo.
+ # It is possible to get the equivalent parsing in term of pod
strings with
+ # parselink(), which returns the same as the pullparser argument as
+ # text, but also returns separately the section and name.
+ # However, it is not possible to simply convert the section or
+ # name string with the Texinfo pullparser parser, as a full pod
text is
+ # expected, starting whith a =head* while we would want to parse a
+ # string only.
+ #my ($l_text, $l_inferred, $l_name, $l_section, $l_type) =
parselink($token->attr('raw'));
my $manual = $token->attr('to');
my $section = $token->attr('section');
+ # the section as tree
+ #print STDERR "S ".Data::Dumper->Dump([$section])."\n";
$manual .= '' if (defined($manual));
+ # coerce to string
$section .= '' if (defined($section));
if (0) {
+ #if (1) {
my $section_text = 'UNDEF';
$section_text = $section if (defined($section));
my $manual_text = 'UNDEF';
@@ -711,6 +735,7 @@ sub _convert_pod($)
(@format_stack and $format_stack[-1] eq 'in_code'));
}
}
+ #print STDERR "T: !$text!\n";
_output($fh, \@accumulated_output, $text);
} elsif ($type eq 'end') {
my $tagname = $token->tagname();
diff --git a/Pod-Simple-Texinfo/pod2texi.pl b/Pod-Simple-Texinfo/pod2texi.pl
index 0fb3a4eb0b..7c739d6c23 100755
--- a/Pod-Simple-Texinfo/pod2texi.pl
+++ b/Pod-Simple-Texinfo/pod2texi.pl
@@ -23,6 +23,9 @@ use Getopt::Long qw(GetOptions);
use File::Basename;
use File::Spec;
+#use Pod::Simple::SimpleTree;
+#use Data::Dumper;
+
Getopt::Long::Configure("gnu_getopt");
#use Pod::Simple::Debug (4);
@@ -420,6 +423,9 @@ foreach my $file (@input_files) {
}
}
+ #my $pod_simple_tree = Pod::Simple::SimpleTree->new->parse_file($file)->root;
+ #print STDERR Data::Dumper->Dump([$pod_simple_tree])."\n";
+
my $new = Pod::Simple::Texinfo->new();
push @included, [$name, $outfile, $file] if ($base_level > 0);
diff --git a/Pod-Simple-Texinfo/t/Pod-Simple-Texinfo.t
b/Pod-Simple-Texinfo/t/Pod-Simple-Texinfo.t
index e640e6b5ed..cca9b74056 100644
--- a/Pod-Simple-Texinfo/t/Pod-Simple-Texinfo.t
+++ b/Pod-Simple-Texinfo/t/Pod-Simple-Texinfo.t
@@ -6,7 +6,7 @@
# change 'tests => 1' to 'tests => last_test_to_print';
use Test::More;
-BEGIN { plan tests => 19 };
+BEGIN { plan tests => 20 };
use Pod::Simple::Texinfo;
ok(1); # If we made it this far, we're ok.
@@ -267,6 +267,16 @@ L</A::b. c> L</D::E. f>
',
'colon and dot in node name');
+run_test('=head1 head C<extra>
+
+L</head C<extra>>
+', '@chapter head @code{extra}
+@anchor{head @code{extra}}
+
+@ref{head extra}
+
+', 'code in reference');
+
run_test('=head1 head
# line 4 "ggggg"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm, Pod-Simple-Texinfo/pod2texi.pl: add comments to explain the issue with formatting section in L. Also add code in comment to show the Pod::Simple tree.,
Patrice Dumas <=
- Prev by Date:
branch master updated: * tp/Texinfo/Common.pm, tp/Texinfo/Commands.pod, doc/tp_api/Makefile.am (tp_api_dependencies, dist_modules_DATA), tp/Texinfo/XS/parsetexi/command_data.txt, tp/Texinfo/XS/parsetexi/commands.h: move Pod documentation on hashes in Texinfo::Commands out of tp/Texinfo/Common.pm to tp/Texinfo/Commands.pod. Add more information in tp/Texinfo/XS/parsetexi/command_data.txt and tp/Texinfo/XS/parsetexi/commands.h.
- Next by Date:
branch master updated: * Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm (_texinfo_handle_element_start, _texinfo_handle_text) (_texinfo_handle_element_end): use handle functions similar to those used in Pod::Simple to be able to use the different Pod::Simple parser styles more easily. Put @accumulated_output in $self->{'texinfo_accumulated'} and @format_stack in $self->{'texinfo_stack'}. Replace token modification after <X> to remove a leading space by setting $self->{'texinfo_ignore_leading_spaces'}.
- Previous by thread:
branch master updated: * tp/Texinfo/Common.pm, tp/Texinfo/Commands.pod, doc/tp_api/Makefile.am (tp_api_dependencies, dist_modules_DATA), tp/Texinfo/XS/parsetexi/command_data.txt, tp/Texinfo/XS/parsetexi/commands.h: move Pod documentation on hashes in Texinfo::Commands out of tp/Texinfo/Common.pm to tp/Texinfo/Commands.pod. Add more information in tp/Texinfo/XS/parsetexi/command_data.txt and tp/Texinfo/XS/parsetexi/commands.h.
- Next by thread:
branch master updated: * Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm (_texinfo_handle_element_start, _texinfo_handle_text) (_texinfo_handle_element_end): use handle functions similar to those used in Pod::Simple to be able to use the different Pod::Simple parser styles more easily. Put @accumulated_output in $self->{'texinfo_accumulated'} and @format_stack in $self->{'texinfo_stack'}. Replace token modification after <X> to remove a leading space by setting $self->{'texinfo_ignore_leading_spaces'}.
- Index(es):