template formatting

This commit is contained in:
f0x 2024-11-06 15:52:08 +01:00
parent 7f4d9b689a
commit 4a2c712b3d
36 changed files with 1037 additions and 1039 deletions

View file

@ -3,6 +3,9 @@
"go.lintFlags": [ "go.lintFlags": [
"--fast" "--fast"
], ],
"go.testEnvVars": {
"WAZERO_COMPILATION_CACHE": "~/.cache/wazero"
},
"gopls": { "gopls": {
"analyses": { "analyses": {
"composites": false "composites": false
@ -19,5 +22,9 @@
], ],
"editor.codeActionsOnSave": { "editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit" "source.fixAll.eslint": "explicit"
} },
"html.format.wrapLineLength": 0,
"html.format.wrapAttributes": "preserve",
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
} }

View file

@ -23,10 +23,13 @@ Someone has submitted a new account sign-up to your instance.
They provided the following details: They provided the following details:
Email address: {{ .SignupEmail }} Email address:
Username: {{ .SignupUsername }} {{ .SignupEmail }}
Username:
{{ .SignupUsername }}
{{- if .SignupReason }} {{- if .SignupReason }}
Reason: {{ .SignupReason }} Reason:
{{ .SignupReason }}
{{- end }} {{- end }}
To view the sign-up, paste the following link into your browser: {{ .SignupURL }} To view the sign-up, paste the following link into your browser: {{ .SignupURL }}

View file

