1 package Gitalist::View::SyntaxHighlight;
3 use Gitalist; # ->path_to
4 use namespace::autoclean;
6 extends 'Catalyst::View';
8 use Syntax::Highlight::Engine::Kate ();
9 use Syntax::Highlight::Engine::Kate::Perl ();
14 # http://github.com/jrockway/angerwhale/blob/master/lib/Angerwhale/Format/Pod.pm#L136
16 no warnings 'redefine';
17 local *Syntax::Highlight::Engine::Kate::Template::logwarning
18 = sub { die @_ }; # i really don't care
19 my $hl = Syntax::Highlight::Engine::Kate->new(
29 # convert Kate's internal representation into
30 # <span class="<internal name>"> value </span>
32 $_ => [ qq{<span class="$_">}, '</span>' ]
34 qw/Alert BaseN BString Char Comment DataType
35 DecVal Error Float Function IString Keyword
36 Normal Operator Others RegionMarker Reserved
37 String Variable Warning/,
41 $c->stash->{blob} = $hl->highlightText($c->stash->{blob});
46 $c->forward('View::Default');
49 __PACKAGE__->meta->make_immutable;