diff --git a/README.md b/README.md index 077e513d51..c42e9c5018 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,6 @@ The Relearn theme is a fork of the great [Learn theme](https://github.com/matcor - Usable offline, no external dependencies - [Usable from your local file system via `file://` protocol](https://mcshelby.github.io/hugo-theme-relearn/basics/customization#file-system) - Support for the [VSCode Front Matter extension](https://github.com/estruyf/vscode-front-matter) for on-premise CMS capabilities - - Support for Internet Explorer 11 - [Support for Open Graph and Twitter Cards](https://mcshelby.github.io/hugo-theme-relearn/basics/customization#social-media-meta-tags) - **Configurable theming and visuals** - [Configurable brand images](https://mcshelby.github.io/hugo-theme-relearn/basics/branding#change-the-logo) diff --git a/assets/css/auto.css b/assets/css/auto.css index dcb5667d46..9b966e0d28 100644 --- a/assets/css/auto.css +++ b/assets/css/auto.css @@ -1,2 +1,2 @@ -@import "{{ printf "%s-%s%s.css" .prefix .light .suffix }}" screen and (prefers-color-scheme: light); -@import "{{ printf "%s-%s%s.css" .prefix .dark .suffix }}" screen and (prefers-color-scheme: dark); +@import "{{ printf "%s-%s.css" .prefix .light }}" screen and (prefers-color-scheme: light); +@import "{{ printf "%s-%s.css" .prefix .dark }}" screen and (prefers-color-scheme: dark); diff --git a/static/css/chroma-learn.css b/assets/css/chroma-learn.css similarity index 100% rename from static/css/chroma-learn.css rename to assets/css/chroma-learn.css diff --git a/static/css/chroma-neon.css b/assets/css/chroma-neon.css similarity index 96% rename from static/css/chroma-neon.css rename to assets/css/chroma-neon.css index e6746bdf4f..7ef838a1a8 100644 --- a/static/css/chroma-neon.css +++ b/assets/css/chroma-neon.css @@ -1,7 +1,3 @@ -/* this variant does not work well if we use fallback styles for IE11 so better - ignore this variant in IE completely */ -@supports not (-ms-high-contrast:none) { - /* based on rrt */ /* Background */ .bg { color: #f8f8f2; background-color: #000000; } /* PreWrapper */ .chroma { color: #f8f8f2; background-color: #000000; } diff --git a/static/css/chroma-relearn-dark.css b/assets/css/chroma-relearn-dark.css similarity index 100% rename from static/css/chroma-relearn-dark.css rename to assets/css/chroma-relearn-dark.css diff --git a/static/css/chroma-relearn-light.css b/assets/css/chroma-relearn-light.css similarity index 100% rename from static/css/chroma-relearn-light.css rename to assets/css/chroma-relearn-light.css diff --git a/assets/css/format-print.css b/assets/css/format-print.css index 4959720bab..90069a3245 100644 --- a/assets/css/format-print.css +++ b/assets/css/format-print.css @@ -1,4 +1,4 @@ -@import "{{ printf "theme-%s%s.css" .themevariant.identifier .mod }}"; +@import "{{ printf "theme-%s.css" .themevariant.identifier }}"; @import "{{ printf "chroma-%s.css" .themevariant.chroma }}"; #R-sidebar { @@ -128,10 +128,10 @@ h1 + .footline{ } #R-topbar{ /* the header is sticky which is not suitable for print; */ - position: inherit; /* IE11 doesn't know "initial" here */ + position: initial; } #R-topbar > .topbar-wrapper { - background-color: rgba( 255, 255, 255, 1 ); /* IE11 doesn't know "initial" here */ + background-color: initial; } #R-body .topbar-sidebar-divider { border-width: 0; diff --git a/static/css/theme-blue.css b/assets/css/theme-blue.css similarity index 100% rename from static/css/theme-blue.css rename to assets/css/theme-blue.css diff --git a/static/css/theme-green.css b/assets/css/theme-green.css similarity index 100% rename from static/css/theme-green.css rename to assets/css/theme-green.css diff --git a/static/css/theme-learn.css b/assets/css/theme-learn.css similarity index 100% rename from static/css/theme-learn.css rename to assets/css/theme-learn.css diff --git a/static/css/theme-neon.css b/assets/css/theme-neon.css similarity index 98% rename from static/css/theme-neon.css rename to assets/css/theme-neon.css index 4a2d640d61..86b8fc59d1 100644 --- a/static/css/theme-neon.css +++ b/assets/css/theme-neon.css @@ -1,7 +1,3 @@ -/* this variant does not work well if we use fallback styles for IE11 so better - ignore this variant in IE completely */ -@supports not (-ms-high-contrast:none) { - :root { --PRIMARY-color: rgba( 243, 0, 178, 1 ); /* brand primary color */ --SECONDARY-color: rgba( 28, 144, 243, 1 ); /* brand secondary color */ diff --git a/static/css/theme-red.css b/assets/css/theme-red.css similarity index 100% rename from static/css/theme-red.css rename to assets/css/theme-red.css diff --git a/static/css/theme-relearn-bright.css b/assets/css/theme-relearn-bright.css similarity index 100% rename from static/css/theme-relearn-bright.css rename to assets/css/theme-relearn-bright.css diff --git a/static/css/theme-relearn-dark.css b/assets/css/theme-relearn-dark.css similarity index 100% rename from static/css/theme-relearn-dark.css rename to assets/css/theme-relearn-dark.css diff --git a/static/css/theme-relearn-light.css b/assets/css/theme-relearn-light.css similarity index 100% rename from static/css/theme-relearn-light.css rename to assets/css/theme-relearn-light.css diff --git a/static/css/theme-relearn.css b/assets/css/theme-relearn.css similarity index 100% rename from static/css/theme-relearn.css rename to assets/css/theme-relearn.css diff --git a/static/css/theme-zen-dark.css b/assets/css/theme-zen-dark.css similarity index 100% rename from static/css/theme-zen-dark.css rename to assets/css/theme-zen-dark.css diff --git a/static/css/theme-zen-light.css b/assets/css/theme-zen-light.css similarity index 100% rename from static/css/theme-zen-light.css rename to assets/css/theme-zen-light.css diff --git a/exampleSite/config/_default/hugo.toml b/exampleSite/config/_default/hugo.toml index 2728a21eeb..34e02a462c 100644 --- a/exampleSite/config/_default/hugo.toml +++ b/exampleSite/config/_default/hugo.toml @@ -63,15 +63,6 @@ title = "Hugo Relearn Theme" # if in doubt, remove this line renderer.unsafe = true -# allows `hugo server` to display this showcase in IE11; this is used for testing, as we -# are still supporting IE11 - although with degraded experience; if you don't care about -# `hugo server` or browsers of ancient times, fell free to remove this whole block -[server] - [[server.headers]] - for = "**.html" - [server.headers.values] - X-UA-Compatible = "IE=edge" - # showcase of the menu shortcuts; you can use relative URLs linking # to your content or use fully-qualified URLs to link outside of # your project diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml index dafe22018f..e2e7ff897e 100644 --- a/exampleSite/config/_default/params.toml +++ b/exampleSite/config/_default/params.toml @@ -75,17 +75,6 @@ themeVariant = [ { identifier = "red" } ] -# Filename suffix for variant files. -# Default: not set -# The theme modifies the variant stylesheets during build and tries to store -# them with the same file name. In certain installations it was observed, that -# Hugo could not overwrite these files due to permission issues. If you -# experience this, you can first try to set the `--noChmod` option for Hugo. -# If this still doesn't help you can set this option to eg. ".gen". This will -# be used as a suffix for these generated files, causing them to be newly -# created instead of overwriting the existing ones. -themeVariantModifier = "" - #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # General # These options are defining general, non visual behavior. diff --git a/exampleSite/content/_index.en.md b/exampleSite/content/_index.en.md index 8ac7b6cdcd..813c83f83e 100644 --- a/exampleSite/content/_index.en.md +++ b/exampleSite/content/_index.en.md @@ -21,7 +21,6 @@ The theme is a fork of the great [Learn theme](https://github.com/matcornic/hugo - Usable offline, no external dependencies - [Usable from your local file system via `file://` protocol](basics/customization#file-system) - Support for the [VSCode Front Matter extension](https://github.com/estruyf/vscode-front-matter) for on-premise CMS capabilities - - Support for Internet Explorer 11 - [Support for Open Graph and Twitter Cards](basics/customization#social-media-meta-tags) - **Configurable theming and visuals** - [Configurable brand images](basics/branding#change-the-logo) diff --git a/exampleSite/content/basics/branding/_index.en.md b/exampleSite/content/basics/branding/_index.en.md index 55816a3e22..363fb4df58 100644 --- a/exampleSite/content/basics/branding/_index.en.md +++ b/exampleSite/content/basics/branding/_index.en.md @@ -24,9 +24,9 @@ Set the `themeVariant` value to the name of your theme file. That's it! Your sit {{< /multiconfig >}} {{% notice note %}} -Your theme variant file must reside in your site's `static/css` directory or in the theme's `static/css` directory and the file name must start with `theme-` and end wit `.css`. In the above example, the path of your theme file must be `static/css/theme-relearn-light.css`. +Your theme variant file must reside in your site's `assets/css` directory and the file name must start with `theme-` and end in `.css`. In the above example, the path of your theme file must be `assets/css/theme-relearn-light.css`. -If you want to make changes to a shipped color variant, create a copy in your site's `static/css` directory. Don't edit the file in the theme's directory! +If you want to make changes to a shipped color variant, create a copy in your site's `assets/css` directory. Don't edit the file in the theme's directory! {{% /notice %}} ### Multiple Variants @@ -92,9 +92,9 @@ The size of the logo will adapt automatically. If you want to switch the syntax highlighting theme together with your color variant, you need to configure your installation [according to Hugo's documentation](https://gohugo.io/content-management/syntax-highlighting/) and provide a syntax highlighting stylesheet file. -You can use a one of the shipped stylesheet files or use Hugo to generate a file for you. The file must be written to `static/css/chroma-.css`. To use it with your color variant you have to define `--CODE-theme: ` in the color variant stylesheet file. +You can use a one of the shipped stylesheet files or use Hugo to generate a file for you. The file must be written to `assets/css/chroma-.css`. To use it with your color variant you have to define `--CODE-theme: ` in the color variant stylesheet file. -For an example, take a look into [`theme-relearn-light.css`](https://github.com/McShelby/hugo-theme-relearn/blob/main/static/css/theme-relearn-light.css) and [`hugo.toml`](https://github.com/McShelby/hugo-theme-relearn/blob/main/exampleSite/config/_default/hugo.toml) of the exampleSite. +For an example, take a look into [`theme-relearn-light.css`](https://github.com/McShelby/hugo-theme-relearn/blob/main/assets/css/theme-relearn-light.css) and [`hugo.toml`](https://github.com/McShelby/hugo-theme-relearn/blob/main/exampleSite/config/_default/hugo.toml) of the exampleSite. ## Change the Variant (Advanced) {#theme-variant-advanced} @@ -125,7 +125,7 @@ The `identifier` option is mandatory and equivalent to the string in the first e | Name | Default | Notes | |-----------------------|-----------------|-------------| -| identifier | _<empty>_ | Must correspond to the name of a color variant either in your site's or the theme's directory in the form `static/css/theme-.css`. | +| identifier | _<empty>_ | Must correspond to the name of a color variant either in your site's or the theme's directory in the form `assets/css/theme-.css`. | | name | see notes | The name to be displayed in the variant selector. If not set, the identifier is used in a human readable form. | | auto | _<empty>_ | If set, the variant is treated as an [auto mode variant](#adjust-to-os-settings). It has the same behavior as the `themeVariantAuto` option. The first entry in the array is the color variant for light mode, the second for dark mode. Defining auto mode variants with the advanced options has the benefit that you can now have multiple auto mode variants instead of just one with the simple options. | @@ -159,15 +159,15 @@ In case you like a shipped variant but only want to tweak some aspects, you have 1. Copy and change - You can copy the shipped variant file from the theme's `static/css` directory to the site's `static/css` directory and either store it with the same name or give it a new name. Edit the settings and save the new file. Afterwards you can use it in your `hugo.toml` by the chosen name. + You can copy the shipped variant file from the theme's `assets/css` directory to the site's `assets/css` directory and either store it with the same name or give it a new name. Edit the settings and save the new file. Afterwards you can use it in your `hugo.toml` by the chosen name. 2. Create and import - You can create a new variant file in the site's `static/css` directory and give it a new name. Import the shipped variant, add the settings you want to change and save the new file. Afterwards you can use it in your `hugo.toml` by the chosen name. + You can create a new variant file in the site's `assets/css` directory and give it a new name. Import the shipped variant, add the settings you want to change and save the new file. Afterwards you can use it in your `hugo.toml` by the chosen name. - For example, you want to use the `relearn-light` variant but want to change the syntax highlighting schema to the one used in the `neon` variant. For that, create a new `static/css/theme-my-branding.css` in your site's directory and add the following lines: + For example, you want to use the `relearn-light` variant but want to change the syntax highlighting schema to the one used in the `neon` variant. For that, create a new `assets/css/theme-my-branding.css` in your site's directory and add the following lines: - ````css {title="static/css/theme-my-branding.css"} + ````css {title="assets/css/theme-my-branding.css"} @import "theme-relearn-light.css"; :root { diff --git a/exampleSite/content/basics/generator/_index.en.md b/exampleSite/content/basics/generator/_index.en.md index fbc5e22963..be33d1c36a 100644 --- a/exampleSite/content/basics/generator/_index.en.md +++ b/exampleSite/content/basics/generator/_index.en.md @@ -18,9 +18,11 @@ To better understand this select the `neon` variant and modify the different hea Once you've changed a color, the variant selector will show a "My custom variant" entry and your changes are stored in the browser. You can **browse to other pages** and even close the browser **without losing your changes**. -Once you are satisfied, you can download the new variants file and copy it into your site's `static/css` directory. Afterwards you have to adjust the `themeVariant` parameter in your `hugo.toml` to your chosen file name. +Once you are satisfied, you can download the new variants file and copy it into your site's `assets/css` directory. Afterwards you have to adjust the `themeVariant` parameter in your `hugo.toml` to your chosen file name. Eg. if your new variants file is named `theme-my-custom-variant.css`, you have to set `themeVariant='my-custom-variant'` to use it. + +See the docs for [further configuration options](basics/branding) {{% /expand %}} {{% button style="secondary" icon="download" href="javascript:window.variants&&variants.getStylesheet();this.blur();" %}}Download variant{{% /button %}} diff --git a/exampleSite/content/basics/migration/_index.en.md b/exampleSite/content/basics/migration/_index.en.md index 47ef19e8d0..ebf3835108 100644 --- a/exampleSite/content/basics/migration/_index.en.md +++ b/exampleSite/content/basics/migration/_index.en.md @@ -18,7 +18,25 @@ This document shows you what's new in the latest release and flags it with one o --- -## 5.28.0.beta (XXXX-XX-XX) {#5280} +## 6.0.0.beta (XXXX-XX-XX) {#600} + +- {{% badge style="warning" title=" " %}}Breaking{{% /badge %}} This release requires you to move your self-defined variant (`theme-*.css`) and chroma stylesheets (`chroma-*.css`) from `static/css` to `assets/css`. + + This was necessary to avoid permission errors on build if running in certain Unix configurations. + + In addition it is not allowed anymore to `@import` your chroma stylesheet from inside of your variant stylesheet. + + Say, your chroma stylesheet is named `chroma-monokai.css`, you have to add the following inside your variant stylesheet: + + ````css + --CODE-theme: monokai; + ```` + +- {{% badge style="warning" title=" " %}}Breaking{{% /badge %}} Support for Internet Explorer 11 was finally dropped. + +- {{% badge style="note" title=" " %}}Change{{% /badge %}} Removing support for Internet Explorer 11 finally allowed the theme to upgradte to Font Awesome 6.5.2. + + You may experience slight changes for some icons. In addition you have additional ~1700 icons [to chose](https://fontawesome.com/v6/search?m=free) from. - {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} Translation into Romanian. diff --git a/exampleSite/content/dev/contributing/_index.en.md b/exampleSite/content/dev/contributing/_index.en.md index 72ae57b167..c1cf2dde95 100644 --- a/exampleSite/content/dev/contributing/_index.en.md +++ b/exampleSite/content/dev/contributing/_index.en.md @@ -23,14 +23,6 @@ Remove reported issue from the browser's console. Check for unnecessary whitespace and correct indention of your resulting HTML. -Be compatible to IE11, at least for main functionality, this means: - -- test in IE11 -- check caniuse.com -- don't use JavaScript arrow functions -- don't use JavaScript template literals -- don't use other fancy JavaScript ES5/6 stuff - ## Conventional Commits Write commit messages in the [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/) format. diff --git a/exampleSite/content/shortcodes/expand.en.md b/exampleSite/content/shortcodes/expand.en.md index 6feb72f8ce..ca3290020f 100644 --- a/exampleSite/content/shortcodes/expand.en.md +++ b/exampleSite/content/shortcodes/expand.en.md @@ -19,10 +19,6 @@ That's some more text with a footnote.[^someid] Blue light glows blue. {{% /expand %}} -{{% notice note %}} -This only works in modern browsers flawlessly. While Internet Explorer 11 has issues in displaying it, the functionality still works. -{{% /notice %}} - ## Usage While the examples are using shortcodes with named parameter you are free to use positional as well or also call this shortcode from your own partials. diff --git a/exampleSite/content/shortcodes/icon.en.md b/exampleSite/content/shortcodes/icon.en.md index 2ad89e2771..06411955a9 100644 --- a/exampleSite/content/shortcodes/icon.en.md +++ b/exampleSite/content/shortcodes/icon.en.md @@ -61,9 +61,9 @@ While the examples are using shortcodes with positional parameter you are free t ### Finding an icon -Browse through the available icons in the [Font Awesome Gallery](https://fontawesome.com/v5/search?m=free). Notice that the **free** filter is enabled, as only the free icons are available by default. +Browse through the available icons in the [Font Awesome Gallery](https://fontawesome.com/v6/search?m=free). Notice that the **free** filter is enabled, as only the free icons are available by default. -Once on the Font Awesome page for a specific icon, for example the page for the [heart](https://fontawesome.com/v5/icons/heart?s=solid), copy the icon name and paste into the Markdown content. +Once on the Font Awesome page for a specific icon, for example the page for the [heart](https://fontawesome.com/v6/icons/heart?s=solid), copy the icon name and paste into the Markdown content. ### Customising Icons diff --git a/exampleSite/content/shortcodes/math.en.md b/exampleSite/content/shortcodes/math.en.md index 210e46a955..78784084b5 100644 --- a/exampleSite/content/shortcodes/math.en.md +++ b/exampleSite/content/shortcodes/math.en.md @@ -9,10 +9,6 @@ The `math` shortcode generates beautiful formatted math and chemical formulae us $$\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)$$ {{< /math >}} -{{% notice note %}} -This only works in modern browsers. -{{% /notice %}} - ## Usage While the examples are using shortcodes with named parameter it is recommended to use codefences instead. This is because more and more other software supports Math codefences (eg. GitHub) and so your markdown becomes more portable. diff --git a/exampleSite/content/shortcodes/mermaid.en.md b/exampleSite/content/shortcodes/mermaid.en.md index be014baac6..a189d9fffa 100644 --- a/exampleSite/content/shortcodes/mermaid.en.md +++ b/exampleSite/content/shortcodes/mermaid.en.md @@ -11,10 +11,6 @@ graph LR; Then --> Else {{< /mermaid >}} -{{% notice note %}} -This only works in modern browsers. -{{% /notice %}} - ## Usage While the examples are using shortcodes with named parameter it is recommended to use codefences instead. This is because more and more other software supports Mermaid codefences (eg. GitHub) and so your markdown becomes more portable. diff --git a/exampleSite/content/shortcodes/openapi/_index.en.md b/exampleSite/content/shortcodes/openapi/_index.en.md index d34ce7ccc7..f6b57d9d26 100644 --- a/exampleSite/content/shortcodes/openapi/_index.en.md +++ b/exampleSite/content/shortcodes/openapi/_index.en.md @@ -5,10 +5,6 @@ title: "OpenAPI" The `openapi` shortcode uses the [Swagger UI](https://github.com/swagger-api/swagger-ui) library to display your OpenAPI / Swagger specifications. -{{% notice note %}} -This only works in modern browsers. -{{% /notice %}} - ## Usage While the examples are using shortcodes with named parameter you are free to also call this shortcode from your own partials. diff --git a/layouts/partials/favicon.html b/layouts/partials/favicon.html index ebb551add5..b49a2e23c8 100644 --- a/layouts/partials/favicon.html +++ b/layouts/partials/favicon.html @@ -12,11 +12,6 @@ {{- $faviconMatch = true }} {{- end }} - {{- $c:="" }}{{/* - Warning: IE and old browser versions do not support media queries necessary for the light & dark theme option. - If you have requirements to support IE and/or older browser versions, use one of the other options. - Reference: https://caniuse.com/css-media-interaction - */}} {{- if (fileExists (printf "/static/images/%s-light.%s" $faviconName .ext)) }} {{- $faviconMatch = true }} diff --git a/layouts/partials/get-theme-variants.hugo b/layouts/partials/get-theme-variants.hugo index 8e29d70f77..24e4f8ccc9 100644 --- a/layouts/partials/get-theme-variants.hugo +++ b/layouts/partials/get-theme-variants.hugo @@ -1,15 +1,18 @@ {{- $page := . }} -{{- $mod := $page.Site.Params.themeVariantModifier | default "" }} {{- $autores := resources.Get "css/auto.css" }} {{- $printres := resources.Get "css/format-print.css" }} +{{- $nonautothemevariants := slice }} +{{- /* we need relearn-light in every case for the print styles */}} +{{- $refthemevariants := slice | append "relearn-light" }} {{- /* -Config run: +Unification run: - convert from old forms to slice of dicts +- add default name property - convert auto property to slice -- add name property +- save non auto variants to later assign them as default for missing auto variants +- mark variants configured by the user */}} -{{- $refthemevariants := slice | append "relearn-light" | append "relearn-dark" }} {{- $tempthemevariants := slice | append (.Site.Params.themeVariant | default "auto" ) }} {{- $themevariants := slice }} {{- range $tempthemevariant := $tempthemevariants }} @@ -22,15 +25,47 @@ Config run: {{- end }} {{- if eq $themevariant.identifier "auto" }} {{- $themevariant = collections.Merge $themevariant (dict "auto" ($themevariant.auto | default slice)) }} - {{- $refthemevariants = $refthemevariants | append $themevariant.auto }} + {{- end }} + {{- if not (isset $themevariant "auto") }} + {{- $nonautothemevariants = $nonautothemevariants | append $themevariant.identifier }} {{- end }} {{- $themevariant = collections.Merge $themevariant (dict "config" true) }} {{- $themevariants = $themevariants | append $themevariant }} {{- end }} +{{- /* +Auto run: +- fill up auto property with defaults +- save variants referenced by auto configuration +- write variant CSS file based on auto template +- add chroma property +- write chroma CSS file based on auto template +*/}} +{{- $defaultautothemevariants := slice }} +{{- $defaultautothemevariants = $defaultautothemevariants | append (index .Site.Params.themeVariantAuto 0 | default (index $nonautothemevariants 0) | default "relearn-light") }} +{{- $defaultautothemevariants = $defaultautothemevariants | append (index .Site.Params.themeVariantAuto 1 | default (index $nonautothemevariants 1) | default "relearn-dark") }} +{{- $tempthemevariants = $themevariants }} +{{- $themevariants = slice }} +{{- range $tempthemevariant := $tempthemevariants }} + {{- $themevariant := $tempthemevariant }} + {{- if collections.IsSet $themevariant "auto" }} + {{- $light := index $themevariant.auto 0 | default (index $defaultautothemevariants 0) }} + {{- $dark := index $themevariant.auto 1 | default (index $defaultautothemevariants 1) }} + {{- $themevariant = collections.Merge $themevariant (dict "auto" (slice | append $light | append $dark)) }} + {{- $refthemevariants = $refthemevariants | append $themevariant.auto }} + {{- $cssres := $autores | resources.ExecuteAsTemplate (printf "css/theme-%s.css" $themevariant.identifier) (dict "prefix" "theme" "light" $light "dark" $dark) }} + {{- /* the following code causes Hugo to generate our css file - although it is in comments */}} + {{- $themevariant = collections.Merge $themevariant (dict "chroma" $themevariant.identifier) }} + {{- $cssres = $autores | resources.ExecuteAsTemplate (printf "css/chroma-%s.css" $themevariant.chroma) (dict "prefix" "chroma" "light" $light "dark" $dark) }} + {{- /* the following code causes Hugo to generate our css file - although it is in comments */}} + {{- end }} + {{- $themevariants = $themevariants | append $themevariant }} +{{- end }} + {{- /* Ref run: -- add non-configured but referenced variants +- add variants referenced by auto properties +- add default name property */}} {{- range $refthemevariant := $refthemevariants }} {{- if not (index (collections.Where $themevariants "identifier" $refthemevariant) 0) }} @@ -40,111 +75,59 @@ Ref run: {{- end }} {{- /* -Non-auto run -- fix and regenerate theme css for advanced config mode -- add chroma property from stylesheet +Non-auto run: +- write variant CSS file and all imported variant CSS files +- add chroma property from deepest imported variant +- write chroma CSS file (just the root one because they are not allowed to be nested and the deepest one wins) */}} {{- $tempthemevariants = $themevariants }} {{- $themevariants = slice }} {{- range $tempthemevariant := $tempthemevariants }} {{- $themevariant := $tempthemevariant }} {{- if not (collections.IsSet $themevariant "auto") }} - {{- $themevariant = partial "get-theme-details.html" (dict "themevariant" $themevariant "identifier" $themevariant.identifier "mod" $mod)}} - {{- end }} - {{- $themevariants = $themevariants | append $themevariant }} -{{- end }} - -{{- /* -Auto run -- fill up auto property -- fill up chroma property -- generate theme and chroma css files from template -*/}} -{{- $tempthemevariants = $themevariants }} -{{- $themevariants = slice }} -{{- range $tempthemevariant := $tempthemevariants }} - {{- $themevariant := $tempthemevariant }} - {{- if collections.IsSet $themevariant "auto" }} - {{- $i := 0 }} - {{- if eq (int (len $themevariant.auto)) 0 }} - {{- range $tempthemevariants }} - {{- $i = add $i 1 }} - {{- if not (collections.IsSet . "auto") }} - {{- $themevariant = collections.Merge $themevariant (dict "auto" ($themevariant.auto | append .identifier)) }} - {{- break }} - {{- end }} - {{- end }} + {{- $themevariant = partial "get-theme-details.html" (dict "themevariant" $themevariant "identifier" $themevariant.identifier)}} + {{- $cssres := resources.Get (printf "css/chroma-%s.css" $themevariant.chroma) }} + {{- if not $cssres }} + {{- errorf "\"chroma-%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\"" $themevariant.chroma }} {{- end }} - {{- if eq (int (len $themevariant.auto)) 0 }} - {{- $themevariant = collections.Merge $themevariant (dict "auto" ($themevariant.auto | append "relearn-light")) }} - {{- end }} - {{- if eq (int (len $themevariant.auto)) 1 }} - {{- $poppedthemevariants := last (sub (len $tempthemevariants) $i) $tempthemevariants }} - {{- range $poppedthemevariants }} - {{- if not (collections.IsSet . "auto") }} - {{- $themevariant = collections.Merge $themevariant (dict "auto" ($themevariant.auto | append .identifier)) }} - {{- break }} - {{- end }} - {{- end }} - {{- end }} - {{- if eq (int (len $themevariant.auto)) 1 }} - {{- $themevariant = collections.Merge $themevariant (dict "auto" ($themevariant.auto | append "relearn-dark")) }} - {{- end }} - {{- $themevariant = collections.Merge $themevariant (dict "auto" ($themevariant.auto | first 2)) }} - {{- $light := index $themevariant.auto 0 }}; - {{- $dark := index $themevariant.auto 1 }}; - {{- $cssres := $autores | resources.ExecuteAsTemplate (printf "css/theme-%s%s.css" $themevariant.identifier $mod) (dict "prefix" "theme" "suffix" $mod "light" $light "dark" $dark) }} - {{- /* the following code causes Hugo to generate our css file - although it is in comments */}} - {{- $themevariant = collections.Merge $themevariant (dict "chroma" $themevariant.identifier) }} - {{- $light = (index (collections.Where $tempthemevariants "identifier" $light) 0).chroma }} - {{- $dark = (index (collections.Where $tempthemevariants "identifier" $dark) 0).chroma }} - {{- $cssres = $autores | resources.ExecuteAsTemplate (printf "css/chroma-%s.css" $themevariant.chroma) (dict "prefix" "chroma" "suffix" "" "light" $light "dark" $dark) }} {{- /* the following code causes Hugo to generate our css file - although it is in comments */}} {{- end }} {{- $themevariants = $themevariants | append $themevariant }} {{- end }} -{{- $cssres := $printres | resources.ExecuteAsTemplate "css/format-print.css" (dict "themevariant" (index (collections.Where $themevariants "identifier" "relearn-light") 0) "mod" $mod) }} +{{- $cssres := $printres | resources.ExecuteAsTemplate "css/format-print.css" (dict "themevariant" (index (collections.Where $themevariants "identifier" "relearn-light") 0)) }} {{- /* the following code causes Hugo to generate our css file - although it is in comments */}} {{- return collections.Where $themevariants "config" true }} -{{ define "partials/get-theme-details.html" }} +{{- define "partials/get-theme-details.html" }} {{- $themevariant := .themevariant }} {{- $identifier := .identifier }} - {{- $mod := .mod }} {{- $themecontent := "" }} {{- with resources.Get (printf "css/theme-%s.css" $identifier) }} - {{- $themecontent = .Content}} + {{- $themecontent = .Content }} {{- else }} - {{- if fileExists (printf "static/css/theme-%s.css" $identifier) }} - {{- $themecontent = readFile (printf "static/css/theme-%s.css" $identifier) }} - {{- else }} - {{- errorf "\"theme-%s.css\": file not found neither in \"static/css\" and \"assets/css\"" $identifier }} - {{- end }} + {{- 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 }} - {{- replaceRE (printf `([ \t]*@import\s+[^$]*?theme-[^.]*?)(?:%s)?(\.css)` (replace $mod "." "\\.")) (printf "${1}%s${2}" $mod) $themecontent }} {{- $chroma := "" }} + {{- range findRESubmatch `[ \t]*@import\s+[^$]*?chroma-([^.]*?)\.css` $themecontent }} + {{- $chroma = index . 1 }} + {{- errorf "\"theme-%s.css\": UNSUPPORTED use of @import for chroma stylesheet, instead use '--CODE-theme: %s;'" $identifier $chroma }} + {{- end }} + {{- range findRESubmatch `[ \t]*@import\s+[^$]*?theme-([^.]*?)\.css` $themecontent }} + {{- $subidentifier := index . 1 }} + {{- $themevariant = partial "get-theme-details.html" (dict "themevariant" $themevariant "identifier" $subidentifier) }} + {{- $chroma = $themevariant.chroma }} + {{- end }} {{- range findRESubmatch `[ \t]*--CODE-theme\s*:\s*([^;]*?)\s*;` $themecontent }} {{- $chroma = index . 1 }} - {{- else }} - {{- range findRESubmatch `[ \t]*@import\s+[^$]*?chroma-([^.]*?)\.css` $themecontent }} - {{- $chroma = index . 1 }} - {{- warnf "\"theme-%s.css\": DEPRECATED use of @import for chroma stylesheet, instead use '--CODE-theme: %s;'" $identifier $chroma }} - {{- $themecontent = replaceRE `[ \t]*@import\s+[^$]*?chroma-[^.]*?\.css.*?\n` "" $themecontent }} - {{- else }} - {{- range findRESubmatch (printf `[ \t]*@import\s+[^$]*?theme-([^.]*?)%s\.css` (replace $mod "." "\\.")) $themecontent }} - {{- $subidentifier := index . 1 }} - {{- $themevariant = partial "get-theme-details.html" (dict "themevariant" $themevariant "identifier" $subidentifier "mod" $mod) }} - {{- $chroma = $themevariant.chroma }} - {{- else }} - {{- $chroma = "relearn-light" }} - {{- end }} - {{- end }} + {{- end }} + {{- if not $chroma }} + {{- $chroma = "relearn-light" }} {{- $themecontent = replaceRE `(:root\s*\{[ \t]*)(\s*)` (printf "${1}${2}--CODE-theme: %s;${2}" $chroma) $themecontent }} {{- end }} {{- $themevariant = collections.Merge $themevariant (dict "chroma" $chroma) }} - {{- $cssres := $themecontent | resources.FromString (printf "css/theme-%s%s.css" $identifier $mod) }} + {{- $cssres := $themecontent | resources.FromString (printf "css/theme-%s.css" $identifier) }} {{- /* the following code causes Hugo to generate our css file - although it is in comments */}} {{- return $themevariant }} {{- end }} \ No newline at end of file diff --git a/layouts/partials/logo.html b/layouts/partials/logo.html index 40eea2fc16..38928e07b3 100644 --- a/layouts/partials/logo.html +++ b/layouts/partials/logo.html @@ -40,23 +40,6 @@ margin-inline-end: .5rem; } } - @media all and (-ms-high-contrast:none) { - {{ "/* IE11s understanding of positioning is weird at best */" | safeCSS }} - a#R-logo { - margin-top: -3.625rem; - } - #R-logo svg { - margin-bottom: -3.875rem; - margin-left: -1.47rem; - margin-right: .5rem; - } - } - @media only all and (-ms-high-contrast:none) and (max-width: 59.999rem) { - #R-logo svg { - margin-left: -1.47rem; - margin-right: .5rem; - } - }