Compare commits

...

15 Commits

Author SHA1 Message Date
Mark Dumay
6b250b8d4c Merge pull request #1455 from gethinode/develop
Refine assets
2025-06-08 08:34:23 +02:00
Mark Dumay
90f8f91e61 Merge branch 'main' into develop 2025-06-08 08:26:31 +02:00
Mark Dumay
cc0d83189d Enhance rendering of args shortcode 2025-06-08 08:24:52 +02:00
Mark Dumay
4d4db9e870 Add default hook for card images 2025-06-08 07:19:10 +02:00
Mark Dumay
58cfcc9131 Improve backwards compatibility of kbd shortcode 2025-06-08 07:18:06 +02:00
Mark Dumay
362aae875e Fix video asset bugs 2025-06-08 07:16:50 +02:00
Mark Dumay
3f3a7c21e3 Fix handling of color modes for images 2025-06-08 07:15:54 +02:00
Mark Dumay
dddb881628 Update dependencies 2025-06-08 07:14:00 +02:00
Mark Dumay
1a0b2f5632 Merge pull request #1454 from gethinode/develop
Clean up modules
2025-06-08 05:58:08 +02:00
Mark Dumay
b25de1eb02 Merge branch 'main' into develop 2025-06-08 05:50:04 +02:00
Mark Dumay
0a0315e531 Bump package version 2025-06-08 05:48:52 +02:00
Mark Dumay
9a1a1405fe Update build stats 2025-06-08 05:48:31 +02:00
Mark Dumay
f7bda6236e Update footer arguments 2025-06-08 05:48:27 +02:00
Mark Dumay
c8c5384bd3 Clean up modules 2025-06-08 05:48:03 +02:00
Mark Dumay
4d4d5ad9bd Update dependencies 2025-06-08 05:47:53 +02:00
16 changed files with 288 additions and 147 deletions

View File

@@ -2,6 +2,9 @@ comment: >-
Generates a markdown table of structured arguments. The argument definitions are Generates a markdown table of structured arguments. The argument definitions are
expected to be defined in a data file identified by a provided structure name. expected to be defined in a data file identified by a provided structure name.
arguments: arguments:
page:
optional: false
group: partial
structure: structure:
type: string type: string
position: 0 position: 0
@@ -26,3 +29,28 @@ arguments:
comment: >- comment: >-
Flag to filter only arguments that have a parent attribute (either Flag to filter only arguments that have a parent attribute (either
`cascade` or `merge`). `cascade` or `merge`).
render-type:
type: select
position: 3
default: both
optional: true
comment: >-
Option whether to render arguments, user-defined types, or both. Please
note that the arguments will render a link to a user-defined type in any
case.
options:
values:
- arguments
- types
- both
release: v1.0.0
header-level:
type: int
default: 3
optional: true
options:
min: 1
max: 6
comment: >-
The header level to use for the user-defined type headers.
release: v1.0.0

View File

@@ -65,6 +65,7 @@ arguments:
release: v1.0.0 release: v1.0.0
link-type: link-type:
hook: hook:
default: assets/image.html
group: partial group: partial
sizes: sizes:
group: partial group: partial

View File

@@ -1,6 +1,7 @@
comment: Adds a keyboard input element. comment: Adds a keyboard input element.
arguments: arguments:
text: text:
optional: true
position: 0 position: 0
release: v1.0.0 release: v1.0.0
class: class:

View File

