{% import ( "runtime/debug" "golang.org/x/text/language" "golang.org/x/text/message" "source.toby3d.me/toby3d/auth/internal/domain" ) %} {% interface Page { body() head() lang() t(format message.Reference, args ...any) title() } %} {% code type BaseOf struct { Config *domain.Config Language language.Tag Printer *message.Printer } %} {% stripspace %} {% func (p *BaseOf) lang() %} {% if p.Language != language.Und %} {%s p.Language.String() %} {% else %} en {% endif %} {% endfunc %} {% endstripspace %} {% collapsespace %} {% func (p *BaseOf) title() %} {%s p.Config.Name %} {% endfunc %} {% 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 Template(p Page) %} {%= p.head() %} {%= p.title() %} {%= p.body() %} {% code var path, vcsRevision string if bi, ok := debug.ReadBuildInfo(); ok { path = bi.Path for i := range bi.Settings { if bi.Settings[i].Key != "vcs.revision" { continue } vcsRevision = bi.Settings[i].Value } } %} {% if vcsRevision != "" %} {% endif %} {% endfunc %} {% func (p BaseOf) t(format message.Reference, args ...any) %} {%s= p.Printer.Sprintf(format, args...) %} {% endfunc %} {% endcollapsespace %}