variant: fix :root nesting selector for modified variants #974
Some checks failed
docs-build-deployment / Run deploy (push) Has been cancelled
docs-build / Run build (push) Has been cancelled

This commit is contained in:
Sören Weber 2024-12-19 23:37:24 +01:00
parent f1701957c3
commit ec88e24f46
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
2 changed files with 8 additions and 8 deletions

View file

@ -60,11 +60,11 @@ Generator run:
{{- $formathtml = print $formathtml {{- $formathtml = print $formathtml
"\n:root:not([data-r-output-format='print'])[data-r-theme-variant='" $themevariant.identifier "'] {" "\n:root:not([data-r-output-format='print'])[data-r-theme-variant='" $themevariant.identifier "'] {"
"\n@media screen and (prefers-color-scheme: light) {" "\n@media screen and (prefers-color-scheme: light) {"
"\n&" $lightthemevariant.themecontent "\n" $lightthemevariant.themecontent
"\n" $lightthemevariant.chromacontent "\n" $lightthemevariant.chromacontent
"\n}" "\n}"
"\n@media screen and (prefers-color-scheme: dark) {" "\n@media screen and (prefers-color-scheme: dark) {"
"\n&" $darkthemevariant.themecontent "\n" $darkthemevariant.themecontent
"\n" $darkthemevariant.chromacontent "\n" $darkthemevariant.chromacontent
"\n}" "\n}"
"\n}" "\n}"
@ -76,7 +76,7 @@ Generator run:
}} }}
{{- $formathtml = print $formathtml {{- $formathtml = print $formathtml
"\n:root:not([data-r-output-format='print'])[data-r-theme-variant='" $themevariant.identifier "'] {" "\n:root:not([data-r-output-format='print'])[data-r-theme-variant='" $themevariant.identifier "'] {"
"\n&" $themevariant.themecontent "\n" $themevariant.themecontent
"\n" $themevariant.chromacontent "\n" $themevariant.chromacontent
"\n}" "\n}"
}} }}
@ -180,7 +180,7 @@ Generator run:
$formathtml $formathtml
"\n}" "\n}"
"\n@media print {" "\n@media print {"
"\n&" $defaultthemevariant.themecontent "\n" $defaultthemevariant.themecontent
"\n" $defaultthemevariant.chromacontent "\n" $defaultthemevariant.chromacontent
"\n}" "\n}"
"\n@media print {" "\n@media print {"
@ -199,7 +199,7 @@ Generator run:
*/}} */}}
{{- $printcontent = print {{- $printcontent = print
":root[data-r-output-format='print'] {" ":root[data-r-output-format='print'] {"
"\n&" $defaultthemevariant.themecontent "\n" $defaultthemevariant.themecontent
"\n" $defaultthemevariant.chromacontent "\n" $defaultthemevariant.chromacontent
"\n}" "\n}"
"\n" $printcontent "\n" $printcontent
@ -217,7 +217,7 @@ Generator run:
{{- $identifier := .identifier }} {{- $identifier := .identifier }}
{{- $themecontent := "" }} {{- $themecontent := "" }}
{{- with resources.Get (printf "css/theme-%s.css" $identifier) }} {{- with resources.Get (printf "css/theme-%s.css" $identifier) }}
{{- $themecontent = .Content }} {{- $themecontent = replaceRE `([ \t]*)(:root)` "${1}&${2}" .Content }}
{{- else }} {{- else }}
{{- errorf "\"theme-%s.css\": file not found in \"assets/css\"; if you are migrating from a theme version older thant 6.0.0, you have to move it over from \"static/css\"" $identifier }} {{- errorf "\"theme-%s.css\": file not found in \"assets/css\"; if you are migrating from a theme version older thant 6.0.0, you have to move it over from \"static/css\"" $identifier }}
{{- end }} {{- end }}
@ -235,7 +235,7 @@ Generator run:
{{- $chroma = $themevariant.chroma }} {{- $chroma = $themevariant.chroma }}
{{- $chromacontent = $themevariant.chromacontent }} {{- $chromacontent = $themevariant.chromacontent }}
{{- end }} {{- end }}
{{- $themecontent = $tempthemecontent}} {{- $themecontent = replaceRE `(&\s*)+:root` "&:root" $tempthemecontent }}
{{- range findRESubmatch `[ \t]*--CODE-theme\s*:\s*([^;]*?)\s*;` $themecontent }} {{- range findRESubmatch `[ \t]*--CODE-theme\s*:\s*([^;]*?)\s*;` $themecontent }}
{{- $chroma = index . 1 }} {{- $chroma = index . 1 }}
{{- $cssres := resources.Get (printf "css/chroma-%s.css" $chroma) }} {{- $cssres := resources.Get (printf "css/chroma-%s.css" $chroma) }}

View file

@ -1 +1 @@
7.2.1+66f4fbf5f04db1aa128d8f951c0883cc226312b9 7.2.1+f1701957c30daae7cd133bec5a7968480563ce9f