Pod::Man should strip leading lib/ for module manpages (from
[p5sagit/p5-mst-13.2.git] / lib / Pod / Html.pm
index 00b7e89..89e3d0f 100644 (file)
@@ -1351,17 +1351,19 @@ sub process_puretext {
        # skip space runs
        next if $word =~ /^\s*$/;
        # see if we can infer a link
-       if( $notinIS && $word =~ /^(\w+)\((.*)\)\W*$/ ) {
+       if( $notinIS && $word =~ /^(\w+)\((.*)\)$/ ) {
            # has parenthesis so should have been a C<> ref
             ## try for a pagename (perlXXX(1))?
-            if( $2 =~ /^\d+$/ ){
+            my( $func, $args ) = ( $1, $2 );
+            if( $args =~ /^\d+$/ ){
                 my $url = page_sect( $word, '' );
                 if( defined $url ){
                     $word = "<A HREF=\"$url\">the $word manpage</A>";
                     next;
                 }
             }
-           $word = emit_C( $word );
+            ## try function name for a link, append tt'ed argument list
+            $word = emit_C( $func, '', "($args)");
 
 #### disabled. either all (including $\W, $\w+{.*} etc.) or nothing.
 ##      } elsif( $notinIS && $word =~ /^[\$\@%&*]+\w+$/) {
@@ -1410,10 +1412,13 @@ sub process_text {
 
 sub process_text1($$;$$){
     my( $lev, $rstr, $func, $closing ) = @_;
-    $lev++ unless defined $func;
     my $res = '';
 
-    $func ||= '';
+    unless (defined $func) {
+       $func = '';
+       $lev++;
+    }
+
     if( $func eq 'B' ){
        # B<text> - boldface
        $res = '<STRONG>' . process_text1( $lev, $rstr ) . '</STRONG>';
@@ -1584,8 +1589,7 @@ sub process_text1($$;$$){
            return $res if !$3 && $lev > 1;
             if( $3 ){
                $res .= process_text1( $lev, $rstr, $3, closing $4 );
-           }
-
+           }
        }
        if( $lev == 1 ){
            $res .= pure_text( $$rstr );
@@ -1622,13 +1626,14 @@ sub go_ahead($$$){
 # emit_C - output result of C<text>
 #    $text is the depod-ed text
 #
-sub emit_C($;$){
-    my( $text, $nocode ) = @_;
+sub emit_C($;$$){
+    my( $text, $nocode, $args ) = @_;
+    $args = '' unless defined $args;
     my $res;
     my( $url, $fid ) = coderef( undef(), $text );
 
     # need HTML-safe text
-    my $linktext = html_escape( $text );
+    my $linktext = html_escape( "$text$args" );
 
     if( defined( $url ) &&
         (!defined( $EmittedItem ) || $EmittedItem ne $fid ) ){
@@ -1930,7 +1935,7 @@ sub depod1($;$$){
       # skip to next begin of an interior sequence
       while( $$rstr =~ s/\A(.*?)([BCEFILSXZ])<(<+[^\S\n]+)?// ){
          # recurse into its text
-         $res .= $1 . depod1( $rstr, $2, closing $3);
+         $res .= $1 . depod1( $rstr, $2, closing $3);
       }
       $res .= $$rstr;
   } elsif( $func eq 'E' ){
@@ -1946,7 +1951,7 @@ sub depod1($;$$){
   } else {
       # all others: either recurse into new function or
       # terminate at closing angle bracket
-      my $term = pattern $closing; 
+      my $term = pattern $closing;
       while( $$rstr =~ s/\A(.*?)(([BCEFILSXZ])<(<+[^\S\n]+)?|$term)// ){
          $res .= $1;
          last unless $3;