From 75d3ee252e7d966055bb76258d3e0da28488d261 Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Tue, 25 Jun 2024 12:48:20 +0200 Subject: ref: Redo commit cell --- templates/commit.qtpl | 17 +++++++ templates/commit.qtpl.go | 100 +++++++++++++++++++++++++++++++++++++++ templates/gititemlog.qtpl | 13 +---- templates/gititemlog.qtpl.go | 61 ++++++++---------------- templates/gititemsummary.qtpl | 13 +---- templates/gititemsummary.qtpl.go | 83 ++++++++++++++------------------ 6 files changed, 174 insertions(+), 113 deletions(-) create mode 100644 templates/commit.qtpl create mode 100644 templates/commit.qtpl.go (limited to 'templates') diff --git a/templates/commit.qtpl b/templates/commit.qtpl new file mode 100644 index 0000000..3070172 --- /dev/null +++ b/templates/commit.qtpl @@ -0,0 +1,17 @@ +{% import "github.com/go-git/go-git/v5/plumbing/object" %} + +{% func Commit(name string, c *object.Commit) %} +
+ +
+
{%s c.Message %}
+
+
+{% endfunc %} diff --git a/templates/commit.qtpl.go b/templates/commit.qtpl.go new file mode 100644 index 0000000..7f46499 --- /dev/null +++ b/templates/commit.qtpl.go @@ -0,0 +1,100 @@ +// Code generated by qtc from "commit.qtpl". DO NOT EDIT. +// See https://github.com/valyala/quicktemplate for details. + +//line commit.qtpl:1 +package templates + +//line commit.qtpl:1 +import "github.com/go-git/go-git/v5/plumbing/object" + +//line commit.qtpl:3 +import ( + qtio422016 "io" + + qt422016 "github.com/valyala/quicktemplate" +) + +//line commit.qtpl:3 +var ( + _ = qtio422016.Copy + _ = qt422016.AcquireByteBuffer +) + +//line commit.qtpl:3 +func StreamCommit(qw422016 *qt422016.Writer, name string, c *object.Commit) { +//line commit.qtpl:3 + qw422016.N().S(` +
+ +
+
`)
+//line commit.qtpl:14
+	qw422016.E().S(c.Message)
+//line commit.qtpl:14
+	qw422016.N().S(`
+
+
+`) +//line commit.qtpl:17 +} + +//line commit.qtpl:17 +func WriteCommit(qq422016 qtio422016.Writer, name string, c *object.Commit) { +//line commit.qtpl:17 + qw422016 := qt422016.AcquireWriter(qq422016) +//line commit.qtpl:17 + StreamCommit(qw422016, name, c) +//line commit.qtpl:17 + qt422016.ReleaseWriter(qw422016) +//line commit.qtpl:17 +} + +//line commit.qtpl:17 +func Commit(name string, c *object.Commit) string { +//line commit.qtpl:17 + qb422016 := qt422016.AcquireByteBuffer() +//line commit.qtpl:17 + WriteCommit(qb422016, name, c) +//line commit.qtpl:17 + qs422016 := string(qb422016.B) +//line commit.qtpl:17 + qt422016.ReleaseByteBuffer(qb422016) +//line commit.qtpl:17 + return qs422016 +//line commit.qtpl:17 +} diff --git a/templates/gititemlog.qtpl b/templates/gititemlog.qtpl index 3588d32..ee3841c 100644 --- a/templates/gititemlog.qtpl +++ b/templates/gititemlog.qtpl @@ -11,18 +11,7 @@ type GitItemLogPage struct { {% func (g *GitItemLogPage) GitContent(name, ref string) %}
{% for _, c := range g.Commits %} -
- -
- {%s TimeFormat(c.Committer.When) %} -
-
-
{%s c.Message %}
-
-
- {%s c.Committer.Name %} <{%s c.Committer.Email %}> -
-
+ {%= Commit(name, c) %} {% endfor %}
{% endfunc %} diff --git a/templates/gititemlog.qtpl.go b/templates/gititemlog.qtpl.go index b950d15..da8167a 100644 --- a/templates/gititemlog.qtpl.go +++ b/templates/gititemlog.qtpl.go @@ -68,66 +68,43 @@ func (g *GitItemLogPage) StreamGitContent(qw422016 *qt422016.Writer, name, ref s for _, c := range g.Commits { //line gititemlog.qtpl:13 qw422016.N().S(` -
- -
- `) -//line gititemlog.qtpl:17 - qw422016.E().S(TimeFormat(c.Committer.When)) -//line gititemlog.qtpl:17 + `) +//line gititemlog.qtpl:14 + StreamCommit(qw422016, name, c) +//line gititemlog.qtpl:14 qw422016.N().S(` -
-
-
`)
-//line gititemlog.qtpl:20
-		qw422016.E().S(c.Message)
-//line gititemlog.qtpl:20
-		qw422016.N().S(`
-
-
- `) -//line gititemlog.qtpl:23 - qw422016.E().S(c.Committer.Name) -//line gititemlog.qtpl:23 - qw422016.N().S(` <`) -//line gititemlog.qtpl:23 - qw422016.E().S(c.Committer.Email) -//line gititemlog.qtpl:23 - qw422016.N().S(`> -
-
`) -//line gititemlog.qtpl:26 +//line gititemlog.qtpl:15 } -//line gititemlog.qtpl:26 +//line gititemlog.qtpl:15 qw422016.N().S(` `) -//line gititemlog.qtpl:28 +//line gititemlog.qtpl:17 } -//line gititemlog.qtpl:28 +//line gititemlog.qtpl:17 func (g *GitItemLogPage) WriteGitContent(qq422016 qtio422016.Writer, name, ref string) { -//line gititemlog.qtpl:28 +//line gititemlog.qtpl:17 qw422016 := qt422016.AcquireWriter(qq422016) -//line gititemlog.qtpl:28 +//line gititemlog.qtpl:17 g.StreamGitContent(qw422016, name, ref) -//line gititemlog.qtpl:28 +//line gititemlog.qtpl:17 qt422016.ReleaseWriter(qw422016) -//line gititemlog.qtpl:28 +//line gititemlog.qtpl:17 } -//line gititemlog.qtpl:28 +//line gititemlog.qtpl:17 func (g *GitItemLogPage) GitContent(name, ref string) string { -//line gititemlog.qtpl:28 +//line gititemlog.qtpl:17 qb422016 := qt422016.AcquireByteBuffer() -//line gititemlog.qtpl:28 +//line gititemlog.qtpl:17 g.WriteGitContent(qb422016, name, ref) -//line gititemlog.qtpl:28 +//line gititemlog.qtpl:17 qs422016 := string(qb422016.B) -//line gititemlog.qtpl:28 +//line gititemlog.qtpl:17 qt422016.ReleaseByteBuffer(qb422016) -//line gititemlog.qtpl:28 +//line gititemlog.qtpl:17 return qs422016 -//line gititemlog.qtpl:28 +//line gititemlog.qtpl:17 } diff --git a/templates/gititemsummary.qtpl b/templates/gititemsummary.qtpl index 06a785a..ef2c534 100644 --- a/templates/gititemsummary.qtpl +++ b/templates/gititemsummary.qtpl @@ -44,6 +44,7 @@ type GitItemSummaryPage struct {
@@ -56,17 +57,7 @@ type GitItemSummaryPage struct {
{% for _, c := range g.Commits %} -
-
- {%s TimeFormat(c.Committer.When) %} -
-
-
{%s c.Message %}
-
-
- {%s c.Committer.Name %} <{%s c.Committer.Email %}> -
-
+ {%= Commit(name, c) %} {% endfor %}
diff --git a/templates/gititemsummary.qtpl.go b/templates/gititemsummary.qtpl.go index 4e48efd..570a955 100644 --- a/templates/gititemsummary.qtpl.go +++ b/templates/gititemsummary.qtpl.go @@ -159,27 +159,36 @@ func (g *GitItemSummaryPage) StreamGitContent(qw422016 *qt422016.Writer, name, r //line gititemsummary.qtpl:47 qw422016.E().S(name) //line gititemsummary.qtpl:47 - qw422016.N().S(`/tree/`) + qw422016.N().S(`/archive/`) //line gititemsummary.qtpl:47 qw422016.E().S(b.Name().Short()) //line gititemsummary.qtpl:47 - qw422016.N().S(`/">tree + qw422016.N().S(`.tar.gz">tar.gz tree + log
`) -//line gititemsummary.qtpl:52 +//line gititemsummary.qtpl:53 } -//line gititemsummary.qtpl:52 +//line gititemsummary.qtpl:53 qw422016.N().S(` @@ -187,70 +196,48 @@ func (g *GitItemSummaryPage) StreamGitContent(qw422016 *qt422016.Writer, name, r
`) -//line gititemsummary.qtpl:58 +//line gititemsummary.qtpl:59 for _, c := range g.Commits { -//line gititemsummary.qtpl:58 +//line gititemsummary.qtpl:59 qw422016.N().S(` -
-
- `) -//line gititemsummary.qtpl:61 - qw422016.E().S(TimeFormat(c.Committer.When)) -//line gititemsummary.qtpl:61 + `) +//line gititemsummary.qtpl:60 + StreamCommit(qw422016, name, c) +//line gititemsummary.qtpl:60 qw422016.N().S(` -
-
-
`)
-//line gititemsummary.qtpl:64
-		qw422016.E().S(c.Message)
-//line gititemsummary.qtpl:64
-		qw422016.N().S(`
-
-
- `) -//line gititemsummary.qtpl:67 - qw422016.E().S(c.Committer.Name) -//line gititemsummary.qtpl:67 - qw422016.N().S(` <`) -//line gititemsummary.qtpl:67 - qw422016.E().S(c.Committer.Email) -//line gititemsummary.qtpl:67 - qw422016.N().S(`> -
-
`) -//line gititemsummary.qtpl:70 +//line gititemsummary.qtpl:61 } -//line gititemsummary.qtpl:70 +//line gititemsummary.qtpl:61 qw422016.N().S(`
`) -//line gititemsummary.qtpl:73 +//line gititemsummary.qtpl:64 } -//line gititemsummary.qtpl:73 +//line gititemsummary.qtpl:64 func (g *GitItemSummaryPage) WriteGitContent(qq422016 qtio422016.Writer, name, ref string) { -//line gititemsummary.qtpl:73 +//line gititemsummary.qtpl:64 qw422016 := qt422016.AcquireWriter(qq422016) -//line gititemsummary.qtpl:73 +//line gititemsummary.qtpl:64 g.StreamGitContent(qw422016, name, ref) -//line gititemsummary.qtpl:73 +//line gititemsummary.qtpl:64 qt422016.ReleaseWriter(qw422016) -//line gititemsummary.qtpl:73 +//line gititemsummary.qtpl:64 } -//line gititemsummary.qtpl:73 +//line gititemsummary.qtpl:64 func (g *GitItemSummaryPage) GitContent(name, ref string) string { -//line gititemsummary.qtpl:73 +//line gititemsummary.qtpl:64 qb422016 := qt422016.AcquireByteBuffer() -//line gititemsummary.qtpl:73 +//line gititemsummary.qtpl:64 g.WriteGitContent(qb422016, name, ref) -//line gititemsummary.qtpl:73 +//line gititemsummary.qtpl:64 qs422016 := string(qb422016.B) -//line gititemsummary.qtpl:73 +//line gititemsummary.qtpl:64 qt422016.ReleaseByteBuffer(qb422016) -//line gititemsummary.qtpl:73 +//line gititemsummary.qtpl:64 return qs422016 -//line gititemsummary.qtpl:73 +//line gititemsummary.qtpl:64 } -- cgit v1.2.3