From 3e6a720154b70a9882af14399548e494b1d0089f Mon Sep 17 00:00:00 2001 From: Anirudh Oppiliappan Date: Sat, 17 Dec 2022 22:35:48 +0530 Subject: git, templates: diff view --- templates/commit.html | 56 ++++++++++++++++++++++++++++++++++++--------------- templates/log.html | 4 ++-- templates/repo.html | 2 +- 3 files changed, 43 insertions(+), 19 deletions(-) (limited to 'templates') diff --git a/templates/commit.html b/templates/commit.html index f7a36b4..b4061aa 100644 --- a/templates/commit.html +++ b/templates/commit.html @@ -9,8 +9,12 @@ {{ template "nav" . }}
-
-

author: {{ .commit.Author.Name }} <{{ .commit.Author.Email}}> on {{ .commit.Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}

+
+
+          {{- .commit.Message -}}
+        
+

{{ .commit.Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}

+

{{ .commit.Author.Name }} {{ .commit.Author.Email}}

commit: {{ .commit.This }} @@ -19,34 +23,54 @@ {{ .commit.Parent }}

-

{{ .stat.FilesChanged }} files changed, +

+
+ {{ .stat.FilesChanged }} files changed, {{ .stat.Insertions }} insertions(+), {{ .stat.Deletions }} deletions(-) -

+
+
+
+

jump to:

+ {{ range .diff }} + + {{ end }} +
+
+ {{ $repo := .name }} + {{ $this := .commit.This }} {{ range .diff }} +
+
{{ if .Name.Old }} -

{{ .Name.Old }} → {{ .Name.New }}

+ {{ .Name.Old }} → + {{ .Name.New }} {{ else }} -

{{.Name.New }}

+ {{ .Name.New }} {{- end -}} +
+
             {{- range .TextFragments -}}
             

{{- .Header -}}

- {{- range .Lines -}} - {{- if eq .Op.String "+" -}} - {{ .String }} - {{- end -}} - {{- if eq .Op.String "-" -}} - {{ .String }} - {{- end -}} - {{- if eq .Op.String " " -}} - {{ .String }} - {{- end -}} + {{- range .Lines -}} + {{- if eq .Op.String "+" -}} + {{ .String }} {{- end -}} + {{- if eq .Op.String "-" -}} + {{ .String }} + {{- end -}} + {{- if eq .Op.String " " -}} + {{ .String }} + {{- end -}} + {{- end -}} {{- end -}}
+
{{ end }}
diff --git a/templates/log.html b/templates/log.html index c4ee9c3..4a0292c 100644 --- a/templates/log.html +++ b/templates/log.html @@ -9,7 +9,7 @@ {{ template "nav" . }}
- {{ $repo := .repo }} + {{ $repo := .name }}
{{ range .commits }}
@@ -17,7 +17,7 @@
{{ .Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}
{{ .Message }}
-
{{ .Author.Name }} {{ .Author.Email }}
+
{{ .Author.Name }} {{ .Author.Email }}
{{ end }}
diff --git a/templates/repo.html b/templates/repo.html index d4e3e46..3b5d2b0 100644 --- a/templates/repo.html +++ b/templates/repo.html @@ -25,7 +25,7 @@
{{ .Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}
{{ .Message }}
-
{{ .Author.Name }} {{ .Author.Email }}
+
{{ .Author.Name }} {{ .Author.Email }}
{{ end }}
-- cgit