Compare commits

...

19 Commits

Author SHA1 Message Date
Mark Dumay
6ad6eef347 Merge pull request #576 from gethinode/develop
Fix buttons
2023-10-22 15:27:55 +02:00
Mark Dumay
43ed4d411e Merge branch 'main' into develop 2023-10-22 15:20:11 +02:00
mark
7c8d5453cc Update dependencies 2023-10-22 15:19:24 +02:00
mark
f4a40367f6 Fix close button image 2023-10-22 15:19:12 +02:00
mark
e786ef279a Fix close button aria labels 2023-10-22 14:39:24 +02:00
mark
a6684e1bb5 Fix close button aria label 2023-10-22 14:28:51 +02:00
Mark Dumay
4fbe389245 Merge pull request #575 from gethinode/develop
Improve layout
2023-10-22 13:42:32 +02:00
Mark Dumay
04b0af5d58 Merge branch 'main' into develop 2023-10-22 12:55:37 +02:00
mark
7f797af3eb Sort actions by weight 2023-10-22 12:52:33 +02:00
mark
4a3a0fb0bb Fix gap between CTA buttons 2023-10-22 12:39:33 +02:00
mark
f9e9eec611 Fix vertical centering of button icon 2023-10-22 12:38:10 +02:00
mark
cb71742a91 Fix spacing between button rows 2023-10-22 12:32:13 +02:00
mark
638c7054d0 Bump package release 2023-10-22 08:43:14 +02:00
mark
fb21633f8c Fix support of floating numbers 2023-10-22 08:42:45 +02:00
mark
9bb7cf1825 Set dimensions of vector image in light/dark mode 2023-10-22 08:42:18 +02:00
Mark Dumay
e00ad4498b Merge pull request #574 from gethinode/develop
Fix section menu initialization
2023-10-21 15:14:40 +02:00
Mark Dumay
a0f7e62616 Merge branch 'main' into develop 2023-10-21 14:56:17 +02:00
mark
11653015ab Fix section menu initialization 2023-10-21 14:55:38 +02:00
mark
e6a37cab0f Fix typos 2023-10-21 14:53:39 +02:00
24 changed files with 134 additions and 116 deletions

View File

@@ -18,7 +18,7 @@
@import "components/alert.scss"; @import "components/alert.scss";
@import "components/blockquote.scss"; @import "components/blockquote.scss";
@import "components/breadcrumb.scss"; @import "components/breadcrumb.scss";
@import "components/buttons.scss"; @import "components/button.scss";
@import "components/card.scss"; @import "components/card.scss";
@import "components/carousel.scss"; @import "components/carousel.scss";
@import "components/clipboard.scss"; @import "components/clipboard.scss";

View File

@@ -16,7 +16,7 @@
@import "components/alert.scss"; @import "components/alert.scss";
@import "components/blockquote.scss"; @import "components/blockquote.scss";
@import "components/breadcrumb.scss"; @import "components/breadcrumb.scss";
@import "components/buttons.scss"; @import "components/button.scss";
@import "components/card.scss"; @import "components/card.scss";
@import "components/carousel.scss"; @import "components/carousel.scss";
@import "components/clipboard.scss"; @import "components/clipboard.scss";

View File

