ref: 241f9f9e469b14145f88546ce3873c9b0e1a2634
parent: 9d80ecb4d8efa1a45f649d8b75d7e2c946c09070
author: bep <[email protected]>
date: Sat Feb 28 14:24:30 EST 2015
Improve error message on missing shortcode inner content Fixes #933
--- a/hugolib/shortcode.go
+++ b/hugolib/shortcode.go
@@ -313,7 +313,7 @@
// return that error, more specific
continue
}
- return sc, fmt.Errorf("Shortcode '%s' has no .Inner, yet a closing tag was provided", next.val)
+ return sc, fmt.Errorf("Shortcode '%s' in page '%s' has no .Inner, yet a closing tag was provided", next.val, p.FullFilePath())
}
pt.consume(2)
return sc, nil
--- a/hugolib/shortcode_test.go
+++ b/hugolib/shortcode_test.go
@@ -184,7 +184,7 @@
testScPlaceholderRegexp, ""},
{"inner", `Some text. {{< inner >}}Inner Content{{< / inner >}}. Some more text.`, `inner([], false){[Inner Content]}`,
fmt.Sprintf("Some text. %s. Some more text.", testScPlaceholderRegexp), ""},
- {"close, but not inner", "{{< tag >}}foo{{< /tag >}}", "", false, "Shortcode 'tag' has no .Inner.*"},
+ {"close, but not inner", "{{< tag >}}foo{{< /tag >}}", "", false, "Shortcode 'tag' in page 'simple.md' has no .Inner.*"},
{"nested inner", `Inner->{{< inner >}}Inner Content->{{% inner2 param1 %}}inner2txt{{% /inner2 %}}Inner close->{{< / inner >}}<-done`,
`inner([], false){[Inner Content-> inner2([\"param1\"], true){[inner2txt]} Inner close->]}`,
fmt.Sprintf("Inner->%s<-done", testScPlaceholderRegexp), ""},