From: Jari Aalto Date: Wed, 7 Mar 2007 11:08:24 +0000 (+0200) Subject: Re: [perl #41683] [PATCH] v5.8.8 pod2html -- incorrect treatment of non-manual page... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=54e8619f399d7124d2d993e15e1e69e86b9b334b;p=p5sagit%2Fp5-mst-13.2.git 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 --- diff --git a/lib/Pod/Html.pm b/lib/Pod/Html.pm index 7b61d5c..232bd2b 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 = "the $word manpage"; + $word = qq(the $word manpage$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+$/) {