From: spf13 Date: Thu, 28 Aug 2014 16:48:31 +0000 (-0400) Subject: Inner Shortcodes now treated as markdown. fixed #185 X-Git-Tag: v0.12~23 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=53b7d5b8;p=brevno-suite%2Fhugo Inner Shortcodes now treated as markdown. fixed #185 --- diff --git a/hugolib/shortcode.go b/hugolib/shortcode.go index bfbb1efd..82342673 100644 --- a/hugolib/shortcode.go +++ b/hugolib/shortcode.go @@ -93,7 +93,7 @@ func ShortcodesHandle(stringToParse string, p *Page, t Template) string { var data = &ShortcodeWithPage{Params: params, Page: p} if endStart > 0 { s := stringToParse[leadEnd+3 : leadEnd+endStart] - data.Inner = template.HTML(CleanP(ShortcodesHandle(s, p, t))) + data.Inner = template.HTML(renderBytes([]byte(CleanP(ShortcodesHandle(s, p, t))), p.guessMarkupType())) remainder := CleanP(stringToParse[leadEnd+endEnd:]) return CleanP(stringToParse[:leadStart]) + diff --git a/hugolib/shortcode_test.go b/hugolib/shortcode_test.go index 138d1a6c..115c70fd 100644 --- a/hugolib/shortcode_test.go +++ b/hugolib/shortcode_test.go @@ -53,8 +53,20 @@ func TestInnerSC(t *testing.T) { tem.AddInternalShortcode("inside.html", `{{ .Inner }}`) CheckShortCodeMatch(t, `{{% inside class="aspen" %}}`, `
`, tem) - CheckShortCodeMatch(t, `{{% inside class="aspen" %}}More Here{{% /inside %}}`, `
More Here
`, tem) - CheckShortCodeMatch(t, `{{% inside %}}More Here{{% /inside %}}`, `
More Here
`, tem) + CheckShortCodeMatch(t, `{{% inside class="aspen" %}}More Here{{% /inside %}}`, "

More Here

\n
", tem) + CheckShortCodeMatch(t, `{{% inside %}}More Here{{% /inside %}}`, "

More Here

\n
", tem) +} + +func TestInnerSCWithMarkdown(t *testing.T) { + tem := NewTemplate() + tem.AddInternalShortcode("inside.html", `{{ .Inner }}`) + + CheckShortCodeMatch(t, `{{% inside %}} +# More Here + +[link](http://spf13.com) and text + +{{% /inside %}}`, "

More Here

\n\n

link and text

\n
", tem) } func TestEmbeddedSC(t *testing.T) {