From 6333ef00cb5eeba691b83bbed84b7ffc2d583508 Mon Sep 17 00:00:00 2001 From: Frederick Yin Date: Wed, 22 Jul 2020 16:55:00 +0800 Subject: Add line number in blob view --- git-gmi/git.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'git-gmi/git.py') diff --git a/git-gmi/git.py b/git-gmi/git.py index f249ec5..800dc0f 100644 --- a/git-gmi/git.py +++ b/git-gmi/git.py @@ -4,6 +4,7 @@ from datetime import datetime import mimetypes from const import * from config import * +from utils import * mimetypes.add_type("text/gemini", ".gmi") mimetypes.add_type("text/gemini", ".gemini") @@ -273,7 +274,7 @@ class GitGmiRepo: elif blob.size < MAX_DISPLAYED_BLOB_SIZE: response += ( f"=> {blob.name}?raw view raw\n\n" - "```\n" + blob.data.decode("utf-8") + "\n```" + "```\n" + add_line_numbers(blob.data.decode("utf-8")) + "\n```" ) else: response += ( -- cgit v1.2.3