assetbuster: use asset buster for all resources #875

This commit is contained in:
Sören Weber 2024-07-04 08:23:54 +02:00
parent c90d41e5c1
commit 1b2e139512
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
22 changed files with 180 additions and 153 deletions

View file

@ -1,2 +1,3 @@
@import "{{ printf "%s-%s.css" .prefix .light }}" screen and (prefers-color-scheme: light); {{- $assetBusting := partialCached "assetbusting.hugo" . -}}
@import "{{ printf "%s-%s.css" .prefix .dark }}" screen and (prefers-color-scheme: dark); @import "{{ printf "%s-%s.css%s" .prefix .light $assetBusting }}" screen and (prefers-color-scheme: light);
@import "{{ printf "%s-%s.css%s" .prefix .dark $assetBusting }}" screen and (prefers-color-scheme: dark);

View file

@ -1,5 +1,6 @@
@import "{{ printf "theme-%s.css" .themevariant.identifier }}"; {{- $assetBusting := partialCached "assetbusting.hugo" . -}}
@import "{{ printf "chroma-%s.css" .themevariant.chroma }}"; @import "{{ printf "theme-%s.css%s" .themevariant.identifier $assetBusting }}";
@import "{{ printf "chroma-%s.css%s" .themevariant.chroma $assetBusting }}";
#R-sidebar { #R-sidebar {
display: none; display: none;

2
assets/css/print.css Normal file
View file

@ -0,0 +1,2 @@
{{- $assetBusting := partialCached "assetbusting.hugo" . -}}
@import "{{ printf "format-print.css%s" $assetBusting }}";

View file

@ -1,7 +1,8 @@
{{- $assetBusting := partialCached "assetbusting.hugo" . -}}
/* Styles to make Swagger-UI fit into our theme */ /* Styles to make Swagger-UI fit into our theme */
@import "fonts.css"; @import "{{ printf "fonts.css%s" $assetBusting }}";
@import "variant-internal.css"; @import "{{ printf "variables.css%s" $assetBusting }}";
body{ body{
line-height: 1.574; line-height: 1.574;

View file

@ -1,3 +1,4 @@
{{- $assetBusting := partialCached "assetbusting.hugo" . -}}
/* this file is here for compatiblity with older installations /* this file is here for compatiblity with older installations
use theme-relearn-light instead */ use theme-relearn-light instead */
@import "theme-relearn-light.css"; @import "{{ printf "theme-relearn-light.css%s" $assetBusting }}";

View file

@ -1,4 +1,5 @@
@import "variant-internal.css"; {{- $assetBusting := partialCached "assetbusting.hugo" . -}}
@import "{{ printf "variables.css%s" $assetBusting }}";
html { html {
color-scheme: only var(--INTERNAL-BROWSER-theme); color-scheme: only var(--INTERNAL-BROWSER-theme);

View file

@ -22,6 +22,8 @@ This document shows you what's new in the latest release and flags it with one o
- {{% badge style="note" title=" " %}}Change{{% /badge %}} The [`include` shortcode](shortcodes/include) is now able to resolve links to pages as well as resources or files in the file system (the old behavior). - {{% badge style="note" title=" " %}}Change{{% /badge %}} The [`include` shortcode](shortcodes/include) is now able to resolve links to pages as well as resources or files in the file system (the old behavior).
- {{% badge style="note" title=" " %}}Change{{% /badge %}} To make the asset buster mechanism more robust, some internally used stylesheets where restructured. This generally should not affect your page in any negative way.
- {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} The [`openapi` shortcode](shortcodes/openapi) is now able to resolve links to resources as well as to files in the file system (the old behavior). You can configure to generate warnings or errors during build by setting `openapi.errorlevel` to either `warning` or `error` in your `hugo.toml` if a path can not be resolved. - {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} The [`openapi` shortcode](shortcodes/openapi) is now able to resolve links to resources as well as to files in the file system (the old behavior). You can configure to generate warnings or errors during build by setting `openapi.errorlevel` to either `warning` or `error` in your `hugo.toml` if a path can not be resolved.
--- ---

View file

@ -1,4 +1,4 @@
{{- $assetBusting := partialCached "assetbusting.hugo" . }}
<span class="github-buttons"></span> <span class="github-buttons"></span>
<p>Built with <a href="https://github.com/McShelby/hugo-theme-relearn" title="love"><i class="fas fa-heart"></i></a> by <a href="https://gohugo.io/">Hugo</a></p> <p>Built with <a href="https://github.com/McShelby/hugo-theme-relearn" title="love"><i class="fas fa-heart"></i></a> by <a href="https://gohugo.io/">Hugo</a></p>
<script> <script>
@ -7,14 +7,14 @@
var colorPropertyValue = window.getComputedStyle( document.querySelector( '#R-sidebar' ) ).getPropertyValue( 'background-color' ); var colorPropertyValue = window.getComputedStyle( document.querySelector( '#R-sidebar' ) ).getPropertyValue( 'background-color' );
var colorValues = colorPropertyValue.match( /\d+/g ).map( function( e ){ return parseInt(e,10); }); var colorValues = colorPropertyValue.match( /\d+/g ).map( function( e ){ return parseInt(e,10); });
if( colorValues.length === 3 && ((0.2126 * colorValues[0]) + (0.7152 * colorValues[1]) + (0.0722 * colorValues[2]) < 165) ){ if( colorValues.length === 3 && ((0.2126 * colorValues[0]) + (0.7152 * colorValues[1]) + (0.0722 * colorValues[2]) < 165) ){
// Luma, https://en.wikipedia.org/wiki/Luma_%28video%29, SMPTE C, Rec. 709 weightings {{- /* Luma, https://en.wikipedia.org/wiki/Luma_%28video%29, SMPTE C, Rec. 709 weightings */}}
scheme = 'dark'; scheme = 'dark';
} }
return scheme; return scheme;
} }
function githubButtonsInit(){ function githubButtonsInit(){
if( !window.githubButtons ){ if( !window.githubButtons ){
// wait for the script to load {{- /* wait for the script to load */}}
setTimeout( githubButtonsInit, 50 ); setTimeout( githubButtonsInit, 50 );
return; return;
} }
@ -33,11 +33,11 @@
}); });
} }
document.addEventListener( 'themeVariantLoaded', function( e ){ document.addEventListener( 'themeVariantLoaded', function( e ){
// we have to wait until the CSS class .default-animation has settled and the buttons have loaded to recalculate the scheme again {{- /* we have to wait until the CSS class .default-animation has settled and the buttons have loaded to recalculate the scheme again */}}
setTimeout( githubButtonsInit, 400 ); setTimeout( githubButtonsInit, 400 );
}); });
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => { window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
setTimeout( githubButtonsInit, 400 ); setTimeout( githubButtonsInit, 400 );
}); });
</script> </script>
<script async src="{{"js/github-buttons.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script> <script async src="{{"js/github-buttons.js" | relURL}}{{ $assetBusting }}"></script>

