summaryrefslogtreecommitdiffstats
path: root/hugolib/shortcode.go
diff options
context:
space:
mode:
authorbep <bjorn.erik.pedersen@gmail.com>2015-04-30 15:59:14 +0200
committerbep <bjorn.erik.pedersen@gmail.com>2015-04-30 15:59:07 +0200
commitbe9df847723f414770d38c071eada0cbe646b4e3 (patch)
tree811582d96afb84aaa42d6613ff1250244d390218 /hugolib/shortcode.go
parentbe7b830f33ca947fc6109e631c40b1c3e10666dd (diff)
shortcodeparser: fix panic on slash following opening shortcode comment
Fixes #1093
Diffstat (limited to 'hugolib/shortcode.go')
-rw-r--r--hugolib/shortcode.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/hugolib/shortcode.go b/hugolib/shortcode.go
index 722c86db0..2a973f99b 100644
--- a/hugolib/shortcode.go
+++ b/hugolib/shortcode.go
@@ -125,7 +125,11 @@ func (sc shortcode) String() string {
// HandleShortcodes does all in one go: extract, render and replace
// only used for testing
func HandleShortcodes(stringToParse string, page *Page, t tpl.Template) (string, error) {
- tmpContent, tmpShortcodes := extractAndRenderShortcodes(stringToParse, page, t)
+ tmpContent, tmpShortcodes, err := extractAndRenderShortcodes(stringToParse, page, t)
+
+ if err != nil {
+ return "", err
+ }
if len(tmpShortcodes) > 0 {
tmpContentWithTokensReplaced, err := replaceShortcodeTokens([]byte(tmpContent), shortcodePlaceholderPrefix, true, tmpShortcodes)
@@ -236,7 +240,7 @@ func renderShortcode(sc shortcode, p *Page, t tpl.Template) string {
return renderShortcodeWithPage(tmpl, data)
}
-func extractAndRenderShortcodes(stringToParse string, p *Page, t tpl.Template) (string, map[string]string) {
+func extractAndRenderShortcodes(stringToParse string, p *Page, t tpl.Template) (string, map[string]string, error) {
content, shortcodes, err := extractShortcodes(stringToParse, p, t)
renderedShortcodes := make(map[string]string)
@@ -255,7 +259,7 @@ func extractAndRenderShortcodes(stringToParse string, p *Page, t tpl.Template) (
}
}
- return content, renderedShortcodes
+ return content, renderedShortcodes, err
}