Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

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
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.


      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 (Cardinal) 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?
As of 2014-12-29 11:39 GMT
Find Nodes?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?

    Results (186 votes), past polls