Acme-Monta

 view release on metacpan or  search on metacpan

lib/Acme/Monta.pm  view on Meta::CPAN

}

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

lib/Acme/Monta.pm  view on Meta::CPAN

=item end

  change end tag.

=item open_font

  change open font color.

=item open_back

  change open background color.

=item close_font

  change close font color.

=item close_back

  change close background color.

=item close_img

  set close background image url.

=item replace_tag

  change replaced tag.

=item cursor

  change mouse cursor.

=head1 SEE ALSO

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 2.182 seconds using v1.01-cache-2.11-cpan-d8267643d1d )