From: broquaint Date: Fri, 6 Nov 2009 16:23:07 +0000 (+0000) Subject: Fixed a couple of bugs. X-Git-Tag: 0.000000_01~85^2~2^2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4621ecf0959b92a9642a4a7cfc150c43118f46df;p=catagits%2FGitalist.git Fixed a couple of bugs. One bug involved the template subs not being accessible after forwarding to View::SyntaxHighlight. Another where Cat was choking on wide entities e.g viewing 1fd8159 in /commitdiff would trigger this. --- diff --git a/lib/Gitalist/Controller/Root.pm b/lib/Gitalist/Controller/Root.pm index 55a320c..550dcb8 100644 --- a/lib/Gitalist/Controller/Root.pm +++ b/lib/Gitalist/Controller/Root.pm @@ -363,11 +363,24 @@ Populate the header and footer. Perhaps not the best location. =cut sub auto : Private { - my($self, $c) = @_; + my($self, $c) = @_; - # Yes, this is hideous. - $self->header($c); - $self->footer($c); + # XXX Move these to a plugin! + $c->stash( + time_since => sub { + return age_string(time - $_[0]->epoch); + }, + short_cmt => sub { + my $cmt = shift; + my($line) = split /\n/, $cmt; + $line =~ s/^(.{70,80}\b).*/$1 …/; + return $line; + }, + ); + + # Yes, this is hideous. + $self->header($c); + $self->footer($c); } # XXX This could probably be dropped altogether. @@ -559,18 +572,6 @@ sub end : ActionClass('RenderView') { if ($c->stash->{project}) { $c->stash->{HEAD} = $c->model()->head_hash; } - - # XXX Move these to a plugin! - $c->stash->{time_since} = sub { - return age_string(time - $_[0]->epoch); - }; - $c->stash->{short_cmt} = sub { - my $cmt = shift; - print STDERR "got [$cmt]\n"; - my($line) = split /\n/, $cmt; - $line =~ s/^(.{70,80}\b).*/$1 …/; - return $line; - }; } sub age_string { diff --git a/lib/Gitalist/View/SyntaxHighlight.pm b/lib/Gitalist/View/SyntaxHighlight.pm index 688be51..5e90ed8 100644 --- a/lib/Gitalist/View/SyntaxHighlight.pm +++ b/lib/Gitalist/View/SyntaxHighlight.pm @@ -77,7 +77,9 @@ sub highlight { }, ); - $hl->highlightText($blob); + my $hltxt = $hl->highlightText($blob); + $hltxt =~ s/([^[:ascii:]])/encode_entities($1)/eg; + $hltxt; }; warn $@ if $@; } diff --git a/root/_heads.tt2 b/root/_heads.tt2 index 74e46ab..4e2415c 100644 --- a/root/_heads.tt2 +++ b/root/_heads.tt2 @@ -1,6 +1,7 @@ + @@ -8,6 +9,7 @@ + @@ -17,12 +19,13 @@ [% FOREACH head IN heads %] - + + [% END %] diff --git a/root/commit.tt2 b/root/commit.tt2 index e27fd09..c13cb61 100644 --- a/root/commit.tt2 +++ b/root/commit.tt2 @@ -31,11 +31,11 @@ [% END %] -
[% commit.comment %]
+
[% commit.comment | html%]
[% -# In the case of merge commits there will be no diff tree. -IF diff_tree.size > 0; - INCLUDE '_diff_tree.tt2'; -END; + # In the case of merge commits there will be no diff tree. + IF diff_tree.size > 0; + INCLUDE '_diff_tree.tt2'; + END; %] diff --git a/root/index.tt2 b/root/index.tt2 index 4cdf3da..1304e7f 100644 --- a/root/index.tt2 +++ b/root/index.tt2 @@ -40,7 +40,7 @@ - + [% END %]
HEAD age branch actions
HEAD age branch actions
[% time_since(head.last_change) %][% INCLUDE '_chroma_hash.tt2' sha1 = head.sha1.substr(0,7) %][% time_since(head.last_change) %] [% head.name %] - shortlog - log - tree + shortlog + log + tree
[% p.name %] [% p.description.split(' ').slice(0, 10).join(' ') %] [% p.owner %][% time_since(p.last_change) %][% time_since(p.last_change) %]
committered time[% line.committed_time %]
- [% time_since(line.authored_time) %] + [% time_since(line.authored_time) %]
commit | commitdiff diff --git a/root/static/css/site.css b/root/static/css/site.css index a643c36..3775fa6 100644 --- a/root/static/css/site.css +++ b/root/static/css/site.css @@ -71,8 +71,8 @@ div.commit-message { margin-bottom: 10px; } pre.commit-message { - border-top: solid 2px green; - border-bottom: solid 2px red; + border-top: solid 2px red; + border-bottom: solid 2px green; padding: 5px; } .commit-info dt { @@ -103,7 +103,7 @@ pre.commit-message { text-decoration: underline; } table.heads { - width: 50%; + width: 75%; } /* /blob */