theme: remove code for older hugo versions #679

This commit is contained in:
Sören Weber 2023-11-26 21:19:24 +01:00
parent f9887d1d44
commit 0d51f64dfd
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
8 changed files with 8 additions and 43 deletions

View file

@ -1,10 +1,4 @@
{{- $version := split hugo.Version "." }}
{{- $major := int (index $version 0) }}
{{- $minor := int (index $version 1) }}
{{- $id := "" }}
{{- if or (and (eq $major 0) (ge $minor 108)) (gt $major 0) }}
{{- $id = "" }}
{{- end }}
{{- partial "shortcodes/image.html" (dict
"page" .Page
"url" .Destination

View file

@ -6,9 +6,9 @@
{{- $basename = partial "BaseName.hugo" $format.RelPermalink }}
{{- end }}
{{- if eq . .Site.Sites.First.Home }}
{{- $minHugoVersion := "0.110.0" }}
{{- if lt hugo.Version $minHugoVersion }}
{{- errorf "The Relearn theme requires Hugo %s or later" $minHugoVersion }}
{{- $hugoVersion := "0.110.0" }}
{{- if lt hugo.Version $hugoVersion }}
{{- errorf "The Relearn theme requires Hugo %s or later" $hugoVersion }}
{{- end }}
{{- end }}
<html lang="{{ .Page.Language | default "en" }}" dir="{{ T "Reading-direction" | default "ltr" }}">

View file

@ -1,6 +1,3 @@
{{- $version := split hugo.Version "." }}
{{- $major := int (index $version 0) }}
{{- $minor := int (index $version 1) }}
{{- $page := .page }}
{{- if and (not $page) .context }}
{{- $page = .context }}
@ -43,7 +40,8 @@
{{- $urlPrefix := strings.TrimRight "/" $page.RelPermalink }}
{{- with $page }}
{{- if ne .BundleType "leaf" }}
{{- if or (and (eq $major 0) (ge $minor 112)) (gt $major 0) }}
{{- $hugoVersion := "0.112.0" }}
{{- if ge hugo.Version $hugoVersion }}
{{- 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" $page.File.Filename }}
{{- 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" $page.File.Filename }}
@ -53,7 +51,8 @@
<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">
{{- $fileDir := "" }}
{{- if or (and (eq $major 0) (ge $minor 112)) (gt $major 0) }}
{{- $hugoVersion := "0.112.0" }}
{{- if ge hugo.Version $hugoVersion }}
{{- $fileDir = path.Dir (strings.TrimPrefix (path.Clean hugo.WorkingDir) (path.Clean .File.Filename)) }}
{{- else }}
{{- $fileDir = printf "%s/%s" (path.Clean (.Language.ContentDir | default "content")) (path.Clean .File.Dir) }}

View file

@ -1,11 +1,5 @@
{{- $_hugo_config := `{ "version": 1 }` }}
{{- $version := split hugo.Version "." }}
{{- $major := int (index $version 0) }}
{{- $minor := int (index $version 1) }}
{{- $id := "" }}
{{- if or (and (eq $major 0) (ge $minor 108)) (gt $major 0) }}
{{- $id = "" }}
{{- end }}
{{- partial "shortcodes/expand.html" (dict
"page" .Page
"content" .Inner

View file

@ -1,12 +1,5 @@
{{- $version := split hugo.Version "." }}
{{- $major := int (index $version 0) }}
{{- $minor := int (index $version 1) }}
{{- $content := "" }}
{{- if or (and (eq $major 0) (ge $minor 110)) (gt $major 0) }}
{{- $content = .InnerDeindent }}
{{- else }}
{{- $content = .Inner }}
{{- end }}
{{- $content = .InnerDeindent }}
{{- $attributes := dict }}
{{- $options := dict }}
{{- $type := "" }}

View file

@ -1,10 +1,4 @@
{{- $version := split hugo.Version "." }}
{{- $major := int (index $version 0) }}
{{- $minor := int (index $version 1) }}
{{- $id := "" }}
{{- if or (and (eq $major 0) (ge $minor 108)) (gt $major 0) }}
{{- $id = "" }}
{{- end }}
{{- partial "shortcodes/openapi.html" (dict
"page" .Page
"src" (.Get "src")

View file

@ -1,10 +1,4 @@
{{- $version := split hugo.Version "." }}
{{- $major := int (index $version 0) }}
{{- $minor := int (index $version 1) }}
{{- $id := "" }}
{{- if or (and (eq $major 0) (ge $minor 108)) (gt $major 0) }}
{{- $id = "" }}
{{- end }}
{{- partial "shortcodes/swagger.html" (dict
"page" .Page
"src" (.Get "src")

View file

@ -1,7 +1,4 @@
{{- $unused := .Inner }}
{{- $version := split hugo.Version "." }}
{{- $major := int (index $version 0) }}
{{- $minor := int (index $version 1) }}
{{- $color := (.Get "color") }}
{{- $groupid := ((.Get "groupid") | default (.Get "groupId")) }}
{{- if (.Get "groupId") }}