summaryrefslogtreecommitdiffstats
path: root/hugolib/shortcode.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-07-03 18:02:32 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-07-03 23:31:51 +0200
commit42e150fbfac736bd49bc7e50cb8cdf9f81386f59 (patch)
treef29afdf089823d6c6d4513ae67934357b88f2a05 /hugolib/shortcode.go
parent028b356787426dbc190ce9868fbc9a6400c2996e (diff)
Fix server reload when non-HTML shortcode changes
Fixes #7448
Diffstat (limited to 'hugolib/shortcode.go')
-rw-r--r--hugolib/shortcode.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/hugolib/shortcode.go b/hugolib/shortcode.go
index f5413a932..366c9971c 100644
--- a/hugolib/shortcode.go
+++ b/hugolib/shortcode.go
@@ -176,7 +176,8 @@ type shortcode struct {
ordinal int
err error
- info tpl.Info
+ info tpl.Info // One of the output formats (arbitrary)
+ templs []tpl.Template // All output formats
// If set, the rendered shortcode is sent as part of the surrounding content
// to Blackfriday and similar.
@@ -541,15 +542,14 @@ Loop:
sc.name = currItem.ValStr()
- // Check if the template expects inner content.
- // We pick the first template for an arbitrary output format
- // if more than one. It is "all inner or no inner".
- tmpl, found, _ := s.s.Tmpl().LookupVariant(sc.name, tpl.TemplateVariants{})
- if !found {
+ // Used to check if the template expects inner content.
+ templs := s.s.Tmpl().LookupVariants(sc.name)
+ if templs == nil {
return nil, _errors.Errorf("template for shortcode %q not found", sc.name)
}
- sc.info = tmpl.(tpl.Info)
+ sc.info = templs[0].(tpl.Info)
+ sc.templs = templs
case currItem.IsInlineShortcodeName():
sc.name = currItem.ValStr()
sc.isInline = true