diff --git a/tpl/template.go b/tpl/template.go index bb85225d4..36737eb77 100644 --- a/tpl/template.go +++ b/tpl/template.go @@ -41,6 +41,7 @@ type Template interface { LoadTemplates(absPath string) LoadTemplatesWithPrefix(absPath, prefix string) AddTemplate(name, tpl string) error + AddAceTemplate(name, basePath, innerPath string, baseContent, innerContent []byte) error AddInternalTemplate(prefix, name, tpl string) error AddInternalShortcode(name, tpl string) error PrintErrors() diff --git a/tpl/template_test.go b/tpl/template_test.go index 3c009c599..99c85affb 100644 --- a/tpl/template_test.go +++ b/tpl/template_test.go @@ -1,11 +1,83 @@ package tpl import ( + "bytes" "errors" "io/ioutil" + "os" + "path/filepath" "testing" ) +// Some tests for Issue #1178 -- Ace +func TestAceTemplates(t *testing.T) { + + for i, this := range []struct { + basePath string + innerPath string + baseContent string + innerContent string + expect string + expectErr int + }{ + {"", filepath.FromSlash("_default/single.ace"), "", "{{ . }}", "DATA", 0}, + {filepath.FromSlash("_default/baseof.ace"), filepath.FromSlash("_default/single.ace"), + `= content main + h2 This is a content named "main" of an inner template. {{ . }}`, + `= doctype html +html lang=en + head + meta charset=utf-8 + title Base and Inner Template + body + h1 This is a base template {{ . }} + = yield main`, `