Added tests for funcmap.
This commit is contained in:
parent
65a9ac9fa5
commit
af645ee2e4
3 changed files with 51 additions and 5 deletions
|
|
@ -131,11 +131,12 @@ func (t *Controller) cachePage(c echo.Context, p Page, html *bytes.Buffer) {
|
|||
// 1. The layout/based template specified in Page.Layout
|
||||
// 2. The content template specified in Page.Name
|
||||
// 3. All templates within the components directory
|
||||
// Also included is the function map provided by the funcmap package
|
||||
func (t *Controller) parsePageTemplates(p Page) error {
|
||||
// Check if the template has not yet been parsed or if the app environment is local, so that templates reflect
|
||||
// changes without having the restart the server
|
||||
if _, ok := templates.Load(p.Name); !ok || t.Container.Config.App.Environment == config.EnvLocal {
|
||||
// Parse the Layout and Name templates
|
||||
// Parse the Layout and Name templates along with the function map
|
||||
parsed, err :=
|
||||
template.New(p.Layout+config.TemplateExt).
|
||||
Funcs(funcMap).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue