X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FPod%2FParseUtils.pm;h=18e9626e0e6bcb521b16c0e2ba25ed002e07e287;hb=53bf329c4a7cae809d0c4c820f4ecdeb18754f17;hp=db615a57c476d620ab1d2b45828c01e9e4f0549e;hpb=6facdfffe71025525d0728c47e940e0df82f9b65;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/Pod/ParseUtils.pm b/lib/Pod/ParseUtils.pm index db615a5..18e9626 100644 --- a/lib/Pod/ParseUtils.pm +++ b/lib/Pod/ParseUtils.pm @@ -10,7 +10,7 @@ package Pod::ParseUtils; use vars qw($VERSION); -$VERSION = 0.22; ## Current version of this package +$VERSION = 0.30; ## Current version of this package require 5.005; ## requires this Perl version or later =head1 NAME @@ -284,7 +284,7 @@ sub parse { my $self = shift; local($_) = $_[0]; # syntax check the link and extract destination - my ($alttext,$page,$node,$type) = (undef,'','',''); + my ($alttext,$page,$node,$type,$quoted) = (undef,'','','',0); $self->{_warnings} = []; @@ -311,7 +311,7 @@ sub parse { # problem: a lot of people use (), or (1) or the like to indicate # man page sections. But this collides with L that is supposed # to point to an internal funtion... - my $page_rx = '[\w.]+(?:::[\w.]+)*(?:[(](?:\d\w*|)[)]|)'; + my $page_rx = '[\w.-]+(?:::[\w.-]+)*(?:[(](?:\d\w*|)[)]|)'; # page name only if(m!^($page_rx)$!o) { $page = $1; @@ -321,6 +321,7 @@ sub parse { elsif(m!^(.*?)\s*[|]\s*($page_rx)\s*/\s*"(.+)"$!o) { ($alttext, $page, $node) = ($1, $2, $3); $type = 'section'; + $quoted = 1; #... therefore | and / are allowed } # alttext and page elsif(m!^(.*?)\s*[|]\s*($page_rx)$!o) { @@ -331,11 +332,13 @@ sub parse { elsif(m!^(.*?)\s*[|]\s*(?:/\s*|)"(.+)"$!) { ($alttext, $node) = ($1,$2); $type = 'section'; + $quoted = 1; } # page and "section" elsif(m!^($page_rx)\s*/\s*"(.+)"$!o) { ($page, $node) = ($1, $2); $type = 'section'; + $quoted = 1; } # page and item elsif(m!^($page_rx)\s*/\s*(.+)$!o) { @@ -346,6 +349,7 @@ sub parse { elsif(m!^/?"(.+)"$!) { $node = $1; $type = 'section'; + $quoted = 1; } # only item elsif(m!^\s*/(.+)$!) { @@ -392,7 +396,7 @@ sub parse { if($page =~ /[(]\w*[)]$/) { $self->warning("(section) in '$page' deprecated"); } - if($node =~ m:[|/]:) { + if(!$quoted && $node =~ m:[|/]:) { $self->warning("node '$node' contains non-escaped | or /"); } if($alttext =~ m:[|/]:) { @@ -422,11 +426,9 @@ sub _construct_text { $self->{_text} = $section; } else { - $self->{_text} = (!$section ? '' : - $type eq 'item' ? "the $section entry" : - "the section on $section" ) . - ($page ? ($section ? ' in ':'') . "the $page$page_ext manpage" : - ' elsewhere in this document'); + $self->{_text} = ($section || '') . + (($page && $section) ? ' in ' : '') . + "$page$page_ext"; } # for being marked up later # use the non-standard markers P<> and Q<>, so that the resulting @@ -439,11 +441,8 @@ sub _construct_text { $self->{_markup} = "Q<$section>"; } else { - $self->{_markup} = (!$section ? '' : - $type eq 'item' ? "the Q<$section> entry" : - "the section on Q<$section>" ) . - ($page ? ($section ? ' in ':'') . "the P<$page>$page_ext manpage" : - ' elsewhere in this document'); + $self->{_markup} = (!$section ? '' : "Q<$section>") . + ($page ? ($section ? ' in ':'') . "P<$page>$page_ext" : ''); } } @@ -469,10 +468,10 @@ but without markers (read only). Depending on the link type this is one of the following alternatives (the + and * denote the portions of the text that are marked up): - the +perl+ manpage - the *$|* entry in the +perlvar+ manpage - the section on *OPTIONS* in the +perldoc+ manpage - the section on *DESCRIPTION* elsewhere in this document + +perl+ L + *$|* in +perlvar+ L + *OPTIONS* in +perldoc+ L + *DESCRIPTION* L<"DESCRIPTION"> =cut