mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-11-07 11:39:22 +00:00
fix: skip null colors in repoColors when generating repo-cards CSS
Languages with null entries in repoColors.json caused Go's fmt.Sprintf to emit '%!s(<nil>)' as the color value, producing invalid CSS and browser parse errors. Add a nil guard to skip those entries, letting them fall back to the default dot color. Fixes #2824
This commit is contained in:
1 file changed
+3
-1
@@ -134,7 +134,9 @@
|
|||||||
{{ $cssRules = $cssRules | append ".language-dot[data-language=\"model\"] { background-color: #ff6b35; }" }}
|
{{ $cssRules = $cssRules | append ".language-dot[data-language=\"model\"] { background-color: #ff6b35; }" }}
|
||||||
|
|
||||||
{{ range $lang, $color := $repoColors }}
|
{{ range $lang, $color := $repoColors }}
|
||||||
{{ $cssRules = $cssRules | append (printf ".language-dot[data-language=\"%s\"] { background-color: %s; }" $lang $color) }}
|
{{ if $color }}
|
||||||
|
{{ $cssRules = $cssRules | append (printf ".language-dot[data-language=\"%s\"] { background-color: %s; }" $lang $color) }}
|
||||||
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ $repoCardCSS := resources.FromString "css/repo-cards.css" (delimit $cssRules "\n")
|
{{ $repoCardCSS := resources.FromString "css/repo-cards.css" (delimit $cssRules "\n")
|
||||||
| minify | resources.Fingerprint (.Site.Params.fingerprintAlgorithm | default "sha512")
|
| minify | resources.Fingerprint (.Site.Params.fingerprintAlgorithm | default "sha512")
|
||||||
|
|||||||
Reference in new issue
Block a user