Rename custom-formats.yaml to string-formats.yaml (#1977)

It does not contain only custom formats, so the name didn't fit anymore.
Update also the docs to reflect that.
This commit is contained in:
Kévin Commaille 2024-10-30 23:30:31 +01:00 committed by GitHub
parent 88f0c56ad9
commit 1e0919ad12
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 30 additions and 16 deletions

View file

@ -157,7 +157,7 @@ resolve-additional-types.)
{{/* If the string uses a known format, use it. */}}
{{ with .format }}
{{ with partial "custom-format" . }}
{{ with partial "string-format" . }}
{{ $type = . }}
{{ end }}
{{ end }}
@ -264,7 +264,7 @@ resolve-additional-types.)
{{ range $formatId, $formatType := $formatMap.Values }}
{{ $formatKey := "string" }}
{{ if ne $formatId "string" }}
{{ with partial "custom-format" $formatId }}
{{ with partial "string-format" $formatId }}
{{ $formatKey = . }}
{{ else }}
{{ errorf "Unsupported value for `x-pattern-format`: %s" $formatId }}
@ -331,12 +331,12 @@ resolve-additional-types.)
Computes the type to display for a string format, given the identifier of
the format as a string.
*/}}
{{ define "partials/custom-format" }}
{{ $customFormat := "" }}
{{ define "partials/string-format" }}
{{ $stringFormat := "" }}
{{ with index site.Data "custom-formats" . }}
{{ $customFormat = printf "<a href=\"%s\">%s</a>" (htmlEscape .url) (htmlEscape .title) }}
{{ with index site.Data "string-formats" . }}
{{ $stringFormat = printf "<a href=\"%s\">%s</a>" (htmlEscape .url) (htmlEscape .title) }}
{{ end }}
{{ return $customFormat }}
{{ return $stringFormat }}
{{ end }}