Here's one I use...this is based off of some original code provided by a fellow monk. I'm drawing a blank at the moment, so if said monk could kindly speak up I'll gladly give credit (update: it was jeffa. thanks!). It's been rather modified since then.

Matt

package PerlMonks::PuffBracket; use strict; use warnings; require Exporter; use base qw(Exporter); our @EXPORT = qw(puffbracket); use Carp; use URI; use constant PM_URL => 'http://www.perlmonks.org'; use constant ABSOLUTE => 1; my %SCHEME = ( ftp => 'ftp://', http => 'http://', https => 'https://', kobe => 'http://theoryx5.uwinnipeg.ca/mod_perl/cpan-search?filety +pe=+distribut­ion+name+or+description&j&case=clike&search=', kobes => 'http://theoryx5.uwinnipeg.ca/mod_perl/cpan-search?filety +pe=+distribut­ion+name+or+description&j&case=clike&search=', cpan => 'http://search.cpan.org/search?mode=module&query=', isbn => 'http://shop.barnesandnoble.com/booksearch/isbnInquiry.as +p?isbn=', google => 'http://www.google.com/search?q=', lucky => 'http://www.google.com/search?btnI=I&q=', jargon => 'http://www.science.uva.nl/cng/search/htsearch.CGI?restri +ct=%2F%7Emes%­2F&jargon%2Fwords=', perldoc => 'http://www.perldoc.com/cgi-bin/htsearch?&words=', dict => 'http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va +=', id => '/index.pl?node_id=', pad => '/index.pl?node_id=108949&user=', DEFAULT => '/index.pl?node=', ); my $anch_with_alt = qr/\[(\w+):\/\/([^|\]]*?)\|([^\]]+?)\]/; my $anch = qr/\[(\w+):\/\/([^\]]+?)\]/; my $bracket_with_alt = qr/\[([^|\]]+)\|([^\]]+?)\]/; my $bracket = qr/\[([^\]]+?)\]/; if (ABSOLUTE) { foreach (qw(id pad DEFAULT)) { $SCHEME{$_} = PM_URL . $SCHEME{$_}; } } sub puffbracket { my $line = shift; while ($line =~ /$anch_with_alt/g) { if ($SCHEME{$1}) { my $tgt = URI->new($2)->canonical; $line =~ s/$anch_with_alt/<a href="$SCHEME{$1}$tgt">$3<\/a>/ if $tgt; } } while ($line =~ /$anch/g) { my $scheme = $1; my $tgt = $2; my $txt = ''; if ($SCHEME{$scheme}) { $tgt = URI->new($tgt)->canonical; $txt = $scheme eq 'id' ? "node $tgt" : $tgt; $line =~ s/$anch/<a href="$SCHEME{$scheme}$tgt">$txt<\/a>/; } } while ($line =~ /$bracket_with_alt/g) { my $tgt = URI->new("$SCHEME{DEFAULT}$1")->canonical; $line =~ s/$bracket_with_alt/<a href="$tgt">$2<\/a>/ if $tgt; } while ($line =~ /$bracket/g) { my $tgt = URI->new("$SCHEME{DEFAULT}$1")->canonical; $line =~ s/$bracket/<a href="$tgt">$1<\/a>/ if $tgt; } $line; } 1;

In reply to PerlMonks::PuffBracket by mojotoad
in thread Psuedo-PerlMonk Style Links by The Mad Hatter

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.