diff --git a/README.md b/README.md index a159170..dc7449f 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ web templating engine for static websites, written in Go lang -![konstrui](https://raw.githubusercontent.com/arnaucode/konstrui/master/konstrui.png "konstrui") +![konstrui](https://raw.githubusercontent.com/arnaucode/konstrui/master/media/konstrui.png "konstrui") ## Example @@ -41,9 +41,9 @@ webInput/ - Set the template file: ```html -
-
{{username}}
-
{{description}}
+
+
{{username}}
+
{{description}}
{{phone}}
``` @@ -99,21 +99,21 @@ webInput/ -

My First Heading

-

My first paragraph.

-
-
Michaela Doe
-
Hi, I'm here to code
+

Heading

+

Paragraph.

+
+
Michaela Doe
+
Hi, I'm here to code
456456456
-
-
John Doe
-
Hi, I'm here
+
+
John Doe
+
Hi, I'm here
123456789
-
-
Myself
-
How are you
+
+
Myself
+
How are you
no phone
diff --git a/fileOperations.go b/fileOperations.go index ddc2f6c..35170cd 100644 --- a/fileOperations.go +++ b/fileOperations.go @@ -5,6 +5,7 @@ import ( "encoding/json" "io/ioutil" "os" + "strconv" "strings" ) @@ -50,6 +51,7 @@ func generateFromTemplateAndData(templateContent string, entries []dataEntry) st //now, replace the keys with the values for j := 0; j < len(keys); j++ { entryContent = strings.Replace(entryContent, "{{"+keys[j]+"}}", entries[i][keys[j]], -1) + entryContent = strings.Replace(entryContent, "[[i]]", strconv.Itoa(i), -1) } newContent = newContent + entryContent diff --git a/example.png b/media/example.png similarity index 100% rename from example.png rename to media/example.png diff --git a/konstrui.png b/media/konstrui.png similarity index 100% rename from konstrui.png rename to media/konstrui.png