Changeset 90

Show
Ignore:
Timestamp:
09/15/06 04:13:45 (2 years ago)
Author:
evdb
Message:

Added detection of links just in square brackets.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/PrlMnks/Plugin/Out.pm

    r86 r90  
    1212    id => sub { 
    1313        my $id = shift; 
    14         return "http://www.perlmonks.org/index.pl?node_id=$id"; 
     14        return "http://www.perlmonks.org/index.pl?node_id=" . uri_escape($id); 
     15    }, 
     16    node => sub { 
     17        my $node = shift; 
     18        return "http://www.perlmonks.org/index.pl?node=" . uri_escape($node); 
    1519    }, 
    1620    mod => sub { 
    1721        my $module = shift; 
    1822        $module =~ s{::}{-}g; 
    19         return "http://search.cpan.org/dist/$module"
     23        return "http://search.cpan.org/dist/" . uri_escape($module)
    2024    }, 
    2125); 
  • trunk/lib/PrlMnks/Template.pm

    r85 r90  
    6969        s{ \[ \s* ([a-z]+) ://([^\]]+) \s* \] } 
    7070         { _link_to_out( $1, $2 )             }xeg; 
     71 
     72         # [id://1234] 
     73         s{ \[ ([^\]]+) \] } 
     74          { _link_to_out( 'node', $1 )        }xeg; 
    7175 
    7276        # href="/index.pl?node=Ovid&lastnode_id=1072" 
  • trunk/t/plugin/out/out.t

    r86 r90  
    1515my %tests = ( 
    1616    "/out/id/1234"         => "$perlmonks/index.pl?node_id=1234", 
     17    "/out/node/abcd"         => "$perlmonks/index.pl?node=abcd", 
    1718    "/out/mod/DBD%3A%3APg" => "http://search.cpan.org/dist/DBD-Pg", 
    1819); 
  • trunk/t/template/alter_links.t

    r85 r90  
    4545--- 
    4646Monastery <a href="/html/508076.html">guidelines here</a> <br> 
     47------ 
     48foo [bar] bundy 
     49--- 
     50foo <a href="/out/node/bar">bar</a> bundy 
     51 
    4752END_TEST_TEXT 
    4853