@@ -602,21 +602,76 @@
"fab-medium", "fab-medium",
"fab-whatsapp", "fab-whatsapp",
"fab-x-twitter", "fab-x-twitter",
"faq-184f299e274a5ce56b6a879ad10e2b73", "faq-082ce0b6bb6c6cce73c7496619914264",
"faq-184f299e274a5ce56b6a879ad10e2b73-heading-faq-184f299e274a5ce56b6a879ad10e2b73", "faq-082ce0b6bb6c6cce73c7496619914264-heading-faq-082ce0b6bb6c6cce73c7496619914264",
"faq-184f299e274a5ce56b6a879ad10e2b73-item-0", "faq-082ce0b6bb6c6cce73c7496619914264-item-0",
"faq-184f299e274a5ce56b6a879ad10e2b73-item-1", "faq-082ce0b6bb6c6cce73c7496619914264-item-1",
"faq-184f299e274a5ce56b6a879ad10e2b73-item-2", "faq-082ce0b6bb6c6cce73c7496619914264-item-2",
"faq-43ab418abcc6ab8991ad130c40cca21e", "faq-2b593cdb5946235fa6c9dd5baf6b1005",
"faq-43ab418abcc6ab8991ad130c40cca21e-heading-faq-43ab418abcc6ab8991ad130c40cca21e", "faq-2b593cdb5946235fa6c9dd5baf6b1005-heading-faq-2b593cdb5946235fa6c9dd5baf6b1005",
"faq-43ab418abcc6ab8991ad130c40cca21e-item-0", "faq-2b593cdb5946235fa6c9dd5baf6b1005-item-0",
"faq-43ab418abcc6ab8991ad130c40cca21e-item-1", "faq-2b593cdb5946235fa6c9dd5baf6b1005-item-1",
"faq-43ab418abcc6ab8991ad130c40cca21e-item-2", "faq-2b593cdb5946235fa6c9dd5baf6b1005-item-2",
"faq-5f13c156f93854db8bafbe22d85efd03", "faq-2c2510b2d9d07caeba3db403d3dd8b15",
"faq-5f13c156f93854db8bafbe22d85efd03-heading-faq-5f13c156f93854db8bafbe22d85efd03", "faq-2c2510b2d9d07caeba3db403d3dd8b15-heading-faq-2c2510b2d9d07caeba3db403d3dd8b15",
"faq-5f13c156f93854db8bafbe22d85efd03-item-0", "faq-2c2510b2d9d07caeba3db403d3dd8b15-item-0",
"faq-5f13c156f93854db8bafbe22d85efd03-item-1", "faq-2c2510b2d9d07caeba3db403d3dd8b15-item-1",
"faq-5f13c156f93854db8bafbe22d85efd03-item-2", "faq-2c2510b2d9d07caeba3db403d3dd8b15-item-2",
"faq-309fcd32850149af0c4e5875c9b2341e",
"faq-309fcd32850149af0c4e5875c9b2341e-heading-faq-309fcd32850149af0c4e5875c9b2341e",
"faq-309fcd32850149af0c4e5875c9b2341e-item-0",
"faq-309fcd32850149af0c4e5875c9b2341e-item-1",
"faq-309fcd32850149af0c4e5875c9b2341e-item-2",
"faq-58b4f07bae1855b79866a61f8c5fe483",
"faq-58b4f07bae1855b79866a61f8c5fe483-heading-faq-58b4f07bae1855b79866a61f8c5fe483",
"faq-58b4f07bae1855b79866a61f8c5fe483-item-0",
"faq-58b4f07bae1855b79866a61f8c5fe483-item-1",
"faq-58b4f07bae1855b79866a61f8c5fe483-item-2",
"faq-6715e288969a2e72fcf57126a6fad60d",
"faq-6715e288969a2e72fcf57126a6fad60d-heading-faq-6715e288969a2e72fcf57126a6fad60d",
"faq-6715e288969a2e72fcf57126a6fad60d-item-0",
"faq-6715e288969a2e72fcf57126a6fad60d-item-1",
"faq-6715e288969a2e72fcf57126a6fad60d-item-2",
"faq-7454f17e758ec5c4c0a8ea44eb09c923",
"faq-7454f17e758ec5c4c0a8ea44eb09c923-heading-faq-7454f17e758ec5c4c0a8ea44eb09c923",
"faq-7454f17e758ec5c4c0a8ea44eb09c923-item-0",
"faq-7454f17e758ec5c4c0a8ea44eb09c923-item-1",
"faq-7454f17e758ec5c4c0a8ea44eb09c923-item-2",
"faq-97b15406acccea0bcc123ffb7300b0f9",
"faq-97b15406acccea0bcc123ffb7300b0f9-heading-faq-97b15406acccea0bcc123ffb7300b0f9",
"faq-97b15406acccea0bcc123ffb7300b0f9-item-0",
"faq-97b15406acccea0bcc123ffb7300b0f9-item-1",
"faq-97b15406acccea0bcc123ffb7300b0f9-item-2",
"faq-ad09fcea481e57a87c978325a33c3700",
"faq-ad09fcea481e57a87c978325a33c3700-heading-faq-ad09fcea481e57a87c978325a33c3700",
"faq-ad09fcea481e57a87c978325a33c3700-item-0",
"faq-ad09fcea481e57a87c978325a33c3700-item-1",
"faq-ad09fcea481e57a87c978325a33c3700-item-2",
"faq-d911d42148285445a0e970e7769d031a",
"faq-d911d42148285445a0e970e7769d031a-heading-faq-d911d42148285445a0e970e7769d031a",
"faq-d911d42148285445a0e970e7769d031a-item-0",
"faq-d911d42148285445a0e970e7769d031a-item-1",
"faq-d911d42148285445a0e970e7769d031a-item-2",
"faq-de1edaacff57b5f927d93e17791ca22f",
"faq-de1edaacff57b5f927d93e17791ca22f-heading-faq-de1edaacff57b5f927d93e17791ca22f",
"faq-de1edaacff57b5f927d93e17791ca22f-item-0",
"faq-de1edaacff57b5f927d93e17791ca22f-item-1",
"faq-de1edaacff57b5f927d93e17791ca22f-item-2",
"faq-efb104176b982dcb8db3b89d076e1c39",
"faq-efb104176b982dcb8db3b89d076e1c39-heading-faq-efb104176b982dcb8db3b89d076e1c39",
"faq-efb104176b982dcb8db3b89d076e1c39-item-0",
"faq-efb104176b982dcb8db3b89d076e1c39-item-1",
"faq-efb104176b982dcb8db3b89d076e1c39-item-2",
"faq-f91cdd3629fc4d3372588f422a78bc81",
"faq-f91cdd3629fc4d3372588f422a78bc81-heading-faq-f91cdd3629fc4d3372588f422a78bc81",
"faq-f91cdd3629fc4d3372588f422a78bc81-item-0",
"faq-f91cdd3629fc4d3372588f422a78bc81-item-1",
"faq-f91cdd3629fc4d3372588f422a78bc81-item-2",
"faq-feb961d329b2907e0d71c90ca0e0d3e1",
"faq-feb961d329b2907e0d71c90ca0e0d3e1-heading-faq-feb961d329b2907e0d71c90ca0e0d3e1",
"faq-feb961d329b2907e0d71c90ca0e0d3e1-item-0",
"faq-feb961d329b2907e0d71c90ca0e0d3e1-item-1",
"faq-feb961d329b2907e0d71c90ca0e0d3e1-item-2",
"fas-1", "fas-1",
"fas-2", "fas-2",
"fas-3", "fas-3",