View file

@ -0,0 +1,6 @@
{{- $assetsBuster := "" }}
{{- $assetBusting := not site.Params.disableAssetsBusting }}
{{- if $assetBusting }}
{{- $assetsBuster = printf "?%d" now.Unix }}
{{- end }}
{{- return $assetsBuster }}

View file

@ -2,6 +2,7 @@
{{- $location := .location }} {{- $location := .location }}
{{- if eq $location "footer" }} {{- if eq $location "footer" }}
{{- with $page }} {{- with $page }}
{{- $assetBusting := partialCached "assetbusting.hugo" . }}
{{- $init := "{}" }} {{- $init := "{}" }}
{{- if isset .Params "mathjaxinitialize" }} {{- if isset .Params "mathjaxinitialize" }}
{{- $init = .Params.mathJaxInitialize }} {{- $init = .Params.mathJaxInitialize }}
@ -27,7 +28,7 @@
{{- else if and (isset .Site.Params "custommathjaxurl") .Site.Params.customMathJaxURL }} {{- else if and (isset .Site.Params "custommathjaxurl") .Site.Params.customMathJaxURL }}
<script id="MathJax-script" async src="{{ .Site.Params.customMathJaxURL }}"></script> <script id="MathJax-script" async src="{{ .Site.Params.customMathJaxURL }}"></script>
{{- else }} {{- else }}
<script id="MathJax-script" async src="{{"js/mathjax/tex-mml-chtml.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script> <script id="MathJax-script" async src="{{"js/mathjax/tex-mml-chtml.js" | relURL}}{{ $assetBusting }}"></script>
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}

View file

