initial commit

This commit is contained in:
2025-02-19 00:16:57 +01:00
parent 1d9cd91fcd
commit d89698593b
1293 changed files with 55933 additions and 0 deletions

View File

@@ -0,0 +1,96 @@
<!DOCTYPE html>
{{- .Store.Set "relearnOutputFormat" "html" }}
<html lang="{{ .Page.Language.LanguageCode }}" dir="{{ .Page.Language.LanguageDirection | default (T "Reading-direction") | default "ltr" }}" itemscope itemtype="http://schema.org/Article" data-r-output-format="{{ with .Store.Get "relearnOutputFormat" }}{{ . }}{{ else }}html{{ end }}">
<head>
{{- partial "meta.html" . }}
{{- $title := partial "title.gotmpl" (dict "page" . "fullyQualified" true "reverse" true) }}
<title>{{ $title }}</title>
{{- /* because this file can be called from literally any URL inside your project, we need to base all relative URLs to make them work */}}
<base href="{{ .Site.BaseURL }}">
{{- partialCached "favicon.html" . }}
{{- partial "stylesheet.html" . }}
{{- partial "custom-header.html" . }}
</head>
<body class="mobile-support {{ with .Store.Get "relearnOutputFormat" }}{{ . }}{{ else }}html{{ end }} notfound" data-url="{{ partial "permalink.gotmpl" (dict "to" .) }}">
<div id="R-body" class="default-animation">
<main id="R-body-inner" class="highlightable chapter" tabindex="-1">
<div class="flex-block-wrapper">
<article>
<h1 id="404"><span>4</span>{{ partial "shortcodes/icon.html" (dict "page" . "icon" "far fa-frown" )}}<span>4</span></h1>
<h2 id="{{ T "title-404" | plainify | anchorize }}">{{ T "title-404" }}</h2>
<p></p>
<p>{{ T "message-404" }}</p>
<p></p>
<p><a href="{{ partial "permalink.gotmpl" (dict "to" .Site.Home) }}">{{ T "Go-to-homepage" }}</a></p>
<p id="shrug">
<svg xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 512.000000 512.000000"
preserveAspectRatio="xMidYMid meet">
<g transform="translate(0.000000,512.000000) scale(0.100000,-0.100000)"
style="fill:#000000;stroke:none;">
<path d="M2359 4821 c-330 -72 -613 -312 -803 -681 -53 -102 -74 -133 -105
-154 -46 -32 -103 -113 -121 -170 -7 -23 -11 -72 -8 -120 3 -65 10 -91 33
-134 36 -66 91 -117 161 -149 30 -13 54 -30 54 -38 0 -33 56 -199 94 -281 54
-115 110 -196 192 -283 35 -38 64 -71 64 -74 0 -3 -17 -11 -37 -18 -57 -18
-170 -77 -238 -122 -75 -52 -213 -184 -270 -259 -51 -68 -46 -74 -75 101 -12
68 -32 150 -45 182 -65 160 -179 253 -342 279 -125 20 -234 85 -376 224 -103
101 -149 127 -233 134 -115 9 -217 -48 -272 -152 -38 -73 -38 -177 0 -259 68
-146 246 -382 417 -554 l101 -102 96 -533 c52 -293 104 -556 113 -583 67 -191
246 -315 455 -315 138 0 251 46 347 142 l49 49 0 -256 c0 -208 3 -263 15 -293
20 -47 50 -79 97 -103 36 -18 71 -19 838 -19 780 0 802 1 840 20 44 22 82 68
99 119 7 22 11 122 11 278 l0 244 49 -49 c96 -96 209 -142 347 -142 209 0 388
124 455 315 9 27 61 290 113 583 l96 533 101 102 c171 172 349 408 417 554 38
82 38 186 0 259 -55 104 -157 161 -272 152 -84 -7 -130 -33 -233 -134 -142
-139 -251 -204 -376 -224 -163 -26 -277 -119 -342 -279 -13 -32 -33 -114 -45
-182 -29 -175 -24 -169 -75 -101 -101 134 -259 264 -423 346 l-72 36 92 93
c51 50 109 116 128 144 l35 52 57 1 c164 0 310 134 325 298 7 74 -10 147 -48
207 -26 40 -30 60 -40 168 -24 283 -91 497 -213 682 -155 232 -387 382 -706
456 -128 30 -405 35 -521 10z m426 -197 c120 -20 265 -71 362 -125 106 -60
242 -196 302 -302 70 -125 126 -307 146 -479 9 -70 13 -69 -153 -32 -360 81
-724 280 -888 486 -63 79 -100 105 -160 114 -61 9 -107 -10 -204 -83 -144
-109 -279 -163 -403 -163 l-59 0 37 68 c50 92 164 240 233 303 118 108 259
183 402 214 88 18 275 18 385 -1z m-295 -674 c108 -107 232 -191 421 -284 207
-103 534 -206 656 -206 60 0 123 -64 123 -125 0 -43 -27 -93 -62 -115 -26 -17
-43 -20 -83 -15 -134 16 -135 15 -203 -90 -69 -106 -230 -260 -332 -318 -255
-143 -537 -153 -781 -26 -242 126 -419 382 -469 679 -15 90 -43 124 -111 135
-89 15 -129 56 -129 132 0 49 18 82 58 109 30 20 40 22 154 17 103 -4 138 -2
210 16 136 32 283 108 388 199 l35 31 19 -27 c10 -15 58 -65 106 -112z m-2091
-974 c186 -176 301 -240 493 -276 119 -23 182 -109 213 -290 8 -52 42 -230 75
-395 78 -394 103 -549 95 -588 -29 -136 -171 -202 -287 -134 -25 15 -55 42
-67 60 -21 34 -54 197 -131 642 -23 132 -46 256 -52 275 -7 23 -43 65 -109
128 -220 210 -444 522 -425 595 9 37 44 67 78 67 22 0 49 -19 117 -84z m4489
54 c38 -36 39 -67 2 -138 -75 -145 -239 -351 -399 -504 -66 -63 -102 -105
-109 -128 -6 -19 -29 -143 -52 -275 -77 -445 -110 -608 -131 -642 -12 -18 -42
-45 -67 -60 -116 -68 -258 -2 -287 134 -8 39 17 194 95 588 33 165 67 343 75
395 31 181 94 267 213 290 192 36 307 100 493 276 96 91 125 103 167 64z
m-2850 -536 c56 -270 324 -461 595 -424 205 28 393 204 439 411 6 30 14 58 18
62 8 10 128 -34 190 -70 166 -96 311 -245 387 -398 57 -113 57 -117 28 -287
-56 -322 -58 -411 -13 -510 74 -161 263 -254 420 -205 45 14 47 14 38 -2 -17
-33 -87 -88 -133 -106 -68 -26 -179 -17 -240 18 -25 15 -92 78 -150 142 l-105
114 -4 97 c-3 91 -5 97 -31 120 -38 33 -96 33 -134 0 l-28 -24 -3 -476 -3
-476 -749 0 -749 0 -3 481 -3 481 -28 24 c-38 33 -96 33 -134 0 -26 -23 -28
-29 -31 -120 l-4 -97 -105 -114 c-58 -64 -125 -127 -150 -142 -61 -35 -172
-44 -240 -18 -46 18 -116 73 -133 106 -9 16 -7 16 38 2 157 -49 346 44 420
205 45 99 43 188 -13 510 -29 170 -29 174 28 287 97 197 295 373 507 451 60
22 65 19 78 -42z m421 -4 c96 -15 253 -8 346 14 33 8 62 13 64 10 11 -10 -35
-99 -74 -141 -175 -195 -480 -111 -559 154 l-7 21 73 -23 c40 -13 111 -29 157
-35z"/>
<path d="M2236 3664 c-20 -20 -26 -37 -26 -68 0 -52 20 -81 65 -96 70 -23 141
42 127 116 -13 71 -113 100 -166 48z"/>
<path d="M2865 3548 c-94 -51 -61 -188 45 -188 103 0 141 138 50 185 -34 18
-67 19 -95 3z"/>
<path d="M2308 3093 c-29 -18 -48 -52 -48 -86 0 -33 36 -86 62 -92 134 -31
266 -55 303 -55 63 0 95 32 95 92 0 82 -11 88 -230 133 -144 29 -147 29 -182
8z"/>
</g>
</svg>
</p>
</article>
</div>
</main>
</div>
</body>
</html>

View File

@@ -0,0 +1,21 @@
{{- $alerttype := .AlertType }}
{{- $alerttitle := "" }}
{{- $alertsign := "" }}
{{- $hugoVersion := "0.134.0" }}
{{- if ge hugo.Version $hugoVersion }}
{{- $alerttitle = .AlertTitle }}
{{- $alertsign = .AlertSign }}
{{- end }}
{{- $text := .Text }}
{{- if $alerttype }}
{{- partial "shortcodes/notice.html" (dict
"page" .Page
"content" $text
"expanded" (cond (eq $alertsign "+") true (cond (eq $alertsign "-") false ""))
"style" $alerttype
"title" $alerttitle
) }}
{{ else -}}
<blockquote>
{{ $text | safeHTML }}</blockquote>
{{ end }}

View File

@@ -0,0 +1,6 @@
{{- partial "shortcodes/math.html" (dict
"page" .Page
"attributes" .Attributes
"content" .Inner
"align" (index .Attributes "align")
) }}

View File

@@ -0,0 +1,6 @@
{{- partial "shortcodes/mermaid.html" (dict
"page" .Page
"attributes" .Attributes
"content" .Inner
"align" (index .Attributes "align")
) }}

View File

@@ -0,0 +1,7 @@
{{- partial "shortcodes/highlight.html" (dict
"page" .Page
"attributes" .Attributes
"content" .Inner
"options" .Options
"type" .Type
) }}

View File

@@ -0,0 +1,9 @@
{{- $id := "" }}
{{- partial "shortcodes/image.html" (dict
"page" .Page
"url" .Destination
"title" .Title
"alt" .Text
"id" $id
"attributes" .Attributes
) }}

View File

@@ -0,0 +1,6 @@
{{- partial "shortcodes/link.html" (dict
"page" .Page
"url" .Destination
"title" .Title
"content" .Text
) }}

View File

@@ -0,0 +1,83 @@
<!DOCTYPE html>
{{- block "storeOutputFormat" . }}{{ end }}
{{- if .IsHome }}
{{- $hugoVersion := "0.126.0" }}
{{- if lt hugo.Version $hugoVersion }}
{{- errorf "The Relearn theme requires Hugo %s or later" $hugoVersion }}
{{- end }}
{{- end }}
{{- if .Site.Params.description }}
{{- warnf "UNSUPPORTED usage of 'params.description' config parameter found, move it to the front matter of your home page; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/6/#6-0-0" }}
{{- end }}
<html lang="{{ .Page.Language.LanguageCode }}" dir="{{ .Page.Language.LanguageDirection | default (T "Reading-direction") | default "ltr" }}" itemscope itemtype="http://schema.org/Article" data-r-output-format="{{ with .Store.Get "relearnOutputFormat" }}{{ . }}{{ else }}html{{ end }}">
<head>
{{- partial "meta.html" . }}
{{- $title := partial "title.gotmpl" (dict "page" . "fullyQualified" true "reverse" true) }}
<title>{{ $title }}</title>
{{- /* multilingual stuff */}}
{{- if .IsTranslated -}}
{{- range $index, $trans := .AllTranslations }}
{{- if eq $index 0 }}
<link href="{{ partial "permalink.gotmpl" (dict "to" . "abs" true) }}" rel="alternate" hreflang="x-default">
{{- end }}
<link href="{{ partial "permalink.gotmpl" (dict "to" . "abs" true) }}" rel="alternate" hreflang="{{ .Language.LanguageCode }}">
{{- end }}
{{- end }}
{{- /* output formats */}}
{{- $page := . }}
{{- $link := "<link href=\"%s\" rel=\"%s\" type=\"%s\" title=\"%s\">" }}
{{- range .AlternativeOutputFormats }}
{{- if eq .Rel "canonical" }}
{{ (printf $link (partial "permalink.gotmpl" (dict "to" . "abs" true)) .Rel .MediaType.Type ($title | htmlEscape)) | safeHTML }}
{{- else if not (partial "_relearn/pageIsSpecial.gotmpl" $page) }}
{{ (printf $link (partial "permalink.gotmpl" (dict "to" .)) .Rel .MediaType.Type ($title | htmlEscape)) | safeHTML }}
{{- end }}
{{- end }}
{{- partialCached "favicon.html" . }}
{{- partial "stylesheet.html" . }}
{{- partial "dependencies.gotmpl" (dict "page" . "location" "header") }}
{{- partial "custom-header.html" . }}
</head>
<body class="mobile-support {{ with .Store.Get "relearnOutputFormat" }}{{ . }}{{ else }}html{{ end }}{{- if .Site.Params.disableHoverBlockCopyToClipBoard }} disableHoverBlockCopyToClipBoard{{ end }}" data-url="{{ partial "permalink.gotmpl" (dict "to" .) }}">
<div id="R-body" class="default-animation">
<div id="R-body-overlay"></div>
<nav id="R-topbar">
<div class="topbar-wrapper">
<div class="topbar-sidebar-divider"></div>
<div class="topbar-area topbar-area-start" data-area="start">
{{- partial "topbar/area/start.html" . }}
</div>
{{- $showBreadcrumb := (and (not .Params.disableBreadcrumb) (not .Site.Params.disableBreadcrumb)) }}
{{- if $showBreadcrumb }}
<ol class="topbar-breadcrumbs breadcrumbs highlightable" itemscope itemtype="http://schema.org/BreadcrumbList">
{{- partial "breadcrumbs.html" (dict "page" .) }}
</ol>
{{- else }}
<span class="topbar-breadcrumbs highlightable">
{{ partial "title.gotmpl" (dict "page" . "linkTitle" true) }}
</span>
{{- end }}
<div class="topbar-area topbar-area-end" data-area="end">
{{- partial "topbar/area/end.html" . }}
</div>
</div>
</nav>
<div id="R-main-overlay"></div>
<main id="R-body-inner" class="highlightable{{ with or .Type "default" }} {{ . }}{{ end }}" tabindex="-1">
<div class="flex-block-wrapper">
{{- block "body" . }}{{ end }}
</div>
</main>
{{- partial "custom-comments.html" . }}
</div>
{{- block "menu" . }}{{ end }}
{{- $assetBusting := partialCached "assetbusting.gotmpl" . }}
<script src="{{"js/clipboard.min.js" | relURL}}{{ $assetBusting }}" defer></script>
<script src="{{"js/perfect-scrollbar.min.js" | relURL}}{{ $assetBusting }}" defer></script>
{{- partial "dependencies.gotmpl" (dict "page" . "location" "footer") }}
<script src="{{"js/theme.js" | relURL}}{{ $assetBusting }}" defer></script>
{{- partial "custom-footer.html" . }}
</body>
</html>

View File

@@ -0,0 +1,6 @@
{{/* the following check avoids to print out content of headless bundles if called from nestedContent.gotmpl */}}
{{- if .RelPermalink -}}
# {{ .Title }}
{{ strings.TrimLeft "\n\r\t " .RawContent | safeHTML }}
{{- end }}

View File

@@ -0,0 +1,4 @@
{{/* the following check avoids to print out content of headless bundles if called from nestedContent.gotmpl */}}
{{- with and .File .File.Filename -}}
{{ readFile . | safeHTML }}
{{- end }}

View File

@@ -0,0 +1,9 @@
{{- define "storeOutputFormat" }}
{{- .Render "views/storeOutputFormat" }}
{{- end }}
{{- define "body" }}
{{- .Render "views/body" }}
{{- end }}
{{- define "menu" }}
{{- .Render "views/menu" }}
{{- end }}

View File

@@ -0,0 +1 @@
{{ define "_empty" }}{{ end }}

View File

@@ -0,0 +1 @@
{{ define "_empty" }}{{ end }}

View File

