Skip to content

Commit

Permalink
Improve error message on missing shortcode inner content
Browse files Browse the repository at this point in the history
Fixes #933
  • Loading branch information
bep committed Feb 28, 2015
1 parent 9d80ecb commit 241f9f9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion hugolib/shortcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ Loop:
// 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
Expand Down
2 changes: 1 addition & 1 deletion hugolib/shortcode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func TestExtractShortcodes(t *testing.T) {
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), ""},
Expand Down

0 comments on commit 241f9f9

Please sign in to comment.