Acme-Monta
view release on metacpan or search on metacpan
lib/Acme/Monta.pm view on Meta::CPAN
}, $class;
return $self;
}
sub montaize {
my $self = shift;
my $data = shift;
$data =~ s|$self->{_start}(.*?)$self->{_end}|
'<' . $self->{_replace_tag} . ' style="' .
'cursor:' . $self->{_cursor} . ';' .
'color:' . $self->{_close_font} . ';' .
'background-color:' . $self->{_close_back} . ';' .
'background-image:' . $self->{_close_img} . ';' .
'" onClick="' .
'this.style.color = \'' . $self->{_open_font} . '\';' .
'this.style.backgroundColor = \'' . $self->{_open_back} . '\';' .
'this.style.backgroundImage = \'\';' .
'this.style.cursor = \'\';' .
'">' . $1 . '</' . $self->{_replace_tag} . '>'
|goie;
return $data;
}
1;
__END__
=head1 NAME
t/montaize_openclose.t view on Meta::CPAN
#########################
# change 'tests => 1' to 'tests => last_test_to_print';
use Test::More tests => 2;
BEGIN { use_ok('Acme::Monta') };
my $monta = Acme::Monta->new(open_font => '#f00', open_back => '#00f', close_font => '#0f0', close_back => '#0f0');
my $data = 'this is <monta>secret words</monta>.';
ok($monta->montaize($data) eq 'this is <span style="cursor:pointer;color:#0f0;background-color:#0f0;background-image:;" onClick="this.style.color = \'#f00\';this.style.backgroundColor = \'#00f\';this.style.backgroundImage = \'\';this.style.cursor = \...
( run in 0.494 second using v1.01-cache-2.11-cpan-49f99fa48dc )