@@ -0,0 +1,56 @@
{{- /* based on Hugo 0.135.0 rss.xml */}}
{{- $authorEmail := "" }}
{{- with .Site.Params.author }}
{{- if reflect.IsMap . }}
{{- with .email }}
{{- $authorEmail = . }}
{{- end }}
{{- end }}
{{- end }}
{{- $authorName := partialCached "_relearn/authorName.gotmpl" . }}
{{- $pages := .Pages }}
{{- $limit := .Site.Config.Services.RSS.Limit }}
{{- if ge $limit 1 }}
{{- $pages = $pages | first $limit }}
{{- end }}
{{- $page := . }}
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ partial "title.gotmpl" (dict "page" . "fullyQualified" true "reverse" true) }}</title>
<link>{{ partial "permalink.gotmpl" (dict "to" . "abs" true) }}</link>
<description>{{ trim (or .Description .Summary | plainify | htmlUnescape) "\n\r\t " | transform.XMLEscape | safeHTML }}</description>
<generator>Hugo</generator>
<language>{{ site.Language.LanguageCode }}</language>{{ with $authorEmail }}
<managingEditor>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with $authorEmail }}
<webMaster>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with .Site.Copyright }}
<copyright>{{ . }}</copyright>{{ end }}{{ if not .Date.IsZero }}
<lastBuildDate>{{ (index $pages.ByLastmod.Reverse 0).Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
{{- with .OutputFormats.Get "rss" }}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" ( partial "permalink.gotmpl" (dict "to" . "abs" true)) .MediaType | safeHTML }}
{{- end }}
{{- range $pages }}
{{- $visible := true }}
{{- if partial "_relearn/pageIsSpecial.gotmpl" . }}
{{- $visible = false }}
{{- else if or (eq .Kind "taxonomy") (eq .Kind "term") }}
{{- $visible = and .Title .Permalink (or (ne .Site.Params.disableTagHiddenPages true) (not (partialCached "_relearn/pageIsHidden.gotmpl" . .Path) ) ) }}
{{- else }}
{{- $visible = and .Title .Permalink (or (ne .Site.Params.disableSeoHiddenPages true) (not (partialCached "_relearn/pageIsHiddenSelfOrAncestor.gotmpl" (dict "page" . "to" $page) .Path $page.Path) ) ) }}
{{- end }}
{{- if $visible }}
<item>
<title>{{ partial "title.gotmpl" (dict "page" .) }}</title>
<link>{{ partial "permalink.gotmpl" (dict "to" . "abs" true) }}</link>
<pubDate>{{ (or .PublishDate .Date).Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{- with $authorEmail }}<author>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</author>{{ end }}
<guid>{{ partial "permalink.gotmpl" (dict "to" . "abs" true) }}</guid>
<description>{{ trim (or .Description .Summary | plainify | htmlUnescape) "\n\r\t " | transform.XMLEscape | safeHTML }}</description>
</item>
{{- end }}
{{- end }}
</channel>
</rss>

View File

@@ -0,0 +1,9 @@
{{- define "storeOutputFormat" }}
{{- .Render "views/storeOutputFormat" }}
{{- end }}
{{- define "body" }}
{{- .Render "views/body" }}
{{- end }}
{{- define "menu" }}
{{- .Render "views/menu" }}
{{- end }}

View File

@@ -0,0 +1 @@
{{ define "_empty" }}{{ end }}

View File

@@ -0,0 +1 @@
{{ define "_empty" }}{{ end }}

View File

@@ -0,0 +1,17 @@
{{- /* based on Hugo 0.125.5 sitemap.xml */}}
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" | safeHTML }}
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
{{- range where .Pages "Sitemap.Disable" "ne" true }}
{{- if partial "_relearn/pageIsSpecial.gotmpl" . }}
{{- else if and .Title .RelPermalink (or (ne .Site.Params.disableSeoHiddenPages true) (not (partialCached "_relearn/pageIsHiddenSelfOrAncestor.gotmpl" (dict "page" . "to" .Site.Home) .Path .Site.Home.Path) ) ) }}
<url>
<loc>{{ partial "permalink.gotmpl" (dict "to" . "abs" true) }}</loc>{{ if not .Lastmod.IsZero }}
<lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}{{ with .Sitemap.ChangeFreq }}
<changefreq>{{ . }}</changefreq>{{ end }}{{ if ge .Sitemap.Priority 0.0 }}
<priority>{{ .Sitemap.Priority }}</priority>{{ end }}{{ if .IsTranslated }}{{ range $index, $trans := .AllTranslations }}{{- if eq $index 0 }}
<xhtml:link rel="alternate" hreflang="x-default" href="{{ partial "permalink.gotmpl" (dict "to" . "abs" true) }}" />{{ end }}
<xhtml:link rel="alternate" hreflang="{{ .Language.LanguageCode }}" href="{{ partial "permalink.gotmpl" (dict "to" . "abs" true) }}" />{{ end }}{{ end }}
</url>
{{- end -}}
{{- end }}
</urlset>

View File

@@ -0,0 +1,9 @@
{{- define "storeOutputFormat" }}
{{- .Render "views/storeOutputFormat" }}
{{- end }}
{{- define "body" }}
{{- partial "bodys/taxonomy.html" . }}
{{- end }}
{{- define "menu" }}
{{- .Render "views/menu" }}
{{- end }}

View File

@@ -0,0 +1,9 @@
{{- define "storeOutputFormat" }}
{{- .Render "views/storeOutputFormat" }}
{{- end }}
{{- define "body" }}
{{- partial "bodys/term.html" . }}
{{- end }}
{{- define "menu" }}
{{- .Render "views/menu" }}
{{- end }}

View File

@@ -0,0 +1,12 @@
<article class="default">
<header class="headline">
{{- partial "content-header.html" . }}
</header>
{{ partial "heading-pre.html" . }}{{ partial "heading.html" . }}{{ partial "heading-post.html" . }}
{{ partial "article-content.html" . }}
<footer class="footline">
{{- partial "content-footer.html" . }}
</footer>
</article>

View File

@@ -0,0 +1 @@
{{- partial "bodys/single.html" . }}

View File

@@ -0,0 +1 @@
{{- partial "bodys/tree.html" . }}

View File

@@ -0,0 +1 @@
{{- partial "menu.html" . }}

View File

@@ -0,0 +1 @@
{{- .Store.Set "relearnOutputFormat" "html" }}

View File

@@ -0,0 +1 @@
{{- .Store.Set "relearnOutputFormat" "print" }}

View File

@@ -0,0 +1,31 @@
<article class="default">
<header class="headline">
{{- partial "content-header.html" . }}
</header>
{{ partial "heading-pre.html" . }}{{ partial "heading.html" . }}{{ partial "heading-post.html" . }}
<search>
<form action="javascript:triggerSearch()">
<div class="searchform">
<label class="a11y-only" for="R-search-by-detail">{{ T "Search" }}</label>
<input data-search-input id="R-search-by-detail" class="search-by" name="search-by" type="search" placeholder="{{ T "Search-placeholder" }}">
{{- partial "shortcodes/button.html" (dict
"page" .
"type" "submit"
"style" "secondary"
"icon" "search"
"content" (T "Search")
)}}
</div>
</form>
</search>
<div class="searchhint">
</div>
<hr>
<div id="R-searchresults">
</div>
<footer class="footline">
{{- partial "content-footer.html" . }}
</footer>
</article>

View File

@@ -0,0 +1,30 @@
{{- /* based on Hugo 0.125.5 alias.html */}}
<!DOCTYPE html>
<html>
<head>
{{- $url := .Permalink }}
{{- if site.BaseURL }}
{{- $url = replace .Permalink site.BaseURL "/" }}
{{- end }}
{{- $url = replace $url "//" "/" }}
{{- with site.GetPage $url }}
{{- /* if defaultContentLanguageInSubdir=false we are ending here for home page of the default language */}}
{{- $url = partial "permalink.gotmpl" (dict "to" .) }}
{{- else }}
{{- $url_alt := replaceRE "^/[^/]*(/.*)" "${1}" $url }}
{{- with site.GetPage $url_alt }}
{{- /* if defaultContentLanguageInSubdir=true we are ending here for home page */}}
{{- $url = partial "permalink.gotmpl" (dict "to" .) }}
{{- else }}
{{- /* for regular aliases we are ending here with no original page found */}}
{{- $url = partial "permalink.gotmpl" (dict "link" $url) }}
{{- end }}
{{- end }}
<meta charset="utf-8">
<meta name="robots" content="noindex">
<meta http-equiv="refresh" content="0; url={{ $url }}">
{{- $link := "<link href=\"%s\" rel=\"%s\">" }}
<title>{{ $url }}</title>
{{ (printf $link $url "canonical") | safeHTML }}
</head>
</html>

View File

@@ -0,0 +1,13 @@
<article class="chapter narrow">
<header class="headline">
{{- partial "content-header.html" . }}
</header>
{{ partial "heading-pre.html" . }}{{ with .Params.Weight }}<div class="article-subheading">{{ T "Chapter" . }}</div>{{ end }}
{{ partial "heading.html" . }}{{ partial "heading-post.html" . }}
{{ partial "article-content.html" . }}
<footer class="footline">
{{- partial "content-footer.html" . }}
</footer>
</article>

View File

@@ -0,0 +1,12 @@
<article class="home">
<header class="headline">
{{- partial "content-header.html" . }}
</header>
{{ partial "heading-pre.html" . }}{{ partial "heading.html" . }}{{ partial "heading-post.html" . }}
{{ partial "article-content.html" . }}
<footer class="footline">
{{- partial "content-footer.html" . }}
</footer>
</article>

View File

@@ -0,0 +1,12 @@
{{- $authorName := "" }}
{{- with .Site.Params.author }}
{{- if reflect.IsMap . }}
{{- with .name }}
{{- $authorName = . }}
{{- end }}
{{- else }}
{{- warnf "DEPRECATED usage of 'params.author' config parameter found, replace it with `params.author.name` in your hugo.toml; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-23-0" }}
{{- $authorName = . }}
{{- end }}
{{- end }}
{{- return $authorName }}

View File

@@ -0,0 +1,35 @@
{{- $style := lower .style }}
{{- $set := "" }}
{{- range site.Params.boxStyle }}
{{- if eq (lower .identifier) $style }}
{{- $title := or .title (.i18n | T) }}
{{- $set = dict "style" $style "title" $title "icon" .icon }}
{{- break }}
{{- end }}
{{- end }}
{{- if not $set }}
{{- range (slice
(dict "identifier" "caution" "icon" "hand")
(dict "identifier" "important" "icon" "bolt")
(dict "identifier" "info" "icon" "info-circle")
(dict "identifier" "note" "icon" "exclamation-circle")
(dict "identifier" "tip" "icon" "lightbulb")
(dict "identifier" "warning" "icon" "exclamation-triangle")
) }}
{{- if eq .identifier $style }}
{{- $title := .identifier | T }}
{{- $set = dict "style" $style "title" $title "icon" .icon }}
{{- break }}
{{- end }}
{{- end }}
{{- end }}
{{- if not $set }}
{{- $set = dict "style" $style "title" "" "icon" "" }}
{{- end }}
{{- if .title }}
{{- $set = merge $set (dict "title" .title) }}
{{- end }}
{{- if .icon }}
{{- $set = merge $set (dict "icon" .icon) }}
{{- end }}
{{- return $set }}

View File

@@ -0,0 +1,57 @@
{{- $href := partial "permalink.gotmpl" (dict "to" .linkObject) }}
{{- $silent := .silent | default false }}
{{- $hideFilepath := .hideFilepath | default false }}
{{- $u := urls.Parse .url }}
{{- with $u.RawQuery }}
{{- $href = printf "%s?%s" $href . }}
{{- end }}
{{- with $u.Fragment }}
{{- $href = printf "%s#%s" $href . }}
{{- if not $silent }}
{{- partial "inline/validate-fragment.html" (dict "origPage" $.page "page" $.linkObject "parsedURL" $u "url" $.url "param" $.param "hideFilepath" $hideFilepath) }}
{{- end }}
{{- end }}
{{- return $href }}
{{- define "partials/inline/validate-fragment.html" }}
{{- /*
Validates the fragment portion of a link destination.
*/}}
{{- /* Initialize. */}}
{{- $errorLevel := .errorLevel }}
{{- $origPage := .origPage }}
{{- $p := .page }}
{{- $url := .url }}
{{- $u := .parsedURL }}
{{- $param := .param }}
{{- $hideFilepath := .hideFilepath }}
{{- /* Validate. */}}
{{- with $u.Fragment }}
{{- if $p.Fragments.Identifiers.Contains . }}
{{- if gt ($p.Fragments.Identifiers.Count .) 1 }}
{{- $filepath := "[virtual file]" }}{{ with and $origPage $origPage.File $origPage.File.Filename }}{{ $filepath = . }}{{ end }}
{{- $msg := printf "%q: duplicate heading ID %q found" $filepath . }}
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" $url "page" $origPage "param" $param "msg" $msg) }}
{{- end }}
{{- else }}
{{- /* Determine target path for warning and error message. */}}
{{- $targetPath := "" }}
{{- with $p.File }}
{{- $targetPath = .Path }}
{{- else }}
{{- $targetPath = .Path }}
{{- end }}
{{- $filepath := "[virtual file]" }}{{ with and $origPage $origPage.File $origPage.File.Filename }}{{ $filepath = . }}{{ end }}
{{- $msg := printf "heading ID %q not found" . }}
{{- if not $hideFilepath }}
{{- $msg = printf "%q: %s" $filepath $msg }}
{{- end }}
{{- if or $hideFilepath (ne $origPage $p) }}
{{- $msg = printf "%s in %q" $msg $targetPath }}
{{- end }}
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" $url "page" $origPage "param" $param "msg" $msg) }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,40 @@
{{- range .Site.Params.relearn.dependencies }}
{{- $has := printf "has%s" .name }}
{{- $disable := printf "disable%s" .name }}
{{- $enable := printf "%s" (lower .name) }}
{{- $wantsPage := false }}
{{- $filepath := "[virtual file]" }}{{ with and $.File $.File.Filename }}{{ $filepath = . }}{{ end }}
{{- if ne (index $.Params $disable) nil }}
{{- $wantsPage = not (index $.Params $disable) }}
{{- warnf "%q: DEPRECATED front matter 'disable%s' found, use '%s' or '%s.force' instead and invert the value; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-0-0" $filepath .name (lower .name) (lower .name) }}
{{- else if and (eq .name "Math") (ne (index $.Params "disableMathJax") nil) }}
{{- $wantsPage = not (index $.Params "disableMathJax") }}
{{- warnf "%q: DEPRECATED front matter 'disableMathJax' found, use 'math' or 'math.force' instead and invert the value; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-0-0" $filepath }}
{{- end }}
{{- with index $.Params $enable }}
{{- $wantsPage = or
(and (reflect.IsMap .) (eq (index . "force") true))
(and (not (reflect.IsMap .)) (eq . true))
}}
{{- end }}
{{- $wantsSite := false }}
{{- if ne (index $.Site.Params $disable) nil }}
{{- $wantsSite = not (index $.Site.Params $disable) }}
{{- warnf "DEPRECATED option 'disable%s' found, use '%s' or '%s.force' instead and invert the value; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-0-0" .name (lower .name) (lower .name) }}
{{- else if and (eq .name "Math") (ne (index $.Site.Params "disableMathJax") nil) }}
{{- $wantsSite = not (index $.Site.Params "disableMathJax") }}
{{- warnf "DEPRECATED option 'disableMathJax' found, use 'math' or 'math.force' instead and invert the value; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-0-0" }}
{{- end }}
{{- with index $.Site.Params $enable }}
{{- $wantsSite = or
(and (reflect.IsMap .) (eq (index . "force") true))
(and (not (reflect.IsMap .)) (eq . true))
}}
{{- end }}
{{- if or $wantsPage $wantsSite }}
{{- $.Store.Set $has true }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1 @@
{{- return fileExists . }}

View File

@@ -0,0 +1,79 @@
{{- $attributes := .attributes | default dict }}
{{- $height := "auto" }}
{{- $width := "auto" }}
{{- $effects := dict "border" false "dataurl" false "inlinecontent" false "lazy" true "lightbox" true "shadow" false }}
{{- if .page.Site.Params.imageeffects }}
{{- $effects = merge $effects .page.Site.Params.imageeffects }}
{{- end }}
{{- if .page.Params.imageEffects }}
{{- $effects = merge $effects .page.Params.imageEffects }}
{{- end }}
{{- $u := urls.Parse .url }}
{{- if $u.RawQuery }}
{{- if $u.Query.Has "classes" }}
{{- $classes := slice | append (split ($u.Query.Get "classes") ",") }}
{{- range $classes }}
{{- $k := . }}
{{- $v := true }}
{{- if strings.HasPrefix $k "no" }}
{{- $k := strings.TrimPrefix "no" $k }}
{{- $v := false }}
{{- end }}
{{- $effects = merge $effects (dict $k $v) }}
{{- end }}
{{- end }}
{{- if $u.Query.Has "featherlight" }}
{{- $filepath := "[virtual file]" }}{{ with and .page .page.File .page.File.Filename }}{{ $filepath = . }}{{ end }}
{{- warnf "%q: DEPRECATED usage of 'featherlight' image CSS class found, use 'lightbox' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-11-0" $filepath }}
{{- $effects = merge $effects (dict "lightbox" (ne ($u.Query.Get "featherlight") "false")) }}
{{- end }}
{{- range $k, $v := $effects }}
{{- if $u.Query.Has $k }}
{{- $effects = merge $effects (dict $k (ne ($u.Query.Get $k) "false")) }}
{{- end }}
{{- end }}
{{- range $k, $v := $effects }}
{{- if $u.Query.Has $k }}
{{- $paramValue := $u.Query.Get $k }}
{{- $newValue := true }}
{{- if eq $paramValue "" }}
{{- $newValue = true }}
{{- else if eq $paramValue "true" }}
{{- $newValue = true }}
{{- else if eq $paramValue "false" }}
{{- $newValue = false }}
{{- else }}
{{- $newValue = $paramValue }}
{{- end }}
{{- $effects = merge $effects (dict $k $newValue) }}
{{- end }}
{{- end }}
{{- with $u.Query.Get "height" }}
{{- $height = . }}
{{- end }}
{{- with $u.Query.Get "width" }}
{{- $width = . }}
{{- end }}
{{- end }}
{{- $classes := slice }}
{{- range $k, $v := $effects }}
{{- if $v }}
{{- if eq (printf "%T" $v) "bool" }}
{{- $classes = $classes | append $k }}
{{- end }}
{{- end }}
{{- end }}
{{- if and .linkObject $effects.inlinecontent (eq .linkObject.MediaType.Type "image/svg+xml") }}
{{- $content := .linkObject.Content | replaceRE `(?s)^\s*<\?.*?\?>\s*` "" }}
{{- $attributes = merge $attributes (dict "content" $content) }}
{{- else if and .linkObject $effects.dataurl }}
{{- $src := printf "data:%s;base64,%s" .linkObject.MediaType.Type (.linkObject.Content | base64Encode) }}
{{- $attributes = merge $attributes (dict "src" $src) }}
{{- else }}
{{- $attributes = merge $attributes (dict "src" .url) }}
{{- end }}
{{- if $attributes.class }}{{ $classes = $classes | append (split $attributes.class " ") }}{{ end }}
{{- $attributes = merge $attributes (dict "class" (delimit $classes " ")) }}
{{- $attributes = merge $attributes (dict "style" (printf " height: %s; width: %s;%s" $height $width (index $attributes "style" | default ""))) }}
{{- if $effects.lazy }}{{ $attributes = merge $attributes (dict "loading" "lazy") }}{{ end }}
{{- return $attributes }}

View File

@@ -0,0 +1,72 @@
{{- $attributes := .attributes | default dict }}
{{- /* target will be boolean false if no user defined value was set and effect default should be applied */}}
{{- $target := false }}
{{- $u := urls.Parse .url }}
{{- if $u.IsAbs }}
{{- $attributes = merge $attributes (dict "rel" "external") }}
{{- $target = "_blank" }}
{{- if isset .page.Site.Params "externallinktarget" }}
{{- $target = .page.Site.Params.externalLinkTarget }}
{{- if in (slice "false" false 0) $target }}
{{- $target = "" }}
{{- end }}
{{- if in (slice "true" true 1) $target }}
{{- $target = "_blank" }}
{{- end }}
{{- end }}
{{- end }}
{{- $effects := dict "download" false "target" false }}
{{- if .page.Site.Params.linkeffects }}
{{- $effects = merge $effects .page.Site.Params.linkeffects }}
{{- end }}
{{- if .page.Params.linkeffects }}
{{- $effects = merge $effects .page.Params.linkeffects }}
{{- end }}
{{- $target := .target | default $target }}
{{- if ne (printf "%T" $target) "bool" }}
{{- $effects = merge $effects (dict "target" $target) }}
{{- end }}
{{- if $u.RawQuery }}
{{- if $u.Query.Has "classes" }}
{{- $classes := slice | append (split ($u.Query.Get "classes") ",") }}
{{- range $classes }}
{{- $k := . }}
{{- $v := true }}
{{- if strings.HasPrefix $k "no" }}
{{- $k := strings.TrimPrefix "no" $k }}
{{- $v := false }}
{{- end }}
{{- $effects = merge $effects (dict $k $v) }}
{{- end }}
{{- end }}
{{- range $k, $v := $effects }}
{{- if $u.Query.Has $k }}
{{- $paramValue := $u.Query.Get $k }}
{{- $newValue := true }}
{{- if eq $paramValue "" }}
{{- $newValue = true }}
{{- else if eq $paramValue "true" }}
{{- $newValue = true }}
{{- else if eq $paramValue "false" }}
{{- $newValue = false }}
{{- else }}
{{- $newValue = $paramValue }}
{{- end }}
{{- $effects = merge $effects (dict $k $newValue) }}
{{- end }}
{{- end }}
{{- end }}
{{- $classes := slice }}
{{- range $k, $v := $effects }}
{{- if $v }}
{{- if eq (printf "%T" $v) "bool" }}
{{- $classes = $classes | append $k }}
{{- end }}
{{- end }}
{{- end }}
{{- if $attributes.class }}{{ $classes = $classes | append (split $attributes.class " ") }}{{ end }}
{{- $attributes = merge $attributes (dict "class" (delimit $classes " ")) }}
{{- $attributes = merge $attributes (dict "href" .url) }}
{{- $attributes = merge $attributes (dict "download" $effects.download) }}
{{- $attributes = merge $attributes (dict "target" $effects.target) }}
{{- return $attributes }}

View File

@@ -0,0 +1,48 @@
{{- $page := .page }}
{{- $linkObject := "" }}
{{- $u := urls.Parse .url }}
{{- $path := strings.TrimPrefix "./" $u.Path }}
{{- $searchLocal := .searchLocal | default true }}
{{- $searchGlobal := .searchGlobal | default true }}
{{- $searchPage := .searchPage | default true }}
{{- $searchResource := .searchResource | default true }}
{{- if $path }}
{{- with or
(and $searchLocal $searchPage ($page.Page.GetPage $path))
(and $searchLocal $searchPage ($page.Page.GetPage (strings.TrimRight "/" $path)))
(and $searchGlobal $searchPage (site.GetPage $path))
(and $searchGlobal $searchPage (site.GetPage (strings.TrimRight "/" $path)))
(and $searchLocal $searchResource ($page.Page.Resources.Get $path))
(and $searchGlobal $searchResource (resources.Get $path))
}}
{{- $linkObject = . }}
{{- else }}
{{- /* is it a link into another translation? */}}
{{- if strings.HasPrefix $path "/" }}
{{- range $page.AllTranslations }}
{{- $lang := .Language.Lang }}
{{- $prefix := printf "/%s" $lang }}
{{- $suffix := strings.TrimPrefix $prefix $path | default "/" }}
{{- /* with the second check we check if the prefix was finished;
eg. /pir/index.html vs. /pirate/index.html, were the latter is
an external address outside of this site */}}
{{- if and (strings.HasPrefix $path $prefix) (strings.HasPrefix $suffix "/") }}
{{- with or
(and $searchLocal $searchPage (.GetPage $suffix))
(and $searchLocal $searchPage (.GetPage (strings.TrimRight "/" $suffix)))
(and $searchGlobal $searchPage (site.GetPage $path))
(and $searchGlobal $searchPage (site.GetPage (strings.TrimRight "/" $path)))
(and $searchLocal $searchResource (.Resources.Get $suffix))
(and $searchGlobal $searchResource (resources.Get $suffix))
}}
{{- $linkObject = . }}
{{- break }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- else }}
{{- $linkObject = $page.Page }}
{{- end }}
{{- return $linkObject }}

View File

@@ -0,0 +1,13 @@
{{- $page := . }}
{{- if (ne $page.Site.Params.disableRandomIds true) }}
{{- $random := "" }}
{{- $set := split "012345abcdefghijklmnopqrstuvwxyz" "" }}
{{- range (seq 16) }}
{{- with ($set | shuffle | first 1) }}
{{- $random = printf "%s%s" $random . }}
{{- end }}
{{- end }}
{{- md5 $random }}
{{- else }}
{{- printf "00000000000000000000000000000000" }}
{{- end }}

View File

@@ -0,0 +1,5 @@
{{- $linkObject := "" }}
{{- with and . .menu }}
{{- $linkObject = partial "_relearn/refObject.gotmpl" (dict "page" $.page "objectRef" .PageRef "refObject" .Page "searchPage" $.searchPage "searchResource" $.searchResource) }}
{{- end }}
{{- return $linkObject }}

View File

@@ -0,0 +1,25 @@
{{- $url := "" }}
{{- /* because Hugo can not resolve a pageRef if it contains URL query params or
fragments, we simply don't access the .Page here */}}
{{- with and . .menu }}
{{- if .PageRef }}
{{- $url = .PageRef }}
{{- $linkObject := partial "_relearn/refObject.gotmpl" (dict "page" $.page "objectRef" .PageRef "refObject" .Page) }}
{{- if $linkObject }}
{{- $url = partial "_relearn/decoratedLink.gotmpl" (dict "url" .PageRef "page" $.page "linkObject" $linkObject "param" "link" "hideFilepath" true) }}
{{- else }}
{{- $msg := printf "config option 'pageRef' %q for 'menu' entry %q is not a page or a resource" .PageRef (or .KeyName .Identifier .Name .Title) }}
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" .PageRef "page" $.page "param" "link" "msg" $msg) }}
{{- end }}
{{- else if .URL }}
{{- $url = .URL | relLangURL }}
{{- $u := urls.Parse $url }}
{{- if $u.IsAbs }}
{{- partialCached "_relearn/urlExists.gotmpl" (dict "url" $url "page" $.page "type" "menu link") $u.String }}
{{- else }}
{{- $msg := printf "config option 'url' %q for 'menu' entry %q is a local URL; if it references a page or a resource use 'pageRef' instead" .URL (or .KeyName .Identifier .Name .Title) }}
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" .URL "page" $.page "param" "link" "msg" $msg) }}
{{- end }}
{{- end }}
{{- end }}
{{- return $url }}

View File

@@ -0,0 +1,18 @@
{{- $title := "" }}
{{- with and . .menu }}
{{- $objectTitle := "" }}
{{- $menuPage := partial "_relearn/menuObject.gotmpl" (dict "page" $.page "menu" . "searchResource" false) }}
{{- with $menuPage }}
{{- $objectTitle = or .LinkTitle .Title }}
{{- else }}
{{- $menuResource := partial "_relearn/menuObject.gotmpl" (dict "page" $.page "menu" . "searchPage" false) }}
{{- with $menuResource }}
{{- $objectTitle = .Title }}
{{- end }}
{{- end }}
{{- $title = or .Title (.Name | safeHTML) (.Identifier | safeHTML) }}
{{- if and (eq $objectTitle .Title) (ne .Name .Title) }}
{{- $title = (.Name | safeHTML) }}
{{- end }}
{{- end }}
{{- return $title }}

View File

@@ -0,0 +1,9 @@
{{- /* https://discourse.gohugo.io/t/how-to-know-the-section-depth/37302/4 */ -}}
{{- $page := .page }}
{{- $depth := .depth | default 0 }}
{{- with $page.Parent }}
{{- $depth = add $depth 1 }}
{{- partial "_relearn/pageDepth.gotmpl" (dict "page" . "depth" $depth) }}
{{- else }}
{{- $depth }}
{{- end }}

View File

@@ -0,0 +1,4 @@
{{- return or
.Params.hidden
(and .RelPermalink (not (or .Title (partial "title.gotmpl" (dict "page" . "linkTitle" true)))))
}}

View File

@@ -0,0 +1,16 @@
{{- $ret := false }}
{{- with .page }}
{{- $ret = partialCached "_relearn/pageIsHidden.gotmpl" . .Path }}
{{- if not $ret }}
{{- with .Parent }}
{{- if eq . $.to }}
{{- /* stop if we reach the top */}}
{{- else if partialCached "_relearn/pageIsHidden.gotmpl" . .Path }}
{{- $ret = true }}
{{- else }}
{{- $ret = partialCached "_relearn/pageIsHiddenSelfOrAncestor.gotmpl" (dict "page" . "to" $.to) .Path $.to.Path }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- return $ret }}

View File

@@ -0,0 +1,5 @@
{{- $ret := false }}
{{- if hasPrefix .Path "/_relearn" }}
{{- $ret = true }}
{{- end }}
{{- return $ret }}

View File

@@ -0,0 +1,132 @@
{{- $next := "" }}
{{- if eq .Page.Kind "term" }}
{{- /* go to next term page */}}
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
{{- $pages := partialCached "partials/_relearn/pagesTaxonomy.gotmpl" $taxonomy_page $taxonomy_page.Path }}
{{- $next = partial "inline/next-term" (dict "collection" $pages "item" .) }}
{{- else if eq .Page.Kind "taxonomy" }}
{{- /* go to first term page */}}
{{- $pages := partialCached "partials/_relearn/pagesTaxonomy.gotmpl" . .Path }}
{{- with index $pages 0 }}
{{- $next = .Page }}
{{- end }}
{{- else }}
{{- $next = partial "inline/next-page" . }}
{{- end }}
{{- return $next }}
{{- define "partials/inline/next-term" }}
{{- $collection := .collection }}
{{- $item := .item }}
{{- $found := false }}
{{- $result := "" }}
{{- range $collection }}
{{- if $found }}
{{- $result = .Page.Page }}
{{- break }}
{{- else if eq $item .Page.Page }}
{{- $found = true }}
{{- end }}
{{- end }}
{{- return $result }}
{{- end }}
{{- define "partials/inline/next-page" }}
{{- $nextVisible := "" }}
{{- $currentNode := . }}
{{- $pages := partialCached "_relearn/pages.gotmpl" (dict "page" $currentNode) $currentNode.Path }}
{{- range $pages }}
{{- $nextVisible = partial "inline/leftmost_descendant" . }}
{{- if $nextVisible }}
{{- break }}
{{- end }}
{{- end }}
{{- if not $nextVisible }}
{{- $nextVisible = partial "inline/next_sibling_or_ancestor" $currentNode }}
{{- end }}
{{- return $nextVisible }}
{{- end }}
{{- define "partials/inline/next_sibling_or_ancestor" }}
{{- $currentNode := . }}
{{- $nextSibling := "" }}
{{- with partial "inline/parent" $currentNode }}
{{- $parent := . }}
{{- $pages := partialCached "_relearn/pages.gotmpl" (dict "page" $parent) $parent.Path }}
{{- $nextVisible := partial "inline/next_sibling" (dict "siblings" $pages "currentNode" $currentNode) }}
{{- range $pages }}
{{- if not $nextVisible }}
{{- break }}
{{- end }}
{{- $nextSibling = partial "inline/leftmost_descendant" $nextVisible }}
{{- if $nextSibling }}
{{- break }}
{{- else }}
{{- $nextVisible = partial "inline/next_sibling" (dict "siblings" $pages "currentNode" $nextVisible) }}
{{- end }}
{{- end }}
{{- if not $nextSibling }}
{{- if $nextVisible }}
{{- $nextSibling = partial "inline/leftmost_descendant" $nextVisible }}
{{- end }}
{{- if not $nextSibling }}
{{- $nextSibling = partial "inline/next_sibling_or_ancestor" $parent }}
{{- end }}
{{- end }}
{{- end }}
{{- return $nextSibling }}
{{- end }}
{{- define "partials/inline/next_sibling" }}
{{- $siblings := .siblings }}
{{- $currentNode := .currentNode }}
{{- $nextSibling := "" }}
{{- $currentFound := false }}
{{- range $siblings }}
{{- if eq . $currentNode }}
{{- $currentFound = true }}
{{- else if and $currentFound (not (or (eq .Title "") .Params.hidden .Params.menuUrl .Params.menuPageRef)) }}
{{- $nextSibling = . }}
{{- break }}
{{- end }}
{{- end }}
{{- return $nextSibling }}
{{- end }}
{{- define "partials/inline/leftmost_descendant" }}
{{- $leftmostVisible := "" }}
{{- if not (or (eq .Title "") .Params.hidden .Params.menuUrl .Params.menuPageRef) }}
{{- if .RelPermalink }}
{{- $leftmostVisible = . }}
{{- else }}
{{- $pages := partialCached "_relearn/pages.gotmpl" (dict "page" .) .Path }}
{{- range $pages }}
{{- with partial "inline/leftmost_descendant" . }}
{{- $leftmostVisible = . }}
{{- break }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- return $leftmostVisible }}
{{- end }}
{{- define "partials/inline/parent" }}
{{- $nonheadless := "" }}
{{- $page := . }}
{{- $parent := .Parent }}
{{- if not (partial "_relearn/pageIsSpecial.gotmpl" $page) }}
{{- with $parent }}
{{- $pages := partialCached "_relearn/pages.gotmpl" (dict "page" .) .Path }}
{{- range $pages }}
{{- if eq . $page }}
{{- $nonheadless = $parent }}
{{- break }}
{{- end }}
{{- end }}
{{- else }}
{{- $nonheadless = $parent }}
{{- end }}
{{- end }}
{{- return $nonheadless }}
{{- end }}

