Skip to content

Commit

Permalink
Merge pull request #14 for v0.9.0 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
jeevatkm authored Jul 7, 2018
2 parents 5afe6cb + 64b1294 commit fa51a6b
Show file tree
Hide file tree
Showing 12 changed files with 316 additions and 264 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ branches:

go:
- 1.9
- "1.10"
- 1.x
- tip

go_import_path: aahframework.org/view.v0

before_install:
- bash <(curl -s https://aahframework.org/base-before-install) "vfs forge config essentials log"

install:
- go get -t -v ./...

Expand Down
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
# view - aah framework
[![Build Status](https://travis-ci.org/go-aah/view.svg?branch=master)](https://travis-ci.org/go-aah/view) [![codecov](https://codecov.io/gh/go-aah/view/branch/master/graph/badge.svg)](https://codecov.io/gh/go-aah/view/branch/master) [![Go Report Card](https://goreportcard.com/badge/aahframework.org/view.v0)](https://goreportcard.com/report/aahframework.org/view.v0) [![Version](https://img.shields.io/badge/version-0.8.2-blue.svg)](https://github.com/go-aah/view/releases/latest) [![GoDoc](https://godoc.org/aahframework.org/view.v0?status.svg)](https://godoc.org/aahframework.org/view.v0) [![License](https://img.shields.io/github/license/go-aah/view.svg)](LICENSE) [![Twitter](https://img.shields.io/badge/twitter-@aahframework-55acee.svg)](https://twitter.com/aahframework)
<p align="center">
<img src="https://cdn.aahframework.org/assets/img/aah-logo-64x64.png" />
<h2 align="center">View Engine library by aah framework</h2>
</p>
<p align="center">
<p align="center"><a href="https://travis-ci.org/go-aah/view"><img src="https://travis-ci.org/go-aah/view.svg?branch=master" alt="Build Status"></a> <a href="https://codecov.io/gh/go-aah/view/branch/master"><img src="https://codecov.io/gh/go-aah/view/branch/master/graph/badge.svg" alt="Code Coverage"></a> <a href="https://goreportcard.com/report/aahframework.org/view.v0"><img src="https://goreportcard.com/badge/aahframework.org/view.v0" alt="Go Report Card"></a> <a href="https://github.com/go-aah/view/releases/latest"><img src="https://img.shields.io/badge/version-0.9.0-blue.svg" alt="Release Version"></a> <a href="https://godoc.org/aahframework.org/view.v0"><img src="https://godoc.org/aahframework.org/view.v0?status.svg" alt="Godoc"></a> <a href="https://twitter.com/aahframework"><img src="https://img.shields.io/badge/twitter-@aahframework-55acee.svg" alt="Twitter @aahframework"></a></p>
</p>

***v0.8.2 [released](https://github.com/go-aah/view/releases/latest) and tagged on Apr 25, 2018***
View Engine library provides enhanced Go template engine which supports partial template inheritance, imports, etc.

Go HTML template library which supports partial template inheritance, imports, etc.
### News

*`view` developed for aah framework. However, it's an independent library, can be used separately with any `Go` language project. Feel free to use it.*
* `v0.9.0` [released](https://github.com/go-aah/view/releases/latest) and tagged on Jul 06, 2018.

## Installation

# Installation
#### Stable Version - Production Ready
```bash
# install the library
go get -u aahframework.org/view.v0
```

Visit official website https://aahframework.org to learn more.
Visit official website https://aahframework.org to learn more about `aah` framework.
95 changes: 0 additions & 95 deletions anti_csrf_field.go

This file was deleted.

43 changes: 0 additions & 43 deletions anti_csrf_field_test.go

This file was deleted.

28 changes: 19 additions & 9 deletions funcs.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Jeevanandam M. (https://github.com/jeevatkm)
// go-aah/view source code and usage is governed by a MIT style
// aahframework.org/view source code and usage is governed by a MIT style
// license that can be found in the LICENSE file.

package view
Expand All @@ -13,30 +13,40 @@ import (
)

// tmplSafeHTML method outputs given HTML as-is, use it with care.
func tmplSafeHTML(str string) template.HTML {
func (e *GoViewEngine) tmplSafeHTML(str string) template.HTML {
return template.HTML(str)
}

// tmplInclude method renders given template with View Args and imports into
// current template.
func tmplInclude(name string, viewArgs map[string]interface{}) template.HTML {
func (e *GoViewEngine) tmplInclude(name string, viewArgs map[string]interface{}) template.HTML {
if !strings.HasPrefix(name, "common") {
name = "common/" + name
}

name = filepath.ToSlash(name)
var err error
var tmpl *template.Template
if e.hotReload {
if tmpl, err = e.ParseFile(name); err != nil {
log.Errorf("goviewengine: %s", err)
return e.tmplSafeHTML("")
}
} else {
tmpl = commonTemplates.Lookup(name)
}

tmpl := commonTemplates.Lookup(name)
if tmpl == nil {
log.Warnf("goviewengine: common template not found: %s", name)
return tmplSafeHTML("")
return e.tmplSafeHTML("")
}

buf := acquireBuffer()
defer releaseBuffer(buf)
if err := tmpl.Execute(buf, viewArgs); err != nil {
log.Error(err)
return template.HTML("")
if err = tmpl.Execute(buf, viewArgs); err != nil {
log.Errorf("goviewengine: %s", err)
return e.tmplSafeHTML("")
}

return tmplSafeHTML(buf.String())
return e.tmplSafeHTML(buf.String())
}
Loading

0 comments on commit fa51a6b

Please sign in to comment.