Hi,

My name's Dave Storrs; I've been browsing the archives and Googling for an
answer to the following question with no success, so I thought I'd check.

>From what I see in the man page, I should be able to do the following:

        Please click L<here|http://archive.develooper.com> for the
        archives

and get back something that looks like this:

        Please click <A HREF="http://archive.develooper.com";>here</A> for
        the archives

But whenever I try that, it tells me that it "could not resolve link" and
spits up (instead of a link, I just get <EM> tags).  I poked at the source
a bit and then wrote the following patch to Pod::Html.pm, but it seems
like I'm probably missing something.  Is there a better way to do this?


Thanks in advance,


Dave Storrs


PS  I've always wondered...why is it "develooper", instead of "developer"?
Was it just a typo?



###################################################

[dstorrs@maya p2html]$ diff -u -b Pod/Html.pm
/usr/lib/perl5/5.6.1/Pod/Html.pm
--- Pod/Html.pm Sun Jul 21 13:08:40 2002
+++ /usr/lib/perl5/5.6.1/Pod/Html.pm    Sun Sep  9 18:02:40 2001
@@ -1461,16 +1461,12 @@
        ## L<cross-ref> => make text from cross-ref
        ## need to extract text
        my $par = go_ahead( $rstr, 'L', $closing );
+
         # some L<>'s that shouldn't be:
        # a) full-blown URL's are emitted as-is
        if( $par =~ m{^\w+://}s ){
            return make_URL_href( $par );
        }
-       if( $par =~ m{^((\w+)\|)?\w+://}s ){
-               my $text = $2;
-               $par =~ s/^$text\|//;
-               return make_URL_href( $par, $text );
-       }
         # b) C<...> is stripped and treated as C<>
         if( $par =~ /^C<(.*)>$/ ){
            my $text = depod( $1 );
@@ -1516,7 +1512,7 @@
         my( $url, $ltext, $fid );

         RESOLVE: {
-            if( defined $ident ) {
+            if( defined $ident ){
                 ## try to resolve $ident as an item
                ( $url, $fid ) = coderef( $page, $ident );
                 if( $url ){
@@ -1531,7 +1527,6 @@
                 ## no luck: go for a section (auto-quoting!)
                 $section = $ident;
             }
-
             ## now go for a section
             my $htmlsection = htmlify( $section );
            $url = page_sect( $page, $htmlsection );
@@ -2018,17 +2013,11 @@
 # make_URL_href - generate HTML href from URL
 # Special treatment for CGI queries.
 #
-sub make_URL_href($;$){
-    my( $url, $text ) = @_;
-
-       if ( $text ) { $url = "<A HREF=\"$url\">$text</A>"; }
-       else {
-         $text = $url;
-         if( $url !~   s{^(http:[-\w/#~:.+=&%@!]+)(\?.*)$}
-                                        {<A HREF="$1$2">$1</A>}i )
-         {
-               $url = "<A HREF=\"$url\">$text</A>";
-         }
+sub make_URL_href($){
+    my( $url ) = @_;
+    if( $url !~
+        s{^(http:[-\w/#~:.+=&%@!]+)(\?.*)$}{<A HREF="$1$2">$1</A>}i ){
+        $url = "<A HREF=\"$url\">$url</A>";
        }
   return $url;
 }

Reply via email to