diff --git a/konstrui b/konstrui index 36532f0..45a5218 100755 Binary files a/konstrui and b/konstrui differ diff --git a/templating.go b/templating.go index 6fa8116..d7376bc 100644 --- a/templating.go +++ b/templating.go @@ -99,22 +99,14 @@ func konstruiRepeatJSON(templateContent string) string { func konstruiRepeatElem(templateContent string, entry dataEntry, jsonData *gabs.Container) string { if strings.Contains(templateContent, "") - children, _ := jsonData.S(elemName).Children() - /*for _, child := range children { - //var entry dataEntry - fmt.Println(child) - //replaced = replaced + replaceEntry(extracted, entry, child, elemName) - replaced = replaced + extracted - }*/ fragmentLines := getLines(extracted) fragmentLines = deleteArrayElementsWithString(fragmentLines, "konstrui-repeatElem") f := concatStringsWithJumps(fragmentLines) - + children, _ := jsonData.S(elemName).Children() var replaced string for _, child := range children { + fmt.Println(child.Data().(string)) replacedElem := strings.Replace(f, "{{"+elemName+"}}", child.Data().(string), -1) replaced = replaced + replacedElem } @@ -130,12 +122,6 @@ func konstruiRepeatElem(templateContent string, entry dataEntry, jsonData *gabs. return templateContent } -/*func getElemFromObj(entry dataEntry, elemName string) []dataEntry { - var elemEntries []dataEntry - fmt.Println(elemName) - fmt.Println(entry) - return elemEntries -}*/ func konstruiSimpleVars(template string, entries []dataEntry, jsonData *gabs.Container) string { //now, replace simple templating variables {{vars}} /*for _, entry := range entries { @@ -153,6 +139,36 @@ func konstruiSimpleVars(template string, entries []dataEntry, jsonData *gabs.Con template = replaceEntry(template, entry, jsonData, "") return template } +func konstruiInclude(content string) string { + var result string + if strings.Contains(content, "