Skip to content

Commit

Permalink
Fixed example in README and a test comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
kberov committed Feb 28, 2024
1 parent 9716f8b commit 6507e85
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion gledki_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6507e85

Please sign in to comment.