@ -2,22 +2,23 @@
{{- $location := .location }} {{- $location := .location }}
{{- if eq $location "footer" }} {{- if eq $location "footer" }}
{{- with $page }} {{- with $page }}
<script src="{{"js/d3/d3-color.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script> {{- $assetBusting := partialCached "assetbusting.hugo" . }}
<script src="{{"js/d3/d3-dispatch.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script> <script src="{{"js/d3/d3-color.min.js" | relURL}}{{ $assetBusting }}" defer></script>
<script src="{{"js/d3/d3-drag.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script> <script src="{{"js/d3/d3-dispatch.min.js" | relURL}}{{ $assetBusting }}" defer></script>
<script src="{{"js/d3/d3-ease.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script> <script src="{{"js/d3/d3-drag.min.js" | relURL}}{{ $assetBusting }}" defer></script>
<script src="{{"js/d3/d3-interpolate.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script> <script src="{{"js/d3/d3-ease.min.js" | relURL}}{{ $assetBusting }}" defer></script>
<script src="{{"js/d3/d3-selection.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script> <script src="{{"js/d3/d3-interpolate.min.js" | relURL}}{{ $assetBusting }}" defer></script>
<script src="{{"js/d3/d3-timer.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script> <script src="{{"js/d3/d3-selection.min.js" | relURL}}{{ $assetBusting }}" defer></script>
<script src="{{"js/d3/d3-transition.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script> <script src="{{"js/d3/d3-timer.min.js" | relURL}}{{ $assetBusting }}" defer></script>
<script src="{{"js/d3/d3-zoom.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script> <script src="{{"js/d3/d3-transition.min.js" | relURL}}{{ $assetBusting }}" defer></script>
<script src="{{"js/js-yaml.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script> <script src="{{"js/d3/d3-zoom.min.js" | relURL}}{{ $assetBusting }}" defer></script>
<script src="{{"js/js-yaml.min.js" | relURL}}{{ $assetBusting }}" defer></script>
{{- if and (isset .Params "custommermaidurl") .Params.customMermaidURL }} {{- if and (isset .Params "custommermaidurl") .Params.customMermaidURL }}
<script src="{{ .Params.customMermaidURL }}" defer></script> <script src="{{ .Params.customMermaidURL }}" defer></script>
{{- else if and (isset .Site.Params "custommermaidurl") .Site.Params.customMermaidURL }} {{- else if and (isset .Site.Params "custommermaidurl") .Site.Params.customMermaidURL }}
<script src="{{ .Site.Params.customMermaidURL }}" defer></script> <script src="{{ .Site.Params.customMermaidURL }}" defer></script>
{{- else }} {{- else }}
<script src="{{"js/mermaid.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script> <script src="{{"js/mermaid.min.js" | relURL}}{{ $assetBusting }}" defer></script>
{{- end }} {{- end }}
{{- $init := "{}" }} {{- $init := "{}" }}
{{- if isset .Params "mermaidinitialize" }} {{- if isset .Params "mermaidinitialize" }}

View file

@ -2,7 +2,8 @@
{{- $location := .location }} {{- $location := .location }}
{{- if eq $location "footer" }} {{- if eq $location "footer" }}
{{- with $page }} {{- with $page }}
<script src="{{"js/js-yaml.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script> {{- $assetBusting := partialCached "assetbusting.hugo" . }}
<script src="{{"js/js-yaml.min.js" | relURL}}{{ $assetBusting }}" defer></script>
{{- $urlOpenapi := "" }} {{- $urlOpenapi := "" }}
{{- $relOpenapi := "" }} {{- $relOpenapi := "" }}
{{- $cssInProject := false }} {{- $cssInProject := false }}
@ -13,8 +14,8 @@
{{- $urlOpenapi = .Site.Params.customOpenapiURL }} {{- $urlOpenapi = .Site.Params.customOpenapiURL }}
{{- $relOpenapi = .Site.Params.customOpenapiURL }} {{- $relOpenapi = .Site.Params.customOpenapiURL }}
{{- else }} {{- else }}
{{- $urlOpenapi = printf "%s%s" ("js/swagger-ui/swagger-ui-bundle.js" | relURL) (cond .Site.Params.disableAssetsBusting "" (printf "?%d" now.Unix)) }} {{- $urlOpenapi = printf "%s%s" ("js/swagger-ui/swagger-ui-bundle.js" | relURL) $assetBusting }}
{{- $relOpenapi = printf "%s%s" ("/js/swagger-ui/swagger-ui-bundle.js") (cond .Site.Params.disableAssetsBusting "" (printf "?%d" now.Unix)) }} {{- $relOpenapi = printf "%s%s" ("/js/swagger-ui/swagger-ui-bundle.js") $assetBusting }}
{{- $cssInProject = true }} {{- $cssInProject = true }}
{{- end }} {{- end }}
<script>window.noZensmooth = true;</script> <script>window.noZensmooth = true;</script>
@ -24,7 +25,7 @@
{{- $relOpenapi := replace $relOpenapi "swagger-ui-bundle" "swagger-ui" }} {{- $relOpenapi := replace $relOpenapi "swagger-ui-bundle" "swagger-ui" }}
{{- $relOpenapi := replace $relOpenapi ".js" ".css" }} {{- $relOpenapi := replace $relOpenapi ".js" ".css" }}
<script> <script>
window.themeUseOpenapi = { css: {{ $relOpenapi }}, cssInProject: {{ $cssInProject | safeJS }}, assetsBuster: {{ cond (not .Site.Params.disableAssetsBusting) now.Unix 0 }} }; window.themeUseOpenapi = { css: {{ $relOpenapi }}, cssInProject: {{ $cssInProject | safeJS }}, assetsBuster: "{{ $assetBusting }}" };
</script> </script>
{{- end }} {{- end }}
{{- end }} {{- end }}

