1 package Gitalist::Model::ContentMangler;
3 use MooseX::Types::Moose qw/HashRef/;
4 use namespace::autoclean;
6 extends 'Catalyst::Model';
8 # FIXME - Never cleared!!
12 default => sub { {} },
15 _add_language => 'set',
21 # FIXME This method is a gross hack.
23 # We need to work out what types of content mangles we have for various things based on hit type
24 # file name and mime type, and perform the appropriate bits..
26 # We need to support multiple languages, and we also want to be able to do HTMLizing (for e.g. Pod)
32 my $language = $c->stash->{language} || '';
33 $language = 'Perl' if $c->stash->{filename} =~ /\.p[lm]$/i;
36 $self->_add_language($language, $c->uri_for('/static/css/syntax/' . $language . '.css')) if $language;
38 if ($c->stash->{blobs} || $c->stash->{blob}) {
39 for($c->stash->{blobs} ? @{$c->stash->{blobs}} : $c->stash->{blob}) {
40 $_ = $c->view('SyntaxHighlight')->render($c, $_, { language => $language });
45 __PACKAGE__->meta->make_immutable;