Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

allow handleLinks to do aliases

by castaway (Parson)
on May 15, 2005 at 11:06 UTC ( #457196=pmdevtopic: print w/ replies, xml ) Need Help??
castaway has raised the following topic:

So that we can make aliases for link shortcuts in handlelinks settings such as:  wikipedia =wp Make the following change to Everything/
sub handleLinks { for(_test){ goto &$_ if $_ } my( $inner, $lastnodeid )= @_; my $title; my $HLS= getVars(getNode('handlelinks settings','setting')); my( $prefix, $nodeloc )= split( /:\/\//, $inner, 2 ); if($nodeloc){ ## change here $prefix = $1 if($$HLS{lc($prefix) =~ /^=(\w+)$/); ## ($nodeloc,$title)=split(/\|/,$nodeloc,2); my $cpantitle=$title || $nodeloc; my $escapedname=$query->escape($nodeloc); if($prefix){ if($$HLS{lc($prefix)}){ eval($$HLS{lc($prefix)}); } else { return "[$prefix://$nodeloc]"; } } } else { return linkNodeTitle($inner); } }


Comment on allow handleLinks to do aliases
Select or Download Code
Replies are listed 'Best First'.
Re: allow handleLinks to do aliases
by theorbtwo (Prior) on May 15, 2005 at 11:12 UTC

    This doesn't allow for aliases to aliases. while ($HLS->{lc $prefix) =~ /^=(.*)/) {$prefix = $1} will keep going until it's done.

    Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).

      This is true, however since these are not random people adding the aliases, but actual seasoned pmdevs, I would hope that would be a waste of cycles.. ;)


        Given the extreme difficulty in joining pmdev ... I'm not so sure we're that far away from "random people" ;-}

        (I had to say it before someone said it about me ;-)

Re: allow handleLinks to do aliases
by ysth (Canon) on May 15, 2005 at 14:16 UTC
    return "[$prefix://$nodeloc]"; had better become return "[$inner]"; then.

    I'd also like to see the // become optional; does anyone have a problem with doing that (for all prefixes)?

      Only hysterical ones, why change a long established tradition?


Re: allow handleLinks to do aliases
by tye (Sage) on May 15, 2005 at 14:31 UTC

    I thought we already had aliases where a setting value matching /^\w+$/ indicated an aliases. But perhaps that is only in the long-unfinished replacement?

    - tye        

      Presumably, since I don't see it in the current code..


Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2015-11-26 01:31 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (695 votes), past polls