mirror of
https://github.com/gethinode/hinode.git
synced 2025-10-16 22:43:13 +00:00
31 lines
936 B
HTML
31 lines
936 B
HTML
<!--
|
|
Copyright © 2024 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 -}}
|
|
|
|
<!-- Validate arguments -->
|
|
{{ if partial "utilities/IsInvalidArgs.html" (dict "structure" "kbd" "args" .Params ) }}
|
|
{{ errorf "Invalid arguments: %s" .Position -}}
|
|
{{ $error = true }}
|
|
{{ end }}
|
|
|
|
<!-- Initialize arguments -->
|
|
{{- $title := "" -}}
|
|
{{- $class := "" -}}
|
|
{{- $color := "" -}}
|
|
{{- if .IsNamedParams }}
|
|
{{ $title = .Get "title" }}
|
|
{{ $class = .Get "class" }}
|
|
{{ $color = .Get "color" }}
|
|
{{ else }}
|
|
{{ $title = .Get 0 }}
|
|
{{ end }}
|
|
|
|
<!-- Main code -->
|
|
{{- if not $error }}
|
|
<kbd {{ if or $color $class }}class="{{ with $color }}text-bg-{{ . }}{{ end }}{{ with $class }} {{ . }}{{ end }}"{{ end }}>{{ $title | plainify }}</kbd>
|
|
{{ end -}}
|