View File

@@ -0,0 +1,106 @@
{{- $prev := "" }}
{{- if eq .Page.Kind "term" }}
{{- /* go to previous term page or taxonomy page if it is the first term */}}
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
{{- $pages := partialCached "partials/_relearn/pagesTaxonomy.gotmpl" $taxonomy_page $taxonomy_page.Path }}
{{- $prev = partial "inline/prev-term" (dict "collection" $pages "item" .) | default $taxonomy_page }}
{{- else if eq .Page.Kind "taxonomy" }}
{{- $prev = .Site.Home }}
{{- else if eq .Page.Kind "home" }}
{{- /* no prev here */}}
{{- else }}
{{- $prev = or (partial "inline/prev_page" .) .Site.Home }}
{{- end }}
{{- return $prev }}
{{- define "partials/inline/prev-term" }}
{{- $collection := .collection }}
{{- $item := .item }}
{{- $last := "" }}
{{- $result := "" }}
{{- range $collection }}
{{- if eq $item .Page.Page }}
{{- $result = $last }}
{{- break }}
{{- end }}
{{- $last = .Page.Page }}
{{- end }}
{{- return $result }}
{{- end }}
{{- define "partials/inline/prev_page" }}
{{- $previousVisible := "" }}
{{- $currentNode := . }}
{{- with partial "inline/parent" $currentNode }}
{{- $parent := . }}
{{- $pages := partialCached "_relearn/pages.gotmpl" (dict "page" $parent) $parent.Path }}
{{- $previousSibling := partial "inline/prev_sibling" (dict "siblings" $pages "currentNode" $currentNode) }}
{{- if $previousSibling }}
{{- $previousVisible = partial "inline/rightmost_descendant" $previousSibling }}
{{- if not $previousVisible }}
{{- if $previousSibling.RelPermalink }}
{{- $previousVisible = $previousSibling }}
{{- else }}
{{- $previousVisible = partial "inline/prev_page" $previousSibling }}
{{- end }}
{{- end }}
{{- else }}
{{- if $parent.RelPermalink }}
{{- $previousVisible = $parent }}
{{- else }}
{{- $previousVisible = partial "inline/prev_page" $parent }}
{{- end }}
{{- end }}
{{- end }}
{{- return $previousVisible }}
{{- end }}
{{- define "partials/inline/prev_sibling" }}
{{- $previousSibling := "" }}
{{- $siblings := .siblings }}
{{- $currentNode := .currentNode }}
{{- range $siblings }}
{{- if eq . $currentNode }}
{{- break }}
{{- else if not (or (eq .Title "") .Params.hidden .Params.menuUrl .Params.menuPageRef) }}
{{- $previousSibling = . }}
{{- end }}
{{- end }}
{{- return $previousSibling }}
{{- end }}
{{- define "partials/inline/rightmost_descendant" }}
{{- $rightmostVisible := . }}
{{- $pages := (partialCached "_relearn/pages.gotmpl" (dict "page" $rightmostVisible) $rightmostVisible.Path) | collections.Reverse }}
{{- range $pages }}
{{- if not (or (eq .Title "") .Params.hidden .Params.menuUrl .Params.menuPageRef) }}
{{- with partial "inline/rightmost_descendant" . }}
{{- if .RelPermalink }}
{{- $rightmostVisible = . }}
{{- break }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- return $rightmostVisible }}
{{- end }}
{{- define "partials/inline/parent" }}
{{- $nonheadless := "" }}
{{- $page := . }}
{{- $parent := .Parent }}
{{- if not (partial "_relearn/pageIsSpecial.gotmpl" $page) }}
{{- with $parent }}
{{- $pages := partialCached "_relearn/pages.gotmpl" (dict "page" .) .Path }}
{{- range $pages }}
{{- if eq . $page }}
{{- $nonheadless = $parent }}
{{- break }}
{{- end }}
{{- end }}
{{- else }}
{{- $nonheadless = $parent }}
{{- end }}
{{- end }}
{{- return $nonheadless }}
{{- end }}

