From: Dan Brook Date: Sat, 17 Apr 2010 20:42:07 +0000 (+0100) Subject: Got blob highlighting working with the ContentMangler. X-Git-Tag: 0.002002~27 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1064e5b8d484d1007295d0325a82a80801ad14b9;p=catagits%2FGitalist.git Got blob highlighting working with the ContentMangler. --- diff --git a/lib/Gitalist/Controller/Fragment/Ref.pm b/lib/Gitalist/Controller/Fragment/Ref.pm index 914eed9..9793dd7 100644 --- a/lib/Gitalist/Controller/Fragment/Ref.pm +++ b/lib/Gitalist/Controller/Fragment/Ref.pm @@ -68,8 +68,7 @@ after blame => sub { blob => join("\n", map $_->{line}, @$blame), ); - $c->forward('Model::ContentMangler') - unless $c->stash->{no_wrapper}; + $c->forward('Model::ContentMangler'); }; =head2 blob @@ -84,9 +83,7 @@ after blob => sub { is_image => File::Type::WebImages::mime_type($c->stash->{blob}), is_binary => Gitalist::Utils::is_binary($c->stash->{blob}), ); - - $c->forward('Model::ContentMangler') - unless $c->stash->{no_wrapper}; + $c->forward('Model::ContentMangler'); }; after history => sub { diff --git a/lib/Gitalist/Model/ContentMangler.pm b/lib/Gitalist/Model/ContentMangler.pm index d7b7457..62a3356 100644 --- a/lib/Gitalist/Model/ContentMangler.pm +++ b/lib/Gitalist/Model/ContentMangler.pm @@ -44,7 +44,10 @@ sub process { my @steps = $self->resolve({ filename => $c->stash->{filename} }); my @css = map { $_->[1]->{css} } grep { exists $_->[1] && exists $_->[1]->{css} && defined $_->[1]->{css} && length $_->[1]->{css} } @steps; - $c->stash(syntax_css => [ map { $c->uri_for('/static/css/syntax/' . $_ . '.css') } @css ]); + $c->stash( + syntax_css => [ map { $c->uri_for('/static/css/syntax/' . $_ . '.css') } @css ], + mangled => scalar @steps, + ); if ($c->stash->{blobs} || $c->stash->{blob}) { foreach my $step (@steps) { diff --git a/root/fragment/ref/blob.tt2 b/root/fragment/ref/blob.tt2 index aaaa65d..3fe51e8 100644 --- a/root/fragment/ref/blob.tt2 +++ b/root/fragment/ref/blob.tt2 @@ -3,5 +3,6 @@ [%- ELSIF is_binary -%]
This is a binary file which won't render natively on the web, but you can get it here all the same: [% filename %]
[%- ELSE -%] -
[% blob | html %]
+[%- INCLUDE inc/syntax_highlight_css.tt2 -%] +
[% IF mangled; blob; ELSE; blob | html; END; %]
[%- END -%] diff --git a/root/ref/blob.tt2 b/root/ref/blob.tt2 index fb4497d..92fbf03 100755 --- a/root/ref/blob.tt2 +++ b/root/ref/blob.tt2 @@ -1,5 +1,3 @@ -[% INCLUDE inc/syntax_highlight_css.tt2 %] -

[% INCLUDE 'nav/path.tt2' %]

[% IF object.type == 'commit' %]