This repository has been archived on 2024-02-28. You can view files and clone it, but cannot push or open issues or pull requests.
stick/example_parent_test.go
2020-02-04 16:58:39 -07:00

37 lines
691 B
Go

package stick_test
import (
"fmt"
"os"
"path/filepath"
"github.com/tyler-sommer/stick"
)
// An example of macro definition and usage.
//
// This example uses a macro to list the values, also showing two
// ways to import macros. Check the templates in the testdata folder
// for more information.
func ExampleEnv_Execute_parent() {
d, _ := os.Getwd()
env := stick.New(stick.NewFilesystemLoader(filepath.Join(d, "testdata")))
err := env.Execute("parent.txt.twig", os.Stdout, nil)
if err != nil {
fmt.Println(err)
}
// Output:
// This is a document.
//
// Not A title
//
// Testing parent()
//
// This is a test
//
// Another section
//
// Some extra information.
}