View File

@@ -0,0 +1,40 @@
{{- $page := .page }}
{{- /* default sort order for the theme is historically by weight */}}
{{- $by := .by }}
{{- if eq $by "auto" }}
{{- $by = "" }}
{{- end }}
{{- $by = $by | default $page.Params.ordersectionsby | default $page.Site.Params.ordersectionsby | default "weight" }}
{{- $pages := slice }}
{{- if eq $by "weight" }}
{{- $pages = $page.Pages.ByWeight }}
{{- else if or (eq $by "name") (eq $by "title") (eq $by "linktitle") }}
{{- $pages = $page.Pages.ByLinkTitle }}
{{- else if eq $by "modifieddate" }}
{{- $pages = $page.Pages.Lastmod }}
{{- else if eq $by "expirydate" }}
{{- $pages = $page.Pages.ByExpiryDate }}
{{- else if eq $by "publishdate" }}
{{- $pages = $page.Pages.ByPublishDate }}
{{- else if eq $by "date" }}
{{- $pages = $page.Pages.ByDate }}
{{- else if eq $by "length" }}
{{- $pages = $page.Pages.ByLength }}
{{- else if eq $by "default" }}
{{- $pages = $page.Pages }}
{{- else }}
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
{{- warnf "%q: Unknown pages sort order '%s'" $filepath }}
{{- $pages = $page.Pages }}
{{- end }}
{{- $filtered_pages := slice }}
{{- range $pages }}
{{- if not (partial "_relearn/pageIsSpecial.gotmpl" .) }}
{{- $filtered_pages = $filtered_pages | append . }}
{{- end }}
{{- end }}
{{- return $filtered_pages }}

View File

@@ -0,0 +1,15 @@
{{- $pages := slice }}
{{- range .Data.Terms }}
{{- $count := 0 }}
{{- range .Pages }}
{{- /* count pages of term */}}
{{- if and .Title .RelPermalink (or (ne .Site.Params.disableTagHiddenPages true) (not (partialCached "_relearn/pageIsHiddenSelfOrAncestor.gotmpl" (dict "page" . "to" .Site.Home) .Path .Site.Home.Path) ) ) }}
{{- $count = add $count 1 }}
{{- end }}
{{- end }}
{{- if $count }}
{{- $pages = $pages| append (dict "Title" (partial "title.gotmpl" (dict "page" .Page "linkTitle" true)) "Page" .Page "Count" $count )}}
{{- end }}
{{- end }}
{{- $pages = sort $pages ".Title" }}
{{- return $pages }}

View File

@@ -0,0 +1,8 @@
{{- $pages := slice }}
{{- range .Pages }}
{{- if and .Title .RelPermalink (or (ne .Site.Params.disableTagHiddenPages true) (not (partialCached "_relearn/pageIsHiddenSelfOrAncestor.gotmpl" (dict "page" . "to" .Site.Home) .Path .Site.Home.Path) ) ) }}
{{- $pages = $pages | append (dict "Title" .Title "Page" . )}}
{{- end }}
{{- end }}
{{- $pages = sort $pages ".Title" }}
{{- return $pages }}

View File

@@ -0,0 +1,11 @@
{{- $linkObject := "" }}
{{- /* because Hugo can not resolve a pageRef if it contains URL query params or
fragments, we do it ourself if we detect such a case */}}
{{- with .refObject }}
{{- $linkObject = . }}
{{- else }}
{{- with .objectRef }}
{{- $linkObject = partial "_relearn/linkObject.gotmpl" (dict "url" . "page" $.page "searchLocal" false "searchPage" $.searchPage "searchResource" $.searchResource) }}
{{- end }}
{{- end }}
{{- return $linkObject }}

View File

@@ -0,0 +1,11 @@
{{- /* generates an uphill path from the current page to the root of the site */}}
{{- $subdir := strings.TrimSuffix (relLangURL "/") (relLangURL "") }}
{{- $relBasePath := .RelPermalink }}
{{- $relBasePath = replaceRE "/[^/]*$" "" $relBasePath }}
{{- $relBasePath = strings.TrimPrefix $subdir $relBasePath }}
{{- $relBasePath = replaceRE "/[^/]*" "/.." $relBasePath }}
{{- $relBasePath = trim $relBasePath "/" }}
{{- if not $relBasePath }}
{{- $relBasePath = "." }}
{{- end }}
{{- return $relBasePath }}

View File

@@ -0,0 +1,10 @@
{{- /* generates an uphill path from the current page to the root of the server */}}
{{- $subdir := strings.TrimSuffix (relLangURL "/") (relLangURL "") }}
{{- $relBaseUri := .RelPermalink }}
{{- $relBaseUri = replaceRE "/[^/]*$" "" $relBaseUri }}
{{- $relBaseUri = replaceRE "/[^/]*" "/.." $relBaseUri }}
{{- $relBaseUri = trim $relBaseUri "/" }}
{{- if not $relBaseUri }}
{{- $relBaseUri = "." }}
{{- end }}
{{- return $relBaseUri }}

View File

