jmou/cgithub
git clone https://github.com/jmou/cgithub.git
git clone git@github.com:jmou/cgithub.git
Loading…
(top)/views/blob.eta
1.42 KB / 35 lines / 32 loc
History
View raw
<% 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>
<% } %>