hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit 1b7f18e39172429545198b3559dcc64bbfb7aa9c
parent 7b3df2386d25791253c1c784bd399f746cd7aef4
Author: spf13 <steve.francia@gmail.com>
Date:   Wed,  3 Sep 2014 11:30:08 -0400

Making partials context optional for compatibility with template.

If not provided, context is nil.

Diffstat:
Mhugolib/template.go | 9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/hugolib/template.go b/hugolib/template.go
@@ -296,10 +296,17 @@ func NewTemplate() Template {
 	return templates
 }
 
-func Partial(name string, context interface{}) template.HTML {
+func Partial(name string, context_list ...interface{}) template.HTML {
 	if strings.HasPrefix("partials/", name) {
 		name = name[8:]
 	}
+	var context interface{}
+
+	if len(context_list) == 0 {
+		context = nil
+	} else {
+		context = context_list[0]
+	}
 	return ExecuteTemplateToHTML(context, "partials/"+name, "theme/partials/"+name)
 }