Skip to content
This repository has been archived by the owner on Dec 6, 2022. It is now read-only.

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyvankooten committed Apr 10, 2017
1 parent 8d293d1 commit cd1ac63
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

Grender is a package that provides functionality for easily rendering HTML templates and JSON or XML data to a HTTP response. It is based on [github.com/unrolled/render](https://github.com/unrolled/render) with some subtle modifications when it comes to rendering HTML templates.

- Templates can extend other templates using a template comment: `{{/* extends "master.tmpl" */}}`
- Configure template files using a glob string: `templates/*.tmpl`
- Support for partials as normal templates: `{{ template "footer" .}}`
- Templates inheritance: `{{/* extends "master.tmpl" */}}`
- Glob configuration: `templates/*.tmpl`
- Normal templates as partials: `{{ template "footer" .}}`

## Usage
Grender can be used with pretty much any web framework providing you can access the `http.ResponseWriter` from your handler. The rendering functions simply wraps Go's existing functionality for marshaling and rendering data.
Expand Down Expand Up @@ -62,16 +62,17 @@ r := grender.New(grender.Options{

First, define your parent template like this.

file: _master.tmpl_
```go
// master.tmpl
<html>
{{template "content" .}}
</html>
```

// Then, in a separate template file use a template comment to indicate that you want to extend the other template file.
Then, in a separate template file use a template comment on the first line to indicate that you want to extend the other template file.

file: _child.tmpl_
```go
// child.tmpl
{{/* extends "master.tmpl" */}}

{{define "content"}}Hello world!{{end}}
Expand Down

0 comments on commit cd1ac63

Please sign in to comment.