summaryrefslogtreecommitdiffstats
path: root/hugolib/shortcode.go
diff options
context:
space:
mode:
authorVas Sudanagunta <vas@commonkarma.org>2018-05-04 20:17:16 -0400
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-05-12 20:16:26 +0200
commit2fb9af59c14b1732ba1a2f21794e2cf8dfca0604 (patch)
treee8bd293fae36dea700e779a9707598c8e7bc5252 /hugolib/shortcode.go
parent00e36a4164d730bd1dff1d0efd04283992bfe671 (diff)
Improve markup determination logic
Sets Page.markup earlier (as early as possible, when the page is loaded). Sets it once and only once, removing many redundant calls to determineMarkupType(). This kills a sleeping bug that was avoided by the parts of the code depending on this value making those redundant calls.
Diffstat (limited to 'hugolib/shortcode.go')
-rw-r--r--hugolib/shortcode.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/hugolib/shortcode.go b/hugolib/shortcode.go
index 8afbfb645..b82c1b6c2 100644
--- a/hugolib/shortcode.go
+++ b/hugolib/shortcode.go
@@ -314,7 +314,8 @@ func renderShortcode(
if sc.doMarkup {
newInner := p.s.ContentSpec.RenderBytes(&helpers.RenderingContext{
- Content: []byte(inner), PageFmt: p.determineMarkupType(),
+ Content: []byte(inner),
+ PageFmt: p.Markup,
Cfg: p.Language(),
DocumentID: p.UniqueID(),
DocumentName: p.Path(),
@@ -333,7 +334,7 @@ func renderShortcode(
// substitutions in <div>HUGOSHORTCODE-1</div> which prevents the
// generation, but means that you can’t use shortcodes inside of
// markdown structures itself (e.g., `[foo]({{% ref foo.md %}})`).
- switch p.determineMarkupType() {
+ switch p.Markup {
case "unknown", "markdown":
if match, _ := regexp.MatchString(innerNewlineRegexp, inner); !match {
cleaner, err := regexp.Compile(innerCleanupRegexp)