summaryrefslogtreecommitdiff
path: root/cgithub/views/blob.eta
diff options
context:
space:
mode:
Diffstat (limited to 'cgithub/views/blob.eta')
-rw-r--r--cgithub/views/blob.eta35
1 files changed, 35 insertions, 0 deletions
diff --git a/cgithub/views/blob.eta b/cgithub/views/blob.eta
new file mode 100644
index 0000000..9f6706e
--- /dev/null
+++ b/cgithub/views/blob.eta
@@ -0,0 +1,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>
+<% } %>