aboutsummaryrefslogtreecommitdiff
path: root/views/blob.eta
blob: 9f6706e6f78e9956c10d8fe96c25e583cd6d60f7 (plain)
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
<% layout("/layouts/repo.eta"); it.searchType = "code" %>

<%~ include("./_nav.eta", {...it, view: "blob"}) %>

<div>
  <% if (it.language) { %>
    <div>language: <%= it.language %></div>
  <% } %>
  <div><%= it.size %></div>
  <div>
    <a href="/<%= it.repo.owner %>/<%= it.repo.name %>/commits/<%= it.branch %>/<%= it.path %>">History</a>
  </div>
  <div>
    <a href="/<%= it.repo.owner %>/<%= it.repo.name %>/raw/<%= it.branch %>/<%= it.path %>">View raw</a>
  </div>
</div>

<% if (it.image) { %>
  <div class="box"><img src="/<%= it.repo.owner %>/<%= it.repo.name %>/raw/<%= it.branch %>/<%= it.path %>"></div>
<% } else if (it.renderFileType === "pdf") { %>
  <object class="box pdf" type="application/pdf"
          data="/<%= it.repo.owner %>/<%= it.repo.name %>/embed/<%= it.renderFileType %>/<%= it.branch %>/<%= it.path %>">
    This file cannot be displayed.
  </object>
<% } else if (it.htmlContent) { %>
  <div class="box"><%~ it.htmlContent %></div>
<% } else if (it.htmlLines) { %>
  <pre class="box"><code><% for (const [i, line] of it.htmlLines.entries()) {
    %><%= i ? "\n" : "" %><span id="L<%= i + 1 %>"><%~ line %></span><% } %></code></pre>
<% } else if (it.textLines) { %>
  <pre class="box"><code><% for (const [i, line] of it.textLines.entries()) {
    %><%= i ? "\n" : "" %><span id="L<%= i + 1 %>"><%= line %></span><% } %></code></pre>
<% } else { %>
  <div class="box">This file cannot be displayed.</div>
<% } %>