View file

@ -1,4 +1,4 @@
{{- $assetBusting := not .Site.Params.disableAssetsBusting }} {{- $assetBusting := partialCached "assetbusting.hugo" . }}
{{- $faviconMatch := false }} {{- $faviconMatch := false }}
{{- $svg := dict "ext" "svg" "type" "type=\"image/svg+xml\"" }} {{- $svg := dict "ext" "svg" "type" "type=\"image/svg+xml\"" }}
{{- $png := dict "ext" "png" "type" "type=\"image/png\"" }} {{- $png := dict "ext" "png" "type" "type=\"image/png\"" }}
@ -10,15 +10,15 @@
{{- range $faviconTypes }} {{- range $faviconTypes }}
{{- if fileExists (printf "/static/images/%s.%s" $faviconName .ext) }} {{- if fileExists (printf "/static/images/%s.%s" $faviconName .ext) }}
{{- $faviconMatch = true }} {{- $faviconMatch = true }}
<link href="{{ printf "images/%s.%s" $faviconName .ext | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="icon" {{ .type | safeHTMLAttr }}> <link href="{{ printf "images/%s.%s" $faviconName .ext | relURL }}{{ $assetBusting }}" rel="icon" {{ .type | safeHTMLAttr }}>
{{- end }} {{- end }}
{{- if (fileExists (printf "/static/images/%s-light.%s" $faviconName .ext)) }} {{- if (fileExists (printf "/static/images/%s-light.%s" $faviconName .ext)) }}
{{- $faviconMatch = true }} {{- $faviconMatch = true }}
<link href="{{ printf "images/%s-light.%s" $faviconName .ext | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="icon" {{ .type | safeHTMLAttr }} media="(prefers-color-scheme: light)"> <link href="{{ printf "images/%s-light.%s" $faviconName .ext | relURL }}{{ $assetBusting }}" rel="icon" {{ .type | safeHTMLAttr }} media="(prefers-color-scheme: light)">
{{- end }} {{- end }}
{{- if (fileExists (printf "/static/images/%s-dark.%s" $faviconName .ext)) }} {{- if (fileExists (printf "/static/images/%s-dark.%s" $faviconName .ext)) }}
{{- $faviconMatch = true }} {{- $faviconMatch = true }}
<link href="{{ printf "images/%s-dark.%s" $faviconName .ext | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="icon" {{ .type | safeHTMLAttr }} media="(prefers-color-scheme: dark)"> <link href="{{ printf "images/%s-dark.%s" $faviconName .ext | relURL }}{{ $assetBusting }}" rel="icon" {{ .type | safeHTMLAttr }} media="(prefers-color-scheme: dark)">
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if $faviconMatch }} {{- if $faviconMatch }}

View file