@@ -28,3 +28,16 @@
background-color: transparent; background-color: transparent;
color: var(--bs-primary) if($enable-important-utilities, !important, null); color: var(--bs-primary) if($enable-important-utilities, !important, null);
} }
a.btn {
margin-top: $spacer * .25;
margin-bottom: $spacer * .25;
}
.btn-close {
background-color: transparent if($enable-important-utilities, !important, null);
background-image: var(--#{$prefix}btn-close-bg) if($enable-important-utilities, !important, null);
background-position: center if($enable-important-utilities, !important, null);
background-repeat: no-repeat if($enable-important-utilities, !important, null);
background-size: $btn-close-width if($enable-important-utilities, !important, null);
}

View File

@@ -404,11 +404,11 @@ H{{</* sub 2 */>}}O est un liquide.
<!-- markdownlint-disable MD037 --> <!-- markdownlint-disable MD037 -->
{{< example lang="hugo" >}} {{< example lang="hugo" >}}
{{</* button toast="toast-example-1" */>}} {{</* button toast="toast-example-1" */>}}
Affiche la notifiaction #1 Affiche la notification #1
{{</* /button */>}} {{</* /button */>}}
{{</* button toast="toast-example-2" */>}} {{</* button toast="toast-example-2" */>}}
Affiche la notifiaction #1 Affiche la notification #1
{{</* /button */>}} {{</* /button */>}}
{{</* toast id="toast-example-1" header="Premier titre" */>}} {{</* toast id="toast-example-1" header="Premier titre" */>}}

2
go.mod
View File

@@ -3,7 +3,7 @@ module github.com/gethinode/hinode
go 1.19 go 1.19
require ( require (
github.com/gethinode/mod-bootstrap v1.2.1 // indirect github.com/gethinode/mod-bootstrap v1.2.2 // indirect
github.com/gethinode/mod-flexsearch v1.5.1 // indirect github.com/gethinode/mod-flexsearch v1.5.1 // indirect
github.com/gethinode/mod-fontawesome v1.5.0 // indirect github.com/gethinode/mod-fontawesome v1.5.0 // indirect
github.com/gethinode/mod-katex v1.0.4 // indirect github.com/gethinode/mod-katex v1.0.4 // indirect

2
go.sum
View File

@@ -8,6 +8,8 @@ github.com/gethinode/mod-bootstrap v1.2.0 h1:JkTcImU3qpi25WgKvUxUYiMoiXtrxrG+Wf/
github.com/gethinode/mod-bootstrap v1.2.0/go.mod h1:DcpPc2cNaXUPGEvhD7npuEEPA7573NvakTlrwFbyjr8= github.com/gethinode/mod-bootstrap v1.2.0/go.mod h1:DcpPc2cNaXUPGEvhD7npuEEPA7573NvakTlrwFbyjr8=
github.com/gethinode/mod-bootstrap v1.2.1 h1:z54dgsbhShhlri+X77Z+yLrg0wz/f8C8ojA/wnlhsJc= github.com/gethinode/mod-bootstrap v1.2.1 h1:z54dgsbhShhlri+X77Z+yLrg0wz/f8C8ojA/wnlhsJc=
github.com/gethinode/mod-bootstrap v1.2.1/go.mod h1:DcpPc2cNaXUPGEvhD7npuEEPA7573NvakTlrwFbyjr8= github.com/gethinode/mod-bootstrap v1.2.1/go.mod h1:DcpPc2cNaXUPGEvhD7npuEEPA7573NvakTlrwFbyjr8=
github.com/gethinode/mod-bootstrap v1.2.2 h1:Q8E04OKWr9owk7nhQ/NBukUgSFhsECxZsOLEaf5oeiQ=
github.com/gethinode/mod-bootstrap v1.2.2/go.mod h1:DcpPc2cNaXUPGEvhD7npuEEPA7573NvakTlrwFbyjr8=
github.com/gethinode/mod-flexsearch v1.0.1 h1:FJkRsUzSnQTXl3MWCigT4E6vfff870UWTnkGqaDGIhA= github.com/gethinode/mod-flexsearch v1.0.1 h1:FJkRsUzSnQTXl3MWCigT4E6vfff870UWTnkGqaDGIhA=
github.com/gethinode/mod-flexsearch v1.0.1/go.mod h1:TXbGbWsvmhBdsTzRt887mcpFfr4ORpzG3+h/l4W3YM4= github.com/gethinode/mod-flexsearch v1.0.1/go.mod h1:TXbGbWsvmhBdsTzRt887mcpFfr4ORpzG3+h/l4W3YM4=
github.com/gethinode/mod-flexsearch v1.1.0 h1:7BCMyQDlYlskNXuazt8Jg/jg9WREexu2xVkYqThkAX4= github.com/gethinode/mod-flexsearch v1.1.0 h1:7BCMyQDlYlskNXuazt8Jg/jg9WREexu2xVkYqThkAX4=

View File

@@ -30,7 +30,6 @@
"align-items-center", "align-items-center",
"align-self-center", "align-self-center",
"bg-body", "bg-body",
"bg-info",
"bg-opacity-10", "bg-opacity-10",
"bg-primary", "bg-primary",
"bottom-0", "bottom-0",
@@ -82,15 +81,12 @@
"flex-column", "flex-column",
"flex-fill", "flex-fill",
"flex-grow-1", "flex-grow-1",
"flex-row",
"footer", "footer",
"form-control", "form-control",
"fs-3", "fs-3",
"fs-5", "fs-5",
"fullscreen",
"fw-30", "fw-30",
"fw-bold", "fw-bold",
"h-100",
"hstack", "hstack",
"img-fluid", "img-fluid",
"img-wrap", "img-wrap",
@@ -169,8 +165,7 @@
"toast-container", "toast-container",
"toast-header", "toast-header",
"toggler-icon", "toggler-icon",
"top-bar", "top-bar"
"w-100"
], ],
"ids": [ "ids": [
"-theme", "-theme",

View File

@@ -65,6 +65,8 @@
translation: "Startseite" translation: "Startseite"
- id: languageSwitcherLabel - id: languageSwitcherLabel
translation: "Sprache" translation: "Sprache"
- id: close
translation: "Schließen"
# Table of contents # Table of contents
- id: toc - id: toc

View File

@@ -71,6 +71,8 @@
translation: "Home" translation: "Home"
- id: languageSwitcherLabel - id: languageSwitcherLabel
translation: "Language" translation: "Language"
- id: close
translation: "Close"
# Table of contents # Table of contents
- id: toc - id: toc

View File

@@ -67,6 +67,8 @@
translation: "Accueil" translation: "Accueil"
- id: languageSwitcherLabel - id: languageSwitcherLabel
translation: "Langage" translation: "Langage"
- id: close
translation: "Fermer"
# Table of contents # Table of contents
- id: toc - id: toc

View File

@@ -69,6 +69,8 @@
translation: "Home" translation: "Home"
- id: languageSwitcherLabel - id: languageSwitcherLabel
translation: "Taal" translation: "Taal"
- id: close
translation: "Sluiten"
# Table of contents # Table of contents
- id: toc - id: toc

View File

@@ -40,18 +40,9 @@
{{- end -}} {{- end -}}
{{- /* Define section headings */ -}} {{- /* Define section headings */ -}}
{{- $headings := slice -}} {{ $sections := partial "utilities/GetSections.html" . }}
{{ if .Fragments }} {{- $.Scratch.Set "sections" $sections -}}
{{ $headings = $headings | append .Title }}
{{- range .Fragments.Headings }}
{{- range .Headings }}
{{- $headings = $headings | append .Title -}}
{{- end -}}
{{- end -}}
{{ end }}
{{- $.Scratch.Set "headings" $headings -}}
{{- $section := .Section }}
{{- $fullCover := or (or (and .IsHome .Site.Params.home.fullCover) .Page.Params.fullCover) .Site.Params.main.footerBelowFold }} {{- $fullCover := or (or (and .IsHome .Site.Params.home.fullCover) .Page.Params.fullCover) .Site.Params.main.footerBelowFold }}
<!doctype html> <!doctype html>

View File

@@ -1,5 +1,11 @@
{{- define "featured" }} {{- define "featured" }}
{{- $headings := $.Scratch.Get "headings" -}} {{- $sections := $.Scratch.Get "sections" -}}
{{- $headings := slice }}
{{ if .Params.sectionMenu }}
{{ range $sections }}
{{ $headings = $headings | append .title }}
{{ end }}
{{ end }}
{{- $page := . -}} {{- $page := . -}}
{{- $orientation := site.Params.list.feature.orientation | default "horizontal" -}} {{- $orientation := site.Params.list.feature.orientation | default "horizontal" -}}
@@ -33,86 +39,9 @@
{{- define "main" -}} {{- define "main" -}}
{{- $page := . -}} {{- $page := . -}}
{{- $sections := slice -}} {{- $sections := $.Scratch.Get "sections" -}}
{{- $sections = $sections | append $page.Type -}}
{{ with $page.Params.sections }}
{{ $sections = $sections | append . }}
{{ end }}
{{- $headings := slice -}}
{{- $layout := $page.Params.layout -}} {{- $layout := $page.Params.layout -}}
{{ if $page.IsHome }}
{{- if not $page.Params.sections -}}
{{- with site.Params.home.sections }}
{{ $sections = $sections | append . }}
{{ else }}
{{ range $section := site.Sections }}
{{ $sections = $sections | append $section.Type }}
{{ end }}
{{ end }}
{{- end -}}
{{ else }}
{{ $headings = $headings | append $page.Title }}
{{- range .Fragments.Headings }}
{{- range .Headings }}
{{- $headings = $headings | append .Title -}}
{{- end -}}
{{- end -}}
{{ end }}
{{/* Generate section content first to determine headings */}}
{{ $body := "" }}
{{- range $index, $section := $sections -}}
{{- $sectionPage := site.GetPage "section" $section -}}
{{- $sectionURL := $sectionPage.RelPermalink -}}
{{ with $sectionPage.Params.redirect}}
{{ $target := partial "utilities/GetPage.html" (dict "url" . "page" $page) }}
{{- if not $target -}}
{{ if eq (printf "%T" $page.File) "*hugolib.fileInfo"}}
{{- errorf "Cannot find redirect target on page '%s': %s" $page.File . -}}
{{ else }}
{{- errorf "Cannot find redirect target: %s" . -}}
{{ end }}
{{ else }}
{{- $sectionURL = $target.RelPermalink -}}
{{ end }}
{{ end }}
{{- $title := or $sectionPage.Title $sectionPage.Type -}}
{{- with (index site.Params.sections $section) -}}
{{- with index . "title" }}{{ $title = or . $title }}{{ end -}}
{{- end -}}
{{- $thumbnail := (or (and (reflect.IsMap $sectionPage.Params.Thumbnail) $sectionPage.Params.Thumbnail.url) $sectionPage.Params.Thumbnail) -}}
{{- $icon := $sectionPage.Params.Icon -}}
{{- $content := $sectionPage.Content -}}
{{- $sectionTitle := strings.FirstUpper $sectionPage.Type -}}
{{- $moreTitle := "" -}}
{{- with (index site.Params.sections $section) -}}
{{- with index . "reference" }}{{ $moreTitle = . }}{{ end -}}
{{- end -}}
{{- $moreTitle = or $moreTitle (printf (T "more" (pluralize $sectionTitle))) -}}
{{- $sectionContent := trim (partial "assets/section-list.html" (dict
"page" $page
"section" $section
"home" $page.IsHome
"simple" (eq (len $sections) 1)
"nested" (and $page.IsHome (eq $section $page.Section))
"thumbnail" $thumbnail
"icon" $icon
"content" $content
"moreTitle" $moreTitle
"sectionURL" $sectionURL)) " \r\n"
-}}
{{ if $sectionContent }}
{{- if not $page.IsHome }}{{ $headings = $headings | append $title }}{{ end -}}
{{- $body = printf "%s%s" $body $sectionContent }}
{{ end }}
{{- end -}}
{{/* Display main content */}}
<div class="container-xxl flex-fill px-4 px-xxl-0"> <div class="container-xxl flex-fill px-4 px-xxl-0">
{{- if ne $layout "featured" -}} {{- if ne $layout "featured" -}}
{{ if and (not $page.IsHome) site.Params.navigation.breadcrumb }} {{ if and (not $page.IsHome) site.Params.navigation.breadcrumb }}
@@ -130,7 +59,7 @@
{{- end -}} {{- end -}}
{{- $content := partial "utilities/ProcessContent" (dict "page" $page "raw" $page.RawContent) -}} {{- $content := partial "utilities/ProcessContent" (dict "page" $page "raw" $page.RawContent) -}}
{{ $content | safeHTML }} {{ $content | safeHTML }}
{{ if and (and (and $sections (eq (len $sections) 1)) (not $body)) (not $content) }} {{ if and (and $sections (eq (len $sections) 1)) (not $content) }}
<p class="pt-4">{{- T "emptyList" }}.</p> <p class="pt-4">{{- T "emptyList" }}.</p>
{{ end }} {{ end }}
</div> </div>
@@ -153,5 +82,7 @@
</div> </div>
{{/* Display generated sections */}} {{/* Display generated sections */}}
{{ $body | safeHTML }} {{ range $sections }}
{{ .content | safeHTML }}
{{ end }}
{{- end -}} {{- end -}}

View File

@@ -37,7 +37,7 @@
<div class="offcanvas offcanvas-start" tabindex="-1" id="offcanvass-sidebar" aria-inledby="offcanvas-label"> <div class="offcanvas offcanvas-start" tabindex="-1" id="offcanvass-sidebar" aria-inledby="offcanvas-label">
<div class="offcanvas-header"> <div class="offcanvas-header">
<h5 class="offcanvas-title" id="offcanvas-label">{{ strings.FirstUpper $.Section }}</h5> <h5 class="offcanvas-title" id="offcanvas-label">{{ strings.FirstUpper $.Section }}</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button> <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="{{ T "close" }}"></button>
</div> </div>
<div class="offcanvas-body"> <div class="offcanvas-body">
{{ . | safeHTML }} {{ . | safeHTML }}

View File

@@ -161,7 +161,7 @@
> >
<div class="d-flex justify-content-{{ $justify }}"> <div class="d-flex justify-content-{{ $justify }}">
<div class="my-auto">{{ $title | safeHTML }}</div> <div class="my-auto">{{ $title | safeHTML }}</div>
{{- with $icon }}<div class="align-self-center{{ if $title }}{{ if eq $order "first" }} order-first pe-1{{ else }} ps-1{{ end }}{{ end }}">{{ partial "assets/icon.html" (dict "icon" $icon) }}</div>{{ end }} {{- with $icon }}<div class="align-self-center{{ if $title }}{{ if eq $order "first" }} order-first pe-1{{ else }} ps-1{{ end }}{{ end }}">{{ partial "assets/icon.html" (dict "icon" $icon "spacing" false) }}</div>{{ end }}
</div> </div>
{{- with $badge }} {{- with $badge }}

View File

@@ -242,8 +242,9 @@
<!-- Insert the brand logo or name --> <!-- Insert the brand logo or name -->
<a class="navbar-brand mx-auto" href="{{ site.Home.RelPermalink }}"> <a class="navbar-brand mx-auto" href="{{ site.Home.RelPermalink }}">
{{- if (and $logoLight $logoDark) -}} {{- if (and $logoLight $logoDark) -}}
<img src="{{if $absoluteURL }}{{ absURL $logoLight }}{{ else }}{{ $logoLight }}{{ end }}" class="d-none-dark" alt="{{ $title }} logo" height="30"> {{ $width := partial "utilities/GetWidth.html" (dict "path" $logoLight "height" 30) }}
<img src="{{if $absoluteURL }}{{ absURL $logoDark }}{{ else }}{{ $logoDark }}{{ end }}" class="d-none-light" alt="{{ $title }} logo" height="30"> <img src="{{if $absoluteURL }}{{ absURL $logoLight }}{{ else }}{{ $logoLight }}{{ end }}" class="d-none-dark" alt="{{ $title }} logo" height="30"{{ with $width }} width="{{ . }}"{{ end }}>
<img src="{{if $absoluteURL }}{{ absURL $logoDark }}{{ else }}{{ $logoDark }}{{ end }}" class="d-none-light" alt="{{ $title }} logo" height="30"{{ with $width }} width="{{ . }}"{{ end }}>
{{- else if $logo -}} {{- else if $logo -}}
{{ $width := partial "utilities/GetWidth.html" (dict "path" $logo "height" 30) }} {{ $width := partial "utilities/GetWidth.html" (dict "path" $logo "height" 30) }}
<img src="{{if $absoluteURL }}{{ absURL $logo }}{{ else }}{{ $logo }}{{ end }}" alt="{{ $title }} logo" height="30"{{ with $width }} width="{{ . }}"{{ end }}> <img src="{{if $absoluteURL }}{{ absURL $logo }}{{ else }}{{ $logo }}{{ end }}" alt="{{ $title }} logo" height="30"{{ with $width }} width="{{ . }}"{{ end }}>
@@ -356,7 +357,7 @@
<input id="search-input-modal" class="search-input form-control is-search" tabindex="1" type="search" placeholder="{{ T "ui_search" }}..." aria-label="{{ T "ui_search" }}" autocomplete="off"> <input id="search-input-modal" class="search-input form-control is-search" tabindex="1" type="search" placeholder="{{ T "ui_search" }}..." aria-label="{{ T "ui_search" }}" autocomplete="off">
</form> </form>
</div> </div>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="{{ T "close" }}"></button>
</div> </div>
<div class="modal-body p-2"> <div class="modal-body p-2">
<div class="search-suggestions bg-body" data-no-results="{{ T "ui_no_results" }}"></div> <div class="search-suggestions bg-body" data-no-results="{{ T "ui_no_results" }}"></div>

View File

@@ -10,6 +10,6 @@
{{- if $pageAlertMsg -}} {{- if $pageAlertMsg -}}
<div id="page-alert" class="alert alert-primary alert-no-decoration fade show d-flex align-items-center small m-0 py-1" data-page-alert-version="{{ $version }}"> <div id="page-alert" class="alert alert-primary alert-no-decoration fade show d-flex align-items-center small m-0 py-1" data-page-alert-version="{{ $version }}">
<a href="{{ with $pageAlertURL }}{{ . }}{{ else }}#!{{ end }}" class="text-decoration-none flex-grow-1 text-center">{{ $pageAlertMsg }}</a> <a href="{{ with $pageAlertURL }}{{ . }}{{ else }}#!{{ end }}" class="text-decoration-none flex-grow-1 text-center">{{ $pageAlertMsg }}</a>
<button id="page-alert-btn-close" type="button" class="btn-close" data-bs-dismiss="alert"></button> <button id="page-alert-btn-close" type="button" class="btn-close" data-bs-dismiss="alert" aria-label="{{ T "close" }}"></button>
</div> </div>
{{- end -}} {{- end -}}

View File

@@ -25,7 +25,7 @@
<div id="{{ $id }}" class="toast{{ with $class }} {{ . }}{{ end }}" role="alert" aria-live="assertive" aria-atomic="true"> <div id="{{ $id }}" class="toast{{ with $class }} {{ . }}{{ end }}" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-header"> <div class="toast-header">
{{ with $header }}<strong class="me-auto">{{ . }}</strong>{{ end }} {{ with $header }}<strong class="me-auto">{{ . }}</strong>{{ end }}
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button> <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="{{ T "close" }}"></button>
</div> </div>
<div class="toast-body">{{ $message }}</div> <div class="toast-body">{{ $message }}</div>
</div> </div>

View File

@@ -31,7 +31,8 @@
<span class="fs-5 text-muted">{{ $page.Description }}</span> <span class="fs-5 text-muted">{{ $page.Description }}</span>
{{ if $actions }} {{ if $actions }}
<div class="hstack{{ if gt (len $actions) 1 }} gap-3{{ end }} justify-content-{{ $align}} pt-5 pt-md-3"> {{- $actions = sort $actions "weight" "asc" -}}
<div class="hstack{{ if gt (len $actions) 1 }} gap-1{{ end }} justify-content-{{ $align}} pt-5 pt-md-3">
{{ range $actions }} {{ range $actions }}
{{ partial "assets/button.html" (dict "href" .url "icon" .icon "title" .title "outline" .outline "order" "last" "justify" "start") }} {{ partial "assets/button.html" (dict "href" .url "icon" .icon "title" .title "outline" .outline "order" "last" "justify" "start") }}
{{ end }} {{ end }}

View File

@@ -0,0 +1,76 @@
{{- $page := . -}}
{{/* Add title for current page */}}
{{- $items := slice -}}
{{ $items = $items | append (dict "title" .Title "content" "" )}}
{{/* Identify page sections */}}
{{- $sections := slice -}}
{{- $sections = $sections | append $page.Type -}}
{{ with $page.Params.sections }}
{{ $sections = $sections | append . }}
{{ end }}
{{ if $page.IsHome }}
{{- if not $page.Params.sections -}}
{{- with site.Params.home.sections }}
{{ $sections = $sections | append . }}
{{ else }}
{{ range $section := site.Sections }}
{{ $sections = $sections | append $section.Type }}
{{ end }}
{{ end }}
{{- end -}}
{{ end }}
{{/* Generate title and content for each section */}}
{{- range $index, $section := $sections -}}
{{- $sectionPage := site.GetPage "section" $section -}}
{{- $sectionURL := $sectionPage.RelPermalink -}}
{{ with $sectionPage.Params.redirect}}
{{ $target := partial "utilities/GetPage.html" (dict "url" . "page" $page) }}
{{- if not $target -}}
{{ if eq (printf "%T" $page.File) "*hugolib.fileInfo"}}
{{- errorf "Cannot find redirect target on page '%s': %s" $page.File . -}}
{{ else }}
{{- errorf "Cannot find redirect target: %s" . -}}
{{ end }}
{{ else }}
{{- $sectionURL = $target.RelPermalink -}}
{{ end }}
{{ end }}
{{- $title := or $sectionPage.Title $sectionPage.Type -}}
{{- with (index site.Params.sections $section) -}}
{{- with index . "title" }}{{ $title = or . $title }}{{ end -}}
{{- end -}}
{{- $thumbnail := (or (and (reflect.IsMap $sectionPage.Params.Thumbnail) $sectionPage.Params.Thumbnail.url) $sectionPage.Params.Thumbnail) -}}
{{- $icon := $sectionPage.Params.Icon -}}
{{- $content := $sectionPage.Content -}}
{{- $sectionTitle := strings.FirstUpper $sectionPage.Type -}}
{{- $moreTitle := "" -}}
{{- with (index site.Params.sections $section) -}}
{{- with index . "reference" }}{{ $moreTitle = . }}{{ end -}}
{{- end -}}
{{- $moreTitle = or $moreTitle (printf (T "more" (pluralize $sectionTitle))) -}}
{{- $sectionContent := trim (partial "assets/section-list.html" (dict
"page" $page
"section" $section
"home" $page.IsHome
"simple" (eq (len $sections) 1)
"nested" (and $page.IsHome (eq $section $page.Section))
"thumbnail" $thumbnail
"icon" $icon
"content" $content
"moreTitle" $moreTitle
"sectionURL" $sectionURL)) " \r\n"
-}}
{{ if $sectionContent }}
{{ $items = $items | append (dict "title" $title "content" $sectionContent)}}
{{ end }}
{{- end -}}
{{ return $items }}

View File

@@ -5,7 +5,7 @@
{{ if eq (path.Ext $path) ".svg" }} {{ if eq (path.Ext $path) ".svg" }}
{{ $path := path.Join "static" .path }} {{ $path := path.Join "static" .path }}
{{ if fileExists $path }} {{ if fileExists $path }}
{{ with findRE `viewBox="\d+[\s,]\d+[\s,]\d+[\s,]\d+"` (readFile $path) 1 }} {{ with findRE `viewBox="\d*\.?\d+[\s,]\d*\.?\d+[\s,]\d*\.?\d+[\s,]\d*\.?\d+"` (readFile $path) 1 }}
{{ $content := split (index (split (index . 0) `"`) 1) " " }} {{ $content := split (index (split (index . 0) `"`) 1) " " }}
{{ $viewbox_width := float (index $content 2) }} {{ $viewbox_width := float (index $content 2) }}
{{ $viewbox_height := float (index $content 3) }} {{ $viewbox_height := float (index $content 3) }}

View File

@@ -56,7 +56,7 @@
{{ with $icon }}<div class="pt-1 pe-2">{{ . }}</div>{{ end }} {{ with $icon }}<div class="pt-1 pe-2">{{ . }}</div>{{ end }}
<div class="flex-grow-1 my-auto"> <div class="flex-grow-1 my-auto">
{{ trim .Inner " \r\n" | .Page.RenderString | safeHTML -}} {{ trim .Inner " \r\n" | .Page.RenderString | safeHTML -}}
{{ if $dismissible }}<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>{{ end }} {{ if $dismissible }}<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="{{ T "close" }}"></button>{{ end }}
</div> </div>
</div> </div>
{{- end -}} {{- end -}}

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "@gethinode/hinode", "name": "@gethinode/hinode",
"version": "0.21.0-beta3", "version": "0.21.0-beta5",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@gethinode/hinode", "name": "@gethinode/hinode",
"version": "0.21.0-beta3", "version": "0.21.0-beta5",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@fullhuman/postcss-purgecss": "^5.0.0", "@fullhuman/postcss-purgecss": "^5.0.0",

View File

@@ -1,6 +1,6 @@
{ {
"name": "@gethinode/hinode", "name": "@gethinode/hinode",
"version": "0.21.0-beta3", "version": "0.21.0-beta5",
"description": "Hinode is a clean documentation and blog theme for Hugo, an open-source static site generator", "description": "Hinode is a clean documentation and blog theme for Hugo, an open-source static site generator",
"keywords": [ "keywords": [
"hugo", "hugo",