theme: add deprecation warnings #565

This commit is contained in:
Sören Weber 2023-06-09 23:42:03 +02:00
parent 882688711f
commit 4026fba240
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
9 changed files with 28 additions and 6 deletions

View file

@ -20,6 +20,12 @@ This document shows you what's new in the latest release. For a detailed list of
## 5.16.0 (2023-06-08)
- {{% badge style="note" title=" " %}}Change{{% /badge %}} The theme now provides warnings for deprecated or now unsupported features. The warnings include hints how to fix them and an additional link to the documenation.
`DEPRECATION` warnings mark features that still work but may be removed in the future.
`UNSUPPORTED` warnings mark features that will not work anymore.
- {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} The [`tabs` shortcode]({{% relref "shortcodes/tabs" %}}) and the [`tab` shortcode]({{% relref "shortcodes/tab" %}}) received some love and now align with their style, color, title and icon parameter to the other shortcodes.
The visuals are now slightly different compared to previous versions. Most noteable, if you now display a single code block in a tab, its default styling will adapt to that of a code block but with a tab handle at the top.
@ -329,7 +335,7 @@ This document shows you what's new in the latest release. For a detailed list of
- {{% badge style="note" title=" " %}}Change{{% /badge %}} Previously, if the [`tabs` shortcode]({{% relref "shortcodes/tabs" %}}) could not find a tab item because, the tabs ended up empty. Now the first tab is selected instead.
- {{% badge style="note" title=" " %}}Change{{% /badge %}} The `landingPageURL` was removed from `config.toml`. You can safely remove this as well from your configuration as it is not used anymore. The theme will detect the landing page URL automatically.
- {{% badge style="note" title=" " %}}Change{{% /badge %}} The `landingPageURL` was removed from `config.toml`. You can safely remove this as well from your configuration as it is not used anymore. The theme will detect the landing page URL automatically and will point to the project's homepage. If you want to support a different link, overwrite the `logo.html` partial.
- {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} All shortcodes can now be also called from your partials. Examples for this are added to the documentation of each shortcode.

View file

@ -1,6 +1,7 @@
{{- $page := .page }}
{{- $content := .content }}
{{- with $page }}
{{- warnf "%q: DEPRECATED usage of old 'chapter' archetype found, remove 'chapter=true' and add 'archetype=\"chapter\"' to your frontmatter and remove the leading h3 and h1 headings; see http://localhost:1313/basics/migration/#500-2022-07-05" $page.File.Path }}
<article class="chapter deprecated">
<header class="headline">
{{- partial "content-header.html" . }}

View file

@ -1,6 +1,7 @@
{{- $page := .page }}
{{- $content := .content }}
{{- with $page }}
{{- warnf "%q: DEPRECATED usage of old 'home' archetype found, add 'archetype=\"home\"' to your frontmatter and remove the leading h1 heading; see http://localhost:1313/basics/migration/#500-2022-07-05" $page.File.Path }}
<article class="home deprecated">
<header class="headline">
{{- partial "content-header.html" . }}

View file

@ -17,6 +17,9 @@
{{- end }}
</div>
{{- if not .Site.Params.disableLandingPageButton }}
{{- if (ne .Site.Params.landingPageURL nil) }}
{{- warnf "%q: UNSUPPORTED usage of 'landingPageURL' config parameter found, remove it and optionally overwrite the `logo.html` partial to provide a link if it should not point to the project's home page; see http://localhost:1313/basics/migration/#420-2022-06-23" .File.Path }}
{{- end }}
<div id="homelinks" class="default-animation">
<ul>
<li><a class="padding" href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" .Site.Home) }}">{{ .Site.Params.landingPageName | default `<i class="fas fa-home"></i> Home` | safeHTML }}</a></li>

View file

