Compare commits
No commits in common. "main" and "v0.0.1" have entirely different histories.
2 changed files with 1 additions and 18 deletions
10
Makefile
10
Makefile
|
@ -1,10 +0,0 @@
|
|||
all: fmt vet test
|
||||
|
||||
fmt:
|
||||
go fmt ./...
|
||||
|
||||
vet:
|
||||
go vet ./...
|
||||
|
||||
test:
|
||||
go test -vet=off ./...
|
|
@ -23,7 +23,6 @@ type Collection struct {
|
|||
type Options struct {
|
||||
// Files from shared collections will be available in every main template.
|
||||
SharedCollections []Collection
|
||||
FuncMap template.FuncMap
|
||||
}
|
||||
|
||||
// Load templates from specified directories with default options.
|
||||
|
@ -39,7 +38,6 @@ func LoadWithOptions(
|
|||
options Options,
|
||||
) (map[string]*template.Template, error) {
|
||||
sharedTemplate := template.New("")
|
||||
|
||||
for _, stp := range options.SharedCollections {
|
||||
files, err := getFiles(stp.RootDir, stp.Prefix)
|
||||
if err != nil {
|
||||
|
@ -47,12 +45,7 @@ func LoadWithOptions(
|
|||
}
|
||||
|
||||
for name, contents := range files {
|
||||
sharedTemplate = sharedTemplate.New(name)
|
||||
if options.FuncMap != nil {
|
||||
sharedTemplate = sharedTemplate.Funcs(options.FuncMap)
|
||||
}
|
||||
|
||||
sharedTemplate, err = sharedTemplate.Parse(contents)
|
||||
sharedTemplate, err = sharedTemplate.New(name).Parse(contents)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue