ref: 92c7f7ab85a40cae8f36f2348d86f3e47d811eb5
parent: a03c631c420a03f9d90699abdf9be7e4fca0ff61
author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
date: Thu Dec 12 06:44:36 EST 2019
tpl: Add some comments
--- a/tpl/internal/go_templates/texttemplate/hugo_template.go
+++ b/tpl/internal/go_templates/texttemplate/hugo_template.go
@@ -88,7 +88,7 @@
return
}
-// Below are modifed structs etc.
+// Below are modifed structs etc. The changes are marked with "Added for Hugo."
// state represents the state of an execution. It's not part of the
// template so that multiple executions of the same template
@@ -95,7 +95,7 @@
// can execute in parallel.
type state struct {
tmpl *Template
- helper ExecHelper
+ helper ExecHelper // Added for Hugo.
wr io.Writer
node parse.Node // current node, for errors
vars []variable // push-down stack of variable values.
@@ -109,6 +109,7 @@
var function reflect.Value
var ok bool
if s.helper != nil {
+ // Added for Hugo.
function, ok = s.helper.GetFunc(name)
}
@@ -175,6 +176,7 @@
}
var result reflect.Value
if s.helper != nil {
+ // Added for Hugo.
result, _ = s.helper.GetMapValue(receiver, nameVal)
} else {
result = receiver.MapIndex(nameVal)