diff options
-rw-r--r-- | templates/commit.qtpl | 17 | ||||
-rw-r--r-- | templates/commit.qtpl.go | 100 | ||||
-rw-r--r-- | templates/gititemlog.qtpl | 13 | ||||
-rw-r--r-- | templates/gititemlog.qtpl.go | 61 | ||||
-rw-r--r-- | templates/gititemsummary.qtpl | 13 | ||||
-rw-r--r-- | templates/gititemsummary.qtpl.go | 83 |
6 files changed, 174 insertions, 113 deletions
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) %} + <div class="row event"> + <div class="row"> + <div class="col-md"> + <a title="{%s c.Hash.String() %}" href="/{%s name %}/commit/{%s c.Hash.String() %}">{%s c.Hash.String()[0:8] %}</a> + </div> + <div class="col-md text-md-end"> + <a title="{%s c.Committer.Email %}" href="mailto:{%s c.Committer.Email %}">{%s c.Committer.Name %}</a> + </div> + </div> + <div class="code-view"> + <pre>{%s c.Message %}</pre> + </div> + </div> +{% 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(` + <div class="row event"> + <div class="row"> + <div class="col-md"> + <a title="`) +//line commit.qtpl:7 + qw422016.E().S(c.Hash.String()) +//line commit.qtpl:7 + qw422016.N().S(`" href="/`) +//line commit.qtpl:7 + qw422016.E().S(name) +//line commit.qtpl:7 + qw422016.N().S(`/commit/`) +//line commit.qtpl:7 + qw422016.E().S(c.Hash.String()) +//line commit.qtpl:7 + qw422016.N().S(`">`) +//line commit.qtpl:7 + qw422016.E().S(c.Hash.String()[0:8]) +//line commit.qtpl:7 + qw422016.N().S(`</a> + </div> + <div class="col-md text-md-end"> + <a title="`) +//line commit.qtpl:10 + qw422016.E().S(c.Committer.Email) +//line commit.qtpl:10 + qw422016.N().S(`" href="mailto:`) +//line commit.qtpl:10 + qw422016.E().S(c.Committer.Email) +//line commit.qtpl:10 + qw422016.N().S(`">`) +//line commit.qtpl:10 + qw422016.E().S(c.Committer.Name) +//line commit.qtpl:10 + qw422016.N().S(`</a> + </div> + </div> + <div class="code-view"> + <pre>`) +//line commit.qtpl:14 + qw422016.E().S(c.Message) +//line commit.qtpl:14 + qw422016.N().S(`</pre> + </div> + </div> +`) +//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) %} <div class="event-list"> {% for _, c := range g.Commits %} - <div class="row event"> - - <div class="col-xxl-2"> - {%s TimeFormat(c.Committer.When) %} - </div> - <div class="col-xxl-7 code-view"> - <pre>{%s c.Message %}</pre> - </div> - <div class="col-xxl-3"> - <small>{%s c.Committer.Name %} <{%s c.Committer.Email %}></small> - </div> - </div> + {%= Commit(name, c) %} {% endfor %} </div> {% 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(` - <div class="row event"> - - <div class="col-xxl-2"> - `) -//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(` - </div> - <div class="col-xxl-7 code-view"> - <pre>`) -//line gititemlog.qtpl:20 - qw422016.E().S(c.Message) -//line gititemlog.qtpl:20 - qw422016.N().S(`</pre> - </div> - <div class="col-xxl-3"> - <small>`) -//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(`></small> - </div> - </div> `) -//line gititemlog.qtpl:26 +//line gititemlog.qtpl:15 } -//line gititemlog.qtpl:26 +//line gititemlog.qtpl:15 qw422016.N().S(` </div> `) -//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 { </div> <div class="col-8"> <div class="float-end"> + <a href="/{%s name %}/archive/{%s b.Name().Short() %}.tar.gz">tar.gz</a> <a href="/{%s name %}/tree/{%s b.Name().Short() %}/">tree</a> <a href="/{%s name %}/log/{%s b.Name().Short() %}/">log</a> </div> @@ -56,17 +57,7 @@ type GitItemSummaryPage struct { <div class="row"> <div class="event-list"> {% for _, c := range g.Commits %} - <div class="row event"> - <div class="col-xxl-2"> - {%s TimeFormat(c.Committer.When) %} - </div> - <div class="col-xxl-7 code-view"> - <pre>{%s c.Message %}</pre> - </div> - <div class="col-xxl-3"> - <small>{%s c.Committer.Name %} <{%s c.Committer.Email %}></small> - </div> - </div> + {%= Commit(name, c) %} {% endfor %} </div> </div> 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</a> + qw422016.N().S(`.tar.gz">tar.gz</a> <a href="/`) //line gititemsummary.qtpl:48 qw422016.E().S(name) //line gititemsummary.qtpl:48 - qw422016.N().S(`/log/`) + qw422016.N().S(`/tree/`) //line gititemsummary.qtpl:48 qw422016.E().S(b.Name().Short()) //line gititemsummary.qtpl:48 + qw422016.N().S(`/">tree</a> + <a href="/`) +//line gititemsummary.qtpl:49 + qw422016.E().S(name) +//line gititemsummary.qtpl:49 + qw422016.N().S(`/log/`) +//line gititemsummary.qtpl:49 + qw422016.E().S(b.Name().Short()) +//line gititemsummary.qtpl:49 qw422016.N().S(`/">log</a> </div> </div> </div> `) -//line gititemsummary.qtpl:52 +//line gititemsummary.qtpl:53 } -//line gititemsummary.qtpl:52 +//line gititemsummary.qtpl:53 qw422016.N().S(` </div> </div> @@ -187,70 +196,48 @@ func (g *GitItemSummaryPage) StreamGitContent(qw422016 *qt422016.Writer, name, r <div class="row"> <div class="event-list"> `) -//line gititemsummary.qtpl:58 +//line gititemsummary.qtpl:59 for _, c := range g.Commits { -//line gititemsummary.qtpl:58 +//line gititemsummary.qtpl:59 qw422016.N().S(` - <div class="row event"> - <div class="col-xxl-2"> - `) -//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(` - </div> - <div class="col-xxl-7 code-view"> - <pre>`) -//line gititemsummary.qtpl:64 - qw422016.E().S(c.Message) -//line gititemsummary.qtpl:64 - qw422016.N().S(`</pre> - </div> - <div class="col-xxl-3"> - <small>`) -//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(`></small> - </div> - </div> `) -//line gititemsummary.qtpl:70 +//line gititemsummary.qtpl:61 } -//line gititemsummary.qtpl:70 +//line gititemsummary.qtpl:61 qw422016.N().S(` </div> </div> `) -//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 } |