~edwargix/git.sr.ht

ref: 2369d4aa225d9f7d7d0b3fc77e391ee884cebf7c git.sr.ht/gitsrht/templates/blob.html -rw-r--r-- 3.3 KiB
2369d4aa — Sebastian Resolve name and email from mailmap 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
{% extends "repo-full.html" %}
{% import "utils.html" as utils %}
{% block title %}
<title>{{repo.owner.canonical_name}}/{{repo.name}}: {{path_join(*path)}} - {{cfg("sr.ht", "site-name")}} git</title>
{% endblock %}
{% block repohead %}
<style>
pre {
  tab-size: {{editorconfig.tab_width()}}
}
</style>
{% endblock %}
{% block content %}
<div class="header-extension" style="margin-bottom: 0;">
  <div class="blob container-fluid">
    <span>
      {{ utils.breadcrumb(ref, repo, path, entry, view, path_join, stat, pygit2, humanize) }}
    </span>
    {% if commit %}
    <div class="commit">
      <a
        href="{{url_for("repo.commit",
          owner=repo.owner.canonical_name,
          repo=repo.name,
          ref=ref)}}"
      >{{commit.id.hex[:8]}}</a> &mdash;
      {% set author = repo.author(commit) %}
      {% set author_user = lookup_user(author.email) %}
      {% if author_user %}
      <a href="{{url_for("public.user_index",
        username=author_user.username)}}">{{author.name}}</a>
      {% else %}
      {{author.name}}
      {% endif %}
      {{trim_commit(commit.message)}}
      <span class="text-muted">
        {{ commit_time(commit) | date }}
      </span>
    </div>
    <div class="clearfix"></div>
    {% endif %}
  </div>
</div>
{% if markdown %}
<div class="container-fluid markdown-nav">
  <ul class="nav nav-tabs">
    <li class="nav-item">
      <a
        class="nav-link {{"active" if not force_source else ""}}"
        href="?view-rendered"
      >View Rendered</a>
    </li>
    <li class="nav-item">
      <a
        class="nav-link {{"active" if force_source else ""}}"
        href="?view-source"
      >View Source</a>
    </li>
  </ul>
</div>
{% endif %}
{% if markdown and not force_source %}
<div class="container">
{% else %}
<div class="container-fluid code-viewport">
{% endif %}
  {#
    This row has some weird styles going on. This prevents the page from
    scrolling horizontally
  #}
  <div class="row" style="margin-right: 0;">
    {% if markdown and not force_source %}
    <div class="col-md-10 offset-md-1" style="margin-top: 1rem">
      {{ markdown }}
    </div>
    {% else %}
    {% if not blob.is_binary %}
    <div class="col-md-12 code-view">
      <pre class="ruler"><span>{% for i in range(
        editorconfig.max_line_length()) %} {% endfor %}</span></pre>
      <pre class="lines">{% for line in data.splitlines() %}<a
        href="#L{{loop.index}}"
        id="L{{loop.index}}"
        >{{loop.index}}</a>{% if not loop.last %}
{% endif %}{% endfor %}</pre>
      {{ highlight_file(repo, ref, entry,
        data, blob.id.hex, commit.id.hex) }}
    </div>
    {% else %}
    <div class="col-md-12">
      <div style="padding: 1rem">
        <p>
          <span title="{{ blob.size }} bytes">
            {{humanize.naturalsize(blob.size,
              binary=True).replace("Byte", "byte")}}
          </span>
          binary file not shown.
        </p>
        <p>
          <a href="{{url_for("repo.raw_blob",
              owner=repo.owner.canonical_name,
              repo=repo.name, ref=ref,
              path=path_join(*path))}}"
              class="btn btn-primary"
              rel="nofollow"
          >Download {{icon("caret-right")}}</a>
        </p>
      </div>
    </div>
    {% endif %}
    {% endif %}
</div>
{% endblock %}

{% block scripts %}
<script src="/static/linelight.js"></script>
{% endblock %}