4
go.mod
View File

@@ -8,7 +8,6 @@ require (
github.com/gethinode/mod-bootstrap v1.3.3 // indirect github.com/gethinode/mod-bootstrap v1.3.3 // indirect
github.com/gethinode/mod-csp v1.0.7 // indirect github.com/gethinode/mod-csp v1.0.7 // indirect
github.com/gethinode/mod-flexsearch/v2 v2.1.1 // indirect github.com/gethinode/mod-flexsearch/v2 v2.1.1 // indirect
github.com/gethinode/mod-fontawesome v1.10.1 // indirect
github.com/gethinode/mod-fontawesome/v2 v2.0.0 // indirect github.com/gethinode/mod-fontawesome/v2 v2.0.0 // indirect
github.com/gethinode/mod-google-analytics v1.3.1 // indirect github.com/gethinode/mod-google-analytics v1.3.1 // indirect
github.com/gethinode/mod-katex v1.1.3 // indirect github.com/gethinode/mod-katex v1.1.3 // indirect
@@ -16,8 +15,7 @@ require (
github.com/gethinode/mod-lottie v1.5.14 // indirect github.com/gethinode/mod-lottie v1.5.14 // indirect
github.com/gethinode/mod-mermaid v1.1.23 // indirect github.com/gethinode/mod-mermaid v1.1.23 // indirect
github.com/gethinode/mod-simple-datatables v1.1.7 // indirect github.com/gethinode/mod-simple-datatables v1.1.7 // indirect
github.com/gethinode/mod-utils/v2 v2.10.0 // indirect github.com/gethinode/mod-utils/v3 v3.1.3 // indirect
github.com/gethinode/mod-utils/v3 v3.1.2 // indirect
github.com/nextapps-de/flexsearch v0.0.0-20250606060143-c28f52c09b7a // indirect github.com/nextapps-de/flexsearch v0.0.0-20250606060143-c28f52c09b7a // indirect
github.com/twbs/bootstrap v5.3.6+incompatible // indirect github.com/twbs/bootstrap v5.3.6+incompatible // indirect
) )

2
go.sum
View File

