09c2f33f5a
Binary blobs are currently rendered as raw data directly into the HTML output, looking much like "line noise". This is rarely, if ever, meaningful, and consumes considerable storage space since the entire raw blob content is embedded in the generated HTML file. Address this issue by instead emitting summary information about the blob, such as its classification ("binary") and its size. Other information can be added as needed. As in Git itself, a blob is considered binary if a NUL is present in the first ~8KB. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
66 lines
1.7 KiB
HTML
66 lines
1.7 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
|
|
% if not dirname.raw:
|
|
% reltree = './'
|
|
% else:
|
|
% reltree = '../' * (len(dirname.split('/')) - 1)
|
|
% end
|
|
% relroot = reltree + '../' * (len(repo.branch.split('/')) - 1)
|
|
|
|
<title>git » {{repo.name}} »
|
|
{{repo.branch}} » {{dirname.unicode}}/{{fname.unicode}}</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"/>
|
|
</head>
|
|
|
|
<body class="tree">
|
|
<h1><a href="{{relroot}}../../../../../">git</a> »
|
|
<a href="{{relroot}}../../../">{{repo.name}}</a> »
|
|
<a href="{{reltree}}../">{{repo.branch}}</a> »
|
|
<a href="{{reltree}}">tree</a>
|
|
</h1>
|
|
|
|
<h3>
|
|
<a href="{{reltree}}">[{{repo.branch}}]</a> /
|
|
% base = smstr(reltree)
|
|
% for c in dirname.split('/'):
|
|
% if not c.raw:
|
|
% continue
|
|
% end
|
|
<a href="{{base.url}}{{c.url}}/">{{c.unicode}}</a> /
|
|
% base += c + '/'
|
|
% end
|
|
<a href="">{{!fname.html}}</a>
|
|
</h3>
|
|
|
|
% if can_embed_image(repo, fname.unicode):
|
|
{{!embed_image_blob(fname.raw, blob.raw_content)}}
|
|
% elif is_binary(blob.raw_content):
|
|
<table class="nice">
|
|
<tr>
|
|
<td>
|
|
binary — {{'{:,}'.format(len(blob.raw_content))}} bytes
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
% elif can_markdown(repo, fname.unicode):
|
|
{{!markdown_blob(blob.utf8_content)}}
|
|
% elif can_colorize(blob.utf8_content):
|
|
{{!colorize_blob(fname.unicode, blob.utf8_content)}}
|
|
% else:
|
|
<pre class="blob-body">
|
|
{{blob.utf8_content}}
|
|
</pre>
|
|
% end
|
|
|
|
<hr/>
|
|
|
|
</body>
|
|
</html>
|