From adb2dde04355bbca10fe4f140b4f3c3f9096fee2 Mon Sep 17 00:00:00 2001
From: Keiji Yoshida
Date: Tue, 25 Feb 2014 18:23:55 +0900
Subject: [PATCH 1/8] Update README.md
---
README.md | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/README.md b/README.md
index 2d48393..ee4d1d8 100644
--- a/README.md
+++ b/README.md
@@ -9,5 +9,45 @@ Gold is a template engine for [Golang](http://golang.org/). This simplifies HTML
## Example
```gold
+doctype html
+html lang=en
+ head
+ title {{.Title}}
+ body
+ h1 Gold - Template engine for Golang
+ #container.wrapper
+ {{if true}}
+ p You can use an expression of Golang html/template package in a Gold template.
+ {{end}}
+ p.
+ Gold is a template engine for Golang.
+ This simplifies HTML coding in Golang web application development.
+ javascript:
+ msg = 'Welcome to Gold!';
+ alert(msg);
+```
+
+becomes
+```html
+
+
+
+ Gold
+
+
+ Gold - Template engine for Golang
+
+
You can use an expression of Golang html/template package in a Gold template.
+
+ Gold is a template engine for Golang.
+ This simplifies HTML coding in Golang web application development.
+
+
+
+
+
```
From 7b4506cf3b0b2a326e19ba1a9f35676c8f04b028 Mon Sep 17 00:00:00 2001
From: Keiji Yoshida
Date: Tue, 25 Feb 2014 18:24:39 +0900
Subject: [PATCH 2/8] Update README.md
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index ee4d1d8..4435c0e 100644
--- a/README.md
+++ b/README.md
@@ -27,6 +27,7 @@ html lang=en
alert(msg);
```
+
becomes
```html
From 61ebe16a73cadee885ab8cefada25d2b16f8397a Mon Sep 17 00:00:00 2001
From: Keiji Yoshida
Date: Tue, 25 Feb 2014 18:24:50 +0900
Subject: [PATCH 3/8] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 4435c0e..177e98b 100644
--- a/README.md
+++ b/README.md
@@ -27,9 +27,9 @@ html lang=en
alert(msg);
```
-
becomes
+
```html
From 1421952ad44b700c2e82ce1ea5eb80cbb5267fae Mon Sep 17 00:00:00 2001
From: Keiji Yoshida
Date: Tue, 25 Feb 2014 18:26:07 +0900
Subject: [PATCH 4/8] Update README.md
---
README.md | 1 -
1 file changed, 1 deletion(-)
diff --git a/README.md b/README.md
index 177e98b..ee4d1d8 100644
--- a/README.md
+++ b/README.md
@@ -29,7 +29,6 @@ html lang=en
becomes
-
```html
From 311e99cb48bba42b92be2bc02fa862a027cc05a6 Mon Sep 17 00:00:00 2001
From: Keiji Yoshida
Date: Tue, 25 Feb 2014 18:33:11 +0900
Subject: [PATCH 5/8] Update README.md
---
README.md | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/README.md b/README.md
index ee4d1d8..221b10b 100644
--- a/README.md
+++ b/README.md
@@ -51,3 +51,32 @@ becomes
```
+
+## Implementation Example
+
+```go
+package main
+
+import (
+ "github.com/yosssi/gold"
+ "net/http"
+)
+
+var g = gold.NewGenerator(false)
+
+func handler(w http.ResponseWriter, r *http.Request) {
+ tpl, err := g.ParseFile("./top.gold")
+ if err != nil {
+ panic(err)
+ }
+ data := map[string]interface{}{"Title": "Gold"}
+ if err := tpl.Execute(w, data); err != nil {
+ panic(err)
+ }
+}
+
+func main() {
+ http.HandleFunc("/", handler)
+ http.ListenAndServe(":8080", nil)
+}
+```
From a7df74a938020c7b9a82f78680ada38b67237cc6 Mon Sep 17 00:00:00 2001
From: Keiji Yoshida
Date: Tue, 25 Feb 2014 18:53:58 +0900
Subject: [PATCH 6/8] Update README.md
---
README.md | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/README.md b/README.md
index 221b10b..6c31213 100644
--- a/README.md
+++ b/README.md
@@ -80,3 +80,48 @@ func main() {
http.ListenAndServe(":8080", nil)
}
```
+
+## Syntax
+
+### Creating Simple Tags
+
+```gold
+div
+ address
+ i
+ strong
+```
+
+becomes
+
+```html
+
+```
+
+### Putting Texts Inside Tags
+
+```gold
+p Welcome to Gold
+p
+ | You can insert single text.
+p.
+ You can insert
+ multiple texts.
+```
+
+becomes
+
+```html
+Welcome to Gold
+You can insert single text.
+
+ You can insert
+ multiple texts.
+
+```
+
+## APIs
From 61c5f36e5149701f5433f1332cbc801cf45c7b3a Mon Sep 17 00:00:00 2001
From: Keiji Yoshida
Date: Tue, 25 Feb 2014 18:59:52 +0900
Subject: [PATCH 7/8] Update README.md
---
README.md | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 6c31213..045547d 100644
--- a/README.md
+++ b/README.md
@@ -62,15 +62,28 @@ import (
"net/http"
)
+// Create a generator which parses a Gold templates and
+// returns a html/template package's template.
+// You can have a generator cache templates by passing
+// true to NewGenerator function.
var g = gold.NewGenerator(false)
func handler(w http.ResponseWriter, r *http.Request) {
+ // ParseFile parses a Gold templates and
+ // returns a html/template package's template.
tpl, err := g.ParseFile("./top.gold")
+
if err != nil {
panic(err)
}
+
data := map[string]interface{}{"Title": "Gold"}
- if err := tpl.Execute(w, data); err != nil {
+
+ // Call Execute method of the html/template
+ // package's template.
+ err := tpl.Execute(w, data)
+
+ if err != nil {
panic(err)
}
}
From 09c45129c0fede00e5e3debf17fb71d46e8d80c4 Mon Sep 17 00:00:00 2001
From: Keiji Yoshida
Date: Tue, 25 Feb 2014 19:13:00 +0900
Subject: [PATCH 8/8] Update README.md
---
README.md | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 045547d..87e9ca4 100644
--- a/README.md
+++ b/README.md
@@ -70,7 +70,7 @@ var g = gold.NewGenerator(false)
func handler(w http.ResponseWriter, r *http.Request) {
// ParseFile parses a Gold templates and
- // returns a html/template package's template.
+ // returns an html/template package's template.
tpl, err := g.ParseFile("./top.gold")
if err != nil {
@@ -137,4 +137,19 @@ becomes
```
+### Adding Attributes to Tags
+
+```gold
+a href=https://github.com/yosssi/gold target=_blank Gold GitHub Page
+button data-action=btnaction style="font-weight: bold; font-size: 1rem;"
+ | This is a button
+```
+
+becomes
+
+```html
+Gold GitHub Page
+This is a button
+```
+
## APIs