@@ -412,6 +412,8 @@ github.com/gethinode/mod-utils/v3 v3.1.1 h1:hjC/vnq7NF2Kf18qkpeTHiS14bVrNa55avy0
github.com/gethinode/mod-utils/v3 v3.1.1/go.mod h1:9iHYWiDpDlcyrGAOHniubK/kziJYhTsw7UpGM+u4MOM= github.com/gethinode/mod-utils/v3 v3.1.1/go.mod h1:9iHYWiDpDlcyrGAOHniubK/kziJYhTsw7UpGM+u4MOM=
github.com/gethinode/mod-utils/v3 v3.1.2 h1:nE1tUkeSTOPxaLRoSiQlODbJhekOJsHrKXte5A2jujg= github.com/gethinode/mod-utils/v3 v3.1.2 h1:nE1tUkeSTOPxaLRoSiQlODbJhekOJsHrKXte5A2jujg=
github.com/gethinode/mod-utils/v3 v3.1.2/go.mod h1:9iHYWiDpDlcyrGAOHniubK/kziJYhTsw7UpGM+u4MOM= github.com/gethinode/mod-utils/v3 v3.1.2/go.mod h1:9iHYWiDpDlcyrGAOHniubK/kziJYhTsw7UpGM+u4MOM=
github.com/gethinode/mod-utils/v3 v3.1.3 h1:oIpbIUCpVrWb7Axo1TZODWJ2iA6uYZp4rpx8fC7GIXk=
github.com/gethinode/mod-utils/v3 v3.1.3/go.mod h1:9iHYWiDpDlcyrGAOHniubK/kziJYhTsw7UpGM+u4MOM=
github.com/nextapps-de/flexsearch v0.0.0-20230711092928-1243fd883ec3 h1:H/qVR5O4BXjRjD+5PZB+r4ug2BSJ2Of4RtwOntd+OKo= github.com/nextapps-de/flexsearch v0.0.0-20230711092928-1243fd883ec3 h1:H/qVR5O4BXjRjD+5PZB+r4ug2BSJ2Of4RtwOntd+OKo=
github.com/nextapps-de/flexsearch v0.0.0-20230711092928-1243fd883ec3/go.mod h1:5GdMfPAXzbA2gXBqTjC6l27kioSYzHlqDMh0+wyx7sU= github.com/nextapps-de/flexsearch v0.0.0-20230711092928-1243fd883ec3/go.mod h1:5GdMfPAXzbA2gXBqTjC6l27kioSYzHlqDMh0+wyx7sU=
github.com/nextapps-de/flexsearch v0.0.0-20240108021025-afd75f742f22 h1:re7L8FxbXQpnX8BgzkdUnDpsUmloGNyLmiy2ZCln8pg= github.com/nextapps-de/flexsearch v0.0.0-20240108021025-afd75f742f22 h1:re7L8FxbXQpnX8BgzkdUnDpsUmloGNyLmiy2ZCln8pg=

View File

