From 46640c68b9758b3c76d6a81d5a7c8601b6c4b5ee Mon Sep 17 00:00:00 2001 From: Eric Sunshine Date: Tue, 13 Jan 2015 04:57:16 -0500 Subject: views: blob: render empty blobs specially Empty (zero-length) blobs are currently rendered by 'pygments' misleadingly as a single empty line, or, when 'pygments' is unavailable, as "nothingness" preceding a horizontal rule. In either case, it is somewhat difficult to glean concrete information about the blob. Address this by instead rendering summary information about the blob: in particular, its classification ("empty") and its size ("0 bytes"). This is analogous to the summary information rendered for binary blobs ("binary" and size). Signed-off-by: Eric Sunshine Signed-off-by: Alberto Bertogli --- views/blob.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/views/blob.html b/views/blob.html index 521fe74..ef20328 100644 --- a/views/blob.html +++ b/views/blob.html @@ -39,7 +39,13 @@ {{!fname.html}} -% if can_embed_image(repo, fname.unicode): +% if len(blob.raw_content) == 0: + + + + +
empty — 0 bytes
+% elif can_embed_image(repo, fname.unicode): {{!embed_image_blob(fname.raw, blob.raw_content)}} % elif is_binary(blob.raw_content): -- cgit v1.2.3