Single templates

{{ define "inactiveBrick" }}
{{ end }} {{ define "raisedBrick" }}
{{ end }} {{ define "speakerBrick" }}
{{ end }} {{ define "markBrick" }}
X
{{ end }}

For each type

{{ range .Bricks }}
for {{ .Name }}
{{ template "inactiveBrick" .ColorClass }} {{ template "raisedBrick" .ColorClass }} {{ template "speakerBrick" .ColorClass }} {{ template "markBrick" .ColorClass }}
{{ end }}

Now for BrickData taking parametrized template name

{{ define "brick" }} {{ if eq .TemplateType "inactiveBrick" }} {{ template "inactiveBrick" .ColorClass }} {{ else if eq .TemplateType "raisedBrick" }} {{ template "raisedBrick" .ColorClass }} {{ else if eq .TemplateType "speakerBrick" }} {{ template "speakerBrick" .ColorClass }} {{ else if eq .TemplateType "markBrick" }} {{ template "markBrick" .ColorClass }} {{ end }} {{end}}

Now for a person

{{ define "personBlocks" }}
{{ range (bricksForPerson .) }} {{ template "brick" . }} {{ end }}

{{ .Name }}

{{ end }}

And now i'll want to get all persons for a room

{{ define "roomPeople" }} {{ with (personsFromRoom .)}}
{{ range .Persons }} {{ template "personBlocks" . }} {{ end }}
{{ end }} {{end}}