@@ -0,0 +1,130 @@
{{/*
Copyright © 2022 - 2025 The Hinode Team / Mark Dumay. All rights reserved.
Use of this source code is governed by The MIT License (MIT) that can be found in the LICENSE file.
Visit gethinode.com/license for more details.
*/}}
{{ $error := false }}
{{ define "_partials/inline/args-table.html"}}
{{ $args := .args }}
{{ $types := .types }}
{{ $page := .page }}
{{ $group := .group | default "" }}
{{ $parent := .parent }}
{{ $reflect := "" }}
{{ $table := printf "| %s | %s | %s | %s | %s |\n| --- | --- | --- | --- | --- |"
(T "name") (T "type") (T "required") (T "default") (T "comment")
}}
{{ range $key, $val := $args }}
{{ if eq $key "_reflect" }}
{{ $reflect = $val }}
{{ continue }}
{{ end }}
{{ $skip := false }}
{{ $groups := slice }}
{{ if $val }} {{ $groups = $groups | append $val.group }}{{ end }}
{{ if and $group $val.group }}
{{ $skip = not (in $groups $group )}}
{{ end }}
{{ if $parent }}{{ $skip = not (in (slice "cascade" "merge") $val.parent) }}{{ end }}
{{ if not $skip }}
{{ $type := $val.type }}
{{ $udt := false }}
{{ $slice := false }}
{{ if reflect.IsSlice $val.type }}{{ $type = delimit $val.type ", " }}{{ end }}
{{ with index $types $val.type }}
{{ $udt = true }}
{{ $slice = eq ._reflect "[]interface {}" }}
{{ end }}
{{ $required := "" }}
{{ if not $val.optional }}{{ $required = "yes" }}{{ end }}
{{ $comment := $val.comment }}
{{ if $val.deprecated }}
{{ $btn := printf `{{< release version="%s" short="true" button-size="sm" inline="true" release-state="deprecated" >}}` $val.deprecated }}
{{ with $val.alternative }}
{{ $comment = printf "%s **%s**. %s" $btn (T "alternativeFeature" .) $comment }}
{{ else }}
{{ $comment = printf "%s %s" $btn $comment }}
{{ end }}
{{ end }}
{{ if $val.release }}
{{ $comment = printf `{{< release version="%s" short="true" button-size="sm" inline="true" >}} %s` $val.release $comment }}
{{ end }}
{{ $min := "" }}
{{ $max := "" }}
{{ if and $val.options.values (eq $type "select") }}
{{ $comment = printf "%s %s: [`%s`]." $comment (T "supportedValues") (delimit $val.options.values "`, `") }}
{{ else if in (slice "int" "float" "float64") $type }}
{{ if eq (printf "%T" $val.options.min) "int" }}{{ $min = int $val.options.min }}{{ end }}
{{ if eq (printf "%T" $val.options.max) "int" }}{{ $max = int $val.options.max }}{{ end }}
{{ end }}
{{ if and (eq (printf "%T" $min) "int") (eq (printf "%T" $max) "int") }}
{{ $comment = printf "%s %s: [`%d - %d`]." $comment (T "supportedValues") $min $max }}
{{ else if (eq (printf "%T" $min) "int") }}
{{ $comment = printf "%s %s: `>=%d`." $comment (T "supportedValues") $min }}
{{ else if (eq (printf "%T" $max) "int") }}
{{ $comment = printf "%s %s: `<=%d`." $comment (T "supportedValues") $max }}
{{ end }}
{{ $default := "" }}
{{ with $val.default }}{{ $default = printf "`%v`" . }}{{ end }}
{{ if $udt }}{{ $type = printf "[%s](#%s)" $type (anchorize (printf "%s %s" $type (T "type"))) }}{{ end }}
{{ if $slice }}{{ $type = printf "[]%s" $type }}{{ end }}
{{ $table = printf "%s\n| %s | %s | %s | %s | %s |" $table $key $type $required $default $comment }}
{{ end }}
{{ end }}
{{ return partial "assets/table.html" (dict "page" $page "input" $table "wrap" true) }}
{{ end }}
{{/* Initialize arguments */}}
{{- $args := partial "utilities/InitArgs.html" (dict "structure" "args" "args" . "group" "partial") -}}
{{- if or $args.err $args.warnmsg -}}
{{- partial (cond $args.err "utilities/LogErr.html" "utilities/LogWarn.html") (dict
"partial" "assets/args.html"
"msg" "Invalid arguments"
"details" ($args.errmsg | append $args.warnmsg)
"file" page.File
) -}}
{{- $error = $args.err -}}
{{- end -}}
{{/* Initialize type structure */}}
{{ $structure := $args.structure }}
{{ $bookshop := "" }}
{{ if hasPrefix $structure "bookshop-" }}{{ $bookshop = strings.TrimPrefix "bookshop-" $structure }}{{ $structure = "" }}{{ end }}
{{ $types := dict }}
{{ if not $error }}
{{ $types = partial "utilities/InitTypes.html" (dict "structure" $structure "bookshop" $bookshop) }}
{{ if or $types.err $types.warnmsg }}
{{ partial (cond $args.err "utilities/LogErr.html" "utilities/LogWarn.html") (dict
"partial" "assets/args.html"
"msg" "Invalid arguments"
"details" ($types.errmsg | append $types.warnmsg)
"file" page.File
)}}
{{ $error = $args.err }}
{{ end }}
{{ end }}
{{/* Main code */}}
{{ if not $error }}
{{ $params := dict "types" $types.udt "page" $args.page "group" $args.group "parent" $args.parent }}
{{ if in (slice "arguments" "both") $args.renderType }}
{{ partial "inline/args-table.html" (merge $params (dict "args" $types.types)) }}
{{ end }}
{{ if in (slice "types" "both") $args.renderType }}
{{ $prefix := strings.Repeat $args.headerLevel "#" }}
{{ range $k, $v := $types.udt }}
{{ printf "%s %s %s" $prefix $k (T "type") | $args.page.RenderString }}
{{ partial "inline/args-table.html" (merge $params (dict "args" $v)) }}
{{ end }}
{{ end }}
{{ end }}

View File

@@ -61,7 +61,7 @@
{{- range $suffix := $modes -}} {{- range $suffix := $modes -}}
{{- $image := printf "%s-%s%s" $base $suffix $ext -}} {{- $image := printf "%s-%s%s" $base $suffix $ext -}}
{{- $params = merge $params (dict "src" $image "color-mode" $suffix "modes" $modes) -}} {{- $params = merge $params (dict "src" $image) -}}
{{- partial "assets/helpers/image-definition.html" $params -}} {{- partial "assets/helpers/image-definition.html" $params -}}
{{- end -}} {{- end -}}
{{ else }} {{ else }}

View File

