Skip to content

Commit

Permalink
theme: remove output format from topbar, dependency loader and base/h…
Browse files Browse the repository at this point in the history
…eader #891
  • Loading branch information
McShelby committed Sep 13, 2024
1 parent a78b1b0 commit 8053314
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 44 deletions.
3 changes: 1 addition & 2 deletions layouts/404.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<!DOCTYPE html>
{{- partialCached "page-meta.hugo" . .RelPermalink }}
{{- $outputFormat := partial "output-format.hugo" . }}
<html lang="{{ .Page.Language.LanguageCode }}" dir="{{ .Page.Language.LanguageDirection | default (T "Reading-direction") | default "ltr" }}" itemscope itemtype="http://schema.org/Article">
<head>
{{- partial "meta.html" . }}
{{- $title := partial "pageHelper/title.hugo" (dict "page" . "fullyQualified" true "reverse" true) }}
<title>{{ $title }}</title>
<base href="{{ .Site.BaseURL }}">
{{- partialCached "favicon.html" . }}
{{- partial "stylesheet.html" (dict "page" . "outputFormat" $outputFormat) }}
{{- partial "stylesheet.html" . }}
{{- partial "custom-header.html" . }}
</head>
<body class="mobile-support html notfound" data-url="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" .) }}">
Expand Down
1 change: 0 additions & 1 deletion layouts/partials/dependencies.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{{- $page := .page }}
{{- $location := .location }}
{{- $outputFormat := .outputFormat | default (partial "output-format.hugo" $page) }}
{{- range $k, $v := $page.Site.Params.relearn.dependencies }}
{{- $has := printf "has%s" $v.name }}
{{- $hasnested := printf "relearnHasNested%s" $v.name }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{{- $assetBusting := partialCached "assetbusting.hugo" . }}
<script src="{{"js/clipboard.min.js" | relURL}}{{ $assetBusting }}" defer></script>
<script src="{{"js/perfect-scrollbar.min.js" | relURL}}{{ $assetBusting }}" defer></script>
{{- partial "dependencies.html" (dict "page" . "location" "footer" "outputFormat" $outputFormat) }}
{{- partial "dependencies.html" (dict "page" . "location" "footer") }}
<script src="{{"js/theme.js" | relURL}}{{ $assetBusting }}" defer></script>
{{- partial "custom-footer.html" . }}
</body>
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
{{- end }}

{{- partialCached "favicon.html" . }}
{{- partial "stylesheet.html" (dict "page" . "outputFormat" $outputFormat) }}
{{- partial "dependencies.html" (dict "page" . "location" "header" "outputFormat" $outputFormat) }}
{{- partial "stylesheet.html" . }}
{{- partial "dependencies.html" (dict "page" . "location" "header") }}
{{- partial "custom-header.html" . }}
</head>
<body class="mobile-support {{ $outputFormat }}{{- if .Site.Params.disableInlineCopyToClipBoard }} disableInlineCopyToClipboard{{ end }}{{- if .Site.Params.disableHoverBlockCopyToClipBoard }} disableHoverBlockCopyToClipBoard{{ end }}" data-url="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" .) }}">
Expand Down
15 changes: 4 additions & 11 deletions layouts/partials/stylesheet.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
{{- $page := .page }}
{{- $outputFormat := .outputFormat }}
{{- if not $page }}
{{- $page = . }}
{{- $outputFormat = partial "output-format.hugo" $page }}
{{- end }}
{{- with $page }}
{{- $outputFormat := partial "output-format.hugo" . }}
{{- $assetBusting := partialCached "assetbusting.hugo" . }}
{{- /* https://github.com/filamentgroup/loadCSS/blob/master/README.md#how-to-use */}}
<link href="{{"css/fontawesome-all.min.css" | relURL}}{{ $assetBusting }}" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;"><noscript><link href="{{"css/fontawesome-all.min.css" | relURL}}{{ $assetBusting }}" rel="stylesheet"></noscript>
Expand All @@ -27,8 +21,8 @@
<script src="{{"js/variant.js" | relURL}}{{ $assetBusting }}"></script>
<script>
window.relearn = window.relearn || {};
window.relearn.relBasePath='{{ partial "relBasePath.hugo" $page | safeJS }}';
window.relearn.relBaseUri='{{ partial "relBaseUri.hugo" $page | safeJS }}';
window.relearn.relBasePath='{{ partial "relBasePath.hugo" . | safeJS }}';
window.relearn.relBaseUri='{{ partial "relBaseUri.hugo" . | safeJS }}';
window.relearn.absBaseUri='{{ replaceRE "/*$" "" .Site.BaseURL | safeJS }}';
window.relearn.disableAnchorCopy={{ printf "%t" (eq .Site.Params.disableAnchorCopy true) | safeJS }};
window.relearn.disableAnchorScrolling={{ printf "%t" (eq .Site.Params.disableAnchorScrolling true) | safeJS }};
Expand All @@ -47,5 +41,4 @@
{{ printf "window.T_View_reset = `%s`;" (T `View-reset`) | safeJS }}
{{ printf "window.T_No_results_found = `%s`;" (T "No-results-found") | safeJS }}
{{ printf "window.T_N_results_found = `%s`;" (T "N-results-found") | safeJS }}
</script>
{{- end }}
</script>
4 changes: 1 addition & 3 deletions layouts/partials/topbar/button/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
{{- $onwidthm := cond (isset . "onwidthm") .onwidthm "show" }}
{{- $onwidthl := cond (isset . "onwidthl") .onwidthl "show" }}
{{- with .page }}
{{- $format := partial "get-format.hugo" . }}
{{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }}
{{- if and (eq $outputFormat "html") .File }}
{{- if .File }}
{{- $filePath := printf "%s%s" (strings.TrimLeft "/" (replace .File.Dir "\\" "/")) .File.LogicalName }}
{{- $href := "" }}
{{- if .Site.Params.editURL }}
Expand Down
4 changes: 1 addition & 3 deletions layouts/partials/topbar/button/print.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
{{- $onwidthm := cond (isset . "onwidthm") .onwidthm "show" }}
{{- $onwidthl := cond (isset . "onwidthl") .onwidthl "show" }}
{{- with .page }}
{{- $format := partial "get-format.hugo" . }}
{{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }}
{{- $printFormat := .OutputFormats.Get "print" }}
{{- if and (eq $outputFormat "html") $printFormat }}
{{- if $printFormat }}
{{- partial "topbar/func/button.html" (dict
"page" .
"class" "topbar-button-print"
Expand Down
4 changes: 1 addition & 3 deletions layouts/partials/topbar/button/toc.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
{{- $onwidthm := cond (isset . "onwidthm") .onwidthm "show" }}
{{- $onwidthl := cond (isset . "onwidthl") .onwidthl "show" }}
{{- with .page }}
{{- $format := partial "get-format.hugo" . }}
{{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }}
{{- $defaultDisableToc := .Site.Params.disableToc | default false }}
{{- $currentDisableToc := .Params.disableToc | default $defaultDisableToc }}
{{- if and (eq $outputFormat "html") (not $currentDisableToc) }}
{{- if not $currentDisableToc }}
{{- $content := partial "toc-class.html" . }}
{{- $hascontent := not (eq 0 (int (len (trim ($content | plainify) "\n\r\t ")))) }}
{{- if not $hascontent }}
Expand Down
32 changes: 14 additions & 18 deletions layouts/partials/topbar/func/area-button.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,18 @@
{{- $onwidthm := cond (isset . "onwidthm") .onwidthm "show" }}
{{- $onwidthl := cond (isset . "onwidthl") .onwidthl "show" }}
{{- with .page }}
{{- $format := partial "get-format.hugo" . }}
{{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }}
{{- if and (eq $outputFormat "html") }}
{{- $content := printf "\n <div class=\"topbar-area topbar-area-%s\" data-area=\"%s\">%s\n </div>" $area $area (partial (printf "topbar/area/%s.html" $area) .) | safeHTML }}
{{- partial "topbar/func/button.html" (dict
"page" .
"class" (printf "topbar-button-%s" $area)
"href" "javascript:toggleTopbarFlyout(this)"
"icon" $icon
"onempty" $onempty
"onwidths" $onwidths
"onwidthm" $onwidthm
"onwidthl" $onwidthl
"title" $title
"hint" $hint
"content" $content
)}}
{{- end }}
{{- $content := printf "\n <div class=\"topbar-area topbar-area-%s\" data-area=\"%s\">%s\n </div>" $area $area (partial (printf "topbar/area/%s.html" $area) .) | safeHTML }}
{{- partial "topbar/func/button.html" (dict
"page" .
"class" (printf "topbar-button-%s" $area)
"href" "javascript:toggleTopbarFlyout(this)"
"icon" $icon
"onempty" $onempty
"onwidths" $onwidths
"onwidthm" $onwidthm
"onwidthl" $onwidthl
"title" $title
"hint" $hint
"content" $content
)}}
{{- end }}

0 comments on commit 8053314

Please sign in to comment.