@ -4,10 +4,11 @@
</div><!-- #R-body --> </div><!-- #R-body -->
{{- $outputFormat := partial "output-format.hugo" .Page }} {{- $outputFormat := partial "output-format.hugo" .Page }}
{{- partial "output-partial.hugo" (dict "base" "menu" "page" . "parameter" . "outputFormat" $outputFormat) }} {{- partial "output-partial.hugo" (dict "base" "menu" "page" . "parameter" . "outputFormat" $outputFormat) }}
<script src="{{"js/clipboard.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script> {{- $assetBusting := partialCached "assetbusting.hugo" . }}
<script src="{{"js/perfect-scrollbar.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script> <script src="{{"js/clipboard.min.js" | relURL}}{{ $assetBusting }}" defer></script>
<script src="{{"js/perfect-scrollbar.min.js" | relURL}}{{ $assetBusting }}" defer></script>
{{- partial "dependencies.html" (dict "page" . "location" "footer" "outputFormat" $outputFormat) }} {{- partial "dependencies.html" (dict "page" . "location" "footer" "outputFormat" $outputFormat) }}
<script src="{{"js/theme.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script> <script src="{{"js/theme.js" | relURL}}{{ $assetBusting }}" defer></script>
{{- partial "custom-footer.html" . }} {{- partial "custom-footer.html" . }}
</body> </body>
</html> </html>

View file

@ -1,6 +1,5 @@
{{- $page := . }} {{- $page := . }}
{{- $autores := resources.Get "css/auto.css" }} {{- $autores := resources.Get "css/auto.css" }}
{{- $printres := resources.Get "css/format-print.css" }}
{{- $nonautothemevariants := slice }} {{- $nonautothemevariants := slice }}
{{- /* we need relearn-light in every case for the print styles */}} {{- /* we need relearn-light in every case for the print styles */}}
{{- $refthemevariants := slice | append "relearn-light" }} {{- $refthemevariants := slice | append "relearn-light" }}
@ -108,7 +107,20 @@ Chroma auto run:
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- $cssres := $printres | resources.ExecuteAsTemplate "css/format-print.css" (dict "themevariant" (index (collections.Where $themevariants "identifier" "relearn-light") 0)) }} {{- $swaggerres := resources.Get "css/swagger.css" }}
{{- $cssres := $swaggerres | resources.ExecuteAsTemplate "css/swagger.css" (dict) }}
{{- /* the following code causes Hugo to generate our css file - although it is in comments */}}<!-- {{ $cssres.RelPermalink }} -->
{{- $variantres := resources.Get "css/variant.css" }}
{{- $cssres := $variantres | resources.ExecuteAsTemplate "css/variant.css" (dict) }}
{{- /* the following code causes Hugo to generate our css file - although it is in comments */}}<!-- {{ $cssres.RelPermalink }} -->
{{- $printres := resources.Get "css/print.css" }}
{{- $cssres := $printres | resources.ExecuteAsTemplate "css/print.css" (dict) }}
{{- /* the following code causes Hugo to generate our css file - although it is in comments */}}<!-- {{ $cssres.RelPermalink }} -->
{{- $formatprintres := resources.Get "css/format-print.css" }}
{{- $cssres := $formatprintres | 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 */}}<!-- {{ $cssres.RelPermalink }} --> {{- /* the following code causes Hugo to generate our css file - although it is in comments */}}<!-- {{ $cssres.RelPermalink }} -->
{{- return collections.Where $themevariants "config" true }} {{- return collections.Where $themevariants "config" true }}

View file

