Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-04-02 11:30:24 +0300
committerGitHub <noreply@github.com>2019-04-02 11:30:24 +0300
commita55640de8e3944d3b9f64b15155148a0e35cb31e (patch)
tree3fe07277c5f7f675571c15851ce9fdc96a2bcecd /compare/compare.go
parent9225db636e2f9b75f992013a25c0b149d6bd8b0d (diff)
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
Diffstat (limited to 'compare/compare.go')
-rw-r--r--compare/compare.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/compare/compare.go b/compare/compare.go
index 19a5deaa2..18c0de777 100644
--- a/compare/compare.go
+++ b/compare/compare.go
@@ -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