@ -1,3 +1,6 @@
{{- $version := split hugo.Version "." }}
{{- $major := int (index $version 0) }}
{{- $minor := int (index $version 1) }}
{{- $context := .context }}
{{- $color := .color | default "" }}
{{- $content := .content }}
@ -29,12 +32,16 @@
{{- end }}
{{- $urlPrefix := strings.TrimRight "/" $context.RelPermalink }}
{{- with $context }}
{{- if ne .BundleType "leaf" }}
{{- if or (and (eq $major 0) (ge $minor 112)) (gt $major 0) }}
{{- warnf "%q: UNSUPPORTED usage of 'attachments' shortcode found while using Hugo >= 0.112.0, use a leaf bundle instead; see https://mcshelby.github.io/hugo-theme-relearn/shortcodes/attachments/index.html#single-language" $context.File.Path }}
{{- else }}
{{- warnf "%q: DEPRECATED usage of 'attachments' shortcode found which will not be compatible while using Hugo >= 0.112.0, use a leaf bundle instead; see https://mcshelby.github.io/hugo-theme-relearn/shortcodes/attachments/index.html#single-language" $context.File.Path }}
{{- end }}
{{- end }}
<div class="box attachments cstyle {{ $style }}"{{ if $color }} style="--VARIABLE-BOX-color: {{ $color }};"{{ end }}>
<div class="box-label">{{ if $icon }}<i class="{{ $icon }}"></i>{{ end }}{{ if and $icon $title }} {{ end }}{{ $title | .RenderString }}</div>
<ul class="box-content attachments-files">
{{- $version := split hugo.Version "." }}
{{- $major := int (index $version 0) }}
{{- $minor := int (index $version 1) }}
{{- $fileDir := "" }}
{{- if or (and (eq $major 0) (ge $minor 112)) (gt $major 0) }}
{{- $fileDir = path.Dir (strings.TrimPrefix (path.Clean hugo.WorkingDir) (path.Clean .File.Filename)) }}

View file

@ -25,6 +25,9 @@
{{- if $dest_url.Query.Get "classes" }}
{{- $classes = $classes | append (split ($dest_url.Query.Get "classes") ",") }}
{{- end }}
{{- if $dest_url.Query.Has "featherlight" }}
{{- warnf "%q: DEPRECATED usage of 'featherlight' image CSS class found, use 'lightbox' instead; see http://localhost:1313/basics/migration/#5110-2023-02-07" $context.File.Path }}
{{- end }}
{{- $lightbox = and (ne ($dest_url.Query.Get "lightbox") "false") (ne ($dest_url.Query.Get "featherlight") "false") }}
{{- with $dest_url.Query.Get "height" }}
{{ $height = . }}

View file

@ -1,4 +1,4 @@
{{ warnf "DEPRECATED: Use shortcode openapi instead of swagger in %q" .context.File.Path }}
{{ warnf "%q: DEPRECATED shortcode `swagger`found, use `openapi` instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5130-2023-05-17" .context.File.Path }}
{{- partial "shortcodes/openapi.html" (dict
"context" .context
"src" .src

View file

@ -7,7 +7,7 @@
{{- $tabs := slice }}
{{- range $tab := (.content | default slice) }}
{{- if and (not $tab.title) $tab.name }}
{{- warnf "%s: parameter 'name' is deprecated for shortcode 'tab', use 'title' instead" $context.File.Path }}
{{- warnf "%q: DEPRECATED parameter 'name' for shortcode 'tab' found, use 'title' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5160-2023-06-08" $context.File.Path }}
{{- $tab = merge $tab (dict "title" .name) }}
{{- end }}
{{- with $tab }}

View file

@ -34,6 +34,7 @@
{{ "// hack to let hugo tell us how to get to the root when using relativeURLs, it needs to be called *url= for it to do its magic:" | safeJS }}
{{ "// https://github.com/gohugoio/hugo/blob/145b3fcce35fbac25c7033c91c1b7ae6d1179da8/transform/urlreplacers/absurlreplacer.go#L72" | safeJS }}
{{- with .Site.Home.OutputFormats.Get "JSON" }}
{{- warnf "%q: DEPRECATED usage of 'JSON' output format found, use 'SEARCH' instead; see http://localhost:1313/basics/configuration/#activate-search" $page.File.Path }}
window.index_json_url={{ "index.json" | relLangURL }};
{{- end }}
{{- with .Site.Home.OutputFormats.Get "SEARCH" }}