File: proxy.go

package info (click to toggle)
golang-github-yosssi-ace-proxy 0.0~git20141007.0.ecd9b78-5.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 80 kB
  • sloc: makefile: 3
file content (32 lines) | stat: -rw-r--r-- 558 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package proxy

import (
	"html/template"

	"github.com/yosssi/ace"
)

// Proxy represents a proxy for the Ace template engine.
type Proxy struct {
	Opts *ace.Options
}

// Load calls the `Load` function of the Ace template engine.
func (p *Proxy) Load(basePath, innerPath string, opts *ace.Options) (*template.Template, error) {
	var o *ace.Options

	if opts == nil {
		o = p.Opts
	} else {
		o = opts
	}

	return ace.Load(basePath, innerPath, o)
}

// New creates and returns a proxy.
func New(opts *ace.Options) *Proxy {
	return &Proxy{
		Opts: opts,
	}
}