mirror of
https://github.com/gohugoio/hugo.git
synced 2024-05-11 05:54:58 +00:00
tpl: Allow the partial template func to return any type
This commit adds support for return values in partials.
This means that you can now do this and similar:
{{ $v := add . 42 }}
{{ return $v }}
Partials without a `return` statement will be rendered as before.
This works for both `partial` and `partialCached`.
Fixes #5783
This commit is contained in:
committed by
GitHub
parent
9225db636e
commit
a55640de8e
@@ -20,6 +20,12 @@ type Eqer interface {
|
||||
Eq(other interface{}) bool
|
||||
}
|
||||
|
||||
// ProbablyEq is an equal check that may return false positives, but never
|
||||
// a false negative.
|
||||
type ProbablyEqer interface {
|
||||
ProbablyEq(other interface{}) bool
|
||||
}
|
||||
|
||||
// Comparer can be used to compare two values.
|
||||
// This will be used when using the le, ge etc. operators in the templates.
|
||||
// Compare returns -1 if the given version is less than, 0 if equal and 1 if greater than
|
||||
|
||||
Reference in New Issue
Block a user