Compare commits

...

3 Commits

Author SHA1 Message Date
Mark Dumay
4e6aad33d6 Merge pull request #1458 from gethinode/develop
FIx rendering of inner nav-item content
2025-06-10 17:24:04 +02:00
Mark Dumay
8c3989e4f1 Merge branch 'main' into develop 2025-06-10 17:12:37 +02:00
Mark Dumay
42a81bab5f FIx rendering of inner nav-item content 2025-06-10 17:10:36 +02:00
9 changed files with 26 additions and 20 deletions

View File

@@ -1,6 +1,8 @@
comment: >- comment: >-
Defines an individual item. Defines an individual item.
arguments: arguments:
page:
group: partial
id: id:
group: partial group: partial
parent-id: parent-id:

View File

@@ -33,8 +33,9 @@ As an example, the following shortcode displays an accordion with three elements
{{< example lang="hugo" >}} {{< example lang="hugo" >}}
{{</* accordion */>}} {{</* accordion */>}}
{{</* accordion-item title="Accordion Item #1" show="true" */>}} {{</* accordion-item title="Accordion Item #1" show="true" */>}}
This is the first item's accordion body. It supports HTML content, if enabled in the goldmark This is the first item's accordion body.
renderer. The item is shown by adding the value `show` to the `class` argument. It supports Markdown content. The item
is shown by adding the value `show` to the `class` argument.
{{</* /accordion-item */>}} {{</* /accordion-item */>}}
{{</* accordion-item title="Accordion Item #2" */>}} {{</* accordion-item title="Accordion Item #2" */>}}
This is the second item's accordion body. This is the second item's accordion body.
@@ -352,8 +353,8 @@ As an example, the following shortcode displays a tab group with vertically alig
{{< example lang="hugo" >}} {{< example lang="hugo" >}}
{{</* nav tab-type="pills" vertical="true" */>}} {{</* nav tab-type="pills" vertical="true" */>}}
{{</* nav-item title="Nav Item #1" show="true" */>}} {{</* nav-item title="Nav Item #1" show="true" */>}}
This is the first item's nav body. It supports HTML content, if enabled in the goldmark This is the first item's nav body. It supports Markdown content.
renderer. The item is shown by adding the value `show` to the `class` argument. The item is shown by adding the value `show` to the `class` argument.
{{</* /nav-item */>}} {{</* /nav-item */>}}
{{</* nav-item title="Nav Item #2" */>}} {{</* nav-item title="Nav Item #2" */>}}
This is the second item's nav body. This is the second item's nav body.

View File

@@ -603,11 +603,11 @@
"fab-medium", "fab-medium",
"fab-whatsapp", "fab-whatsapp",
"fab-x-twitter", "fab-x-twitter",
"faq-422100b13f9388f5e5d9733a89582b72", "faq-d60f86697e8e822c14f81bde047a063e",
"faq-422100b13f9388f5e5d9733a89582b72-heading-faq-422100b13f9388f5e5d9733a89582b72", "faq-d60f86697e8e822c14f81bde047a063e-heading-faq-d60f86697e8e822c14f81bde047a063e",
"faq-422100b13f9388f5e5d9733a89582b72-item-0", "faq-d60f86697e8e822c14f81bde047a063e-item-0",
"faq-422100b13f9388f5e5d9733a89582b72-item-1", "faq-d60f86697e8e822c14f81bde047a063e-item-1",
"faq-422100b13f9388f5e5d9733a89582b72-item-2", "faq-d60f86697e8e822c14f81bde047a063e-item-2",
"fas-1", "fas-1",
"fas-2", "fas-2",
"fas-3", "fas-3",

View File

