gitprep / templates / include / readme.html.ep /
Newer Older
46 lines | 1.425kb
added readme link feature
Yuki Kimoto authored on 2013-05-11
1
<%
2
  use Mojo::ByteStream ();
support markdown table
Yuki Kimoto authored on 2016-06-18
3
  
4
  my $api = gitprep_api;
added readme link feature
Yuki Kimoto authored on 2013-05-11
5
  
show readme in sub directory
Yuki Kimoto authored on 2014-02-17
6
  my $dir = stash('dir');
7
  
added readme link feature
Yuki Kimoto authored on 2013-05-11
8
  # README
fix sub directory readme mar...
Yuki Kimoto authored on 2014-02-17
9
  my $type = '';
cleanup
Yuki Kimoto authored on 2013-05-14
10
  my $lines;
show readme file in sub dire...
Yuki Kimoto authored on 2014-02-17
11
  my $readme_path = (defined $dir && $dir ne '') ? "$dir/README" : 'README';
cleanup rep_info
Yuki Kimoto authored on 2016-04-16
12
  eval { $lines = app->git->blob(app->rep_info($user, $project), $rev, $readme_path) };
cleanup
Yuki Kimoto authored on 2013-05-14
13
  my $readme_e;
fix markdown image bug
Yuki Kimoto authored on 2015-12-19
14
  
cleanup
Yuki Kimoto authored on 2013-05-14
15
  if ($lines) {
change markdown engine to Te...
Yuki Kimoto authored on 2013-10-07
16
    $type = 'plain';
cleanup
Yuki Kimoto authored on 2013-05-14
17
    my $readme = join "\n", @$lines;
18
    $readme_e = Mojo::ByteStream->new($readme)->xml_escape->to_string;
improve README link
Yuki Kimoto authored on 2013-05-24
19
    $readme_e =~ s#(^|\s|[^\x00-\x7F])(http(?:s)?://.+?)($|\s|[^\x00-\x7F])#$1<a href="$2">$2</a>$3#msg;
cleanup
Yuki Kimoto authored on 2013-05-14
20
  }
now also tries to read READM...
Xavier Caron authored on 2013-08-30
21
  else {
cleanup rep_info
Yuki Kimoto authored on 2016-04-16
22
    eval { $lines = app->git->blob(app->rep_info($user, $project), $rev, "$readme_path.md") };
now also tries to read READM...
Xavier Caron authored on 2013-08-30
23
    if ($lines) {
change markdown engine to Te...
Yuki Kimoto authored on 2013-10-07
24
      $type = 'markdown';
now also tries to read READM...
Xavier Caron authored on 2013-08-30
25
      my $readme = join "\n", @$lines;
fix CGI not display image bu...
Yuki Kimoto authored on 2016-02-13
26
      $readme =~ s#^(\[.*\]:)(?!\s*https?://)\s*(\S*)#{"$1 " . url_for("/$user/$project/raw/$rev/$2")}#mge;
27
      $readme =~ s#^(!\[.*\]\()(?!https?://)(\S*)#{$1 . url_for("/$user/$project/raw/$rev/$2")}#mge;
support markdown table
Yuki Kimoto authored on 2016-06-18
28
      $readme_e = $api->markdown($readme);
now also tries to read READM...
Xavier Caron authored on 2013-08-30
29
    }
30
  }
added readme link feature
Yuki Kimoto authored on 2013-05-11
31
%>
32

            
cleanup
Yuki Kimoto authored on 2013-05-14
33
% if (defined $readme_e) {
complete readme design
Yuki Kimoto authored on 2016-01-06
34
  <div class="readme">
35
    <div class="readme-header">
36
      <i class="icon-book"></i> <%= $type eq 'plain' ? 'README' : 'README.md' %>
37
    </div>
38
    <div class="readme-frame">
39
      % if ($type eq 'plain') {
40
        <pre class="plain-text"><%== $readme_e %></pre>
41
      % } else {
42
        <div class="markdown-body"><%== $readme_e %></div>
43
      % }
change markdown engine to Te...
Yuki Kimoto authored on 2013-10-07
44
    </div>
added readme link feature
Yuki Kimoto authored on 2013-05-11
45
  </div>
use hoedown for fenced code ...
Qinhu Wang authored on 2014-03-11
46
% }