From 6507e854a2feff76ef828d43455d395e4401a6a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D1=80=D0=B0=D1=81=D0=B8=D0=BC=D0=B8=D1=80=20=D0=91?= =?UTF-8?q?=D0=B5=D1=80=D0=BE=D0=B2?= Date: Wed, 28 Feb 2024 21:48:14 +0200 Subject: [PATCH] Fixed example in README and a test comment. --- README.md | 7 ++++--- gledki_test.go | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f95ae84..657f117 100644 --- a/README.md +++ b/README.md @@ -32,14 +32,15 @@ import ( "github.com/labstack/gommon/log" ) -var templatesRootDir = "testdata/tpls" +// Multiple templates paths. The first found template with a certain name is +// loaded. Convenient for themes, multidomain sites etc. +var templatesRoots = []string{"./testdata/tpls/theme","./testdata/tpls" } var filesExt = ".htm" -var logger *log.Logger //... // Once on startup. -tpls, err := gl.New(templatesRootDir, filesExt, [2]string{"<%", "%>"}, false) +tpls, err := gl.New(templatesRoots, filesExt, [2]string{"<%", "%>"}, false) if err != nil { fmt.Print("Error:", err.Error()) os.Exit(1) diff --git a/gledki_test.go b/gledki_test.go index fcce7fa..1f6ee98 100644 --- a/gledki_test.go +++ b/gledki_test.go @@ -181,7 +181,8 @@ func TestAddExecuteFunc(t *testing.T) { } } -// We put the second path as first, so files in it will be found first, if they exist. +// We put the second path as first, so files in it will be found first, if they +// exist. The test is successful if the "black" theme files are used. func TestAddExecuteFuncWithTheme(t *testing.T) { roots := []string{includePaths[1], includePaths[0]} tpls, _ := New(roots, filesExt, tagsPair, false)