# 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+$/) {
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>';
return $res if !$3 && $lev > 1;
if( $3 ){
$res .= process_text1( $lev, $rstr, $3, closing $4 );
- }
-
+ }
}
if( $lev == 1 ){
$res .= pure_text( $$rstr );
# 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 ) ){
# 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' ){
} 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;