summaryrefslogtreecommitdiffstats
path: root/hugolib/shortcode.go
diff options
context:
space:
mode:
authorbep <bjorn.erik.pedersen@gmail.com>2015-03-02 21:23:16 +0100
committerbep <bjorn.erik.pedersen@gmail.com>2015-03-02 21:49:33 +0100
commitab5862cd00d84114cc82cde88d31ab1d8eddd388 (patch)
treee98556f80d2d14cea4d159bff8e4d74060631861 /hugolib/shortcode.go
parent241f9f9e469b14145f88546ce3873c9b0e1a2634 (diff)
Allow the same shortcode to be used with or without inline content
Fixes #934
Diffstat (limited to 'hugolib/shortcode.go')
-rw-r--r--hugolib/shortcode.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/hugolib/shortcode.go b/hugolib/shortcode.go
index f144fa38b..08a48d98b 100644
--- a/hugolib/shortcode.go
+++ b/hugolib/shortcode.go
@@ -307,15 +307,21 @@ Loop:
}
case tScClose:
+ next := pt.peek()
if !isInner {
- next := pt.peek()
if next.typ == tError {
// return that error, more specific
continue
}
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)
+ if next.typ == tRightDelimScWithMarkup || next.typ == tRightDelimScNoMarkup {
+ // self-closing
+ pt.consume(1)
+ } else {
+ pt.consume(2)
+ }
+
return sc, nil
case tText:
sc.inner = append(sc.inner, currItem.val)