Change 30722 by [EMAIL PROTECTED] on 2007/03/23 14:47:09
Subject: Re: [perl #41683] [PATCH] v5.8.8 pod2html -- incorrect
treatment of non-manual page refs like "this(c)"
From: Jari Aalto <[EMAIL PROTECTED]>
Date: Wed, 07 Mar 2007 11:08:24 +0200
Message-ID: <[EMAIL PROTECTED]>
with adjustments to the regexp
Affected files ...
... //depot/perl/lib/Pod/Html.pm#91 edit
Differences ...
==== //depot/perl/lib/Pod/Html.pm#91 (text) ====
Index: perl/lib/Pod/Html.pm
--- perl/lib/Pod/Html.pm#90~30708~ 2007-03-22 18:54:54.000000000 -0700
+++ perl/lib/Pod/Html.pm 2007-03-23 07:47:09.000000000 -0700
@@ -1448,20 +1448,36 @@
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)
+ |[^)[EMAIL PROTECTED])]+ # ($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 =~ /[EMAIL PROTECTED]&*]+\w+$/) {
End of Patch.