Template-Plugin-Textile2-1.21/ 0000755 0001750 0000144 00000000000 10533625736 014471 5 ustar mb users Template-Plugin-Textile2-1.21/lib/ 0000755 0001750 0000144 00000000000 10533625736 015237 5 ustar mb users Template-Plugin-Textile2-1.21/lib/Template/ 0000755 0001750 0000144 00000000000 10533625736 017012 5 ustar mb users Template-Plugin-Textile2-1.21/lib/Template/Plugin/ 0000755 0001750 0000144 00000000000 10533625736 020250 5 ustar mb users Template-Plugin-Textile2-1.21/lib/Template/Plugin/Textile2.pm 0000444 0001750 0000144 00000004442 10533625736 022310 0 ustar mb users package Template::Plugin::Textile2;
use strict;
use warnings;
use Template::Plugin::Filter;
use Text::Textile;
our $VERSION = "1.21";
use base qw/Template::Plugin::Filter/;
sub init {
my ($self, $args) = @_;
die 'Args must be an hashref'
if (defined $args) && (ref $args ne 'HASH');
$self-> { _FORMAT_MODE }
= $args->{format_mode} || 'default';
delete $args->{format_mode};
$self->{ _TEXTILE } = Text::Textile->new(
%$args
);
my $name = $self->{ _CONFIG }->{ name } || 'textile2';
$self->install_filter($name);
return $self;
}
sub filter {
my ($self, $text) = @_;
if ( $self->{_FORMAT_MODE} eq 'inline' ) {
return $self->{_TEXTILE}->format_inline(text => $text);
}
else {
return $self->{_TEXTILE}->process($text);
}
}
1;
__END__
=head1 NAME
Template::Plugin::Textile2 - Use Textile formatting with Template Toolkit
=head1 SYNOPSIS
[% USE Textile2 -%]
[% FILTER textile2 %]This *bold* and this is _italic_.[% END %]
this is bold and this is italic.
[% USE Textile2 ( disable_html => 1 ) -%]
[% FILTER textile2 %]this is
_italic_.[% END %]
this is<br /> italic.
=head1 DESCRIPTION
This module wraps Text::Textile into a plugin Template Toolkit. It
provides a filter named C.
This aims to be a more feature-full version L,
by allowing you to pass parameters to L.
Use this way:
[% FILTER textile2 %]
Reasons to use the Template Toolkit:
* Seperation of concerns.
* It's written in Perl.
* Badgers are Still Cool.
[% END %]
or:
[% mytext | textile2 %]
You can pass the same options you would pass to Text::Textile, directly
when using the template. For instance to disable processing of HTML
tags you can do:
[% USE Textile2 ( disable_html => 1 ) %]
To avoid your text to be wrapped into C<<p>...</p>> you can
use:
[% USE Textile2 ( format_mode => 'inline' ) %]
See L for details.
=head1 AUTHOR
Michele Beltrame C.
=head1 LICENSE
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
=head1 SEE ALSO
L, L
=cut
Template-Plugin-Textile2-1.21/MANIFEST 0000444 0001750 0000144 00000000271 10533625736 015620 0 ustar mb users Changes
Makefile.PL
Build.PL
MANIFEST
README
t/Template-Plugin-Textile2.t
lib/Template/Plugin/Textile2.pm
META.yml Module meta-data (added by MakeMaker)
Template-Plugin-Textile2-1.21/META.yml 0000444 0001750 0000144 00000000763 10533625736 015746 0 ustar mb users ---
name: Template-Plugin-Textile2
version: 1.21
author:
- Michele Beltrame C.
abstract: Use Textile formatting with Template Toolkit
license: perl
resources:
license: http://dev.perl.org/licenses/
requires:
Template: 2.15
Text::Textile: 2.03
provides:
Template::Plugin::Textile2:
file: lib/Template/Plugin/Textile2.pm
version: 1.21
generated_by: Module::Build version 0.2805
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.2.html
version: 1.2
Template-Plugin-Textile2-1.21/Changes 0000444 0001750 0000144 00000000234 10533625736 015761 0 ustar mb users Revision history for Perl extension Template::Plugin::Textile.
1.21 Thu Nov 30 2006
- doc & Changes fixes
1.20 Thu Nov 30 2006
- inital release
Template-Plugin-Textile2-1.21/t/ 0000755 0001750 0000144 00000000000 10533625736 014734 5 ustar mb users Template-Plugin-Textile2-1.21/t/Template-Plugin-Textile2.t 0000444 0001750 0000144 00000000722 10533625736 021625 0 ustar mb users use Test::More tests => 1;
use strict;
use Template;
# ### Basic Textile ####
my $template_source = "
[%- USE Textile2 -%]
[%- FILTER textile2 -%]
This is *bold* and this is _italic_.
[%- END -%]
";
my $t = Template->new();
my $output;
$t->process(\$template_source, undef, \$output) or die "Can't process template";
ok( $output eq 'This is bold and this is italic.
' );
# ### No-HTML ###
#TODO
# ### Inline ####
#TODO
1;
Template-Plugin-Textile2-1.21/README 0000444 0001750 0000144 00000002075 10533625736 015353 0 ustar mb users Image-VisualConfirmation version 0.01
=====================================
This module aims at making the creation of visual confirmation images
simple. For who doesn't know, these are the funky images from which
you have to copy the text when submitting a form. Their function is
to avoid robots spamming web forms, and they work quite good even
though spammers' OCR software is becoming increasingly good.
This modle is mainly used in a web application context, in conjuction
with such modules as or with a web framework such as Catalyst.
INSTALLATION
To install this module type the following:
perl Makefile.PL
make
make test
make install
DEPENDENCIES
This module requires these other modules and libraries:
Imager
COPYRIGHT AND LICENCE
Copyright (C) 2006 by Michele Beltrame
This library is free software, you can redistribute it and/or modify it
under the same terms as Perl itself.
The Bitstream Vera font bundled with this distribution is copyrighted
by Bitstream ( http://www.bitstream.com ) and distributed under its
license terms.
Template-Plugin-Textile2-1.21/Build.PL 0000444 0001750 0000144 00000000742 10533625736 015766 0 ustar mb users use strict;
use Module::Build;
my %arguments = (
#create_makefile_pl => 'passthrough',
create_makefile_pl => 'traditional',
license => 'perl',
module_name => 'Template::Plugin::Textile2',
requires => {
'Template' => 2.15,
'Text::Textile' => 2.03,
},
build_requires => {
# 'Test::Exception' => 0
},
);
my $build = Module::Build->new(%arguments);
$build->create_build_script();
Template-Plugin-Textile2-1.21/Makefile.PL 0000444 0001750 0000144 00000000751 10533625736 016444 0 ustar mb users # Note: this file was auto-generated by Module::Build::Compat version 0.03
use ExtUtils::MakeMaker;
WriteMakefile
(
'NAME' => 'Template::Plugin::Textile2',
'VERSION_FROM' => 'lib/Template/Plugin/Textile2.pm',
'PREREQ_PM' => {
'Template' => '2.15',
'Text::Textile' => '2.03'
},
'INSTALLDIRS' => 'site',
'EXE_FILES' => [],
'PL_FILES' => {}
)
;