File tree Expand file tree Collapse file tree 4 files changed +43
-36
lines changed
Expand file tree Collapse file tree 4 files changed +43
-36
lines changed Original file line number Diff line number Diff line change 1- {{ $files := readDir "static/img" }}
2- {{ $names := slice }}
3-
4- {{ range $files }}
5- {{ if hasSuffix .Name "-dark.png" }}
6- {{ $names = $names | append (substr .Name 0 -9) }}
7- {{ end }}
8- {{ end }}
9-
10- < table width ="100% ">
11- < thead >
12- < tr >
13- < th > Base Name</ th >
14- < th > Dark</ th >
15- < th > Light</ th >
16- </ tr >
17- </ thead >
18- < tbody >
19- {{ range $name := $names }}
20- < tr >
21- < td > {{ $name }}</ td >
22- < td >
23- < a href ="img/{{ $name }}-dark.png ">
24- < img src ="img/{{ $name }}-dark.png " alt ="{{ $name }} dark " width ="200px " />
25- </ a >
26- </ td >
27- < td >
28- < a href ="img/{{ $name }}-light.png ">
29- < img src ="img/{{ $name }}-light.png " alt ="{{ $name }} light " width ="200px " />
30- </ a >
31- </ td >
32- </ tr >
33- {{ end }}
34- </ tbody >
35- </ table >
36-
1+ < h1 > Image Gallery</ h1 >
2+
3+ < h2 > Stable</ h2 >
4+ {{ partial "images-table.html" "static/img" }}
5+
6+ < h2 > DEV</ h2 >
7+ {{ partial "images-table.html" "static/img-dev" }}
Original file line number Diff line number Diff line change 1+ {{ $folder := . }}
2+ {{ $files := readDir $folder }}
3+ {{ $names := slice }}
4+
5+ {{ range $files }}
6+ {{ if hasSuffix .Name "-dark.png" }}
7+ {{ $names = $names | append (substr .Name 0 -9) }}
8+ {{ end }}
9+ {{ end }}
10+
11+ < table width ="100% ">
12+ < thead >
13+ < tr >
14+ < th > Base Name</ th >
15+ < th > Dark</ th >
16+ < th > Light</ th >
17+ </ tr >
18+ </ thead >
19+ < tbody >
20+ {{ range $name := $names }}
21+ < tr >
22+ < td > {{ $name }}</ td >
23+ < td >
24+ < a href ="img/{{ $name }}-dark.png ">
25+ < img src ="img/{{ $name }}-dark.png " alt ="{{ $name }} dark " width ="200px " />
26+ </ a >
27+ </ td >
28+ < td >
29+ < a href ="img/{{ $name }}-light.png ">
30+ < img src ="img/{{ $name }}-light.png " alt ="{{ $name }} light " width ="200px " />
31+ </ a >
32+ </ td >
33+ </ tr >
34+ {{ end }}
35+ </ tbody >
36+ </ table >
You can’t perform that action at this time.
0 commit comments