summaryrefslogtreecommitdiff
path: root/cgithub/views/blob.eta
blob: 444508ef0619b77d3a4e2efa7b9865c600479a96 (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
<% layout("./layout.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 %>/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><%~ it.htmlLines.join("\n") %></code></pre>
<% } else if (it.textLines) { %>
  <pre class="box"><code><%= it.textLines.join("\n") %></code></pre>
<% } else { %>
  <div class="box">This file cannot be displayed.</div>
<% } %>