diff options
Diffstat (limited to 'layouts/shortcodes/c/check.html')
-rw-r--r-- | layouts/shortcodes/c/check.html | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/layouts/shortcodes/c/check.html b/layouts/shortcodes/c/check.html new file mode 100644 index 0000000..3420a39 --- /dev/null +++ b/layouts/shortcodes/c/check.html @@ -0,0 +1,29 @@ +{{ $name := replace (.Get 0) "*" "" }} +{{ $required := strings.HasSuffix (.Get 0) "*" }} + +{{ range $index, $content := split (strings.Trim .Inner "\n") "*" }} + {{if ne $content ""}} + + {{ $id := printf "%s-%d" $name $index }} + {{ $value := printf "checked" }} + + {{ $values := split (replaceRE `\s*(\([^\)]+\))*\s*(.*)` "$1#$2" (strings.Trim $content "\n")) "#" }} + {{ $text := (index $values 1) }} + + {{ if ne "" (index $values 0)}} + {{ $value = strings.Trim (index $values 0) "()" }} + {{end}} + +<div class="custom-control custom-checkbox"> + <input type="checkbox" + name="{{$name}}" + id="{{ $id }}" + value="{{$value}}" + class="custom-control-input"> + <label class="custom-control-label" for="{{$id}}">{{ chomp $text }}</label> +</div> + + {{end}} +{{ end }} + + |