From 3b21449468a1b20b3ff706fe00a04556a804e627 Mon Sep 17 00:00:00 2001 From: Gabriel Arakaki Giovanini Date: Sun, 3 Sep 2023 14:55:23 +0200 Subject: ref: Remove quicktemplate This is done in preparation to use text-html/template. This will allow the user to input their own template file --- templates/index.md.qtpl | 39 --------- templates/index.md.qtpl.go | 211 --------------------------------------------- 2 files changed, 250 deletions(-) delete mode 100644 templates/index.md.qtpl delete mode 100644 templates/index.md.qtpl.go (limited to 'templates') diff --git a/templates/index.md.qtpl b/templates/index.md.qtpl deleted file mode 100644 index 434d640..0000000 --- a/templates/index.md.qtpl +++ /dev/null @@ -1,39 +0,0 @@ -{% import "fmt" %} -{% import "strings" %} -{% import "git.sr.ht/~gabrielgio/apkdoc/parser" %} - -{% code -func reduce(lines []string) string { - return strings.Join(lines, " ") -} - -func formatLink(e *parser.Entry, format string) string { - c := strings.Replace(*e.Commit, "-dirty", "", -1) - return fmt.Sprintf(format, c, *e.Origin) -} -%} - -{% func MarkdownTemplate(entries []*parser.Entry, format string) %} -# Apks Alpine 3.18 -{% for _, e := range entries %} -## {%s e.Name %} - -- **Version**: {%s e.Version%} -- **Description**: {%s e.Description%}{% if e.Maintainer != nil %} -- **Maintainer**: {%s *e.Maintainer%}{% endif %} -- **Checksum**:{%s e.Checksum%}{% if e.Architecture != nil %} -- **Architecture**: {%s *e.Architecture%}{% endif %} -- **Size**: {%d e.PackageSize%}B -- **Installed size**: {%d e.InstalledSize%} -- **Url**: {%s e.Url%} -- **License**: {%s e.License%}{% if e.Origin != nil %} -- **Origin**: {%s *e.Origin%}{% endif %}{% if e.BuildTime != nil %} -- **Build time**: {%s e.BuildTime.String() %}{% endif %}{% if e.Commit != nil %} -- **Commit**: [{%s *e.Commit %}]({%s formatLink(e, format) %}){% endif %}{% if e.ProviderPriority != nil %} -- **Provider Priority**: {%d *e.ProviderPriority %}{% endif %}{% if len(e.Dependencies) > 0 %} -- **Dependencies:**: {%s reduce(e.Dependencies) %}{% endif %}{% if len(e.Provides) > 0 %} -- **Provides:**: {%s reduce(e.Provides) %}{% endif %}{% if len(e.InstallIf) > 0 %} -- **Install if:**: {%s reduce(e.InstallIf) %}{% endif %} -{% endfor %} - -{% endfunc %} diff --git a/templates/index.md.qtpl.go b/templates/index.md.qtpl.go deleted file mode 100644 index c87d947..0000000 --- a/templates/index.md.qtpl.go +++ /dev/null @@ -1,211 +0,0 @@ -// Code generated by qtc from "index.md.qtpl". DO NOT EDIT. -// See https://github.com/valyala/quicktemplate for details. - -//line index.md.qtpl:1 -package templates - -//line index.md.qtpl:1 -import "fmt" - -//line index.md.qtpl:2 -import "strings" - -//line index.md.qtpl:3 -import "git.sr.ht/~gabrielgio/apkdoc/parser" - -//line index.md.qtpl:5 -import ( - qtio422016 "io" - - qt422016 "github.com/valyala/quicktemplate" -) - -//line index.md.qtpl:5 -var ( - _ = qtio422016.Copy - _ = qt422016.AcquireByteBuffer -) - -//line index.md.qtpl:6 -func reduce(lines []string) string { - return strings.Join(lines, " ") -} - -func formatLink(e *parser.Entry, format string) string { - c := strings.Replace(*e.Commit, "-dirty", "", -1) - return fmt.Sprintf(format, c, *e.Origin) -} - -//line index.md.qtpl:16 -func StreamMarkdownTemplate(qw422016 *qt422016.Writer, entries []*parser.Entry, format string) { -//line index.md.qtpl:16 - qw422016.N().S(` -# Apks Alpine 3.18 -`) -//line index.md.qtpl:18 - for _, e := range entries { -//line index.md.qtpl:18 - qw422016.N().S(` -## `) -//line index.md.qtpl:19 - qw422016.E().S(e.Name) -//line index.md.qtpl:19 - qw422016.N().S(` - -- **Version**: `) -//line index.md.qtpl:21 - qw422016.E().S(e.Version) -//line index.md.qtpl:21 - qw422016.N().S(` -- **Description**: `) -//line index.md.qtpl:22 - qw422016.E().S(e.Description) -//line index.md.qtpl:22 - if e.Maintainer != nil { -//line index.md.qtpl:22 - qw422016.N().S(` -- **Maintainer**: `) -//line index.md.qtpl:23 - qw422016.E().S(*e.Maintainer) -//line index.md.qtpl:23 - } -//line index.md.qtpl:23 - qw422016.N().S(` -- **Checksum**:`) -//line index.md.qtpl:24 - qw422016.E().S(e.Checksum) -//line index.md.qtpl:24 - if e.Architecture != nil { -//line index.md.qtpl:24 - qw422016.N().S(` -- **Architecture**: `) -//line index.md.qtpl:25 - qw422016.E().S(*e.Architecture) -//line index.md.qtpl:25 - } -//line index.md.qtpl:25 - qw422016.N().S(` -- **Size**: `) -//line index.md.qtpl:26 - qw422016.N().D(e.PackageSize) -//line index.md.qtpl:26 - qw422016.N().S(`B -- **Installed size**: `) -//line index.md.qtpl:27 - qw422016.N().D(e.InstalledSize) -//line index.md.qtpl:27 - qw422016.N().S(` -- **Url**: `) -//line index.md.qtpl:28 - qw422016.E().S(e.Url) -//line index.md.qtpl:28 - qw422016.N().S(` -- **License**: `) -//line index.md.qtpl:29 - qw422016.E().S(e.License) -//line index.md.qtpl:29 - if e.Origin != nil { -//line index.md.qtpl:29 - qw422016.N().S(` -- **Origin**: `) -//line index.md.qtpl:30 - qw422016.E().S(*e.Origin) -//line index.md.qtpl:30 - } -//line index.md.qtpl:30 - if e.BuildTime != nil { -//line index.md.qtpl:30 - qw422016.N().S(` -- **Build time**: `) -//line index.md.qtpl:31 - qw422016.E().S(e.BuildTime.String()) -//line index.md.qtpl:31 - } -//line index.md.qtpl:31 - if e.Commit != nil { -//line index.md.qtpl:31 - qw422016.N().S(` -- **Commit**: [`) -//line index.md.qtpl:32 - qw422016.E().S(*e.Commit) -//line index.md.qtpl:32 - qw422016.N().S(`](`) -//line index.md.qtpl:32 - qw422016.E().S(formatLink(e, format)) -//line index.md.qtpl:32 - qw422016.N().S(`)`) -//line index.md.qtpl:32 - } -//line index.md.qtpl:32 - if e.ProviderPriority != nil { -//line index.md.qtpl:32 - qw422016.N().S(` -- **Provider Priority**: `) -//line index.md.qtpl:33 - qw422016.N().D(*e.ProviderPriority) -//line index.md.qtpl:33 - } -//line index.md.qtpl:33 - if len(e.Dependencies) > 0 { -//line index.md.qtpl:33 - qw422016.N().S(` -- **Dependencies:**: `) -//line index.md.qtpl:34 - qw422016.E().S(reduce(e.Dependencies)) -//line index.md.qtpl:34 - } -//line index.md.qtpl:34 - if len(e.Provides) > 0 { -//line index.md.qtpl:34 - qw422016.N().S(` -- **Provides:**: `) -//line index.md.qtpl:35 - qw422016.E().S(reduce(e.Provides)) -//line index.md.qtpl:35 - } -//line index.md.qtpl:35 - if len(e.InstallIf) > 0 { -//line index.md.qtpl:35 - qw422016.N().S(` -- **Install if:**: `) -//line index.md.qtpl:36 - qw422016.E().S(reduce(e.InstallIf)) -//line index.md.qtpl:36 - } -//line index.md.qtpl:36 - qw422016.N().S(` -`) -//line index.md.qtpl:37 - } -//line index.md.qtpl:37 - qw422016.N().S(` - -`) -//line index.md.qtpl:39 -} - -//line index.md.qtpl:39 -func WriteMarkdownTemplate(qq422016 qtio422016.Writer, entries []*parser.Entry, format string) { -//line index.md.qtpl:39 - qw422016 := qt422016.AcquireWriter(qq422016) -//line index.md.qtpl:39 - StreamMarkdownTemplate(qw422016, entries, format) -//line index.md.qtpl:39 - qt422016.ReleaseWriter(qw422016) -//line index.md.qtpl:39 -} - -//line index.md.qtpl:39 -func MarkdownTemplate(entries []*parser.Entry, format string) string { -//line index.md.qtpl:39 - qb422016 := qt422016.AcquireByteBuffer() -//line index.md.qtpl:39 - WriteMarkdownTemplate(qb422016, entries, format) -//line index.md.qtpl:39 - qs422016 := string(qb422016.B) -//line index.md.qtpl:39 - qt422016.ReleaseByteBuffer(qb422016) -//line index.md.qtpl:39 - return qs422016 -//line index.md.qtpl:39 -} -- cgit v1.2.3