repos / pico

pico services mono repo
git clone https://github.com/picosh/pico.git

pico / pkg / apps / prose / html
Eric Bower  ·  2026-01-16

list.partial.tmpl

 1{{define "list"}}
 2	{{$indent := 0}}
 3	{{$mod := 0}}
 4
 5	<div role="list">
 6		{{range .Items}}
 7	    {{if lt $indent .Indent}}
 8	    	<div role="list">
 9	    {{else if gt $indent .Indent}}
10	    	{{$mod = minus $indent .Indent}}
11	    	{{range $y := intRange 1 $mod}}
12	    		</div>
13	    	{{end}}
14	    {{end}}
15
16	    {{$indent = .Indent}}
17
18			{{if .IsText}}
19				<div role="listitem">
20					<div class="listitem-bullet">•</div>
21					<div class="listitem-text">{{.Value}}</div>
22				</div>
23			{{end}}
24
25			{{if .IsURL}}
26				<div role="listitem">
27					<div class="listitem-bullet">•</div>
28					<a class="listitem-text" href="{{.URL}}">{{.Value}}</a>
29				</div>
30			{{end}}
31
32	    {{if .IsImg}}
33	    	<div role="listitem">
34					<div class="listitem-bullet">•</div>
35		    	<img class="listeitem-text" src="{{.URL}}" alt="{{.Value}}" />
36		    </div>
37	    {{end}}
38
39	    {{if .IsBlock}}
40	    	<div role="listitem">
41					<div class="listitem-bullet">•</div>
42		    	<blockquote class="listitem-text">{{.Value}}</blockquote>
43		    </div>
44	    {{end}}
45
46	    {{if .IsPre}}
47	    	<div role="listitem">
48					<div class="listitem-bullet">•</div>
49		    	<pre class="listitem-text">{{.Value}}</pre>
50		    </div>
51	    {{end}}
52
53	    {{if .IsHeaderOne}}
54	    	</div>
55	    	<h2 class="text-xl font-bold">{{.Value}}</h2>
56	    	<div role="list" aria-label="{{.Value}}">
57	    {{end}}
58
59	    {{if .IsHeaderTwo}}
60	    	</div>
61	    	<h3 class="text-lg font-bold">{{.Value}}</h3>
62	    	<div role="list" aria-label="{{.Value}}">
63	    {{end}}
64
65	    {{if .IsHr}}
66	    	</div>
67	    	<hr />
68	    	<div role="list" aria-label="{{.Value}}">
69	    {{end}}
70		{{end}}
71	</div>
72{{end}}