@@ -32,7 +32,8 @@
{{ end }} {{ end }}
{{/* Initialize local arguments */}} {{/* Initialize local arguments */}}
{{- $provider := or $args.provider $args.host }} {{- $title := $args.title -}}
{{- $provider := or $args.host $args.provider }}
{{- $account := $args.account }} {{- $account := $args.account }}
{{ if not $account }} {{ if not $account }}
{{ with index $args.page.Site.Params.videos $provider }} {{ with index $args.page.Site.Params.videos $provider }}
@@ -148,7 +149,6 @@
{{ $width := index $metadata "width" }} {{ $width := index $metadata "width" }}
{{ if and $height $width }} {{ if and $height $width }}
{{ $padding := printf "%.2f%%" (mul (div (float $height) $width) 100) }} {{ $padding := printf "%.2f%%" (mul (div (float $height) $width) 100) }}
{{ $title := $args.title }}
{{ if not $title }}{{ $title = printf "Cloudinary video '%s'" (path.BaseName $id) }}{{ end }} {{ if not $title }}{{ $title = printf "Cloudinary video '%s'" (path.BaseName $id) }}{{ end }}
<div class="video-embedded {{ $args.class }}" data-video-padding="{{ $padding }}"> <div class="video-embedded {{ $args.class }}" data-video-padding="{{ $padding }}">

View File

@@ -5,7 +5,12 @@
{{ cond (gt (len .Site.Copyright) 0) .Site.Copyright $copyright }} {{ cond (gt (len .Site.Copyright) 0) .Site.Copyright $copyright }}
{{ .Site.Params.footer.license | safeHTML }} | {{ .Site.Params.footer.license | safeHTML }} |
{{ if .Site.Params.main.endorse }} {{ if .Site.Params.main.endorse }}
{{ $link := partial "assets/link.html" (dict "destination" (index site.Params.links "hinode") "text" "Hinode" "class" "link-bg-footer" "page" .Page) }} {{ $link := partial "assets/link.html" (dict
"href" (index site.Params.links "hinode")
"text" "Hinode"
"class" "link-bg-footer"
"page" .Page
) }}
{{ T "poweredBy" $link | safeHTML }} {{ T "poweredBy" $link | safeHTML }}
{{ end }} {{ end }}
</small> </small>

View File

