commit 82fdfa2c722cc89d47ffba8fa3d4bbef48c24c04
parent 5cff3e62198e83957b6163e71fcaf822ccb86c38
Author: Ask Bjørn Hansen <ask@develooper.com>
Date: Thu, 20 Feb 2014 00:02:08 -0800
Warn about bad shortcode parameters (and don't crash)
closes #193
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/hugolib/shortcode.go b/hugolib/shortcode.go
@@ -143,6 +143,11 @@ func Tokenize(in string) interface{} {
for i, v := range first {
index := strings.Index(v, "=")
+ if index < 0 {
+ fmt.Printf("Shortcode parameters must be key=value pairs (no spaces) (saw '%s')\n", v)
+ continue
+ }
+
if !inQuote {
if index > 1 {
keys = append(keys, v[:index])