Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Pod-Simple CPAN distribution.

Report information
The Basics
Id: 4896
Status: resolved
Priority: 0/
Queue: Pod-Simple

People
Owner: Nobody in particular
Requestors:
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: support for L<<< alt text |http://some.kind.of.uri.com >>>
This patch doesn't break anything, but you should give it a closer look. "complex L<URL> link"s get screwed up (hopefully you can fix that up :), example: warn $x->_out(qq{=pod\n\nG L<<< text|http://text.com/?E<gt> >>>.\n}), $/; yields <Document><Para>G <L to="text&#62;" type="url">text&#62;</L>.</Para></Document>
diff -rub Pod-Simple-2.05/lib/Pod/Simple.pm Pod-Simple-2.05q/lib/Pod/Simple.pm --- Pod-Simple-2.05/lib/Pod/Simple.pm 2003-11-05 00:32:59.000000000 -0800 +++ Pod-Simple-2.05q/lib/Pod/Simple.pm 2004-01-10 07:30:19.859375000 -0800 @@ -18,7 +18,7 @@ ); @ISA = ('Pod::Simple::BlackBox'); -$VERSION = '2.05'; +$VERSION = '2.05q'; @Known_formatting_codes = qw(I B C L E F S X Z); %Known_formatting_codes = map(($_=>1), @Known_formatting_codes); @@ -969,6 +969,7 @@ # L<text|name/"sec"> or L<text|name/sec> # L<text|/"sec"> or L<text|/sec> or L<text|"sec"> # L<scheme:...> + # AND NOW, L<text|scheme:...> because there ain't no reason not to my($self,@stack) = @_; @@ -977,6 +978,7 @@ # A recursive algorithm implemented iteratively! Whee! +THEWHILE: while($treelet = shift @stack) { for(my $i = 2; $i < @$treelet; ++$i) { # iterate over children of current tree node @@ -1003,11 +1005,14 @@ # URLs can, alas, contain E<...> sequences, so we can't /assume/ # that this is one text node. But it has to START with one text # node... + # PodMaster if(! ref $treelet->[$i][2] and - $treelet->[$i][2] =~ m/^\w+:[^:\s]\S*$/s + $treelet->[$i][2] =~ m/^(?:([^|]*)\|)?(\w+:[^:\s]\S*)$/s ) { + $treelet->[$i][1]{'type'} = 'url'; - $treelet->[$i][1]{'content-implicit'} = 'yes'; + $treelet->[$i][1]{'content-implicit'} = 'yes' unless defined $1; + $treelet->[$i][2] = $1 if defined $1; if( 3 == @{ $treelet->[$i] } ) { # But if it IS just one text node (most common case) @@ -1015,7 +1020,8 @@ $treelet->[$i][2] ; $treelet->[$i][1]{'to'} = Pod::Simple::LinkSection->new( - $treelet->[$i][2] + #$treelet->[$i][2] + defined $2 ? $2 : $1 ); # its own treelet } else { # It's a URL but complex (like "L<foo:bazE<123>bar>"). Feh. @@ -1032,7 +1038,6 @@ DEBUG > 1 and print qq{Catching "$treelet->[$i][1]{'to'}" as a complex L<URL> link.\n}; } - next; # and move on } @@ -1108,6 +1113,37 @@ } } + # PodMaster + ## AND NOW, L<text|scheme:...> because there ain't no reason not to + # again, because there ain't no reason not to + + DEBUG > 3 and print " Peering at L-content for a 'scheme:' ...\n"; + for( my $j = 0 ; $j < @ell_content ; ++$j ) { + next if ref $ell_content[$j]; + DEBUG > 3 + and print + " Peering at L-content text bit \"$ell_content[$j]\" for a 'scheme:'.\n"; + + if( $ell_content[$j] =~ m/^(\w+:[^:\s]\S*)$/s ) { + + @ell_content = grep ref($_) || length($_), @ell_content; + $ell->[1]{'type'} = 'url'; + $ell->[1]{'to'} = Pod::Simple::LinkSection->new( + [ '', {}, @ell_content ] + ); + + DEBUG > 3 + and print "L-to content: ", pretty( $ell->[1]{'to'} ), "\n"; + + @$ell = (@$ell[0,1], defined($link_text) ? splice(@$link_text) : ''); + + DEBUG > 2 + and print "End of L-parsing for this node $treelet->[$i]\n"; + unshift @stack, $treelet->[$i]; # might as well recurse + next THEWHILE; + } + } + # Now look for the "/" -- only in CHILDREN (not all underlings!) # And afterward, anything left in @ell_content will be the raw name --- Pod-Simple-2.05/t/fcodes_ell.t 2003-09-01 23:08:23.000000000 -0700 +++ Pod-Simple-2.05q/t/fcodes_ell.t 2004-01-10 07:42:31.687500000 -0800 @@ -1,7 +1,7 @@ use strict; use Test; -BEGIN { plan tests => 93 }; +BEGIN { plan tests => 99 }; #use Pod::Simple::Debug (10); @@ -381,7 +381,6 @@ '<Document><Para>I like <L section="Basic BLOCKs and Switch Statements" to="perlsyn" type="pod">SWITCH <B>statements</B></L>.</Para></Document>' ); - ok( $x->_out(qq{=pod\n\nI like L<<< the F<< various >> attributes|/"Member Data" >>>.\n}), '<Document><Para>I like <L section="Member Data" type="pod">the <F>various</F> attributes</L>.</Para></Document>' ); @@ -392,6 +391,26 @@ '<Document><Para>I like <L section="Member Data" type="pod">the <F>various</F> attributes</L>.</Para></Document>' ); +# PodMaster +ok( $x->_out(qq{=pod\n\nI like L<<< B<text>s|http://text.com >>>.\n}), +'<Document><Para>I like <L to="http://text.com" type="url"><B>text</B>s</L>.</Para></Document>' +); +ok( $x->_out(qq{=pod\n\nI like L<<< text|https://text.com/1/2 >>>.\n}), +'<Document><Para>I like <L to="https://text.com/1/2" type="url">text</L>.</Para></Document>' +); +ok( $x->_out(qq{=pod\n\nI like L<<< I<text>|http://text.com >>>.\n}), +'<Document><Para>I like <L to="http://text.com" type="url"><I>text</I></L>.</Para></Document>' +); +ok( $x->_out(qq{=pod\n\nI like L<<< C<text>|http://text.com >>>.\n}), +'<Document><Para>I like <L to="http://text.com" type="url"><C>text</C></L>.</Para></Document>' +); +ok( $x->_out(qq{=pod\n\nI like L<<< I<tI<eI<xI<t>>>>|mailto:earl\@text.com >>>.\n}), +'<Document><Para>I like <L to="mailto:earl@text.com" type="url"><I>t<I>e<I>x<I>t</I></I></I></I></L>.</Para></Document>' +); +ok( $x->_out(qq{=pod\n\nI like L<<< textZ<>|http://text.com >>>.\n}), +'<Document><Para>I like <L to="http://text.com" type="url">text</L>.</Para></Document>' +); + # # TODO: S testing.
This patch is written for an older version of the code base, and fails the added tests when I apply it. Please send me an updated version, or I'll see if I can recreate it for the next release.
This will be fixed in 3.06.