25 lines
536 B
Go
25 lines
536 B
Go
package context
|
|
|
|
import (
|
|
"github.com/flosch/pongo2"
|
|
)
|
|
|
|
// RenderFn renders a pongo2 template with additional context
|
|
func RenderFn(templateFilename, outDir, ctx *pongo2.Value, param ...*pongo2.Value) *pongo2.Value {
|
|
dataMapKey := ""
|
|
body := ""
|
|
|
|
for i, p := range param {
|
|
switch i {
|
|
case 0:
|
|
dataMapKey = p.String()
|
|
case 1:
|
|
body = p.String()
|
|
}
|
|
}
|
|
|
|
Add2Nav(CurrentTreeNodeConfig, CurrentPathConfig, templateFilename.String(), outDir.String(), "", ctx.Interface(), dataMapKey, body, true)
|
|
|
|
return pongo2.AsValue(nil)
|
|
}
|