Format challenge #87

This commit is contained in:
Elnu 2022-11-29 22:24:40 -08:00
parent 5d018c79cd
commit a9993b0850
2 changed files with 122 additions and 2 deletions

View file

@ -47,13 +47,16 @@
{{- end -}}
{{- end -}}
{{- end -}}
{{- if .dictionary -}}
{{ if .dictionary }}
{{- $.Scratch.Set "dictionary" .dictionary -}}
{{ end }}
{{- if not (and .dictionary (hasPrefix .dictionary "http")) -}}
{{- $.Scratch.Set "dictionary" (printf "%s" ($.Scratch.Get "dictionary") | printf "%s%s" "https://jisho.org/word/" | printf "%s") -}}
{{- end -}}
{{- if and (not .dictionary) (not .pos) -}}
{{- $.Scratch.Get "html" | safeHTML -}}
{{- else -}}
<a href="https://jisho.org/word/{{- $.Scratch.Get "dictionary" -}}" class="{{- .pos -}}" title="{{- .pos -}}" target="_blank">{{- $.Scratch.Get "html" | safeHTML -}}</a>
<a href="{{- $.Scratch.Get "dictionary" -}}" class="{{- .pos -}}" title="{{- .pos -}}" target="_blank">{{- $.Scratch.Get "html" | safeHTML -}}</a>
{{- end -}}
{{- end -}}</p>
{{- end -}}