use Carp;
$Carp::Internal{__PACKAGE__.""}++;
-our $VERSION = '1.21';
+our $VERSION = '1.22';
our $DEBUG;
our $VERBOSE;
our $PRETTY;
my $for_item;
while (<POD_DIAG>) {
+ sub _split_pod_link {
+ $_[0] =~ '(?:([^|]*)\|)?([^/]*)(?:/("?)(.*)\3)?';
+ ($1,$2,$4);
+ }
+
unescape();
if ($PRETTY) {
sub noop { return $_[0] } # spensive for a noop
sub bold { my $str =$_[0]; $str =~ s/(.)/$1\b$1/g; return $str; }
sub italic { my $str = $_[0]; $str =~ s/(.)/_\b$1/g; return $str; }
s/C<<< (.*?) >>>|C<< (.*?) >>|[BC]<(.*?)>/bold($+)/ges;
- s/[LIF]<(.*?)>/italic($1)/ges;
+ s/[IF]<(.*?)>/italic($1)/ges;
+ s/L<(.*?)>/
+ my($text,$page,$sect) = _split_pod_link($1);
+ defined $text
+ ? $text
+ : defined $sect
+ ? italic($sect) . ' in ' . italic($page)
+ : italic($page)
+ /ges;
} else {
s/C<<< (.*?) >>>|C<< (.*?) >>|[BC]<(.*?)>/$+/gs;
- s/[LIF]<(.*?)>/$1/gs;
+ s/[IF]<(.*?)>/$1/gs;
+ s/L<(.*?)>/
+ my($text,$page,$sect) = _split_pod_link($1);
+ defined $text
+ ? $text
+ : defined $sect
+ ? qq '"$sect" in $page'
+ : $page
+ /ges;
}
unless (/^=/) {
if (defined $header) {
@INC = 'lib';
}
-use Test::More tests => 3;
+use Test::More tests => 5;
BEGIN { use_ok('diagnostics') }
or die "Couldn't redirect STDERR to var: $!";
warn('gmtime(nan) too large');
like $warning, qr/\(W overflow\) You called/, '%0.f patterns';
+
+# L<foo/bar> links
+seek STDERR, 0,0;
+$warning = '';
+warn("accept() on closed socket spanner");
+like $warning, qr/"accept" in perlfunc/, 'L<foo/bar> links';
+
+# L<foo|bar/baz> links
+seek STDERR, 0,0;
+$warning = '';
+warn
+ 'Lexing code attempted to stuff non-Latin-1 character into Latin-1 input';
+like $warning, qr/using lex_stuff_pvn_flags or similar/, 'L<foo|bar/baz>';