@@ -4,124 +4,29 @@
Visit gethinode.com/license for more details. Visit gethinode.com/license for more details.
*/}} */}}
{{ $error := false }} {{- $error := false -}}
{{ define "_partials/inline/args-table.html"}}
{{ $args := .args }}
{{ $types := .types }}
{{ $page := .page }}
{{ $group := .group | default "" }}
{{ $parent := .parent }}
{{ $reflect := "" }}
{{ $table := printf "| %s | %s | %s | %s | %s |\n| --- | --- | --- | --- | --- |"
(T "name") (T "type") (T "required") (T "default") (T "comment")
}}
{{ range $key, $val := $args }}
{{ if eq $key "_reflect" }}
{{ $reflect = $val }}
{{ continue }}
{{ end }}
{{ $skip := false }}
{{ $groups := slice }}
{{ if $val }} {{ $groups = $groups | append $val.group }}{{ end }}
{{ if and $group $val.group }}
{{ $skip = not (in $groups $group )}}
{{ end }}
{{ if $parent }}{{ $skip = not (in (slice "cascade" "merge") $val.parent) }}{{ end }}
{{ if not $skip }}
{{ $type := $val.type }}
{{ $udt := false }}
{{ $slice := false }}
{{ if reflect.IsSlice $val.type }}{{ $type = delimit $val.type ", " }}{{ end }}
{{ with index $types $val.type }}
{{ $udt = true }}
{{ $slice = eq ._reflect "[]interface {}" }}
{{ end }}
{{ $required := "" }}
{{ if not $val.optional }}{{ $required = "yes" }}{{ end }}
{{ $comment := $val.comment }}
{{ if $val.deprecated }}
{{ $btn := printf `{{< release version="%s" short="true" button-size="sm" inline="true" release-state="deprecated" >}}` $val.deprecated }}
{{ with $val.alternative }}
{{ $comment = printf "%s **%s**. %s" $btn (T "alternativeFeature" .) $comment }}
{{ else }}
{{ $comment = printf "%s %s" $btn $comment }}
{{ end }}
{{ end }}
{{ if $val.release }}
{{ $comment = printf `{{< release version="%s" short="true" button-size="sm" inline="true" >}} %s` $val.release $comment }}
{{ end }}
{{ $min := "" }}
{{ $max := "" }}
{{ if and $val.options.values (eq $type "select") }}
{{ $comment = printf "%s %s: [`%s`]." $comment (T "supportedValues") (delimit $val.options.values "`, `") }}
{{ else if in (slice "int" "float" "float64") $type }}
{{ if eq (printf "%T" $val.options.min) "int" }}{{ $min = int $val.options.min }}{{ end }}
{{ if eq (printf "%T" $val.options.max) "int" }}{{ $max = int $val.options.max }}{{ end }}
{{ end }}
{{ if and (eq (printf "%T" $min) "int") (eq (printf "%T" $max) "int") }}
{{ $comment = printf "%s %s: [`%d - %d`]." $comment (T "supportedValues") $min $max }}
{{ else if (eq (printf "%T" $min) "int") }}
{{ $comment = printf "%s %s: `>=%d`." $comment (T "supportedValues") $min }}
{{ else if (eq (printf "%T" $max) "int") }}
{{ $comment = printf "%s %s: `<=%d`." $comment (T "supportedValues") $max }}
{{ end }}
{{ $default := "" }}
{{ with $val.default }}{{ $default = printf "`%v`" . }}{{ end }}
{{ if $udt }}{{ $type = printf "[%s](#%s)" $type (anchorize (printf "%s %s" $type (T "type"))) }}{{ end }}
{{ if $slice }}{{ $type = printf "[]%s" $type }}{{ end }}
{{ $table = printf "%s\n| %s | %s | %s | %s | %s |" $table $key $type $required $default $comment }}
{{ end }}
{{ end }}
{{ return partial "assets/table.html" (dict "page" $page "input" $table "wrap" true) }}
{{ end }}
{{/* Validate and initialize arguments */}} {{/* Validate and initialize arguments */}}
{{ $args := partial "utilities/InitArgs.html" (dict "structure" "args" "args" .Params "named" .IsNamedParams "group" "shortcode") }} {{- $args := partial "utilities/InitArgs.html" (dict "structure" "args" "args" .Params "named" .IsNamedParams "group" "shortcode") -}}
{{ if or $args.err $args.warnmsg }} {{- if or $args.err $args.warnmsg -}}
{{ partial (cond $args.err "utilities/LogErr.html" "utilities/LogWarn.html") (dict {{- partial (cond $args.err "utilities/LogErr.html" "utilities/LogWarn.html") (dict
"partial" "shortcodes/args.html" "partial" "shortcodes/args.html"
"msg" "Invalid arguments" "msg" "Invalid arguments"
"details" ($args.errmsg | append $args.warnmsg) "details" ($args.errmsg | append $args.warnmsg)
"file" page.File "file" page.File
"position" .Position "position" .Position
)}} ) -}}
{{ $error = $args.err }} {{- $error = $args.err -}}
{{ end }} {{- end -}}
{{/* Initialize type structure */}}
{{ $structure := $args.structure }}
{{ $bookshop := "" }}
{{ if hasPrefix $structure "bookshop-" }}{{ $bookshop = strings.TrimPrefix "bookshop-" $structure }}{{ $structure = "" }}{{ end }}
{{ $types := dict }}
{{ if not $error }}
{{ $types = partial "utilities/InitTypes.html" (dict "structure" $structure "bookshop" $bookshop) }}
{{ if or $types.err $types.warnmsg }}
{{ partial (cond $args.err "utilities/LogErr.html" "utilities/LogWarn.html") (dict
"partial" "shortcodes/args.html"
"msg" "Invalid arguments"
"details" ($types.errmsg | append $types.warnmsg)
"file" page.File
"position" .Position
)}}
{{ $error = $args.err }}
{{ end }}
{{ end }}
{{/* Main code */}} {{/* Main code */}}
{{ if not $error }} {{- if not $args.err -}}
{{ $params := dict "types" $types.udt "page" .Page "group" $args.group "parent" $args.parent }} {{- partial "assets/args.html" (dict
{{ partial "inline/args-table.html" (merge $params (dict "args" $types.types)) }} "page" .Page
"structure" $args.structure
{{ range $k, $v := $types.udt }} "group" $args.group
{{ printf "## %s %s" $k (T "type") | $.Page.RenderString }} "parent" $args.parent
{{ partial "inline/args-table.html" (merge $params (dict "args" $v)) }} "render-type" $args.renderType
{{ end }} "header-level" $args.headerLevel
{{ end }} ) -}}
{{- end -}}

View File