@ -15,7 +15,7 @@
<button class="search-clear" type="button" data-search-clear="" title="{{ T "Clear-search" }}"><i class="fas fa-times" title="{{ T "Clear-search" }}"></i></button> <button class="search-clear" type="button" data-search-clear="" title="{{ T "Clear-search" }}"><i class="fas fa-times" title="{{ T "Clear-search" }}"></i></button>
</div> </div>
{{ if $link }}</form>{{ end }}</search> {{ if $link }}</form>{{ end }}</search>
{{- $assetBusting := not .Site.Params.disableAssetsBusting }} {{- $assetBusting := partialCached "assetbusting.hugo" . }}
{{- $pageBaseLang := replaceRE "([a-z]+).*" "${1}" .Page.Language.LanguageCode }} {{- $pageBaseLang := replaceRE "([a-z]+).*" "${1}" .Page.Language.LanguageCode }}
{{- $contentlangs := (union (slice | append (.Site.Params.additionalContentLanguage | default slice)) (slice $pageBaseLang)) }} {{- $contentlangs := (union (slice | append (.Site.Params.additionalContentLanguage | default slice)) (slice $pageBaseLang)) }}
{{- $quotedcontentlangs := slice }} {{- $quotedcontentlangs := slice }}
@ -32,22 +32,22 @@
<script> <script>
var contentLangs=[{{ delimit $quotedcontentlangs ", " | safeJS }}]; var contentLangs=[{{ delimit $quotedcontentlangs ", " | safeJS }}];
</script> </script>
<script src="{{"js/auto-complete.js" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" defer></script> <script src="{{"js/auto-complete.js" | relURL}}{{ $assetBusting }}" defer></script>
<script src="{{"js/lunr/lunr.min.js" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" defer></script> <script src="{{"js/lunr/lunr.min.js" | relURL}}{{ $assetBusting }}" defer></script>
<script src="{{"js/lunr/lunr.stemmer.support.min.js" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" defer></script> <script src="{{"js/lunr/lunr.stemmer.support.min.js" | relURL}}{{ $assetBusting }}" defer></script>
<script src="{{"js/lunr/lunr.multi.min.js" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" defer></script> <script src="{{"js/lunr/lunr.multi.min.js" | relURL}}{{ $assetBusting }}" defer></script>
{{- $tinyseg := false }} {{- $tinyseg := false }}
{{- $wordcut := false }} {{- $wordcut := false }}
{{- range $contentlangs }} {{- range $contentlangs }}
{{- if and (not $tinyseg) (or (eq . "ja")) }} {{- if and (not $tinyseg) (or (eq . "ja")) }}
{{- $tinyseg = true }} {{- $tinyseg = true }}
<script src="{{"js/lunr/tinyseg.js" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" defer></script> <script src="{{"js/lunr/tinyseg.js" | relURL}}{{ $assetBusting }}" defer></script>
{{- end }} {{- end }}
{{- if and (not $wordcut) (or (eq . "hi") (eq . "th")) }} {{- if and (not $wordcut) (or (eq . "hi") (eq . "th")) }}
{{- $wordcut = true }} {{- $wordcut = true }}
<script src="{{"js/lunr/wordcut.js" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" defer></script> <script src="{{"js/lunr/wordcut.js" | relURL}}{{ $assetBusting }}" defer></script>
{{- end }} {{- end }}
{{- $file := (printf "js/lunr/lunr.%s.min.js" .) }} {{- $file := (printf "js/lunr/lunr.%s.min.js" .) }}
<script src="{{ $file | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" defer></script> <script src="{{ $file | relURL}}{{ $assetBusting }}" defer></script>
{{- end }} {{- end }}
<script src="{{ "js/search.js" | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" defer></script> <script src="{{ "js/search.js" | relURL }}{{ $assetBusting }}" defer></script>

View file

