root/lang/perl/Text-Trac/trunk/lib/Text/Trac/Macro.pm @ 6066

Revision 6066, 0.7 kB (checked in by mizzy, 6 years ago)

lang/perl/Text-Trac: initial import.

Line 
1package Text::Trac::Macro;
2use strict;
3use base qw(Text::Trac::InlineNode Class::Accessor::Fast);
4use UNIVERSAL::require;
5use Text::ParseWords qw(quotewords);
6
7__PACKAGE__->mk_accessors( 'pattern' );
8
9sub new {
10    my $class = shift;
11    my $self = {};
12    bless $self, $class;
13    return $self;
14}
15
16sub parse {
17    my ( $self, $name, $args, $match ) = @_;
18    my $c = $self->{context};
19
20    my @args  = quotewords( ',\s*', 0, $args ) if $args;
21    map { s/^\s+|\s+$//g } @args;
22
23    foreach my $class ("Text::Trac::Macro::$name", $name) {
24        if ( $class->require ) {
25            $match = $class->process( $c, @args ) || '';
26            last;
27        }
28    }
29
30    return $match;
31}
32
331;
Note: See TracBrowser for help on using the browser.