@@ -72,7 +72,7 @@
aria-labelledby="{{ $parentID }}-heading-{{ $args.id }}" aria-labelledby="{{ $parentID }}-heading-{{ $args.id }}"
data-bs-parent="#accordion-{{ $parentID }}" data-bs-parent="#accordion-{{ $parentID }}"
> >
<div class="accordion-body">{{- $args.body | safeHTML -}}</div> <div class="accordion-body">{{ $args.body | $args.page.RenderString | safeHTML }}</div>
</div> </div>
</div> </div>
{{ else }} {{ else }}
@@ -87,7 +87,7 @@
data-has-content="{{ gt (len $args.body) 0 }}" data-has-content="{{ gt (len $args.body) 0 }}"
{{ if $args.disabled }} data-disabled-id="{{ $args.id }}"{{ end }} {{ if $args.disabled }} data-disabled-id="{{ $args.id }}"{{ end }}
> >
{{ $args.body }} {{ $args.body | $args.page.RenderString | safeHTML }}
</div> </div>
{{ end }} {{ end }}
{{ end }} {{ end }}

View File

@@ -33,7 +33,8 @@
<div class="d-lg-none"> <div class="d-lg-none">
<div id="accordion-{{ $id }}" class="accordion mb-3{{ with $args.class }} {{ . }}{{ end }} nav-callout"> <div id="accordion-{{ $id }}" class="accordion mb-3{{ with $args.class }} {{ . }}{{ end }} nav-callout">
{{- range $index, $item := $args.list -}} {{- range $index, $item := $args.list -}}
{{ partial "assets/nav-item.html" (dict {{ partial "assets/nav-item.html" (dict
"page" $args.page
"id" $index "id" $index
"parentID" $id "parentID" $id
"fade" false "fade" false

View File

@@ -30,11 +30,12 @@
{{- if isset .Parent.Params "fade" }}{{ $parentFade = partial "utilities/CastBool.html" (.Parent.Get "fade") }}{{ end -}} {{- if isset .Parent.Params "fade" }}{{ $parentFade = partial "utilities/CastBool.html" (.Parent.Get "fade") }}{{ end -}}
{{- $fade = or $fade $parentFade -}} {{- $fade = or $fade $parentFade -}}
{{- $title := or $args.title $args.header -}} {{- $title := or $args.title $args.header -}}
{{- $body := trim .Inner " \r\n" | .Page.RenderString -}} {{- $body := trim .Inner " \r\n" -}}
{{- $current := "" -}} {{- $current := "" -}}
{{/* Main code */}} {{/* Main code */}}
{{- $output := partial "assets/nav-item.html" (dict {{- $output := partial "assets/nav-item.html" (dict
"page" .Page
"id" $id "id" $id
"parent-id" $parent "parent-id" $parent
"fade" $fade "fade" $fade
@@ -57,6 +58,7 @@
{{- end }} {{- end }}
{{- $alternative := partial "assets/nav-item" (dict {{- $alternative := partial "assets/nav-item" (dict
"page" .Page
"id" $id "id" $id
"parent-id" $parent "parent-id" $parent
"fade" $fade "fade" $fade

View File

@@ -21,9 +21,9 @@
{{- $innerTitles := .Scratch.Get "inner-title" -}} {{- $innerTitles := .Scratch.Get "inner-title" -}}
{{- $input := trim .Inner " \r\n" -}} {{- $input := trim .Inner " \r\n" -}}
{{- if $input -}} {{- if $input -}}
{{ $input = replace $input "\n" "\n " -}} {{- $input = replace $input "\n" "\n " -}}
{{ warnf "Unexpected inner content: %s\r\n %s" .Position $input -}} {{- warnf "Unexpected inner content: %s\r\n %s" .Position $input -}}
{{ end }} {{- end -}}
{{/* Main code */}} {{/* Main code */}}
{{- if not $args.err -}} {{- if not $args.err -}}
@@ -41,4 +41,4 @@
"width" $args.width "width" $args.width
) )
-}} -}}
{{ end }} {{- end -}}

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "@gethinode/hinode", "name": "@gethinode/hinode",
"version": "1.0.0-alpha5", "version": "1.0.0-alpha6",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@gethinode/hinode", "name": "@gethinode/hinode",
"version": "1.0.0-alpha5", "version": "1.0.0-alpha6",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@fullhuman/postcss-purgecss": "^7.0.2", "@fullhuman/postcss-purgecss": "^7.0.2",

View File

@@ -1,6 +1,6 @@
{ {
"name": "@gethinode/hinode", "name": "@gethinode/hinode",
"version": "1.0.0-alpha5", "version": "1.0.0-alpha6",
"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",