@ -5,33 +5,33 @@
{{- $outputFormat = partial "output-format.hugo" $page }} {{- $outputFormat = partial "output-format.hugo" $page }}
{{- end }} {{- end }}
{{- with $page }} {{- with $page }}
{{- $assetBusting := not .Site.Params.disableAssetsBusting }} {{- $assetBusting := partialCached "assetbusting.hugo" . }}
{{- /* https://github.com/filamentgroup/loadCSS/blob/master/README.md#how-to-use */}} {{- /* https://github.com/filamentgroup/loadCSS/blob/master/README.md#how-to-use */}}
<link href="{{"css/fontawesome-all.min.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;"><noscript><link href="{{"css/fontawesome-all.min.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet"></noscript> <link href="{{"css/fontawesome-all.min.css" | relURL}}{{ $assetBusting }}" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;"><noscript><link href="{{"css/fontawesome-all.min.css" | relURL}}{{ $assetBusting }}" rel="stylesheet"></noscript>
<link href="{{"css/nucleus.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet"> <link href="{{"css/nucleus.css" | relURL}}{{ $assetBusting }}" rel="stylesheet">
<link href="{{"css/auto-complete.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;"><noscript><link href="{{"css/auto-complete.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet"></noscript> <link href="{{"css/auto-complete.css" | relURL}}{{ $assetBusting }}" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;"><noscript><link href="{{"css/auto-complete.css" | relURL}}{{ $assetBusting }}" rel="stylesheet"></noscript>
<link href="{{"css/perfect-scrollbar.min.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet"> <link href="{{"css/perfect-scrollbar.min.css" | relURL}}{{ $assetBusting }}" rel="stylesheet">
<link href="{{"css/fonts.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;"><noscript><link href="{{"css/fonts.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet"></noscript> <link href="{{"css/fonts.css" | relURL}}{{ $assetBusting }}" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;"><noscript><link href="{{"css/fonts.css" | relURL}}{{ $assetBusting }}" rel="stylesheet"></noscript>
<link href="{{"css/theme.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet"> <link href="{{"css/theme.css" | relURL}}{{ $assetBusting }}" rel="stylesheet">
{{- $themevariants := partialCached "get-theme-variants.hugo" . }} {{- $themevariants := partialCached "get-theme-variants.hugo" . }}
{{- with index $themevariants 0 }} {{- with index $themevariants 0 }}
<link href="{{(printf "css/theme-%s.css" .identifier) | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet" id="R-variant-style"> <link href="{{(printf "css/theme-%s.css" .identifier) | relURL}}{{ $assetBusting }}" rel="stylesheet" id="R-variant-style">
<link href="{{(printf "css/chroma-%s.css" .chroma) | safeHTML | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet" id="R-variant-chroma-style"> <link href="{{(printf "css/chroma-%s.css" .chroma) | safeHTML | relURL}}{{ $assetBusting }}" rel="stylesheet" id="R-variant-chroma-style">
{{- end }} {{- end }}
<link href="{{"css/variant.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet"> <link href="{{"css/variant.css" | relURL}}{{ $assetBusting }}" rel="stylesheet">
<link href="{{"css/print.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet" media="print"> <link href="{{"css/print.css" | relURL}}{{ $assetBusting }}" rel="stylesheet" media="print">
{{- $f := printf "/static/css/format-%s.css" $outputFormat }} {{- $f := printf "/static/css/format-%s.css" $outputFormat }}
{{- if or (partialCached "fileExists.hugo" $f $f) (resources.Get (printf "/css/format-%s.css" $outputFormat)) }} {{- if or (partialCached "fileExists.hugo" $f $f) (resources.Get (printf "/css/format-%s.css" $outputFormat)) }}
<link href="{{(printf "css/format-%s.css" $outputFormat) | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet"> <link href="{{(printf "css/format-%s.css" $outputFormat) | relURL}}{{ $assetBusting }}" rel="stylesheet">
{{- end }} {{- end }}
<script src="{{"js/variant.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script> <script src="{{"js/variant.js" | relURL}}{{ $assetBusting }}"></script>
<script> <script>
window.relearn = window.relearn || {}; window.relearn = window.relearn || {};
window.relearn.relBasePath='{{ partial "relBasePath.hugo" $page | safeJS }}'; window.relearn.relBasePath='{{ partial "relBasePath.hugo" $page | safeJS }}';
window.relearn.relBaseUri='{{ partial "relBaseUri.hugo" $page | safeJS }}'; window.relearn.relBaseUri='{{ partial "relBaseUri.hugo" $page | safeJS }}';
window.relearn.absBaseUri='{{ replaceRE "/*$" "" .Site.BaseURL | safeJS }}'; window.relearn.absBaseUri='{{ replaceRE "/*$" "" .Site.BaseURL | safeJS }}';
{{- with .Site.Home.OutputFormats.Get "search" }} {{- with .Site.Home.OutputFormats.Get "search" }}
window.index_js_url={{ "index.search.js" | relLangURL }}; window.index_js_url={{ (printf "index.search.js%s" $assetBusting) | relLangURL }};
{{- end }} {{- end }}
{{ "// variant stuff" | safeJS }} {{ "// variant stuff" | safeJS }}
{{- $quotedthemevariants := slice }} {{- $quotedthemevariants := slice }}

View file

@ -1 +0,0 @@
@import "format-print.css";

View file

@ -1,50 +0,0 @@
/* Tags */
.tags{
margin-left: 1rem;
margin-top: 1rem;
}
.tags.term-list ul > li ~ li:before {
content: " "
}
#R-body .tags a.term-link {
border-bottom-right-radius: 3px;
border-top-right-radius: 3px;
box-shadow: 0 1px 2px rgba( 0, 0, 0, .2 );
display: inline-block;
font-size: 0.8em;
font-weight: 400;
line-height: 2em;
margin: 0 0 8px -1px;
margin-inline-end: 16px;
padding: 0 10px 0 12px;
position: relative;
}
#R-body .tags a.term-link:before {
border-color: transparent;
border-style: solid;
border-width: 1em 1em 1em 0;
content: "";
left: -1em;
height: 0;
position: absolute;
top:0;
width: 0;
}
#R-body .tags a.term-link:after {
border-radius: 100%;
content: "";
left: 1px;
height: 5px;
position: absolute;
top: 10px;
width: 5px;
}
#R-body .tags a.term-link:hover:after {
width: 5px;
}

View file

@ -1,7 +1,5 @@
@charset "UTF-8"; @charset "UTF-8";
@import "tags.css";
/* until browsers don't let us set length values based on dppx, we /* until browsers don't let us set length values based on dppx, we
need a way to calculate them ourself */ need a way to calculate them ourself */
:root { :root {
@ -326,6 +324,55 @@ dd {
margin: 1.5rem 1rem 1rem 1rem; margin: 1.5rem 1rem 1rem 1rem;
} }
.tags{
margin-left: 1rem;
margin-top: 1rem;
}
.tags.term-list ul > li ~ li:before {
content: " "
}
#R-body .tags a.term-link {
border-bottom-right-radius: 3px;
border-top-right-radius: 3px;
box-shadow: 0 1px 2px rgba( 0, 0, 0, .2 );
display: inline-block;
font-size: 0.8em;
font-weight: 400;
line-height: 2em;
margin: 0 0 8px -1px;
margin-inline-end: 16px;
padding: 0 10px 0 12px;
position: relative;
}
#R-body .tags a.term-link:before {
border-color: transparent;
border-style: solid;
border-width: 1em 1em 1em 0;
content: "";
left: -1em;
height: 0;
position: absolute;
top:0;
width: 0;
}
#R-body .tags a.term-link:after {
border-radius: 100%;
content: "";
left: 1px;
height: 5px;
position: absolute;
top: 10px;
width: 5px;
}
#R-body .tags a.term-link:hover:after {
width: 5px;
}
#R-body { #R-body {
display: flex; display: flex;
flex-basis: 100%; flex-basis: 100%;

