As Link



We've found a numbered reference which is our clue to substitute some kind of reference to a URL entered on the "Edit Links" page and now appearing as r-something in the bindings we loaded in HandleBrowse.

  sub AsLink {
    local($num) = (@_);
    local($ref) = $old{"r$num"};

If we found the URL in our references then either inline an image or link to the external page. If we don't yet have the URL, just let the numbered reference stand unlinked.

    defined $ref
        ? ($ref =~ /\.(?:gif|jpg|jpeg|png)$/i 
            ? "<img src=\"$ref\">" 
            : "<a href=\"$ref\">[$num]<\/a>")
        : "[$num]";
  }

 

Last edited June 13, 2000
Return to WelcomeVisitors