diff options
author | Jari Aalto <jari.aalto@poboxes.com> | 2007-03-07 13:08:24 +0200 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-03-23 14:47:09 +0000 |
commit | 54e8619f399d7124d2d993e15e1e69e86b9b334b (patch) | |
tree | 18e407daca18e9e900d9c32bdd278ee9da70828f /lib/Pod | |
parent | f449fe8af429114912b627758de5588f04953ecc (diff) | |
download | perl-54e8619f399d7124d2d993e15e1e69e86b9b334b.tar.gz |
Re: [perl #41683] [PATCH] v5.8.8 pod2html -- incorrect treatment of non-manual page refs like "this(c)"
Message-ID: <87ejo1s9o7.fsf@w2kpicasso.cante.net>
with adjustments to the regexp
p4raw-id: //depot/perl@30722
Diffstat (limited to 'lib/Pod')
-rw-r--r-- | lib/Pod/Html.pm | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/lib/Pod/Html.pm b/lib/Pod/Html.pm index 7b61d5c853..232bd2b51a 100644 --- a/lib/Pod/Html.pm +++ b/lib/Pod/Html.pm @@ -1448,20 +1448,36 @@ sub process_puretext { foreach my $word (@words) { # skip space runs next if $word =~ /^\s*$/; - # see if we can infer a link - if( $notinIS && $word =~ /^(\w+)\((.*)\)$/ ) { + # see if we can infer a link or a function call + # + # NOTE: This is a word based search, it won't automatically + # mark "substr($var, 1, 2)" because the 1st word would be "substr($var" + # User has to enclose those with proper C<> + + if( $notinIS && $word =~ + m/ + ^([a-z_]{2,}) # The function name + \( + ([0-9][a-z]* # Manual page(1) or page(1M) + |[^)]*[\$\@\%][^)]+ # ($foo), (1, @foo), (%hash) + | # () + ) + \) + ([.,;]?)$ # a possible punctuation follows + /xi + ) { # has parenthesis so should have been a C<> ref ## try for a pagename (perlXXX(1))? - my( $func, $args ) = ( $1, $2 ); + my( $func, $args, $rest ) = ( $1, $2, $3 || '' ); if( $args =~ /^\d+$/ ){ my $url = page_sect( $word, '' ); if( defined $url ){ - $word = "<a href=\"$url\">the $word manpage</a>"; + $word = qq(<a href="$url" class="man">the $word manpage</a>$rest); next; } } ## try function name for a link, append tt'ed argument list - $word = emit_C( $func, '', "($args)"); + $word = emit_C( $func, '', "($args)") . $rest; #### disabled. either all (including $\W, $\w+{.*} etc.) or nothing. ## } elsif( $notinIS && $word =~ /^[\$\@%&*]+\w+$/) { |