aee18d0edd
With the Python 2 to 3 migration and the type checking, we can be fairly confident that smstr are always constructed from strings, not bytes. This allows the code to be simplified, as we no longer need to carry the dual raw/unicode representation.
91 lines
2.2 KiB
HTML
91 lines
2.2 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
|
|
% if not dirname.raw:
|
|
% reltree = './'
|
|
% else:
|
|
% reltree = '../' * (len(dirname.split('/')) - 1)
|
|
% end
|
|
% relroot = reltree + '../' * (len(branch.split('/')) - 1)
|
|
|
|
<title>git » {{repo.name}} »
|
|
{{branch}} » {{dirname.raw}}{{fname.raw}}</title>
|
|
<link rel="stylesheet" type="text/css"
|
|
href="{{relroot}}../../../../../static/git-arr.css"/>
|
|
<link rel="stylesheet" type="text/css"
|
|
href="{{relroot}}../../../../../static/syntax.css"/>
|
|
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
|
|
<meta name=viewport content="width=device-width, initial-scale=1">
|
|
</head>
|
|
|
|
<body class="tree">
|
|
<h1><a href="{{relroot}}../../../../../">git</a> »
|
|
<a href="{{relroot}}../../../">{{repo.name}}</a> »
|
|
<a href="{{reltree}}../">{{branch}}</a> »
|
|
<a href="{{reltree}}">tree</a>
|
|
</h1>
|
|
|
|
<h3>
|
|
<a href="{{reltree}}">[{{branch}}]</a> /
|
|
% base = smstr(reltree)
|
|
% for c in dirname.split('/'):
|
|
% if not c.raw:
|
|
% continue
|
|
% end
|
|
<a href="{{base.url}}{{c.url}}/">{{c.raw}}</a> /
|
|
% base += c + '/'
|
|
% end
|
|
<a href="">{{!fname.html}}</a>
|
|
</h3>
|
|
|
|
% if len(blob.raw_content) == 0:
|
|
<table class="nice">
|
|
<tr>
|
|
<td>empty — 0 bytes</td>
|
|
</tr>
|
|
</table>
|
|
% elif can_embed_image(repo, fname.raw):
|
|
{{!embed_image_blob(fname.raw, blob.raw_content)}}
|
|
% elif is_binary(blob.raw_content):
|
|
<table class="nice blob-binary">
|
|
<tr>
|
|
<td colspan="4">
|
|
binary — {{'{:,}'.format(len(blob.raw_content))}} bytes
|
|
</td>
|
|
</tr>
|
|
% lim = 256
|
|
% for offset, hex1, hex2, text in hexdump(blob.raw_content[:lim]):
|
|
<tr>
|
|
<td class="offset">{{offset}}</td>
|
|
<td><pre>{{hex1}}</pre></td>
|
|
<td><pre>{{hex2}}</pre></td>
|
|
<td><pre>{{text}}</pre></td>
|
|
</tr>
|
|
% end
|
|
% if lim < len(blob.raw_content):
|
|
<tr class="etc">
|
|
<td></td>
|
|
<td>…</td>
|
|
<td>…</td>
|
|
<td>…</td>
|
|
</tr>
|
|
% end
|
|
</table>
|
|
% elif can_markdown(repo, fname.raw):
|
|
<div class="markdown">
|
|
{{!markdown_blob(blob.utf8_content)}}
|
|
</div>
|
|
% elif can_colorize(blob.utf8_content):
|
|
{{!colorize_blob(fname.raw, blob.utf8_content)}}
|
|
% else:
|
|
<pre class="blob-body">
|
|
{{blob.utf8_content}}
|
|
</pre>
|
|
% end
|
|
|
|
<hr/>
|
|
|
|
</body>
|
|
</html>
|