Skip to content

Commit

Permalink
fix bug that dispaly blog image line number
Browse files Browse the repository at this point in the history
  • Loading branch information
yuki-kimoto committed Mar 17, 2014
1 parent 5f3ab9d commit f60788c
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 13 deletions.
32 changes: 32 additions & 0 deletions script/gitprep-shell
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env perl

use strict;
use warnings;
use utf8;
use FindBin;
use lib "$FindBin::Bin/../mojo/lib";
use lib "$FindBin::Bin/../lib";
use lib "$FindBin::Bin/../extlib/lib/perl5";
use Gitprep;

my $user = shift;

die "User not specifed" unless defined $user;

my $app = Gitprep->new;
my $dbi = $app->dbi;

my $public_key = $dbi->model('user')->select('public_keys', id => $user)->value || '';

print $public_key;

=head1 NAME
authorized_keys_command - AuthorizedKeysCommand for sshd
=head1 USAGE
./authorized_keys_command kimoto
This command return user public_key
31 changes: 18 additions & 13 deletions templates/blob.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
# Authors
my $authors = $git->authors($user, $project, $rev, $file);

# Blob lines
my $lines = $git->blob($user, $project, $rev, $file);

# File size
my $file_size = $git->blob_size($user, $project, $rev, $file);

Expand All @@ -32,6 +29,10 @@
# MIME type
my $mime_type = $git->blob_mime_type($user, $project, $rev, $file);

# Blob lines(only text)
my $lines;
$lines = $git->blob($user, $project, $rev, $file) if $mime_type =~ /^text/;

# Variables for included template
stash(id => $rev, project => $project, rev => $rev);
%>
Expand Down Expand Up @@ -65,8 +66,10 @@
<div class="span7" style="padding-top:5px">
<i class="icon-file icon-white"></i>
<%= $file_type %>
<span class="muted">|</span>
<%= @$lines %> lines
% if ($lines) {
<span class="muted">|</span>
<%= @$lines %> lines
% }
<span class="muted">|</span>
<%= $file_size %>kb
</div>
Expand All @@ -77,13 +80,7 @@
</div>
</div>
</div>
% if ($file =~ /\.md$/) {
% my $readme = join "\n", @$lines;
% my $readme_e = Text::Markdown::Hoedown::markdown($readme, extensions => HOEDOWN_EXT_FENCED_CODE);
<div class="markdown border-gray">
<%== $readme_e %>
</div>
% } elsif ($mime_type =~ m#^image/#) {
% if ($mime_type =~ m#^image/#) {
<div style="background:#ddd;text-align:center;padding-top:30px;padding-bottom:30px;margin-bottom:30px">
<img type="<%= $mime_type %>
% if (defined $file) {
Expand All @@ -93,7 +90,15 @@
/>
</div>
% } elsif ($mime_type =~ m#^text/#) {
<pre class="prettyprint linenums"><% for my $line (@$lines) { %><%= "$line\n" %><% } %></pre>
% if ($file =~ /\.md$/) {
% my $readme = join "\n", @$lines;
% my $readme_e = Text::Markdown::Hoedown::markdown($readme, extensions => HOEDOWN_EXT_FENCED_CODE);
<div class="markdown border-gray">
<%== $readme_e %>
</div>
% } else {
<pre class="prettyprint linenums"><% for my $line (@$lines) { %><%= "$line\n" %><% } %></pre>
% }
% } else {
<div style="font-size:16px;background:#ddd;text-align:center;padding-top:30px;padding-bottom:30px;margin-bottom:30px">
<a href="<%= url_for("/$user/$project/raw/$rev/$file") %>">View raw</a>
Expand Down

0 comments on commit f60788c

Please sign in to comment.