@ -26,8 +26,7 @@
href="{{ .URL }}" href="{{ .URL }}"
class="nounderline" class="nounderline"
rel="nofollow noreferrer noopener" rel="nofollow noreferrer noopener"
target="_blank" target="_blank">
>
@{{ .Username }} @{{ .Username }}
</a> </a>
</b> </b>
@ -42,48 +41,47 @@
{{- define "avatarWidth" -}} {{- define "avatarWidth" -}}
{{- with .account }} {{- with .account }}
{{- if isNil .AvatarAttachment -}} {{- if isNil .AvatarAttachment -}}
{{- template "defaultAvatarDimension" . -}} {{- template "defaultAvatarDimension" . -}}
{{- else -}} {{- else -}}
{{- /* Use the avatar's proper dimensions. */ -}} {{- /* Use the avatar's proper dimensions. */ -}}
{{- .AvatarAttachment.Meta.Original.Width -}} {{- .AvatarAttachment.Meta.Original.Width -}}
{{- end -}} {{- end -}}
{{- end }} {{- end }}
{{- end -}} {{- end -}}
{{- define "avatarHeight" -}} {{- define "avatarHeight" -}}
{{- with .account }} {{- with .account }}
{{- if isNil .AvatarAttachment -}} {{- if isNil .AvatarAttachment -}}
{{- template "defaultAvatarDimension" . -}} {{- template "defaultAvatarDimension" . -}}
{{- else -}} {{- else -}}
{{- /* Use the avatar's proper dimensions. */ -}} {{- /* Use the avatar's proper dimensions. */ -}}
{{- .AvatarAttachment.Meta.Original.Height -}} {{- .AvatarAttachment.Meta.Original.Height -}}
{{- end -}} {{- end -}}
{{- end }} {{- end }}
{{- end -}} {{- end -}}
{{- define "avatarAlt" -}} {{- define "avatarAlt" -}}
Avatar for {{ .account.Username -}} Avatar for {{ .account.Username -}}
{{- if .account.AvatarDescription }} {{- if .account.AvatarDescription }}
{{- /* Add the avatar's image description. */ -}} {{- /* Add the avatar's image description. */ -}}
: {{ .account.AvatarDescription -}} : {{ .account.AvatarDescription -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- define "headerAlt" -}} {{- define "headerAlt" -}}
Header for {{ .account.Username -}} Header for {{ .account.Username -}}
{{- if .account.HeaderDescription }} {{- if .account.HeaderDescription }}
{{- /* Add the header's image description. */ -}} {{- /* Add the header's image description. */ -}}
: {{ .account.HeaderDescription -}} : {{ .account.HeaderDescription -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- define "avatar" -}} {{- define "avatar" -}}
{{- with . }} {{- with . }}
<div <div
class="media photoswipe-gallery odd single avatar-image-wrapper" class="media photoswipe-gallery odd single avatar-image-wrapper"
role="group" role="group">
>
<a <a
class="photoswipe-slide" class="photoswipe-slide"
href="{{- .account.Avatar -}}" href="{{- .account.Avatar -}}"
@ -92,18 +90,15 @@
data-pswp-height="{{- template "avatarHeight" . -}}px" data-pswp-height="{{- template "avatarHeight" . -}}px"
data-cropped="true" data-cropped="true"
alt="{{- template "avatarAlt" . -}}" alt="{{- template "avatarAlt" . -}}"
title="{{- template "avatarAlt" . -}}" title="{{- template "avatarAlt" . -}}">
>
<picture <picture
aria-hidden="true" aria-hidden="true">
>
{{- if .account.AvatarAttachment }} {{- if .account.AvatarAttachment }}
<source <source
class="avatar" class="avatar"
srcset="{{- .account.AvatarStatic -}}" srcset="{{- .account.AvatarStatic -}}"
type="{{- .account.AvatarAttachment.PreviewMIMEType -}}" type="{{- .account.AvatarAttachment.PreviewMIMEType -}}"
media="(prefers-reduced-motion: reduce)" media="(prefers-reduced-motion: reduce)" />
/>
{{- end }} {{- end }}
<img <img
class="avatar" class="avatar"
@ -111,8 +106,7 @@
alt="{{- template "avatarAlt" . -}}" alt="{{- template "avatarAlt" . -}}"
title="{{- template "avatarAlt" . -}}" title="{{- template "avatarAlt" . -}}"
width="{{- template "avatarWidth" . -}}" width="{{- template "avatarWidth" . -}}"
height="{{- template "avatarHeight" . -}}" height="{{- template "avatarHeight" . -}}" />
/>
</picture> </picture>
</a> </a>
</div> </div>
@ -132,14 +126,12 @@
<source <source
srcset="{{- .account.HeaderStatic -}}" srcset="{{- .account.HeaderStatic -}}"
type="{{- .account.HeaderAttachment.PreviewMIMEType -}}" type="{{- .account.HeaderAttachment.PreviewMIMEType -}}"
media="(prefers-reduced-motion: reduce)" media="(prefers-reduced-motion: reduce)" />
/>
{{- end }} {{- end }}
<img <img
src="{{- .account.Header -}}" src="{{- .account.Header -}}"
alt="{{- template "headerAlt" . -}}" alt="{{- template "headerAlt" . -}}"
title="{{- template "headerAlt" . -}}" title="{{- template "headerAlt" . -}}" />
/>
</picture> </picture>
</div> </div>
<div class="basic-info"> <div class="basic-info">
@ -163,8 +155,7 @@
<div <div
class="bot-legend-wrapper" class="bot-legend-wrapper"
aria-hidden="true" aria-hidden="true"
title="This is a bot account." title="This is a bot account.">
>
<i class="bot-icon fa fa-microchip"></i> <i class="bot-icon fa fa-microchip"></i>
<span class="bot-legend">bot</span> <span class="bot-legend">bot</span>
</div> </div>
@ -221,8 +212,7 @@
{{- range .pinned_statuses }} {{- range .pinned_statuses }}
<article <article
class="status expanded" class="status expanded"
{{- includeAttr "status_attributes.tmpl" . | indentAttr 6 }} {{- includeAttr "status_attributes.tmpl" . | indentAttr 6 }}>
>
{{- include "status.tmpl" . | indent 6 }} {{- include "status.tmpl" . | indent 6 }}
</article> </article>
{{- end }} {{- end }}
@ -245,8 +235,7 @@
{{- range .statuses }} {{- range .statuses }}
<article <article
class="status expanded" class="status expanded"
{{- includeAttr "status_attributes.tmpl" . | indentAttr 6 }} {{- includeAttr "status_attributes.tmpl" . | indentAttr 6 }}>
>
{{- include "status.tmpl" . | indent 6 }} {{- include "status.tmpl" . | indent 6 }}
</article> </article>
{{- end }} {{- end }}

View file

@ -90,9 +90,8 @@ media photoswipe-gallery {{ (len .) | oddOrEven }} {{ if eq (len .) 1 }}single{{
{{- if .Description }} {{- if .Description }}
alt="{{- $media.Description -}}" alt="{{- $media.Description -}}"
title="{{- $media.Description -}}" title="{{- $media.Description -}}"
{{- end }} {{- end }}>
> <source type="{{- $media.MIMEType -}}" src="{{- $media.URL -}}" />
<source type="{{- $media.MIMEType -}}" src="{{- $media.URL -}}"/>
</video> </video>
{{- else if eq .Type "audio" }} {{- else if eq .Type "audio" }}
<video <video