View file

@ -378,9 +378,9 @@ function initOpenapi( update, attrs ){
} }
function renderOpenAPI(oc) { function renderOpenAPI(oc) {
var relBasePath = window.relearn.relBasePath; var relBasePath = window.relearn.relBasePath;
var buster = window.themeUseOpenapi.assetsBuster ? '?' + window.themeUseOpenapi.assetsBuster : ''; var assetBuster = window.themeUseOpenapi.assetsBuster;
var print = isPrint || attrs.isPrintPreview ? "PRINT-" : ""; var print = isPrint || attrs.isPrintPreview ? "PRINT-" : "";
var theme = print ? `${relBasePath}/css/theme-relearn-light.css${buster}` : document.querySelector( '#R-variant-style' ).attributes.href.value var theme = print ? `${relBasePath}/css/theme-relearn-light.css${assetBuster}` : document.querySelector( '#R-variant-style' ).attributes.href.value
var swagger_theme = variants.getColorValue( print + 'OPENAPI-theme' ); var swagger_theme = variants.getColorValue( print + 'OPENAPI-theme' );
var swagger_code_theme = variants.getColorValue( print + 'OPENAPI-CODE-theme' ); var swagger_code_theme = variants.getColorValue( print + 'OPENAPI-CODE-theme' );
@ -404,8 +404,8 @@ function initOpenapi( update, attrs ){
'<head>' + '<head>' +
'<link rel="stylesheet" href="' + window.themeUseOpenapi.css + '">' + '<link rel="stylesheet" href="' + window.themeUseOpenapi.css + '">' +
'<link rel="stylesheet" href="' + theme + '">' + '<link rel="stylesheet" href="' + theme + '">' +
'<link rel="stylesheet" href="' + relBasePath + '/css/swagger.css' + buster + '">' + '<link rel="stylesheet" href="' + relBasePath + '/css/swagger.css' + assetBuster + '">' +
'<link rel="stylesheet" href="' + relBasePath + '/css/swagger-' + swagger_theme + '.css' + buster + '">' + '<link rel="stylesheet" href="' + relBasePath + '/css/swagger-' + swagger_theme + '.css' + assetBuster + '">' +
'</head>' + '</head>' +
'<body>' + '<body>' +
'<a class="relearn-expander" href="" onclick="return relearn_collapse_all()">Collapse all</a>' + '<a class="relearn-expander" href="" onclick="return relearn_collapse_all()">Collapse all</a>' +