Browse Source

prints cleaned

master
arnaucode 7 years ago
parent
commit
5a9ebd9c4d
3 changed files with 5 additions and 6 deletions
  1. +1
    -1
      fileOperations.go
  2. BIN
      konstrui
  3. +4
    -5
      templating.go

+ 1
- 1
fileOperations.go

@ -76,7 +76,7 @@ func writeFile(path string, newContent string) {
check(err)
color.Green(path + ":")
color.Blue(newContent)
//color.Blue(newContent)
}
/*func generatePageFromTemplateAndData(templateContent string, entry dataEntry) string {

BIN
konstrui


+ 4
- 5
templating.go

@ -1,8 +1,6 @@
package main
import (
"fmt"
"strconv"
"strings"
"github.com/Jeffail/gabs"
@ -15,7 +13,8 @@ func duplicateText(original string, count int) string {
}
return result
}
func replaceEntryOLD(templateContent string, entry dataEntry, jsonData *gabs.Container, elemName string) string {
/*func replaceEntryOLD(templateContent string, entry dataEntry, jsonData *gabs.Container, elemName string) string {
//replace {{}} with data
var keys []string
for key, _ := range entry {
@ -36,7 +35,7 @@ func replaceEntryOLD(templateContent string, entry dataEntry, jsonData *gabs.Con
}
return templateContent
}
}*/
func replaceEntry(templateContent string, entry dataEntry, jsonData *gabs.Container, elemName string) string {
//fmt.Println(jsonData)
children, _ := jsonData.S().ChildrenMap()
@ -106,7 +105,7 @@ 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.Data().(string))
replacedElem := strings.Replace(f, "{{"+elemName+"}}", child.Data().(string), -1)
replaced = replaced + replacedElem
}

Loading…
Cancel
Save