diff --git a/konstrui b/konstrui index 9f99d50..765d3a9 100755 Binary files a/konstrui and b/konstrui differ diff --git a/templating.go b/templating.go index d8e02ed..1c818ee 100644 --- a/templating.go +++ b/templating.go @@ -1,6 +1,7 @@ package main import ( + "fmt" "strings" "github.com/Jeffail/gabs" @@ -96,8 +97,11 @@ func konstruiRepeatJSON(templateContent string) string { return templateContent } func konstruiRepeatElem(templateContent string, entry dataEntry, jsonData *gabs.Container) string { - if strings.Contains(templateContent, "") fragmentLines := getLines(extracted) fragmentLines = deleteArrayElementsWithString(fragmentLines, "konstrui-repeatElem") @@ -105,18 +109,19 @@ func konstruiRepeatElem(templateContent string, entry dataEntry, jsonData *gabs. children, _ := jsonData.S(elemName).Children() var replaced string for _, child := range children { - //fmt.Println(child.Data().(string)) + fmt.Println(child) + fmt.Println(child.Data().(string)) replacedElem := strings.Replace(f, "{{"+elemName+"}}", child.Data().(string), -1) replaced = replaced + replacedElem } fragmentLines = getLines(replaced) + fmt.Println(replaced) - lines := getLines(templateContent) - p := locateStringInArray(lines, "konstrui-repeatElem") - lines = deleteLinesBetween(lines, p[0], p[1]) - lines = addElementsToArrayPosition(lines, fragmentLines, p[0]) - templateContent = concatStringsWithJumps(lines) - + /*lines := getLines(templateContent) + p := locateStringInArray(lines, "konstrui-repeatElem")*/ + tlines = deleteLinesBetween(tlines, tp[0], tp[1]) + tlines = addElementsToArrayPosition(tlines, fragmentLines, tp[0]) + templateContent = concatStringsWithJumps(tlines) } return templateContent }