1 package Blog
::View
::TT
;
6 use base
'Catalyst::View::TT';
7 #use Template::Constants qw(:debug);
10 use Encode
'encode_utf8';
14 COMPILE_DIR
=> Blog
->path_to( 'tmp' ),
18 Blog
->path_to( 'templates', 'lib' ),
19 Blog
->path_to( 'templates', 'src', Blog
->config->{ style
})
21 TEMPLATE_EXTENSION
=> '.tt2',
23 PRE_PROCESS
=> 'config',
27 #DEBUG => DEBUG_UNDEF,
33 encode_utf8
=> \
&encode_utf8
42 my $feed = $c->stash->{ feed
};
45 $feed->{ description
} = $feed->{ description
};
46 if ( scalar @
{ $feed->{ items
} } ) {
47 $feed->{ lastBuildDate
} =
48 time2str
( $feed->{ items
}->[ 0 ]->{ pubDate
} );
50 foreach my $item ( @
{ $feed->{ items
} } ) {
51 $item->{ pubDate
} = time2str
( $item->{ pubDate
} );
55 $feed->{ items
} = [];
58 $c->stash->{ template
} = 'feed';
61 $self->next::method
(@_);
67 Blog
->context->helper( 'BBCode' )->render( $text );
73 Blog
->context->helper( 'CCode' )->render( $text );
79 # return unless $text;
81 # #$text =~ s/&/&/go;
82 # $text =~ s/</</go;
83 # $text =~ s/>/>/go;
85 # $text =~ s/\x0D\x0A/\n/g;
86 # $text =~ tr/\x0D\x0A/\n\n/;
88 # $text =~ s{(?<!\n)(\n)(?!\n)}{<br />\n}g;
90 # . join( "</p>\n\n<p>\n", split( /(?:\r?\n){2,}/, $text ) )
97 my ( $text, $maxlength ) = @_;
99 Blog
->context->model('Util')->cut( $text, $maxlength);
108 This library is free software, you can redistribute it and/or modify
109 it under the same terms as Perl itself.