diff options
| author | Joe Mou <dev@mou.fo> | 2026-09-18 07:27:21 +0100 |
|---|---|---|
| committer | Joe Mou <dev@mou.fo> | 2026-09-18 07:27:21 +0100 |
| commit | 9659525bf2387af6deab9d401784b94b1f44d395 (patch) | |
| tree | c67dc1dd05bf2a8fa48dc123d6353d255a658ef1 /cgithub/views/blob.eta | |
| parent | 9819d8e5504d6f03d27ec6b8786eec8fe5a752a5 (diff) | |
| parent | 01494e6fa1345a509560e5e19a7f08cb2aac5cc8 (diff) | |
Diffstat (limited to 'cgithub/views/blob.eta')
| -rw-r--r-- | cgithub/views/blob.eta | 35 |
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> +<% } %> |