@@ -4,6 +4,8 @@
Visit gethinode.com/license for more details. Visit gethinode.com/license for more details.
*/}} */}}
{{- $error := false -}}
{{/* Initialize arguments */}} {{/* Initialize arguments */}}
{{- $args := partial "utilities/InitArgs.html" (dict "structure" "kbd" "args" .Params "named" .IsNamedParams "group" "shortcode") -}} {{- $args := partial "utilities/InitArgs.html" (dict "structure" "kbd" "args" .Params "named" .IsNamedParams "group" "shortcode") -}}
{{- if or $args.err $args.warnmsg -}} {{- if or $args.err $args.warnmsg -}}
@@ -13,12 +15,26 @@
"details" ($args.errmsg | append $args.warnmsg) "details" ($args.errmsg | append $args.warnmsg)
"file" page.File "file" page.File
"position" .Position "position" .Position
)}} ) -}}
{{- $error = $args.err -}}
{{- end -}}
{{/* Initialize local arguments */}}
{{- $text := or $args.text $args.title }}
{{- if not $text -}}
{{- partial "utilities/LogErr.html" (dict
"partial" "shortcodes/kbd.html"
"msg" "Invalid arguments"
"details" (slice "argument 'text': expected value")
"file" page.File
"position" .Position
) -}}
{{- $error = true -}}
{{- end -}} {{- end -}}
{{/* Main code */}} {{/* Main code */}}
{{- if not $args.error }} {{- if not $error }}
<kbd {{ if or $args.color $args.class }}class="{{ with $args.color }}text-bg-{{ . }} {{ end }}{{ $args.class }}"{{ end }}> <kbd {{ if or $args.color $args.class }}class="{{ with $args.color }}text-bg-{{ . }} {{ end }}{{ $args.class }}"{{ end }}>
{{ or $args.text $args.title | plainify }} {{ $text | plainify }}
</kbd> </kbd>
{{ end -}} {{ end -}}

View File

@@ -21,7 +21,7 @@
{{ partial "assets/video.html" (dict {{ partial "assets/video.html" (dict
"page" .Page "page" .Page
"position" .Position "position" .Position
"provider" (or $args.host $args.provider) "provider" "vimeo"
"media-id" (or $args.mediaId $args.id) "media-id" (or $args.mediaId $args.id)
"class" $args.class "class" $args.class
"title" (or $args.title "Vimeo Video") "title" (or $args.title "Vimeo Video")

View File

@@ -21,7 +21,7 @@
{{ partial "assets/video.html" (dict {{ partial "assets/video.html" (dict
"page" .Page "page" .Page
"position" .Position "position" .Position
"provider" (or $args.host $args.provider) "provider" "youtube"
"media-id" (or $args.mediaId $args.id) "media-id" (or $args.mediaId $args.id)
"class" $args.class "class" $args.class
"title" (or $args.title "YouTube Video") "title" (or $args.title "YouTube Video")

12
package-lock.json generated
View File

@@ -1,19 +1,19 @@
{ {
"name": "@gethinode/hinode", "name": "@gethinode/hinode",
"version": "1.0.0-alpha2", "version": "1.0.0-alpha4",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@gethinode/hinode", "name": "@gethinode/hinode",
"version": "1.0.0-alpha2", "version": "1.0.0-alpha4",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@fullhuman/postcss-purgecss": "^7.0.2", "@fullhuman/postcss-purgecss": "^7.0.2",
"autoprefixer": "^10.4.21", "autoprefixer": "^10.4.21",
"cssnano": "^7.0.7", "cssnano": "^7.0.7",
"cssnano-preset-advanced": "^7.0.7", "cssnano-preset-advanced": "^7.0.7",
"hugo-bin": "0.144.7", "hugo-bin": "0.144.8",
"purgecss-whitelister": "^2.4.0" "purgecss-whitelister": "^2.4.0"
}, },
"devDependencies": { "devDependencies": {
@@ -4262,9 +4262,9 @@
} }
}, },
"node_modules/hugo-bin": { "node_modules/hugo-bin": {
"version": "0.144.7", "version": "0.144.8",
"resolved": "https://registry.npmjs.org/hugo-bin/-/hugo-bin-0.144.7.tgz", "resolved": "https://registry.npmjs.org/hugo-bin/-/hugo-bin-0.144.8.tgz",
"integrity": "sha512-EYbVkonORLj60sJpW3IkDQX3TTmFPwKsadpYXU9mbFzcROhDJNTZkZ63NTDgQEC576lEdtHSzX5Z7KgjCimIVA==", "integrity": "sha512-ZqXy5cvfMJ1FSGrO62rp9koEZ+bXHcw1gPKV5LJDveYKMEFmnBy4TW8KWD0joPyHKD1xKRpVnOL13/AQx8NxlA==",
"funding": [ "funding": [
{ {
"type": "github", "type": "github",

View File

@@ -1,6 +1,6 @@
{ {
"name": "@gethinode/hinode", "name": "@gethinode/hinode",
"version": "1.0.0-alpha2", "version": "1.0.0-alpha4",
"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",
@@ -73,7 +73,7 @@
"autoprefixer": "^10.4.21", "autoprefixer": "^10.4.21",
"cssnano": "^7.0.7", "cssnano": "^7.0.7",
"cssnano-preset-advanced": "^7.0.7", "cssnano-preset-advanced": "^7.0.7",
"hugo-bin": "0.144.7", "hugo-bin": "0.144.8",
"purgecss-whitelister": "^2.4.0" "purgecss-whitelister": "^2.4.0"
}, },
"devDependencies": { "devDependencies": {