Welcome to mirror list, hosted at ThFree Co, Russian Federation.

check.html « c « shortcodes « layouts - github.com/vjeantet/hugo-theme-docport.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3420a39558f8c64c879ddfbcbc2f565a347ac540 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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 }}