From 45e571abfdabb82d98c6834aa921285b24035afa Mon Sep 17 00:00:00 2001 From: Maxim Lebedev Date: Sun, 6 Aug 2023 06:42:38 +0600 Subject: [PATCH] :art: Format templates source code --- web/authorize.qtpl | 24 ++++++------ web/authorize.qtpl.go | 40 +++++++++---------- web/baseof.qtpl | 30 +++++++-------- web/baseof.qtpl.go | 90 +++++++++++++++++++++---------------------- web/callback.qtpl | 2 +- web/callback.qtpl.go | 10 ++--- web/error.qtpl | 10 ++--- web/error.qtpl.go | 26 ++++++------- web/home.qtpl | 18 +++------ web/home.qtpl.go | 82 ++++++++++++++++----------------------- web/ticket.qtpl | 10 ++--- web/ticket.qtpl.go | 18 ++++----- 12 files changed, 169 insertions(+), 191 deletions(-) diff --git a/web/authorize.qtpl b/web/authorize.qtpl index 29644a1..17330ba 100644 --- a/web/authorize.qtpl +++ b/web/authorize.qtpl @@ -16,15 +16,15 @@ State string } %} -{% func (p *AuthorizePage) Title() %} +{% func (p *AuthorizePage) title() %} {% if name := p.Client.GetName(); name != "" %} -{%= p.T("Authorize %s", name) %} +{%= p.t("Authorize %s", name) %} {% else %} -{%= p.T("Authorize application") %} +{%= p.t("Authorize application") %} {% endif %} {% endfunc %} -{% func (p *AuthorizePage) Body() %} +{% func (p *AuthorizePage) body() %}
{% if p.Client.GetLogo() != nil %} 🔐 - {%= p.T(`This client uses %sPKCE%s with the %s%s%s method.`, ``, + {%= p.t(`This client uses %sPKCE%s with the %s%s%s method.`, ``, ``, ``, p.CodeChallengeMethod, ``) %}

{% else %} @@ -72,10 +72,10 @@ role="img" aria-label="unlock">🔓 - {%= p.T(`This client does not use %sPKCE%s!`, ``, ``) %} + {%= p.t(`This client does not use %sPKCE%s!`, ``, ``) %}

- {%= p.T(`%sProof of Key Code Exchange%s is a mechanism that protects against attackers in the middle hijacking `+ + {%= p.t(`%sProof of Key Code Exchange%s is a mechanism that protects against attackers in the middle hijacking `+ `your application's authentication process. You can still authorize this application without this protection, `+ `but you must independently verify the security of this connection. If you have any doubts - stop the process `+ ` and contact the developers.`, ``, ``) %} @@ -112,7 +112,7 @@ {% if len(p.Scope) > 0 %}

- {%= p.T("Scopes") %} + {%= p.t("Scopes") %} {% for _, scope := range p.Scope %}
@@ -129,7 +129,7 @@
{% else %} {% endif %} @@ -173,18 +173,18 @@ name="authorize" value="deny"> - {%= p.T("Deny") %} + {%= p.t("Deny") %} diff --git a/web/authorize.qtpl.go b/web/authorize.qtpl.go index 80548e9..055d637 100644 --- a/web/authorize.qtpl.go +++ b/web/authorize.qtpl.go @@ -38,7 +38,7 @@ type AuthorizePage struct { } //line web/authorize.qtpl:19 -func (p *AuthorizePage) StreamTitle(qw422016 *qt422016.Writer) { +func (p *AuthorizePage) streamtitle(qw422016 *qt422016.Writer) { //line web/authorize.qtpl:19 qw422016.N().S(` `) @@ -48,7 +48,7 @@ func (p *AuthorizePage) StreamTitle(qw422016 *qt422016.Writer) { qw422016.N().S(` `) //line web/authorize.qtpl:21 - p.StreamT(qw422016, "Authorize %s", name) + p.streamt(qw422016, "Authorize %s", name) //line web/authorize.qtpl:21 qw422016.N().S(` `) @@ -58,7 +58,7 @@ func (p *AuthorizePage) StreamTitle(qw422016 *qt422016.Writer) { qw422016.N().S(` `) //line web/authorize.qtpl:23 - p.StreamT(qw422016, "Authorize application") + p.streamt(qw422016, "Authorize application") //line web/authorize.qtpl:23 qw422016.N().S(` `) @@ -71,22 +71,22 @@ func (p *AuthorizePage) StreamTitle(qw422016 *qt422016.Writer) { } //line web/authorize.qtpl:25 -func (p *AuthorizePage) WriteTitle(qq422016 qtio422016.Writer) { +func (p *AuthorizePage) writetitle(qq422016 qtio422016.Writer) { //line web/authorize.qtpl:25 qw422016 := qt422016.AcquireWriter(qq422016) //line web/authorize.qtpl:25 - p.StreamTitle(qw422016) + p.streamtitle(qw422016) //line web/authorize.qtpl:25 qt422016.ReleaseWriter(qw422016) //line web/authorize.qtpl:25 } //line web/authorize.qtpl:25 -func (p *AuthorizePage) Title() string { +func (p *AuthorizePage) title() string { //line web/authorize.qtpl:25 qb422016 := qt422016.AcquireByteBuffer() //line web/authorize.qtpl:25 - p.WriteTitle(qb422016) + p.writetitle(qb422016) //line web/authorize.qtpl:25 qs422016 := string(qb422016.B) //line web/authorize.qtpl:25 @@ -97,7 +97,7 @@ func (p *AuthorizePage) Title() string { } //line web/authorize.qtpl:27 -func (p *AuthorizePage) StreamBody(qw422016 *qt422016.Writer) { +func (p *AuthorizePage) streambody(qw422016 *qt422016.Writer) { //line web/authorize.qtpl:27 qw422016.N().S(`
@@ -199,7 +199,7 @@ func (p *AuthorizePage) StreamBody(qw422016 *qt422016.Writer) { `) //line web/authorize.qtpl:65 - p.StreamT(qw422016, `This client uses %sPKCE%s with the %s%s%s method.`, ``, + p.streamt(qw422016, `This client uses %sPKCE%s with the %s%s%s method.`, ``, ``, ``, p.CodeChallengeMethod, ``) //line web/authorize.qtpl:66 qw422016.N().S(` @@ -217,14 +217,14 @@ func (p *AuthorizePage) StreamBody(qw422016 *qt422016.Writer) { `) //line web/authorize.qtpl:75 - p.StreamT(qw422016, `This client does not use %sPKCE%s!`, ``, ``) + p.streamt(qw422016, `This client does not use %sPKCE%s!`, ``, ``) //line web/authorize.qtpl:75 qw422016.N().S(`

`) //line web/authorize.qtpl:78 - p.StreamT(qw422016, `%sProof of Key Code Exchange%s is a mechanism that protects against attackers in the middle hijacking `+ + p.streamt(qw422016, `%sProof of Key Code Exchange%s is a mechanism that protects against attackers in the middle hijacking `+ `your application's authentication process. You can still authorize this application without this protection, `+ `but you must independently verify the security of this connection. If you have any doubts - stop the process `+ ` and contact the developers.`, ``, ``) @@ -301,7 +301,7 @@ func (p *AuthorizePage) StreamBody(qw422016 *qt422016.Writer) {

`) //line web/authorize.qtpl:115 - p.StreamT(qw422016, "Scopes") + p.streamt(qw422016, "Scopes") //line web/authorize.qtpl:115 qw422016.N().S(` @@ -342,7 +342,7 @@ func (p *AuthorizePage) StreamBody(qw422016 *qt422016.Writer) { @@ -466,7 +466,7 @@ func (p *AuthorizePage) StreamBody(qw422016 *qt422016.Writer) { `) //line web/authorize.qtpl:176 - p.StreamT(qw422016, "Deny") + p.streamt(qw422016, "Deny") //line web/authorize.qtpl:176 qw422016.N().S(` @@ -477,7 +477,7 @@ func (p *AuthorizePage) StreamBody(qw422016 *qt422016.Writer) { `) //line web/authorize.qtpl:183 - p.StreamT(qw422016, "Allow") + p.streamt(qw422016, "Allow") //line web/authorize.qtpl:183 qw422016.N().S(` @@ -485,7 +485,7 @@ func (p *AuthorizePage) StreamBody(qw422016 *qt422016.Writer) { @@ -496,22 +496,22 @@ func (p *AuthorizePage) StreamBody(qw422016 *qt422016.Writer) { } //line web/authorize.qtpl:191 -func (p *AuthorizePage) WriteBody(qq422016 qtio422016.Writer) { +func (p *AuthorizePage) writebody(qq422016 qtio422016.Writer) { //line web/authorize.qtpl:191 qw422016 := qt422016.AcquireWriter(qq422016) //line web/authorize.qtpl:191 - p.StreamBody(qw422016) + p.streambody(qw422016) //line web/authorize.qtpl:191 qt422016.ReleaseWriter(qw422016) //line web/authorize.qtpl:191 } //line web/authorize.qtpl:191 -func (p *AuthorizePage) Body() string { +func (p *AuthorizePage) body() string { //line web/authorize.qtpl:191 qb422016 := qt422016.AcquireByteBuffer() //line web/authorize.qtpl:191 - p.WriteBody(qb422016) + p.writebody(qb422016) //line web/authorize.qtpl:191 qs422016 := string(qb422016.B) //line web/authorize.qtpl:191 diff --git a/web/baseof.qtpl b/web/baseof.qtpl index 9ac8840..b81bebc 100644 --- a/web/baseof.qtpl +++ b/web/baseof.qtpl @@ -8,11 +8,11 @@ ) %} {% interface Page { - Body() - Head() - Lang() - Title() - T(format message.Reference, args ...any) + body() + head() + lang() + t(format message.Reference, args ...any) + title() } %} {% code type BaseOf struct { @@ -22,7 +22,7 @@ } %} {% stripspace %} -{% func (p *BaseOf) Lang() %} +{% func (p *BaseOf) lang() %} {% if p.Language != language.Und %} {%s p.Language.String() %} {% else %} @@ -32,11 +32,11 @@ en {% endstripspace %} {% collapsespace %} -{% func (p *BaseOf) Title() %} +{% func (p *BaseOf) title() %} {%s p.Config.Name %} {% endfunc %} -{% func (p *BaseOf) Head() %} +{% func (p *BaseOf) head() %} {% comment %}https://evilmartians.com/chronicles/how-to-favicon-in-2021-six-files-that-fit-most-needs{% endcomment %} {% endfunc %} -{% func (p *BaseOf) Body() %}{% endfunc %} +{% func (p *BaseOf) body() %}{% endfunc %} {% func Template(p Page) %} + lang="{%= p.lang() %}"> - {%= p.Head() %} + {%= p.head() %} - {%= p.Title() %} + {%= p.title() %} - {%= p.Body() %} + {%= p.body() %} {% code var path, vcsRevision string @@ -92,7 +92,7 @@ en {% if vcsRevision != "" %}