mirror of
https://github.com/gethinode/hinode.git
synced 2025-10-07 18:14:28 +00:00
Compare commits
15 Commits
v1.0.0-alp
...
v1.0.0-alp
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6b250b8d4c | ||
![]() |
90f8f91e61 | ||
![]() |
cc0d83189d | ||
![]() |
4d4db9e870 | ||
![]() |
58cfcc9131 | ||
![]() |
362aae875e | ||
![]() |
3f3a7c21e3 | ||
![]() |
dddb881628 | ||
![]() |
1a0b2f5632 | ||
![]() |
b25de1eb02 | ||
![]() |
0a0315e531 | ||
![]() |
9a1a1405fe | ||
![]() |
f7bda6236e | ||
![]() |
c8c5384bd3 | ||
![]() |
4d4d5ad9bd |
@@ -2,6 +2,9 @@ comment: >-
|
||||
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.
|
||||
arguments:
|
||||
page:
|
||||
optional: false
|
||||
group: partial
|
||||
structure:
|
||||
type: string
|
||||
position: 0
|
||||
@@ -26,3 +29,28 @@ arguments:
|
||||
comment: >-
|
||||
Flag to filter only arguments that have a parent attribute (either
|
||||
`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
|
||||
|
@@ -65,6 +65,7 @@ arguments:
|
||||
release: v1.0.0
|
||||
link-type:
|
||||
hook:
|
||||
default: assets/image.html
|
||||
group: partial
|
||||
sizes:
|
||||
group: partial
|
||||
|
@@ -1,6 +1,7 @@
|
||||
comment: Adds a keyboard input element.
|
||||
arguments:
|
||||
text:
|
||||
optional: true
|
||||
position: 0
|
||||
release: v1.0.0
|
||||
class:
|
||||
|
@@ -602,21 +602,76 @@
|
||||
"fab-medium",
|
||||
"fab-whatsapp",
|
||||
"fab-x-twitter",
|
||||
"faq-184f299e274a5ce56b6a879ad10e2b73",
|
||||
"faq-184f299e274a5ce56b6a879ad10e2b73-heading-faq-184f299e274a5ce56b6a879ad10e2b73",
|
||||
"faq-184f299e274a5ce56b6a879ad10e2b73-item-0",
|
||||
"faq-184f299e274a5ce56b6a879ad10e2b73-item-1",
|
||||
"faq-184f299e274a5ce56b6a879ad10e2b73-item-2",
|
||||
"faq-43ab418abcc6ab8991ad130c40cca21e",
|
||||
"faq-43ab418abcc6ab8991ad130c40cca21e-heading-faq-43ab418abcc6ab8991ad130c40cca21e",
|
||||
"faq-43ab418abcc6ab8991ad130c40cca21e-item-0",
|
||||
"faq-43ab418abcc6ab8991ad130c40cca21e-item-1",
|
||||
"faq-43ab418abcc6ab8991ad130c40cca21e-item-2",
|
||||
"faq-5f13c156f93854db8bafbe22d85efd03",
|
||||
"faq-5f13c156f93854db8bafbe22d85efd03-heading-faq-5f13c156f93854db8bafbe22d85efd03",
|
||||
"faq-5f13c156f93854db8bafbe22d85efd03-item-0",
|
||||
"faq-5f13c156f93854db8bafbe22d85efd03-item-1",
|
||||
"faq-5f13c156f93854db8bafbe22d85efd03-item-2",
|
||||
"faq-082ce0b6bb6c6cce73c7496619914264",
|
||||
"faq-082ce0b6bb6c6cce73c7496619914264-heading-faq-082ce0b6bb6c6cce73c7496619914264",
|
||||
"faq-082ce0b6bb6c6cce73c7496619914264-item-0",
|
||||
"faq-082ce0b6bb6c6cce73c7496619914264-item-1",
|
||||
"faq-082ce0b6bb6c6cce73c7496619914264-item-2",
|
||||
"faq-2b593cdb5946235fa6c9dd5baf6b1005",
|
||||
"faq-2b593cdb5946235fa6c9dd5baf6b1005-heading-faq-2b593cdb5946235fa6c9dd5baf6b1005",
|
||||
"faq-2b593cdb5946235fa6c9dd5baf6b1005-item-0",
|
||||
"faq-2b593cdb5946235fa6c9dd5baf6b1005-item-1",
|
||||
"faq-2b593cdb5946235fa6c9dd5baf6b1005-item-2",
|
||||
"faq-2c2510b2d9d07caeba3db403d3dd8b15",
|
||||
"faq-2c2510b2d9d07caeba3db403d3dd8b15-heading-faq-2c2510b2d9d07caeba3db403d3dd8b15",
|
||||
"faq-2c2510b2d9d07caeba3db403d3dd8b15-item-0",
|
||||
"faq-2c2510b2d9d07caeba3db403d3dd8b15-item-1",
|
||||
"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-2",
|
||||
"fas-3",
|
||||
|
4
go.mod
4
go.mod
@@ -8,7 +8,6 @@ require (
|
||||
github.com/gethinode/mod-bootstrap v1.3.3 // indirect
|
||||
github.com/gethinode/mod-csp v1.0.7 // 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-google-analytics v1.3.1 // 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-mermaid v1.1.23 // 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.2 // indirect
|
||||
github.com/gethinode/mod-utils/v3 v3.1.3 // indirect
|
||||
github.com/nextapps-de/flexsearch v0.0.0-20250606060143-c28f52c09b7a // indirect
|
||||
github.com/twbs/bootstrap v5.3.6+incompatible // indirect
|
||||
)
|
||||
|
2
go.sum
2
go.sum
@@ -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.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.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/go.mod h1:5GdMfPAXzbA2gXBqTjC6l27kioSYzHlqDMh0+wyx7sU=
|
||||
github.com/nextapps-de/flexsearch v0.0.0-20240108021025-afd75f742f22 h1:re7L8FxbXQpnX8BgzkdUnDpsUmloGNyLmiy2ZCln8pg=
|
||||
|
130
layouts/_partials/assets/args.html
Normal file
130
layouts/_partials/assets/args.html
Normal 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 }}
|
@@ -61,7 +61,7 @@
|
||||
|
||||
{{- range $suffix := $modes -}}
|
||||
{{- $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 -}}
|
||||
{{- end -}}
|
||||
{{ else }}
|
||||
|
@@ -32,7 +32,8 @@
|
||||
{{ end }}
|
||||
|
||||
{{/* Initialize local arguments */}}
|
||||
{{- $provider := or $args.provider $args.host }}
|
||||
{{- $title := $args.title -}}
|
||||
{{- $provider := or $args.host $args.provider }}
|
||||
{{- $account := $args.account }}
|
||||
{{ if not $account }}
|
||||
{{ with index $args.page.Site.Params.videos $provider }}
|
||||
@@ -148,7 +149,6 @@
|
||||
{{ $width := index $metadata "width" }}
|
||||
{{ if and $height $width }}
|
||||
{{ $padding := printf "%.2f%%" (mul (div (float $height) $width) 100) }}
|
||||
{{ $title := $args.title }}
|
||||
{{ if not $title }}{{ $title = printf "Cloudinary video '%s'" (path.BaseName $id) }}{{ end }}
|
||||
|
||||
<div class="video-embedded {{ $args.class }}" data-video-padding="{{ $padding }}">
|
||||
|
@@ -5,7 +5,12 @@
|
||||
{{ cond (gt (len .Site.Copyright) 0) .Site.Copyright $copyright }}
|
||||
{{ .Site.Params.footer.license | safeHTML }} |
|
||||
{{ 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 }}
|
||||
{{ end }}
|
||||
</small>
|
||||
|
@@ -4,124 +4,29 @@
|
||||
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 }}
|
||||
{{- $error := false -}}
|
||||
|
||||
{{/* Validate and initialize arguments */}}
|
||||
{{ $args := partial "utilities/InitArgs.html" (dict "structure" "args" "args" .Params "named" .IsNamedParams "group" "shortcode") }}
|
||||
{{ if or $args.err $args.warnmsg }}
|
||||
{{ partial (cond $args.err "utilities/LogErr.html" "utilities/LogWarn.html") (dict
|
||||
{{- $args := partial "utilities/InitArgs.html" (dict "structure" "args" "args" .Params "named" .IsNamedParams "group" "shortcode") -}}
|
||||
{{- if or $args.err $args.warnmsg -}}
|
||||
{{- partial (cond $args.err "utilities/LogErr.html" "utilities/LogWarn.html") (dict
|
||||
"partial" "shortcodes/args.html"
|
||||
"msg" "Invalid arguments"
|
||||
"details" ($args.errmsg | append $args.warnmsg)
|
||||
"file" page.File
|
||||
"position" .Position
|
||||
)}}
|
||||
{{ $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" "shortcodes/args.html"
|
||||
"msg" "Invalid arguments"
|
||||
"details" ($types.errmsg | append $types.warnmsg)
|
||||
"file" page.File
|
||||
"position" .Position
|
||||
)}}
|
||||
{{ $error = $args.err }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
) -}}
|
||||
{{- $error = $args.err -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Main code */}}
|
||||
{{ if not $error }}
|
||||
{{ $params := dict "types" $types.udt "page" .Page "group" $args.group "parent" $args.parent }}
|
||||
{{ partial "inline/args-table.html" (merge $params (dict "args" $types.types)) }}
|
||||
|
||||
{{ range $k, $v := $types.udt }}
|
||||
{{ printf "## %s %s" $k (T "type") | $.Page.RenderString }}
|
||||
{{ partial "inline/args-table.html" (merge $params (dict "args" $v)) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{- if not $args.err -}}
|
||||
{{- partial "assets/args.html" (dict
|
||||
"page" .Page
|
||||
"structure" $args.structure
|
||||
"group" $args.group
|
||||
"parent" $args.parent
|
||||
"render-type" $args.renderType
|
||||
"header-level" $args.headerLevel
|
||||
) -}}
|
||||
{{- end -}}
|
||||
|
@@ -4,6 +4,8 @@
|
||||
Visit gethinode.com/license for more details.
|
||||
*/}}
|
||||
|
||||
{{- $error := false -}}
|
||||
|
||||
{{/* Initialize arguments */}}
|
||||
{{- $args := partial "utilities/InitArgs.html" (dict "structure" "kbd" "args" .Params "named" .IsNamedParams "group" "shortcode") -}}
|
||||
{{- if or $args.err $args.warnmsg -}}
|
||||
@@ -13,12 +15,26 @@
|
||||
"details" ($args.errmsg | append $args.warnmsg)
|
||||
"file" page.File
|
||||
"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 -}}
|
||||
|
||||
{{/* 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 }}>
|
||||
{{ or $args.text $args.title | plainify }}
|
||||
{{ $text | plainify }}
|
||||
</kbd>
|
||||
{{ end -}}
|
||||
|
@@ -21,7 +21,7 @@
|
||||
{{ partial "assets/video.html" (dict
|
||||
"page" .Page
|
||||
"position" .Position
|
||||
"provider" (or $args.host $args.provider)
|
||||
"provider" "vimeo"
|
||||
"media-id" (or $args.mediaId $args.id)
|
||||
"class" $args.class
|
||||
"title" (or $args.title "Vimeo Video")
|
||||
|
@@ -21,7 +21,7 @@
|
||||
{{ partial "assets/video.html" (dict
|
||||
"page" .Page
|
||||
"position" .Position
|
||||
"provider" (or $args.host $args.provider)
|
||||
"provider" "youtube"
|
||||
"media-id" (or $args.mediaId $args.id)
|
||||
"class" $args.class
|
||||
"title" (or $args.title "YouTube Video")
|
||||
|
12
package-lock.json
generated
12
package-lock.json
generated
@@ -1,19 +1,19 @@
|
||||
{
|
||||
"name": "@gethinode/hinode",
|
||||
"version": "1.0.0-alpha2",
|
||||
"version": "1.0.0-alpha4",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@gethinode/hinode",
|
||||
"version": "1.0.0-alpha2",
|
||||
"version": "1.0.0-alpha4",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@fullhuman/postcss-purgecss": "^7.0.2",
|
||||
"autoprefixer": "^10.4.21",
|
||||
"cssnano": "^7.0.7",
|
||||
"cssnano-preset-advanced": "^7.0.7",
|
||||
"hugo-bin": "0.144.7",
|
||||
"hugo-bin": "0.144.8",
|
||||
"purgecss-whitelister": "^2.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -4262,9 +4262,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/hugo-bin": {
|
||||
"version": "0.144.7",
|
||||
"resolved": "https://registry.npmjs.org/hugo-bin/-/hugo-bin-0.144.7.tgz",
|
||||
"integrity": "sha512-EYbVkonORLj60sJpW3IkDQX3TTmFPwKsadpYXU9mbFzcROhDJNTZkZ63NTDgQEC576lEdtHSzX5Z7KgjCimIVA==",
|
||||
"version": "0.144.8",
|
||||
"resolved": "https://registry.npmjs.org/hugo-bin/-/hugo-bin-0.144.8.tgz",
|
||||
"integrity": "sha512-ZqXy5cvfMJ1FSGrO62rp9koEZ+bXHcw1gPKV5LJDveYKMEFmnBy4TW8KWD0joPyHKD1xKRpVnOL13/AQx8NxlA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"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",
|
||||
"keywords": [
|
||||
"hugo",
|
||||
@@ -73,7 +73,7 @@
|
||||
"autoprefixer": "^10.4.21",
|
||||
"cssnano": "^7.0.7",
|
||||
"cssnano-preset-advanced": "^7.0.7",
|
||||
"hugo-bin": "0.144.7",
|
||||
"hugo-bin": "0.144.8",
|
||||
"purgecss-whitelister": "^2.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
Reference in New Issue
Block a user