You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
111 lines
2.2 KiB
Plaintext
111 lines
2.2 KiB
Plaintext
{% 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()
|
|
Title()
|
|
T(format string, args ...interface{})
|
|
} %}
|
|
|
|
{% 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 %}
|
|
<link rel="icon"
|
|
href="/favicon.ico"
|
|
sizes="any">
|
|
|
|
<link rel="icon"
|
|
href="/icon.svg"
|
|
type="image/svg+xml">
|
|
|
|
<link rel="apple-touch-icon"
|
|
href="/apple-touch-icon.png">
|
|
|
|
<link rel="manifest"
|
|
href="/manifest.webmanifest">
|
|
{% endfunc %}
|
|
|
|
{% func (p *BaseOf) Body() %}{% endfunc %}
|
|
|
|
{% func Template(p Page) %}
|
|
<!DOCTYPE html>
|
|
<html class="page"
|
|
lang="{%= p.Lang() %}">
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport"
|
|
content="width=device-width, initial-scale=1.0">
|
|
|
|
{%= p.Head() %}
|
|
|
|
<title>{%= p.Title() %}</title>
|
|
</head>
|
|
|
|
<body class="page__body body">
|
|
{%= 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 != "" %}
|
|
<footer>
|
|
<small>
|
|
{%= p.T("version") %}
|
|
<a href="https://{%s path %}/commit/{%s vcsRevision %}"
|
|
target="_blank">
|
|
{%s vcsRevision[:7] -%}
|
|
</a>
|
|
</small>
|
|
</footer>
|
|
{% endif %}
|
|
</body>
|
|
</html>
|
|
{% endfunc %}
|
|
|
|
{% func (p *BaseOf) T(format string, args ...interface{}) %}
|
|
{%s p.Printer.Sprintf(format, args...) %}
|
|
{% endfunc %}
|
|
{% endcollapsespace %}
|