@@ -0,0 +1,260 @@
{{- $page := . }}
{{- $nonautothemevariants := slice }}
{{- $formathtmlpre := ":root:not([data-r-output-format='print']):not([data-r-theme-variant='my-custom-variant'])" }}
{{- $formathtml := "" }}
{{- $minify := not hugo.IsServer }}
{{- if and (isset site.Params "minify") (ne site.Params.minify "") }}
{{- $minify = site.Params.minify }}
{{- end }}
{{- /*
Unification run:
- convert from old forms to slice of dicts
- add default name property
- convert auto property to slice
- remember default variants for auto mode
*/}}
{{- $tempthemevariants := slice | append (.Site.Params.themeVariant | default "auto" ) }}
{{- $themevariants := slice }}
{{- range $tempthemevariant := $tempthemevariants }}
{{- $themevariant := $tempthemevariant }}
{{- if not (reflect.IsMap $themevariant) }}
{{- $themevariant = dict "identifier" $tempthemevariant }}
{{- end }}
{{- if not $themevariant.name }}
{{- $themevariant = collections.Merge $themevariant (dict "name" ($themevariant.identifier | humanize | strings.Title)) }}
{{- end }}
{{- if eq $themevariant.identifier "auto" }}
{{- $themevariant = collections.Merge $themevariant (dict "auto" ($themevariant.auto | default slice)) }}
{{- end }}
{{- if not (isset $themevariant "auto") }}
{{- $nonautothemevariants = $nonautothemevariants | append $themevariant.identifier }}
{{- end }}
{{- if eq $themevariant.identifier "my-custom-variant" }}
{{- errorf "\"theme-%s.css\": the variant identifier '%s' is reserved for the theme's variant generator, instead rename it to something different" "my-custom-variant" "my-custom-variant" }}
{{- end }}
{{- $themevariants = $themevariants | append $themevariant }}
{{- end }}
{{- /*
Generator run:
- fill up auto property with defaults
- write variant & chroma CSS string of normal variants and for light and dark of auto variants
*/}}
{{- $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)) }}
{{- $lightthemevariant := partial "inline/get-theme-details" (dict "themevariant" $themevariant "identifier" $light) }}
{{- $darkthemevariant := partial "inline/get-theme-details" (dict "themevariant" $themevariant "identifier" $dark) }}
{{- $formathtmlpre = print $formathtmlpre
":not([data-r-theme-variant='" $themevariant.identifier "'])"
}}
{{- $formathtml = print $formathtml
"\n:root:not([data-r-output-format='print'])[data-r-theme-variant='" $themevariant.identifier "'] {"
"\n@media screen and (prefers-color-scheme: light) {"
"\n" $lightthemevariant.themecontent
"\n" $lightthemevariant.chromacontent
"\n}"
"\n@media screen and (prefers-color-scheme: dark) {"
"\n" $darkthemevariant.themecontent
"\n" $darkthemevariant.chromacontent
"\n}"
"\n}"
}}
{{- else }}
{{- $themevariant = partial "inline/get-theme-details" (dict "themevariant" $themevariant "identifier" $themevariant.identifier)}}
{{- $formathtmlpre = print $formathtmlpre
":not([data-r-theme-variant='" $themevariant.identifier "'])"
}}
{{- $formathtml = print $formathtml
"\n:root:not([data-r-output-format='print'])[data-r-theme-variant='" $themevariant.identifier "'] {"
"\n" $themevariant.themecontent
"\n" $themevariant.chromacontent
"\n}"
}}
{{- end }}
{{- $themevariants = $themevariants | append $themevariant }}
{{- end }}
{{- /*
- Read default stuff
*/}}
{{- $defaultthemevariant := partial "inline/get-theme-details" (dict "themevariant" (dict) "identifier" "relearn-light") }}
{{- $nucleuscontent := "" }}
{{- with resources.Get "css/nucleus.css" }}
{{- $nucleuscontent = .Content }}
{{- end }}
{{- $fontscontent := "" }}
{{- with resources.Get "css/fonts.css" }}
{{- $fontscontent = .Content }}
{{- end }}
{{- $htmlcontent := "" }}
{{- with resources.Get "css/format-html.css" }}
{{- $htmlcontent = .Content }}
{{- end }}
{{- $printcontent := "" }}
{{- with resources.Get "css/format-print.css" }}
{{- $printcontent = .Content }}
{{- end }}
{{- /*
- Read variables.css and add custom box styles
*/}}
{{- $variablescontent := "" }}
{{- with resources.Get "css/variables.css" }}
{{- $boxcontent := "" }}
{{- range $page.Site.Params.boxStyle }}
{{- $identifier := upper .identifier }}
{{- $boxcontent = print $boxcontent
"\n --INTERNAL-BOX-" $identifier "-color: var(--BOX-" $identifier "-color, " .color ");"
"\n --INTERNAL-BOX-" $identifier "-TEXT-color: var(--BOX-" $identifier "-TEXT-color, var(--INTERNAL-BOX-TEXT-color));"
}}
{{- end }}
{{- $variablescontent = print
":root {"
"\n" .Content
$boxcontent
"\n}"
}}
{{- end }}
{{- /*
- Write theme.css
*/}}
{{- with resources.Get "css/theme.css" }}
{{- $boxcontent := "" }}
{{- range $page.Site.Params.boxStyle }}
{{- $identifier := upper .identifier }}
{{- $identifierl := lower .identifier }}
{{- $boxcontent = print $boxcontent
"\n.cstyle." $identifierl " {"
"\n --VARIABLE-BOX-color: var(--INTERNAL-BOX-" $identifier "-color);"
"\n --VARIABLE-BOX-TEXT-color: var(--INTERNAL-BOX-" $identifier "-TEXT-color);"
"\n}\n"
}}
{{- end }}
{{- $themecontent := print
$variablescontent
"\n\n" $nucleuscontent
"\n" .Content
$boxcontent
"\n" $fontscontent
}}
{{- $cssres := $themecontent | resources.FromString "css/theme.css" }}
{{- if $minify }}
{{- $cssres = $cssres | minify }}
{{- end }}
{{- /* the following code causes Hugo to generate our css file - although it is in comments */}}<!-- {{ $cssres.RelPermalink }} -->
{{- end }}
{{- /*
- Write swagger.css
*/}}
{{- with resources.Get "css/swagger.css" }}
{{- $swaggercontent := print
$variablescontent "\n"
.Content "\n"
$fontscontent "\n"
}}
{{- $cssres := $swaggercontent | resources.FromString "css/swagger.css" }}
{{- if $minify }}
{{- $cssres = $cssres | minify }}
{{- end }}
{{- /* the following code causes Hugo to generate our css file - although it is in comments */}}<!-- {{ $cssres.RelPermalink }} -->
{{- end }}
{{- /*
- Write format-html.css
*/}}
{{- $htmlcontent = print
"@media screen {"
"\n" $formathtmlpre ","
$formathtml
"\n}"
"\n@media print {"
"\n" $defaultthemevariant.themecontent
"\n" $defaultthemevariant.chromacontent
"\n}"
"\n@media print {"
"\n" $printcontent
"\n}"
"\n" $htmlcontent
}}
{{- $cssres := $htmlcontent | resources.FromString "css/format-html.css" }}
{{- if $minify }}
{{- $cssres = $cssres | minify }}
{{- end }}
{{- /* the following code causes Hugo to generate our css file - although it is in comments */}}<!-- {{ $cssres.RelPermalink }} -->
{{- /*
- Write format-print.css
*/}}
{{- $printcontent = print
":root[data-r-output-format='print'] {"
"\n" $defaultthemevariant.themecontent
"\n" $defaultthemevariant.chromacontent
"\n}"
"\n" $printcontent
}}
{{- $cssres := $printcontent | resources.FromString "css/format-print.css" }}
{{- if $minify }}
{{- $cssres = $cssres | minify }}
{{- end }}
{{- /* the following code causes Hugo to generate our css file - although it is in comments */}}<!-- {{ $cssres.RelPermalink }} -->
{{- return $themevariants }}
{{- define "partials/inline/get-theme-details" }}
{{- $themevariant := .themevariant }}
{{- $identifier := .identifier }}
{{- $themecontent := "" }}
{{- with resources.Get (printf "css/theme-%s.css" $identifier) }}
{{- $themecontent = replaceRE `([ \t]*)(:root)` "${1}&${2}" .Content }}
{{- 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 }}
{{- end }}
{{- $chroma := "" }}
{{- $chromacontent := "" }}
{{- 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;'; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/6/#6-0-0" $identifier $chroma }}
{{- end }}
{{- $tempthemecontent := $themecontent }}
{{- range findRESubmatch `[ \t]*@import\s+[^$]*?theme-([^.]*?)\.css` $themecontent }}
{{- $subidentifier := index . 1 }}
{{- $themevariant = partial "inline/get-theme-details" (dict "themevariant" $themevariant "identifier" $subidentifier) }}
{{- $tempthemecontent = replaceRE (printf `[ \t]*@import\s+[^$]*?theme-%s\.css["']?\s*\)?\s*;?` $subidentifier) $themevariant.themecontent $tempthemecontent 1 }}
{{- $chroma = $themevariant.chroma }}
{{- $chromacontent = $themevariant.chromacontent }}
{{- end }}
{{- $themecontent = replaceRE `(&\s*)+:root` "&:root" $tempthemecontent }}
{{- range findRESubmatch `[ \t]*--CODE-theme\s*:\s*([^;]*?)\s*;` $themecontent }}
{{- $chroma = index . 1 }}
{{- $cssres := resources.Get (printf "css/chroma-%s.css" $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\"" $chroma }}
{{- end }}
{{- $chromacontent = $cssres.Content }}
{{- end }}
{{- if not $chroma }}
{{- $chroma = "relearn-light" }}
{{- $cssres := resources.Get (printf "css/chroma-%s.css" $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\"" $chroma }}
{{- end }}
{{- $chromacontent = $cssres.Content }}
{{- $themecontent = replaceRE `(:root\s*\{[ \t]*)(\s*)` (printf "${1}${2}--CODE-theme: %s;${2}" $chroma) $themecontent }}
{{- end }}
{{- $themevariant = collections.Merge $themevariant (dict "themecontent" $themecontent) }}
{{- $themevariant = collections.Merge $themevariant (dict "chroma" $chroma) }}
{{- $themevariant = collections.Merge $themevariant (dict "chromacontent" $chromacontent) }}
{{- return $themevariant }}
{{- end }}

View File

@@ -0,0 +1,23 @@
{{- $pageParam := index .page.Params .param }}
{{- $siteParam := index site.Params .param }}
{{- $applyErrorIgnore := .applyErrorIgnore | default true }}
{{- $errorlevel := or (and $pageParam $pageParam.errorlevel) (and $siteParam $siteParam.errorlevel) }}
{{- $errorignore := slice | append (.page.Params.errorignore | default slice ) | append (site.Params.errorignore | default slice ) }}
{{- if and (eq $errorlevel "warning") (partial "inline/show-error" (dict "errorignore" $errorignore "url" .url "applyErrorIgnore" $applyErrorIgnore)) }}
{{- warnf .msg }}
{{- else if and (eq $errorlevel "error") (partial "inline/show-error" (dict "errorignore" $errorignore "url" .url "applyErrorIgnore" $applyErrorIgnore)) }}
{{- errorf .msg }}
{{- end }}
{{- define "partials/inline/show-error" }}
{{- $ret := true }}
{{- if .applyErrorIgnore }}
{{- range .errorignore }}
{{- if findRE . $.url 1 }}
{{- $ret = false }}
{{- break }}
{{- end }}
{{- end }}
{{- end }}
{{- return $ret }}
{{- end }}

View File

@@ -0,0 +1,4 @@
{{/* the following check avoids to print out content of headless bundles if called from nestedContent.gotmpl */}}
{{- if .RelPermalink }}
{{- partial "content.html" . | safeHTML }}
{{- end }}

View File

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

View File

@@ -0,0 +1,2 @@
{{- warnf "DEPRECATED partial 'assetbusting.hugo' used, use 'assetbusting.gotmpl' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-0-0" }}
{{- partial "assetbusting.gotmpl" . }}

View File

@@ -0,0 +1,2 @@
{{- .Store.Set "relearnIsNested" false }}
{{- .Render "views/article" }}

View File

@@ -0,0 +1,12 @@
<article>
<header class="headline">
</header>
{{- $title := partial "title.gotmpl" (dict "page" .) }}
<h1 id="{{ $title | plainify | anchorize }}">{{ $title }}</h1>
{{ partial "partials/shortcodes/taxonomy.html" (dict "page" . "taxonomy" .) }}
<footer class="footline">
</footer>
</article>

View File

@@ -0,0 +1,12 @@
<article>
<header class="headline">
</header>
{{- $title := partial "title.gotmpl" (dict "page" .) }}
<h1 id="{{ $title | plainify | anchorize }}">{{ $title }}</h1>
{{ partial "partials/shortcodes/term.html" (dict "page" . "term" .) }}
<footer class="footline">
</footer>
</article>

View File

@@ -0,0 +1,33 @@
{{- .Store.Set "relearnIsNested" true }}
{{- partialCached "inline/article-walker" . .Path | safeHTML }}
{{- define "partials/inline/article-walker" }}
{{- $html := "" }}
{{- $pages := partialCached "_relearn/pages.gotmpl" (dict "page" .) .Path }}
{{- range $pages }}
{{- if not (partialCached "_relearn/pageIsHidden.gotmpl" . .Path) }}
{{- $html = printf "%s%s" $html (partialCached "inline/article-walker" . .Path) }}
{{- $child := . }}
{{- range .Site.Params.relearn.dependencies }}
{{- $has := printf "has%s" .name }}
{{- $hasnested := printf "relearnHasNested%s" .name }}
{{- $.Store.Set $hasnested (or ($.Store.Get $hasnested) ($child.Store.Get $hasnested) ($child.Store.Get $has)) }}
{{- end }}
{{- end }}
{{- end }}
{{- $article := "" }}
{{- if .Title }}
{{- $article = .Render "views/article" }}
{{- end }}
{{- if len $html }}
{{- $title := partial "title.gotmpl" (dict "page" . "linkTitle" true) }}
{{- $html = printf `%s
<section>
<h1 class="a11y-only">%s</h1>%s
</section>` $article (T "Subsections" $title | htmlEscape) $html }}
{{- else }}
{{- $html = $article }}
{{- end }}
{{- return $html }}
{{- end }}

View File

@@ -0,0 +1,43 @@
{{- $page := .page }}
{{- $to := $page }}
{{- $pageurl := partial "permalink.gotmpl" (dict "to" $page) }}
{{- $lasturl := partial "permalink.gotmpl" (dict "to" $page) }}
{{- if .dirOnly }}
{{- $page = $page.Parent }}
{{- $to = $page }}
{{- $lasturl = partial "permalink.gotmpl" (dict "to" $page) }}
{{- end }}
{{- $depth := add 1 (int (partial "_relearn/pageDepth.gotmpl" (dict "page" $page))) }}
{{- if .page.Site.Params.disableRootBreadcrumb }}
{{- $depth = add $depth -1 }}
{{- end }}
{{- $breadcrumb := slice }}
{{- range seq $depth }}
{{- if $to }}
{{- if partial "_relearn/pageIsSpecial.gotmpl" $to }}
{{- break }}
{{- else if or $to.Title (eq $to.Kind "taxonomy") (eq $to.Kind "term") }}
{{- $breadcrumb = $breadcrumb | append $to }}
{{- end }}
{{- else }}
{{- break }}
{{- end }}
{{- $to = $to.Parent }}
{{- end }}
{{- $len := len $breadcrumb -}}
{{- $breadcrumbReversed := slice }}
{{- range seq $len }}
{{- $breadcrumbReversed = $breadcrumbReversed | append (index $breadcrumb (sub $len .)) }}
{{- end }}
{{- $depth := 0 }}
{{- range $i, $e := $breadcrumbReversed }}
{{- $to := $e }}
{{- $depth = add $depth 1 }}
{{- $title := partial "title.gotmpl" (dict "page" $to "linkTitle" true) }}
{{- $url := partial "permalink.gotmpl" (dict "to" $to) }}
{{- $isPage := eq $url $pageurl }}
{{- $isLast := eq $url $lasturl }}
{{- $link := and $url (not $isPage) }}
{{- printf "<li" | safeHTML }}
itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement">{{ if $link }}<a itemprop="item" href="{{ $url }}">{{end}}<span itemprop="name">{{ $title }}</span>{{ if $link }}</a>{{ end }}<meta itemprop="position" content="{{ $depth }}">{{ if not $isLast }}{{ (printf "&nbsp;%s&nbsp;" (default ">" .Site.Params.breadcrumbSeparator)) | safeHTML }}{{ end }}</li>
{{- end }}

View File

@@ -0,0 +1,35 @@
{{- $LastModifierDisplayName := "" }}
{{- $LastModifierEmail := "" }}
{{- $Date := "" }}
{{- with .GitInfo }}
{{- with .AuthorName }}
{{- $LastModifierDisplayName = . }}
{{- end }}
{{- with .AuthorEmail }}
{{- $LastModifierEmail = . }}
{{- end }}
{{- with .AuthorDate }}
{{- $Date = . | time.Format ":date_medium" }}
{{- end }}
{{- else }}
{{- with .Params.LastModifierDisplayName }}
{{- $LastModifierDisplayName = . }}
{{- end }}
{{- with .Params.LastModifierEmail }}
{{- $LastModifierEmail = . }}
{{- end }}
{{- with .Date }}
{{- $Date = . | time.Format ":date_medium" }}
{{- end }}
{{- end }}
{{- if $LastModifierDisplayName }}
<i class='fa-fw fas fa-user'></i> {{ with $LastModifierEmail }}<a href="mailto:{{ . }}">{{ end }}{{ $LastModifierDisplayName }}{{ with $LastModifierEmail }}</a>{{ end }}
{{- with $Date }}
<i class='fa-fw fas fa-calendar'></i> {{ . }}
{{- end }}
{{- end }}
{{- partial "term-list.html" (dict
"page" .
"taxonomy" "categories"
"icon" "layer-group"
) }}

View File

@@ -0,0 +1 @@
{{- partial "tags.html" . }}

View File

@@ -0,0 +1 @@
{{ .Content }}

View File

@@ -0,0 +1,3 @@
<!-- import your comments system
{{ template "_internal/disqus.html" . }}
-->

View File

@@ -0,0 +1,5 @@
<!-- Partial intended to be overwritten with tags loaded at the end of the page loading (usually for Javascript)
<script>
console.log("running some javascript");
</script>
-->

View File

@@ -0,0 +1,8 @@
<!-- compat way of adding custom scripts in old Hugo documentation -->
{{- $assetBusting := partialCached "assetbusting.gotmpl" . }}
{{- if or (fileExists "static/css/custom.css") (fileExists "assets/css/custom.css") }}
<link href="{{"css/custom.css" | relURL}}{{ $assetBusting }}" rel="stylesheet">
{{- end }}
{{- if or (fileExists "static/js/custom.js") (fileExists "assets/js/custom.js") }}
<script src="{{"js/custom.js" | relURL}}{{ $assetBusting }}" defer></script>
{{- end }}

View File

@@ -0,0 +1,17 @@
{{- $page := .page }}
{{- $location := .location }}
{{- partialCached "_relearn/dependencies.gotmpl" $page $page.Path }}
{{- range $k, $v := $page.Site.Params.relearn.dependencies }}
{{- $has := printf "has%s" $v.name }}
{{- $hasnested := printf "relearnHasNested%s" $v.name }}
{{- $wants := or ($page.Page.Store.Get $has) (and ($page.Page.Store.Get "relearnIsNested") ($page.Page.Store.Get $hasnested)) }}
{{- if and $wants }}
{{- if $v.location }}
{{- warnf "DEPRECATED parameter 'location' for dependency '%s' configured in your hugo.toml, query the 'location' parameter inside your dependency loader instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-27-0" $k}}
{{- end }}
{{- if or (not $v.location) (eq $location $v.location) }}
{{- $dep := printf "dependencies/%s.html" $k }}
{{- partial $dep (dict "page" $page "location" $location) }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,2 @@
{{- warnf "DEPRECATED partial 'dependencies.html' used, use 'dependencies.gotmpl' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-0-0" }}
{{- partial "dependencies.gotmpl" . }}

View File

@@ -0,0 +1,34 @@
{{- $page := .page }}
{{- $location := .location }}
{{- if eq $location "footer" }}
{{- with $page }}
{{- $assetBusting := partialCached "assetbusting.gotmpl" . }}
{{- $init := "{}" }}
{{- if isset .Params "mathjaxinitialize" }}
{{- $init = .Params.mathJaxInitialize }}
{{- else if isset .Site.Params "mathjaxinitialize" }}
{{- $init = .Site.Params.mathJaxInitialize }}
{{- end }}
<script>
function useMathJax( config ){
window.MathJax = Object.assign( window.MathJax || {}, {
tex: {
inlineMath: [['\\(', '\\)'], ['$', '$']], // inline
displayMath: [['\\[', '\\]'], ['$$', '$$']], // block
},
options: {
enableMenu: false // avoid translation hassle for context menu
}
}, config );
}
useMathJax( JSON.parse({{ $init }}) );
</script>
{{- if and (isset .Params "custommathjaxurl") .Params.customMathJaxURL }}
<script id="MathJax-script" async src="{{ .Params.customMathJaxURL }}"></script>
{{- else if and (isset .Site.Params "custommathjaxurl") .Site.Params.customMathJaxURL }}
<script id="MathJax-script" async src="{{ .Site.Params.customMathJaxURL }}"></script>
{{- else }}
<script id="MathJax-script" async src="{{"js/mathjax/tex-mml-chtml.js" | relURL}}{{ $assetBusting }}"></script>
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,33 @@
{{- $page := .page }}
{{- $location := .location }}
{{- if eq $location "footer" }}
{{- with $page }}
{{- $assetBusting := partialCached "assetbusting.gotmpl" . }}
<script src="{{"js/d3/d3-color.min.js" | relURL}}{{ $assetBusting }}" defer></script>
<script src="{{"js/d3/d3-dispatch.min.js" | relURL}}{{ $assetBusting }}" defer></script>
<script src="{{"js/d3/d3-drag.min.js" | relURL}}{{ $assetBusting }}" defer></script>
<script src="{{"js/d3/d3-ease.min.js" | relURL}}{{ $assetBusting }}" defer></script>
<script src="{{"js/d3/d3-interpolate.min.js" | relURL}}{{ $assetBusting }}" defer></script>
<script src="{{"js/d3/d3-selection.min.js" | relURL}}{{ $assetBusting }}" defer></script>
<script src="{{"js/d3/d3-timer.min.js" | relURL}}{{ $assetBusting }}" defer></script>
<script src="{{"js/d3/d3-transition.min.js" | relURL}}{{ $assetBusting }}" 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 }}
<script src="{{ .Params.customMermaidURL }}" defer></script>
{{- else if and (isset .Site.Params "custommermaidurl") .Site.Params.customMermaidURL }}
<script src="{{ .Site.Params.customMermaidURL }}" defer></script>
{{- else }}
<script src="{{"js/mermaid.min.js" | relURL}}{{ $assetBusting }}" defer></script>
{{- end }}
{{- $init := "{}" }}
{{- if isset .Params "mermaidinitialize" }}
{{- $init = .Params.mermaidInitialize }}
{{- else if isset .Site.Params "mermaidinitialize" }}
{{- $init = .Site.Params.mermaidInitialize }}
{{- end }}
<script>
window.themeUseMermaid = JSON.parse({{ $init }});
</script>
{{- end }}
{{- end }}

View File

@@ -0,0 +1,31 @@
{{- $page := .page }}
{{- $location := .location }}
{{- if eq $location "footer" }}
{{- with $page }}
{{- $assetBusting := partialCached "assetbusting.gotmpl" . }}
<script src="{{"js/js-yaml.min.js" | relURL}}{{ $assetBusting }}" defer></script>
{{- $urlOpenapi := "" }}
{{- $relOpenapi := "" }}
{{- $cssInProject := false }}
{{- if and (isset .Params "customopenapiurl") .Params.customOpenapiURL }}
{{- $urlOpenapi = .Params.customOpenapiURL }}
{{- $relOpenapi = .Params.customOpenapiURL }}
{{- else if and (isset .Site.Params "customopenapiurl") .Site.Params.customOpenapiURL }}
{{- $urlOpenapi = .Site.Params.customOpenapiURL }}
{{- $relOpenapi = .Site.Params.customOpenapiURL }}
{{- else }}
{{- $urlOpenapi = printf "%s%s" ("js/swagger-ui/swagger-ui-bundle.js" | relURL) $assetBusting }}
{{- $relOpenapi = printf "%s%s" ("/js/swagger-ui/swagger-ui-bundle.js") $assetBusting }}
{{- $cssInProject = true }}
{{- end }}
<script>window.noZensmooth = true;</script>
<script src="{{ $urlOpenapi }}" defer></script>
{{- $urlOpenapi := replace $urlOpenapi "swagger-ui-bundle" "swagger-ui-standalone-preset" }}
<script src="{{ $urlOpenapi }}" defer></script>
{{- $relOpenapi := replace $relOpenapi "swagger-ui-bundle" "swagger-ui" }}
{{- $relOpenapi := replace $relOpenapi ".js" ".css" }}
<script>
window.themeUseOpenapi = { css: {{ $relOpenapi }}, cssInProject: {{ $cssInProject | safeJS }}, assetsBuster: "{{ $assetBusting }}" };
</script>
{{- end }}
{{- end }}

View File

@@ -0,0 +1,32 @@
{{- $assetBusting := partialCached "assetbusting.gotmpl" . }}
{{- $faviconMatch := false }}
{{- $svg := dict "ext" "svg" "type" "type=\"image/svg+xml\"" }}
{{- $png := dict "ext" "png" "type" "type=\"image/png\"" }}
{{- $ico := dict "ext" "ico" "type" "type=\"image/x-icon\" sizes=\"any\"" }}
{{- $faviconTypes := slice $svg $png $ico }}
{{- $faviconNames := slice "favicon" "logo" }}
{{- $normal := dict "suffix" "" "media" "" }}
{{- $light := dict "suffix" "-light" "media" " media=\"(prefers-color-scheme: light\")" }}
{{- $dark := dict "suffix" "-dark" "media" " media=\"(prefers-color-scheme: dark\")" }}
{{- $faviconVariants := slice $normal $light $dark }}
{{- range $faviconNames }}
{{- $faviconName := . }}
{{- range $faviconTypes }}
{{- $faviconType := . }}
{{- range $faviconVariants }}
{{- $faviconVariant := . }}
{{- with (resources.Get (printf "/images/%s%s.%s" $faviconName $faviconVariant.suffix $faviconType.ext)) }}
{{- $faviconMatch = true }}
<link href="{{ .RelPermalink }}{{ $assetBusting }}" rel="icon" {{ $faviconType.type | safeHTMLAttr }}{{ $faviconVariant.media | safeHTMLAttr }}>
{{- else }}
{{- if (fileExists (printf "/static/images/%s%s.%s" $faviconName $faviconVariant.suffix $faviconType.ext)) }}
{{- $faviconMatch = true }}
<link href="{{ printf "images/%s%s.%s" $faviconName $faviconVariant.suffix $faviconType.ext | relURL }}{{ $assetBusting }}" rel="icon" {{ $faviconType.type | safeHTMLAttr }}{{ $faviconVariant.media | safeHTMLAttr }}>
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- if $faviconMatch }}
{{- break }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1 @@
{{ .Params.headingPost | safeHTML }}

View File

@@ -0,0 +1 @@
{{ .Params.headingPre | safeHTML }}

View File

@@ -0,0 +1,2 @@
{{- $title := partial "title.gotmpl" (dict "page" .) }}
<h1 id="{{ $title | plainify | anchorize }}">{{ $title }}</h1>

View File

@@ -0,0 +1,3 @@
<a id="R-logo" class="R-default" href="{{ partial "permalink.gotmpl" (dict "to" .Site.Home) }}">
<div class="logo-title">{{ .Site.Params.linkTitle | default .Site.Title }}</div>
</a>

View File

@@ -0,0 +1,2 @@
<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>

View File

@@ -0,0 +1 @@
{{ if .Params.menuPost }}{{ .Params.menuPost | safeHTML }}{{ else }}{{ .Params.Post | safeHTML }}{{ end }}

View File

@@ -0,0 +1 @@
{{ if .Params.menuPre }}{{ .Params.menuPre | safeHTML }}{{ else }}{{ .Params.Pre | safeHTML }}{{ end }}

View File

@@ -0,0 +1,406 @@
{{- $showvisitedlinks := .Site.Params.showVisitedLinks }}
<aside id="R-sidebar" class="default-animation{{ if $showvisitedlinks }} showVisitedLinks{{ end }}">
{{- $currentNode := . }}
<div id="R-header-topbar" class="default-animation"></div>
<div id="R-header-wrapper" class="default-animation">
<div id="R-header" class="default-animation">
{{ partial "logo.html" . }}
</div>{{ partial "search.html" . }}
</div>
<div id="R-homelinks" class="default-animation{{ if not .Site.Params.disableLandingPageButton }} homelinks{{ end }}">
{{- if not .Site.Params.disableLandingPageButton }}
{{- if (ne .Site.Params.landingPageURL nil) }}
{{- warnf "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 https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/4/#4-2-0" }}
{{- end }}
<ul>
<li><a class="padding" href="{{ partial "permalink.gotmpl" (dict "to" .Site.Home) }}">{{ .Site.Params.landingPageName | default `<i class="fa-fw fas fa-home"></i> Home` | safeHTML }}</a></li>
</ul>
{{- end }}
<hr class="padding">
</div>
<div id="R-content-wrapper" class="highlightable">
{{- $menuconfigs := .Params.sidebarmenus | default site.Params.sidebarmenus | default (slice
(dict "type" "page" "identifier" "home")
(dict "type" "menu" "identifier" "shortcuts")
) }}
{{- range $menuconfigs }}
{{- $config := . }}
{{- if eq $config.type "page" }}
{{- partial "partials/inline/page-tree" (dict "currentnode" $currentNode "config" $config "showvisitedlinks" $showvisitedlinks) }}
{{- else if eq $config.type "menu" }}
{{- partial "partials/inline/menu-tree" (dict "currentnode" $currentNode "config" $config "showvisitedlinks" $showvisitedlinks) }}
{{- else }}
{{- warnf "WARNING: unknown menu type '%s' found in parameter 'sidebarmenus' for menu '%s'; use either 'page' or 'menu'" $config.type $config.identifier }}
{{- end }}
{{- end }}
{{- $siteLanguages := .Site.Languages }}
{{- $showlangswitch := and hugo.IsMultilingual (not .Site.Params.disableLanguageSwitchingButton) (gt (int (len $siteLanguages)) 1) }}
{{- $themevariants := partialCached "_relearn/themeVariants.gotmpl" . }}
{{- $showvariantswitch := gt (int (len $themevariants)) 1 }}
{{- $footer := partial "menu-footer.html" . }}
{{- $showfooter := not (eq 0 (int (len ($footer | plainify)))) }}
<div class="padding footermargin footerLangSwitch footerVariantSwitch footerVisitedLinks footerFooter{{if $showlangswitch}} showLangSwitch{{end}}{{if $showvariantswitch}} showVariantSwitch{{end}}{{if $showvisitedlinks}} showVisitedLinks{{end}}{{if $showfooter}} showFooter{{end}}"></div>
<div id="R-menu-footer">
<hr class="padding default-animation footerLangSwitch footerVariantSwitch footerVisitedLinks footerFooter{{if $showlangswitch}} showLangSwitch{{end}}{{if $showvariantswitch}} showVariantSwitch{{end}}{{if $showvisitedlinks}} showVisitedLinks{{end}}{{if $showfooter}} showFooter{{end}}">
<div id="R-prefooter" class="footerLangSwitch footerVariantSwitch footerVisitedLinks{{if $showlangswitch}} showLangSwitch{{end}}{{if $showvariantswitch}} showVariantSwitch{{end}}{{if $showvisitedlinks}} showVisitedLinks{{end}}">
<ul>
<li id="R-select-language-container" class="footerLangSwitch{{if $showlangswitch}} showLangSwitch{{end}}">
<div class="padding menu-control">
<i class="fa-fw fas fa-language"></i>
<span>&nbsp;</span>
<div class="control-style">
<label class="a11y-only" for="R-select-language">{{ T "Language" }}</label>
<select id="R-select-language" onchange="location = this.querySelector( this.value ).dataset.url;">
{{- $page := .Page }}
{{- $pageLang := .Page.Language.Lang }}
{{- range .Page.AllTranslations }}
<option id="R-select-language-{{ .Language.Lang }}" value="#R-select-language-{{ .Language.Lang }}" data-url="{{ partial "permalink.gotmpl" (dict "to" .) }}" lang="{{ .Language.LanguageCode }}"{{ if eq $pageLang .Language.Lang }} selected{{ end }}>{{ .Language.LanguageName }}</option>
{{- end }}
</select>
</div>
<div class="clear"></div>
</div>
</li>
<li id="R-select-variant-container" class="footerVariantSwitch{{if $showvariantswitch}} showVariantSwitch{{end}}">
<div class="padding menu-control">
<i class="fa-fw fas fa-paint-brush"></i>
<span>&nbsp;</span>
<div class="control-style">
<label class="a11y-only" for="R-select-variant">{{ T "Theme" }}</label>
<select id="R-select-variant" onchange="window.relearn.changeVariant( this.value );">
{{- $firstvariant := true }}
{{- range $themevariants }}
{{- $themevariant := . }}
<option id="R-select-variant-{{ $themevariant.identifier }}" value="{{ $themevariant.identifier }}"{{- if $firstvariant }} selected{{ end }}>{{ $themevariant.name }}</option>
{{- $firstvariant = false }}
{{- end }}
</select>
</div>
<div class="clear"></div>
</div>
<script>window.relearn.markVariant();</script>
</li>
<li class="footerVisitedLinks{{if $showvisitedlinks}} showVisitedLinks{{end}}">
<div class="padding menu-control">
<i class="fa-fw fas fa-history"></i>
<span>&nbsp;</span>
<div class="control-style">
<button onclick="clearHistory();">{{ T "Clear-History" }}</button>
</div>
<div class="clear"></div>
</div>
</li>
</ul>
</div>
<div id="R-footer" class="footerFooter{{if $showfooter}} showFooter{{end}}">
{{- $footer }}
</div>
</div>
</div>
</aside>
{{- define "partials/inline/page-tree" }}
{{- $currentNode := .currentnode }}
{{- $config := .config }}
{{- $showvisitedlinks := .showvisitedlinks }}
<div id="R-shortcutmenu-{{ $config.identifier }}" class="R-sidebarmenu">
{{- $rootObject := site.Home }}
{{- if $config.pageRef }}
{{- $rootObject = partial "_relearn/refObject.gotmpl" (dict "page" $currentNode "objectRef" $config.pageRef) }}
{{- if not $rootObject }}
{{- $msg := printf "config option 'pageRef' %q for 'sidebarmenus' %q is not a page or a resource" $config.pageRef $config.identifier }}
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" $config.pageRef "page" $currentNode "param" "link" "msg" $msg) }}
{{- end }}
{{- end }}
{{- with $rootObject }}
{{- $entry := . }}
{{- $entries := partialCached "_relearn/pages.gotmpl" (dict "page" $entry) $entry.Path }}
{{- $title := "" }}
{{- if not ($config.disableTitle | default true) }}
{{- $title = $entry.Params.menuTitle | default (T (print $config.identifier "-menuTitle")) }}
{{- end }}
{{- with $title }}
<div class="nav-title padding">{{ . }}</div>
{{- end }}
{{- $classes := "space " }}
{{- if ($config.main | default true) }}
{{- $classes = "enlarge morespace " }}
{{- end }}
<ul class="{{ $classes }}collapsible-menu">
{{- $defaultAlwaysopen := site.Params.alwaysopen | default false }}
{{- range $entries }}
{{- $isSubSelf := eq . $currentNode }}
{{- $isSubAncestor := and (not $isSubSelf) (.IsAncestor $currentNode) }}
{{- $isSubHidden := or (.Params.hidden) (eq .Title "") }}
{{- $isSubCollapsible := .Params.collapsibleMenu | default site.Params.collapsibleMenu }}
{{- if or $isSubSelf $isSubAncestor }}
{{- partial "partials/inline/page-walker" (dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden) }}
{{- else if and (not $isSubHidden) (or $isSubCollapsible (not $entry.RelPermalink) (eq $entry $currentNode) ($entry.IsAncestor $currentNode)) }}
{{- $id := md5 .Path }}
{{- partialCached "partials/inline/page-walker" (dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden) $id }}
{{- end }}
{{- end }}
</ul>
</div>
{{- end }}
{{- end }}
{{- define "partials/inline/page-walker" }}
{{- $currentNode := .currentnode }}
{{- $showvisitedlinks := .showvisitedlinks }}
{{- $alwaysopen := .alwaysopen }}
{{- $isSelf := .isSelf }}
{{- $isAncestor := .isAncestor }}
{{- $isHidden := .isHidden }}
{{- with .sect }}
{{- $isActive := $isSelf }}
{{- $entry := . }}
{{- $entries := partialCached "_relearn/pages.gotmpl" (dict "page" .) .Path }}
{{- $hasVisibleChildren := false }}
{{- range $entries }}
{{- $isSubSelf := eq . $currentNode }}
{{- $isSubAncestor := and (not $isSubSelf) (.IsAncestor $currentNode) }}
{{- $isSubHidden := or (.Params.hidden) (eq .Title "") }}
{{- if or $isSubAncestor $isSubSelf (not $isSubHidden) }}
{{- $hasVisibleChildren = true }}
{{- break }}
{{- end }}
{{- end }}
{{- $title := partial "title.gotmpl" (dict "page" . "linkTitle" true) }}
{{- $url := partial "permalink.gotmpl" (dict "to" .) }}
{{- $isCrosslink := false }}
{{- if .Params.menuPageRef }}
{{- $isCrosslink = true }}
{{- $url = .Params.menuPageRef }}
{{- $linkObject := partial "_relearn/refObject.gotmpl" (dict "page" . "objectRef" .Params.menuPageRef) }}
{{- if $linkObject }}
{{- $url = partial "_relearn/decoratedLink.gotmpl" (dict "url" .Params.menuPageRef "page" . "linkObject" $linkObject "param" "link" "silent" true) }}
{{- end }}
{{- else if .Params.menuUrl }}
{{- $isCrosslink = true }}
{{- $url = .Params.menuUrl | relLangURL }}
{{- end }}
{{- $pre := partial "menu-pre.html" . }}
{{- $post := partial "menu-post.html" . }}
{{- if and $hasVisibleChildren (not $isCrosslink) }}
{{- $isCollapsible := .Params.collapsibleMenu | default site.Params.collapsibleMenu }}
{{- $currentAlwaysopen := .Params.alwaysopen | default $alwaysopen }}
{{- if and (not $url) (not $isCollapsible) }}
{{- $currentAlwaysopen = true }}
{{- end }}
{{- $entryId := md5 .Path }}
{{- $isOpen := or $currentAlwaysopen $isSelf $isAncestor }}
<li class="{{if $isActive }}active {{end}}{{if (or $isSelf $isAncestor) }}parent {{end}}{{if $isHidden }}hidden {{end}}{{if not $url }}headless {{end}}{{if $currentAlwaysopen}}alwaysopen {{end}}" data-nav-id="{{ $url }}">
{{- if $isCollapsible }}<input type="checkbox" id="R-section-{{ $entryId }}" aria-controls="R-subsections-{{ $entryId }}"{{ if $isOpen }} checked{{ end }}><label for="R-section-{{ $entryId }}"><i class="fa-fw fas fa-chevron-right"></i><span class="a11y-only">{{ T "Submenu" $title }}</span></label>{{ end }}
{{- if $url }}
{{- $attributes := partial "_relearn/linkAttributes.gotmpl" (dict "url" $url "page" $currentNode "attributes" (dict "class" "padding")) -}}
<a
{{- range $k, $v := $attributes }}
{{- if $v }}
{{- if eq (printf "%T" $v) "bool" }}
{{- printf " %s" $k | safeHTMLAttr }}
{{- else }}
{{- printf " %s=%q" $k $v | safeHTMLAttr }}
{{- end }}
{{- end }}
{{- end }}>
{{- else -}}
<span class="padding">
{{- end }}
{{- $pre }}{{ $title }}{{ $post }}
{{- if $url }}{{ if $showvisitedlinks }}<i class="fa-fw fas fa-check read-icon"></i>{{ end }}</a>{{ else }}</span>{{ end }}<ul id="R-subsections-{{ $entryId }}" class="collapsible-menu">
{{- $defaultAlwaysopen := site.Params.alwaysopen | default true }}
{{- range $entries }}
{{- $isSubSelf := eq . $currentNode }}
{{- $isSubAncestor := and (not $isSubSelf) (.IsAncestor $currentNode) }}
{{- $isSubHidden := or (.Params.hidden) (eq .Title "") }}
{{- $isSubCollapsible := .Params.collapsibleMenu | default site.Params.collapsibleMenu }}
{{- if or $isSubSelf $isSubAncestor }}
{{- partial "partials/inline/page-walker" (dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden) }}
{{- else if and (not $isSubHidden) (or $isSubCollapsible (not $entry.RelPermalink) (eq $entry $currentNode) ($entry.IsAncestor $currentNode)) }}
{{- $id := md5 .Path }}
{{- partialCached "partials/inline/page-walker" (dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden) $id }}
{{- end }}
{{- end }}</ul></li>
{{- else if $url }}
<li class="{{if $isActive }}active {{end}}{{if $isHidden }}hidden {{end}}{{if not $url }}headless {{end}}{{if $isCrosslink }}crosslink {{end}}" data-nav-id="{{ $url }}">
{{- if $url }}
{{- $attributes := partial "_relearn/linkAttributes.gotmpl" (dict "url" $url "page" $currentNode "attributes" (dict "class" "padding")) -}}
<a
{{- range $k, $v := $attributes }}
{{- if $v }}
{{- if eq (printf "%T" $v) "bool" }}
{{- printf " %s" $k | safeHTMLAttr }}
{{- else }}
{{- printf " %s=%q" $k $v | safeHTMLAttr }}
{{- end }}
{{- end }}
{{- end }}>
{{- else -}}
<span class="padding">
{{- end }}
{{- $pre }}{{ $title }}{{ $post }}
{{- if $url }}{{ if $showvisitedlinks }}<i class="fa-fw fas fa-check read-icon"></i>{{ end }}</a>{{ else }}</span>{{ end }}</li>
{{- end }}
{{- end }}
{{- end }}
{{- define "partials/inline/menu-tree" }}
{{- $currentNode := .currentnode }}
{{- $config := .config }}
{{- $showvisitedlinks := .showvisitedlinks }}
{{- with index site.Menus $config.identifier }}
<div id="R-shortcutmenu-{{ $config.identifier }}" class="R-sidebarmenu">
{{- $topLevelMenu := "" }}
{{- $topLevelObject := "" }}
{{- $entries := . }}
{{- with and (eq (len $entries) 1) (index $entries 0) }}
{{- if and (not .PageRef) (not .URL) }}
{{- /* because in Hugo menus can not have parameter but menu entries can,
we can flag a single top level menu entry as a container; this container
entry carrys just meta information and parameter, uses its children
to build the "real" menu, and has no own `url` or `pageRef` */}}
{{- $topLevelMenu = . }}
{{- $topLevelObject = partial "_relearn/menuObject.gotmpl" (dict "page" $currentNode "menu" $topLevelMenu) }}
{{- $entries = .Children }}
{{- end }}
{{- end }}
{{- $title := "" }}
{{- if not ($config.disableTitle | default false) }}
{{- if $topLevelMenu }}
{{- $title = partial "_relearn/menuTitle.gotmpl" (dict "page" $currentNode "menu" $topLevelMenu) }}
{{- else if eq $config.identifier "shortcuts" }}
{{- if not site.Params.DisableShortcutsTitle }}
{{- $title = T (print $config.identifier "-menuTitle") }}
{{- end }}
{{- else }}
{{- $title = T (print $config.identifier "-menuTitle") }}
{{- end }}
{{- end }}
{{- with $title }}
<div class="nav-title padding">{{ . }}</div>
{{- end }}
{{- $classes := "space " }}
{{- if ($config.main | default false) }}
{{- $classes = "enlarge morespace " }}
{{- end }}
<ul class="{{ $classes }}collapsible-menu">
{{- $root := or $topLevelMenu site }}
{{- $defaultAlwaysopen := site.Params.alwaysopen | default false }}
{{- range $entries }}
{{- $entriesObject := partial "_relearn/menuObject.gotmpl" (dict "page" $currentNode "menu" .) }}
{{- $isSubSelf := eq $entriesObject $currentNode }}
{{- $isSubAncestor := and (not $isSubSelf) ($currentNode.HasMenuCurrent .Menu .) }}
{{- $isSubHidden := or (.Params.hidden) (eq (partial "_relearn/menuTitle.gotmpl" (dict "page" $currentNode "menu" .)) "") }}
{{- $isSubCollapsible := .Params.collapsibleMenu | default $root.Params.collapsibleMenu | default site.Params.collapsibleMenu }}
{{- if or $isSubSelf $isSubAncestor }}
{{- partial "partials/inline/menu-walker" (dict "menu" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden "root" $root) }}
{{- else if and (not $isSubHidden) (or $isSubCollapsible (not (partial "_relearn/menuPermalink.gotmpl" (dict "page" $currentNode "menu" $topLevelMenu))) (eq $topLevelObject $currentNode) (and $topLevelMenu ($currentNode.HasMenuCurrent $topLevelMenu.Menu $topLevelMenu))) }}
{{- $id := md5 (print .) }}
{{- partialCached "partials/inline/menu-walker" (dict "menu" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden "root" $root) $id }}
{{- end }}
{{- end }}
</ul>
</div>
{{- else }}
{{- if ne $config.identifier "shortcuts" }}
{{- $msg := printf "config option 'identifier' for 'sidebarmenus' %q is not a menu" $config.identifier }}
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" $config.pageRef "page" $currentNode "param" "link" "msg" $msg "applyErrorIgnore" false) }}
{{- end }}
{{- end }}
{{- end }}
{{- define "partials/inline/menu-walker" }}
{{- $currentNode := .currentnode }}
{{- $showvisitedlinks := .showvisitedlinks }}
{{- $alwaysopen := .alwaysopen }}
{{- $isSelf := .isSelf }}
{{- $isAncestor := .isAncestor }}
{{- $isHidden := .isHidden }}
{{- $root := .root }}
{{- with .menu }}
{{- $isActive := $isSelf }}
{{- $entryMenu := . }}
{{- $entryObject := partial "_relearn/menuObject.gotmpl" (dict "page" $currentNode "menu" $entryMenu) }}
{{- $entries := .Children }}
{{- $hasVisibleChildren := false }}
{{- range $entries }}
{{- $entriesObject := partial "_relearn/menuObject.gotmpl" (dict "page" $currentNode "menu" .) }}
{{- $isSubSelf := eq $entriesObject $currentNode }}
{{- $isSubAncestor := and (not $isSubSelf) ($currentNode.HasMenuCurrent .Menu .) }}
{{- $isSubHidden := or (.Params.hidden) (eq (partial "_relearn/menuTitle.gotmpl" (dict "page" $currentNode "menu" .)) "") }}
{{- if or $isSubAncestor $isSubSelf (not $isSubHidden) }}
{{- $hasVisibleChildren = true }}
{{- break }}
{{- end }}
{{- end }}
{{- $title := partial "_relearn/menuTitle.gotmpl" (dict "page" $currentNode "menu" .) }}
{{- $url := partial "_relearn/menuPermalink.gotmpl" (dict "page" $currentNode "menu" .) }}
{{- $pre := .Pre }}
{{- $post := .Post }}
{{- with $entryObject }}
{{- $pre = or $pre (partial "menu-pre.html" .) }}
{{- $post = or $post (partial "menu-post.html" .) }}
{{- end }}
{{- if $hasVisibleChildren }}
{{- $isCollapsible := .Params.collapsibleMenu | default $root.Params.collapsibleMenu | default site.Params.collapsibleMenu }}
{{- $currentAlwaysopen := .Params.alwaysopen | default $root.Params.alwaysopen | default $alwaysopen }}
{{- if and (not $url) (not $isCollapsible) }}
{{- $currentAlwaysopen = true }}
{{- end }}
{{- $entryId := md5 (print $entryMenu) }}
{{- $isOpen := or $currentAlwaysopen $isSelf $isAncestor }}
<li class="{{if $isActive }}active {{end}}{{if (or $isSelf $isAncestor) }}parent {{end}}{{if $isHidden }}hidden {{end}}{{if not $url }}headless {{end}}{{if $currentAlwaysopen}}alwaysopen {{end}}" data-nav-id="{{ $url }}">
{{- if $isCollapsible }}<input type="checkbox" id="R-section-{{ $entryId }}" aria-controls="R-subsections-{{ $entryId }}"{{ if $isOpen }} checked{{ end }}><label for="R-section-{{ $entryId }}"><i class="fa-fw fas fa-chevron-right"></i><span class="a11y-only">{{ T "Submenu" $title }}</span></label>{{ end }}
{{- if $url }}
{{- $attributes := partial "_relearn/linkAttributes.gotmpl" (dict "url" $url "page" $currentNode "attributes" (dict "class" "padding")) -}}
<a
{{- range $k, $v := $attributes }}
{{- if $v }}
{{- if eq (printf "%T" $v) "bool" }}
{{- printf " %s" $k | safeHTMLAttr }}
{{- else }}
{{- printf " %s=%q" $k $v | safeHTMLAttr }}
{{- end }}
{{- end }}
{{- end }}>
{{- else -}}
<span class="padding">
{{- end }}
{{- $pre }}{{ $title }}{{ $post }}
{{- if $url }}{{ if $showvisitedlinks }}<i class="fa-fw fas fa-check read-icon"></i>{{ end }}</a>{{ else }}</span>{{ end }}<ul id="R-subsections-{{ $entryId }}" class="collapsible-menu">
{{- $defaultAlwaysopen := site.Params.alwaysopen | default true }}
{{- range $entries }}
{{- $entriesObject := partial "_relearn/menuObject.gotmpl" (dict "page" $currentNode "menu" .) }}
{{- $isSubSelf := eq $entriesObject $currentNode }}
{{- $isSubAncestor := and (not $isSubSelf) ($currentNode.HasMenuCurrent .Menu .) }}
{{- $isSubHidden := or (.Params.hidden) (eq (partial "_relearn/menuTitle.gotmpl" (dict "page" $currentNode "menu" .)) "") }}
{{- $isSubCollapsible := .Params.collapsibleMenu | default $root.Params.collapsibleMenu | default site.Params.collapsibleMenu }}
{{- if or $isSubSelf $isSubAncestor }}
{{- partial "partials/inline/menu-walker" (dict "menu" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden "root" $root) }}
{{- else if and (not $isSubHidden) (or $isSubCollapsible (not (partial "_relearn/menuPermalink.gotmpl" (dict "page" $currentNode "menu" $entryMenu))) (eq $entryObject $currentNode) ($currentNode.HasMenuCurrent $entryMenu.Menu $entryMenu)) }}
{{- $id := md5 (print .) }}
{{- partialCached "partials/inline/menu-walker" (dict "menu" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden "root" $root) $id }}
{{- end }}
{{- end }}</ul></li>
{{- else if $url }}
<li class="{{if $isActive }}active {{end}}{{if $isHidden }}hidden {{end}}{{if not $url }}headless {{end}}" data-nav-id="{{ $url }}">
{{- if $url }}
{{- $attributes := partial "_relearn/linkAttributes.gotmpl" (dict "url" $url "page" $currentNode "attributes" (dict "class" "padding")) -}}
<a
{{- range $k, $v := $attributes }}
{{- if $v }}
{{- if eq (printf "%T" $v) "bool" }}
{{- printf " %s" $k | safeHTMLAttr }}
{{- else }}
{{- printf " %s=%q" $k $v | safeHTMLAttr }}
{{- end }}
{{- end }}
{{- end }}>
{{- else -}}
<span class="padding">
{{- end }}
{{- $pre }}{{ $title }}{{ $post }}
{{- if $url }}{{ if $showvisitedlinks }}<i class="fa-fw fas fa-check read-icon"></i>{{ end }}</a>{{ else }}</span>{{ end }}</li>
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,47 @@
<meta charset="utf-8">
{{- /* to avoid that user swiping to the left leaves a gap on the right side, we set minimum-scale, even if not advised to */}}
<meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0, minimum-scale=1.0">
{{- if (ne .Site.Params.disableGeneratorVersion true) }}
{{- $gen := hugo.Generator }}
{{- $gen = replaceRE "\\s*/>$" ">" $gen }}
{{ $gen | safeHTML }}
{{- $ver := partial "version.txt" }}
{{- $ver := printf "<meta name=\"generator\" content=\"%s %s\">" "Relearn" $ver }}
{{ $ver | safeHTML }}
{{- end }}
{{- $title := partial "title.gotmpl" (dict "page" . "linkTitle" true) }}
{{- if not (and $title .RelPermalink (or (ne .Site.Params.disableSeoHiddenPages true) (not (partialCached "_relearn/pageIsHiddenSelfOrAncestor.gotmpl" (dict "page" . "to" .Site.Home) .Path .Site.Home.Path) ) ) ) }}
<meta name="robots" content="noindex, nofollow, noarchive, noimageindex">
{{- end }}
{{- $url := "" }}
{{- $filepath := "[virtual file]" }}{{ with and .File .File.Filename }}{{ $filepath = . }}{{ end }}
{{- $errorlevel := or .Params.link.errorlevel .Site.Params.link.errorlevel }}
{{- if .Params.menuPageRef }}
{{- $url = .Params.menuPageRef }}
{{- $linkObject := partial "_relearn/refObject.gotmpl" (dict "page" . "objectRef" .Params.menuPageRef) }}
{{- if $linkObject }}
{{- $url = partial "_relearn/decoratedLink.gotmpl" (dict "url" .Params.menuPageRef "page" . "linkObject" $linkObject "param" "link") }}
{{- else }}
{{- $msg := printf "%q: front matter 'menuPageRef' %q is not a page or a resource" $filepath .Params.menuPageRef }}
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" .Params.menuPageRef "page" . "param" "link" "msg" $msg) }}
{{- end }}
{{- else if .Params.menuUrl }}
{{- $url = .Params.menuUrl | relLangURL }}
{{- $u := urls.Parse $url }}
{{- if $u.IsAbs }}
{{- partialCached "_relearn/urlExists.gotmpl" (dict "url" $url "page" . "type" "menu link") $u.String }}
{{- else }}
{{- $msg := printf "%q: front matter 'menuUrl' is a local URL; if it references a page or a resource use 'menuPageRef' instead" $filepath .Params.menuUrl }}
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" .Params.menuUrl "page" . "param" "link" "msg" $msg) }}
{{- end }}
{{- end }}
{{- if $url }}
<meta http-equiv="refresh" content="0; url={{ $url }}">
{{- end }}
<meta name="description" content="{{ with trim (or .Description .Summary | plainify | htmlUnescape) "\n\r\t " }}{{ . }}{{ end }}">
{{- $authorName := partialCached "_relearn/authorName.gotmpl" . }}
<meta name="author" content="{{ $authorName }}">
{{- partial "twitter_cards.html" . }}
{{- partial "opengraph.html" . }}
{{- partial "schema.html" . }}

View File

@@ -0,0 +1,84 @@
{{- /* based on Hugo 0.125.5 opengraph.html */}}
<meta property="og:url" content="{{ partial "permalink.gotmpl" (dict "to" . "abs" true) }}">
{{- with site.Title | plainify }}
<meta property="og:site_name" content="{{ . }}">
{{- end }}
{{- with partial "title.gotmpl" (dict "page" . "fullyQualified" true "reverse" true) | plainify }}
<meta property="og:title" content="{{ . }}">
{{- end }}
{{- with trim (or .Description .Summary | plainify | htmlUnescape) "\n\r\t " }}
<meta property="og:description" content="{{ . }}">
{{- end }}
{{- with site.Language.LanguageCode }}
<meta property="og:locale" content="{{ replace . `-` `_` }}">
{{- end }}
{{- if and .IsPage (not (partial "_relearn/pageIsSpecial.gotmpl" .)) }}
<meta property="og:type" content="article">
{{- with .FirstSection }}
<meta property="article:section" content="{{ partial "title.gotmpl" (dict "page" .) | plainify }}">
{{- end }}
{{- $iso8601 := "2006-01-02T15:04:05-07:00" }}
{{- with or .PublishDate .Date }}
<meta property="article:published_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }}>
{{- end }}
{{- with .Lastmod }}
<meta property="article:modified_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }}>
{{- end }}
{{- range .GetTerms "tags" | first 6 }}
<meta property="article:tag" content="{{ partial "title.gotmpl" (dict "page" .Page "linkTitle" true) | plainify }}">
{{- end }}
{{- else }}
<meta property="og:type" content="website">
{{- end }}
{{- with partial "_funcs/get-page-images" . }}
{{- range . | first 6 }}
<meta property="og:image" content="{{ .Permalink }}">
{{- end }}
{{- end }}
{{- with .Params.audio }}
{{- range . | first 6 }}
<meta property="og:audio" content="{{ . | absURL }}">
{{- end }}
{{- end }}
{{- with .Params.videos }}
{{- range . | first 6 }}
<meta property="og:video" content="{{ . | absURL }}">
{{- end }}
{{- end }}
{{- range .GetTerms "series" }}
{{- range .Pages | first 7 }}
{{- if ne $ . }}
<meta property="og:see_also" content="{{ .Permalink }}">
{{- end }}
{{- end }}
{{- end }}
{{- $facebookApp := "" }}
{{- with site.Params.social }}
{{- if reflect.IsMap . }}
{{- with .facebook_app_id }}
{{- $facebookApp = . }}
{{- end }}
{{- end }}
{{- end }}
{{- with site.Params.social }}
{{- if reflect.IsMap . }}
{{- with .facebook_app_id }}
<meta property="fb:app_id" content="{{ . }}">
{{- else }}
{{- with .facebook_admin }}
<meta property="fb:admins" content="{{ . }}">
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1 @@
{{- warnf "DEPRECATED partial 'page-meta.hugo' used, delete it from your templates; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-0-0" }}

View File

@@ -0,0 +1,2 @@
{{- warnf "DEPRECATED partial 'pageHelper/title.hugo' used, use 'title.gotmpl' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-0-0" }}
{{- partial "title.gotmpl" . }}

View File

@@ -0,0 +1,19 @@
{{- $to := .to }}
{{- $abs := .abs }}
{{- $basename := .basename }}
{{- $link := "" }}
{{- if isset . "link" }}
{{- $link = .link }}
{{- else if not $to }}
{{- else if $abs }}
{{- $link = $to.Permalink }}
{{- else }}
{{- $link = $to.RelPermalink }}
{{- end }}
{{- if not $basename }}
{{- $basename = "index" }}
{{- end }}
{{- if and (ne site.Params.disableExplicitIndexURLs true) (eq (substr $link -1) "/") }}
{{- $link = printf "%s%s.html" $link $basename }}
{{- end }}
{{- $link }}

View File

@@ -0,0 +1,2 @@
{{- warnf "DEPRECATED partial 'relLangPrettyUglyURL.hugo' used, use 'permalink.gotmpl' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-0-0" }}
{{- partial "permalink.gotmpl" . }}

View File

@@ -0,0 +1,57 @@
{{- /* based on Hugo 0.125.5 schema.html */}}
{{- with partial "title.gotmpl" (dict "page" . "fullyQualified" true "reverse" true) | plainify }}
<meta itemprop="name" content="{{ . }}">
{{- end }}
{{- with trim (or .Description .Summary | plainify | htmlUnescape) "\n\r\t " }}
<meta itemprop="description" content="{{ . }}">
{{- end }}
{{- $ISO8601 := "2006-01-02T15:04:05-07:00" }}
{{- with or .PublishDate .Date }}
<meta itemprop="datePublished" {{ .Format $ISO8601 | printf "content=%q" | safeHTMLAttr }}>
{{- end }}
{{- with .Lastmod }}
<meta itemprop="dateModified" {{ .Format $ISO8601 | printf "content=%q" | safeHTMLAttr }}>
{{- end }}
{{- with .WordCount }}
<meta itemprop="wordCount" content="{{ . }}">
{{- end }}
{{- $images := partial "_funcs/get-page-images" . }}
{{- range first 6 $images }}
<meta itemprop="image" content="{{ .Permalink }}">
{{- end }}
{{- /*
Keywords precedence:
1. Use "keywords" term page titles.
2. Use "keywords" from front matter if "keywords" is not a taxonomy.
3. Use "tags" term page titles.
4. Use term page titles from all taxonomies.
*/}}
{{- $keywords := slice }}
{{- range .GetTerms "keywords" }}
{{- $keywords = $keywords | append (partial "title.gotmpl" (dict "page" .Page "linkTitle" true) | plainify) }}
{{- else }}
{{- with .Keywords }}
{{- $keywords = . }}
{{- else }}
{{- range .GetTerms "tags" }}
{{- $keywords = $keywords | append (partial "title.gotmpl" (dict "page" .Page "linkTitle" true) | plainify) }}
{{- else }}
{{- range $taxonomy, $_ := site.Taxonomies }}
{{- range $.GetTerms $taxonomy }}
{{- $keywords = $keywords | append (partial "title.gotmpl" (dict "page" .Page "linkTitle" true) | plainify) }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- with $keywords }}
<meta itemprop="keywords" content="{{ delimit . `,` }}">
{{- end }}

View File

@@ -0,0 +1,70 @@
{{- if not .Site.Params.disableSearch }}
{{- $assetBusting := partialCached "assetbusting.gotmpl" . }}
{{- $link := "" }}
{{- with .Site.Home.OutputFormats.Get "search" }}
{{- warnf "UNSUPPORTED usage of 'search' output format found, remove it from your config; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-0-0" }}
{{- end }}
{{- with .Site.Home.OutputFormats.Get "searchpage" }}
{{- warnf "UNSUPPORTED usage of 'searchpage' output format found, remove it from your config; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-0-0" }}
{{- end }}
{{- if not .Site.Params.disableSearchIndex }}
{{- $url := trim (or .Site.Params.searchIndexURL "searchindex.js") "/" }}
{{- $url = path.Join (path.Dir $url) (print (path.BaseName $url) "." .Language.Lang (path.Ext $url)) }}
{{- if .IsHome }}
{{- $templateres := resources.Get "_relearn_searchindex.js" }}
{{- $resultres := $templateres | resources.ExecuteAsTemplate $url .Site.Home }}
{{- /* the following code causes Hugo to generate our file - although it is in comments */}}<!-- {{ $resultres.RelPermalink }} -->
{{- end }}
<script>
window.index_js_url={{ (printf "%s%s" $url $assetBusting) | relURL }};
</script>
{{- if not .Site.Params.disableSearchPage }}
{{- with .Site.GetPage "/_relearn/searchpage/_relearn_searchpage" }}
{{- $link = partial "permalink.gotmpl" (dict "to" .) }}
{{- end }}
{{- end }}
{{- end }}
<search>{{ if $link }}<form action="{{ $link }}" method="get">{{ end }}
<div class="searchbox default-animation">
{{ if $link }}<button class="search-detail" type="submit" title="{{ T "Search" }} (CTRL+ALT+f)">{{ end }}<i class="fas fa-search"{{ if not $link }} title="{{ T "Search" }} (CTRL+ALT+f)"{{ end }}></i>{{ if $link }}</button>{{ end }}
<label class="a11y-only" for="R-search-by">{{ T "Search" }}</label>
<input data-search-input id="R-search-by" name="search-by" class="search-by" type="search" placeholder="{{ T "Search-placeholder" }}">
<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>
{{ if $link }}</form>{{ end }}</search>
{{- $pageBaseLang := replaceRE "([a-z]+).*" "${1}" .Page.Language.LanguageCode }}
{{- $contentlangs := (union (slice | append (.Site.Params.additionalContentLanguage | default slice)) (slice $pageBaseLang)) }}
{{- $quotedcontentlangs := slice }}
{{- $missingcontentlangs := slice }}
{{- range $contentlangs }}
{{- $f := printf "/static/js/lunr/lunr.%s.min.js" . }}
{{- if partialCached "_relearn/fileExists.gotmpl" $f $f }}
{{- $quotedcontentlangs = $quotedcontentlangs | append (printf "'%s'" .) }}
{{- else }}
{{- $missingcontentlangs = $missingcontentlangs | append . }}
{{- end }}
{{- end }}
{{- $contentlangs = $contentlangs | complement $missingcontentlangs }}
<script>
var contentLangs=[{{ delimit $quotedcontentlangs ", " | safeJS }}];
</script>
<script src="{{"js/auto-complete.js" | relURL}}{{ $assetBusting }}" defer></script>
<script src="{{"js/lunr/lunr.min.js" | relURL}}{{ $assetBusting }}" defer></script>
<script src="{{"js/lunr/lunr.stemmer.support.min.js" | relURL}}{{ $assetBusting }}" defer></script>
<script src="{{"js/lunr/lunr.multi.min.js" | relURL}}{{ $assetBusting }}" defer></script>
{{- $tinyseg := false }}
{{- $wordcut := false }}
{{- range $contentlangs }}
{{- if and (not $tinyseg) (or (eq . "ja")) }}
{{- $tinyseg = true }}
<script src="{{"js/lunr/tinyseg.js" | relURL}}{{ $assetBusting }}" defer></script>
{{- end }}
{{- if and (not $wordcut) (or (eq . "hi") (eq . "th")) }}
{{- $wordcut = true }}
<script src="{{"js/lunr/wordcut.js" | relURL}}{{ $assetBusting }}" defer></script>
{{- end }}
{{- $file := (printf "js/lunr/lunr.%s.min.js" .) }}
<script src="{{ $file | relURL}}{{ $assetBusting }}" defer></script>
{{- end }}
<script src="{{ "js/search.js" | relURL }}{{ $assetBusting }}" defer></script>
{{- end }}

View File

@@ -0,0 +1,69 @@
{{- $page := .page }}
{{- if and (not $page) .context }}
{{- $page = .context }}
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'attachments' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
{{- end }}
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
{{- warnf "%q: DEPRECATED shortcode `attachments` found, use `resources` instead; see https://mcshelby.github.io/hugo-theme-relearn/shortcodes/attachments#migration" $filepath }}
{{- $color := .color | default "" }}
{{- $style := .style | default "default" }}
{{- if and (not $color) (eq (len $color) 0) }}
{{- $style = .style | default "transparent" }}
{{- end }}
{{- $boxStyle := partial "_relearn/boxStyle.gotmpl" (dict "style" $style "title" .title "icon" .icon) }}
{{- $title := trim ($boxStyle.title | default ("Attachments-label" | T)) " " }}
{{- $icon := trim ($boxStyle.icon | default "paperclip") " " }}
{{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }}
{{- $icon = printf "fa-fw fas fa-%s" $icon }}
{{- end }}
{{- $sort := .sort | default "asc" }}
{{- $pattern := .pattern | default "" }}
{{- $defaultUrlPrefix := strings.TrimRight "/" $page.RelPermalink }}
{{- if .IsTranslated -}}
{{- $defaultLanguage := (index $page.Site.Home.AllTranslations 0).Language.Lang }}
{{- $defaultLanguagePage := index (where $page.AllTranslations "Language.Lang" $defaultLanguage) 0 }}
{{- $defaultUrlPrefix = strings.TrimRight "/" $defaultLanguagePage.RelPermalink }}
{{- end }}
{{- $urlPrefix := strings.TrimRight "/" $page.RelPermalink }}
{{- with $page }}
{{- if ne .BundleType "leaf" }}
{{- 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" $filepath }}
{{- 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">
{{- $fileDir := path.Dir (strings.TrimPrefix (path.Clean hugo.WorkingDir) (path.Clean .File.Filename)) }}
{{- $fileDir = printf "%s/" (path.Clean (strings.TrimPrefix "/" $fileDir)) }}
{{- $fileLink := $fileDir }}
{{- $fileLink = strings.TrimPrefix "content/" $fileLink }}
{{- $filesName := printf "%s.files" .File.BaseFileName }}
{{- if and (eq .File.BaseFileName "index") (fileExists (printf "%sfiles" $fileDir)) }}
{{- /* backward compat to < 5.9.0 behavior */}}
{{- $filesName = "files" }}
{{- end }}
{{- $dir := printf "%s%s" $fileDir $filesName }}
{{- if fileExists $dir }}
{{- range sort (readDir $dir) "Name" $sort }}
{{- if findRE $pattern .Name}}
{{- $size := .Size }}
{{- $unit := "Byte-symbol" }}
{{- if ge $size 1024 }}
{{- $size = div $size 1024 }}
{{- $unit = "Kilobyte-symbol" }}
{{- end }}
{{- if ge $size 1024 }}
{{- $size = div $size 1024 }}
{{- $unit = "Megabyte-symbol" }}
{{- end }}
{{- $unitsymbol := $unit | T }}
{{- $link := (printf "%s%s/%s" $fileLink $filesName .Name) | relLangURL }}
{{- /* Hugo stores the attachments always in the default language subdirectory */}}
{{- $link = replace $link $urlPrefix $defaultUrlPrefix 1 }}
<li><a href="{{ $link }}">{{.Name}}</a> ({{$size}} {{$unitsymbol}})</li>
{{- end }}
{{- end }}
{{- end }}
</ul>
</div>
{{- end }}

View File

@@ -0,0 +1,18 @@
{{- $page := .page }}
{{- if and (not $page) .context }}
{{- $page = .context }}
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'badge' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
{{- end }}
{{- $color := .color | default "" }}
{{- $content := .content }}
{{- $style := .style | default "default" }}
{{- $boxStyle := partial "_relearn/boxStyle.gotmpl" (dict "style" $style "title" .title "icon" .icon) }}
{{- $title := trim ($boxStyle.title) " " }}
{{- $icon := trim ($boxStyle.icon) " " }}
{{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }}
{{- $icon = printf "fa-fw fas fa-%s" $icon }}
{{- end }}
{{- with $page -}}
<span class="badge cstyle {{ $style }}{{ if or $icon $title }} badge-with-title{{ end }}">{{ if or $icon $title }}<span class="badge-title">{{ if $icon }}<i class="{{ $icon }}"></i>{{ end }}{{ if and $icon $title }} {{ end }}{{ if $title }}{{ $title | .RenderString }}{{ end }}</span>{{ end }}<span class="badge-content"{{ if $color }} style="background-color: {{ $color }};"{{ end }}>{{ $content | safeHTML }}</span></span>
{{- end }}

View File

@@ -0,0 +1,84 @@
{{- $page := .page }}
{{- if and (not $page) .context }}
{{- $page = .context }}
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'button' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
{{- end }}
{{- $color := .color | default "" }}
{{- $content := .content }}
{{- $href := (trim .href " ") | default "" }}
{{- $style := .style | default "default" }}
{{- if and (not $color) (eq (len $color) 0) }}
{{- $style = .style | default "transparent" }}
{{- end }}
{{- $attributes := .attributes | default dict }}
{{- $type := .type | default "" }}
{{- $isButton := false }}
{{- $isLink := false }}
{{- if or $type (strings.HasPrefix $href "javascript:") }}
{{- $isButton = true }}
{{- $href = substr $href (len "javascript:") }}
{{- if not $type }}
{{- $type = "button" }}
{{- end }}
{{- else if not $href }}
{{- else }}
{{- $isLink = true }}
{{- $u := urls.Parse .href }}
{{- if $u.IsAbs }}
{{- partialCached "_relearn/urlExists.gotmpl" (dict "url" .href "page" $page "type" "link") $u.String }}
{{- else }}
{{- $linkObject := partial "_relearn/linkObject.gotmpl" (dict "url" .href "page" $page) }}
{{- if $linkObject }}
{{- $href = partial "_relearn/decoratedLink.gotmpl" (dict "url" .href "page" $page "linkObject" $linkObject "param" "link") }}
{{- else }}
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
{{- $msg := printf "%q: link '%s' is not a page or a resource" $filepath .href }}
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" .href "page" $page "param" "link" "msg" $msg) }}
{{- end }}
{{- end }}
{{- if and (isset . "target") (or (ne (printf "%T" .target) "string") (ne (trim .target " " ) "")) }}
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
{{- warnf "%q: DEPRECATED parameter 'target' for shortcode 'button' found, use link effects instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-4-0" $filepath }}
{{- end }}
{{- $attributes = merge $attributes (partial "_relearn/linkAttributes.gotmpl" (dict "url" $href "page" $page "target" .target)) -}}
{{- end }}
{{- $boxStyle := partial "_relearn/boxStyle.gotmpl" (dict "style" $style "title" (or .title $content) "icon" .icon) }}
{{- $title := trim ($boxStyle.title) " " }}
{{- $icon := trim ($boxStyle.icon) " " }}
{{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }}
{{- $icon = printf "fa-fw fas fa-%s" $icon }}
{{- end }}
{{- $iconposition := .iconposition | default "left" }}
{{- with $page -}}
<span class="btn cstyle {{ if or $isButton $isLink }}interactive {{ end }}{{ $style }}"{{ if $color }} style="--VARIABLE-BOX-color: {{ $color }};"{{ end }}>
{{- if $isButton -}}
<button onclick="{{ $href | safeJS }}"{{ if gt (len $type) 0 }} type="{{ $type }}"{{ end }}>
{{- else if $isLink -}}
<a
{{- range $k, $v := $attributes }}
{{- if $v }}
{{- if eq (printf "%T" $v) "bool" }}
{{- printf " %s" $k | safeHTMLAttr }}
{{- else }}
{{- printf " %s=%q" $k $v | safeHTMLAttr }}
{{- end }}
{{- end }}
{{- end }}>
{{- else -}}
<span>
{{- end }}
{{- if and $icon (eq $iconposition "left") }}<i class="{{ $icon }}"></i>{{ end }}
{{- if and $icon (eq $iconposition "left") $title }} {{ end }}
{{- if $title }}<span class="title">{{- $title | safeHTML }}</span>{{ end }}
{{- if and $icon (eq $iconposition "right") $title }} {{ end }}
{{- if and $icon (eq $iconposition "right") }}<i class="{{ $icon }}"></i>{{ end }}
{{- if $isButton -}}
</button>
{{- else if $isLink -}}
</a>
{{- else -}}
</span>
{{- end -}}
</span>
{{- end }}

View File

@@ -0,0 +1,68 @@
{{- $page := .page }}
{{- if and (not $page) .context }}
{{- $page = .context }}
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'children' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
{{- end }}
{{- $showhidden := .showhidden | default false }}
{{- if eq (printf "%T" $showhidden) "string" }}
{{- $showhidden = (eq $showhidden "true") }}
{{- end }}
{{- $style := .style | default "li" }}
{{- $depth := .depth | default 1 }}
{{- $withDescription := .description | default false }}
{{- if eq (printf "%T" $withDescription) "string" }}
{{- $withDescription = (eq $withDescription "true") }}
{{- end }}
{{- $sortTerm := .sort | lower }}
{{- $containerstyle := .containerstyle | default "ul" }}
{{- if( and (not (eq $style "li") ) (eq $containerstyle "ul" ) ) }}
{{- $containerstyle = "div" }}
{{- end }}
{{- with $page -}}
{{ (printf "<%s class=\"children children-%s children-sort-%s\">" $containerstyle $style $sortTerm)|safeHTML }}
{{- $pages := partial "_relearn/pages.gotmpl" (dict "page" . "by" $sortTerm) }}
{{- template "childs" dict "menu" $pages "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm "page" . }}
{{ (printf "</%s>" $containerstyle)|safeHTML }}
{{- end }}
{{- define "childs" }}
{{- $page := .page }}
{{- range .menu }}
{{- $hidden := and (or (.Params.hidden) (eq .Title "")) (not $.showhidden) }}
{{- if not $hidden }}
{{- if not .IsHome }}
{{- if hasPrefix $.style "h" }}
{{- $num := sub ( int (trim $.style "h") ) 1 }}
{{- $numn := add $num $.count }}
{{ (printf ` <h%d class="children-title" id="%s">` $numn (.LinkTitle | plainify | anchorize))|safeHTML }}{{ if .RelPermalink }}<a href="{{ partial "permalink.gotmpl" (dict "to" .) }}">{{ .LinkTitle }}</a>{{ else }}<span>{{ .LinkTitle }}</span>{{ end }}{{ (printf "</h%d>" $numn)|safeHTML }}
{{- else if eq $.style "li" }}
{{ (printf ` <%s class="children-title">` $.style)|safeHTML }}{{ if .RelPermalink }}<a href="{{ partial "permalink.gotmpl" (dict "to" .) }}">{{ .LinkTitle }}</a>{{ else }}<span>{{ .LinkTitle }}</span>{{ end }}
{{- else }}
{{ (printf ` <%s class="children-title">` $.style)|safeHTML }}{{ if .RelPermalink }}<a href="{{ partial "permalink.gotmpl" (dict "to" .) }}">{{ .LinkTitle }}</a>{{ else }}<span>{{ .LinkTitle }}</span>{{ end }}{{ (printf "</%s>" $.style)|safeHTML }}
{{- end }}
{{- if $.description }}
{{- with or .Description .Summary -}}
<p>{{ . }}</p>
{{- end }}
{{- end }}
{{- end }}
{{- if lt $.count $.depth }}
{{- if eq $.style "li" }}
{{- (printf "<%s>" $.containerstyle)|safeHTML }}
{{- end }}
{{- $pages := partial "_relearn/pages.gotmpl" (dict "page" . "by" $.sortTerm) }}
{{- template "childs" dict "menu" $pages "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm "page" $page }}
{{- if eq $.style "li" }}
{{- (printf "</%s>" $.containerstyle)|safeHTML }}
{{- end }}
{{- end }}
{{- if not .IsHome }}
{{- if eq $.style "li" }}
{{- (printf "</%s>" $.style)|safeHTML -}}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,24 @@
{{- $page := .page }}
{{- if and (not $page) .context }}
{{- $page = .context }}
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'expand' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
{{- end }}
{{- $title := .title | default (T "Expand-title") }}
{{- $title = trim $title " " }}
{{- $expanded := .expanded | default false }}
{{- if and (isset . "open") (or (ne (printf "%T" .open) "string") (ne (trim .open " " ) "")) }}
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
{{- warnf "%q: DEPRECATED parameter 'open' for shortcode 'expand' found, use 'expanded' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/6/#6-3-0" $filepath }}
{{- $expanded = .open }}
{{- end }}
{{- if eq (printf "%T" $expanded) "string" }}
{{- $expanded = (eq $expanded "true") }}
{{- end }}
{{- partial "shortcodes/notice.html" (dict
"page" .page
"content" .content
"expanded" $expanded
"style" "transparent"
"title" $title
) }}

View File

@@ -0,0 +1,112 @@
{{- $page := .page }}
{{- if and (not $page) .context }}
{{- $page = .context }}
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'highlight' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
{{- end }}
{{- $attributes := dict }}
{{- $otherAttributes := dict }}
{{- $content := "" }}
{{- $options := dict }}
{{- $otherOptions := dict }}
{{- $type := "" }}
{{- range $k, $v := . }}
{{- if eq $k "context" }}
{{- else if eq $k "page" }}
{{- else if eq $k "attributes" }}
{{- $attributes = $v }}
{{- else if eq $k "content" }}
{{- $content = trim $v "\n\r" }}
{{- else if eq $k "options" }}
{{- if eq (printf "%T" $v) "string" }}
{{- range (split $v ",") }}
{{- $pair := split . "=" }}
{{- $options = $options | merge (dict (index $pair 0) (index $pair 1)) }}
{{- end }}
{{- else }}
{{- $options = $v }}
{{- end }}
{{- else if eq $k "type" }}
{{- $type = $v }}
{{- else if eq $k "title" }}
{{- $otherAttributes = $otherAttributes | merge (dict $k $v) }}
{{- else if eq $k "wrap" }}
{{- $otherAttributes = $otherAttributes | merge (dict $k $v) }}
{{- else }}
{{- $otherOptions = $otherOptions | merge (dict $k $v) }}
{{- end }}
{{- end }}
{{- /* separate attributes from options */}}
{{- $hl_inline := false }}
{{- if and (isset $page.Params "markup") (isset $page.Params.markup "highlight") (isset $page.Params.markup.highlight "hl_inline") }}
{{- $hl_inline = $page.Params.markup.highlight.hl_inline }}
{{- end }}
{{- $options = $options | merge $otherOptions }}
{{- $otherOptions := dict }}
{{- range $k, $v := $options }}
{{- if eq $k "hl_inline" }}
{{- $hl_inline = $v }}
{{- $otherOptions = (dict $k $v) | merge $otherOptions }}
{{- else if eq $k "title" }}
{{- $otherAttributes = (dict $k $v) | merge $otherAttributes }}
{{- else if eq $k "wrap" }}
{{- $otherAttributes = (dict $k $v) | merge $otherAttributes }}
{{- else }}
{{- $otherOptions = (dict $k $v) | merge $otherOptions }}
{{- end }}
{{- end }}
{{- $options = $otherOptions }}
{{- /* separate shortcode attributes from rest */}}
{{- $title := "" }}
{{- $wrap := true }}
{{- if isset $page.Site.Params "highlightwrap" }}
{{- $wrap = $page.Site.Params.highlightWrap }}
{{- end }}
{{- if isset $page.Params "highlightwrap" }}
{{- $wrap = $page.Params.highlightWrap }}
{{- end }}
{{- $attributes = $attributes | merge $otherAttributes }}
{{- $otherAttributes := dict }}
{{- range $k, $v := $attributes }}
{{- if eq $k "title" }}
{{- $title = $v }}
{{- else if eq $k "wrap" }}
{{- $wrap = $v }}
{{- else }}
{{- $otherAttributes = (dict $k $v) | merge $otherAttributes }}
{{- end }}
{{- end }}
{{- $attributes = $otherAttributes }}
{{- if eq (printf "%T" $wrap) "string" }}
{{- $wrap = (eq $wrap "true") }}
{{- end }}
{{- /* enrich attributes */}}
{{- $attributes = merge $attributes (dict "class" (delimit (append (index $attributes "class" | default slice) "highlight" slice) " ")) }}
{{- if and $wrap (not $hl_inline) }}
{{- $attributes = merge $options (dict "class" (delimit (append (index $attributes "class" | default slice) "wrap-code" slice) " ")) }}
{{- end }}
{{- /* print da shtuff */}}
{{- $div := slice }}
{{- range $k, $v := $attributes }}
{{- if $v }}
{{- $div = $div | append (printf "%s=%q" $k $v | safeHTMLAttr) }}
{{- end }}
{{- end }}
{{- $content = highlight $content $type $options }}
{{- $content = replaceRE "^([\\s\\n\\r]*)(<pre\\s+?[\\s\\S]*)$" "${1}<div class=\"highlight\">${2}</div>" $content }}
{{- $content = replaceRE "(class=\")([^\"]*)\"" (printf "%s" (delimit $div " ")) $content 1 }}
{{- if and $title (not $hl_inline) }}
{{- partial "shortcodes/tab.html" (dict
"page" $page
"title" $title
"content" $content
)}}
{{- else }}
{{- $content | safeHTML }}
{{- if and (not $hl_inline) (not (hasSuffix $content "\n")) }}
{{ end }}
{{- end }}

Some files were not shown because too many files have changed in this diff Show More