Example #1
0
func handleGatsRepeatOvers(sel *goquery.Selection, cont *context) {
	fieldName, _ := sel.Attr("gatsrepeatover")
	length, err := getLength(fieldName, cont)
	if err == nil {
		for i := 0; i < length; i++ {
			c, e := getItem(fieldName, i, cont)
			if e == nil {
				instance := sel.Clone().InsertBefore(sel)
				e1 := fillInTemplate(instance, c) // TODO: stop ignoring the returned errors here
				if e1 != nil {
					panic(e1) // is this really panic worthy?
				}
				instance.RemoveAttr("gatsrepeatover")
			}
		}
	}
	sel.Remove()
}