diff --git a/hugolib/page_test.go b/hugolib/page_test.go index 96b16c664..be74605cb 100644 --- a/hugolib/page_test.go +++ b/hugolib/page_test.go @@ -680,7 +680,7 @@ func TestPageWithShortCodeInSummary(t *testing.T) { assertFunc := func(t *testing.T, ext string, pages page.Pages) { p := pages[0] checkPageTitle(t, p, "Simple") - checkPageContent(t, p, normalizeExpected(ext, "

Summary Next Line.

. More text here.

Some more text

")) + checkPageContent(t, p, normalizeExpected(ext, "

Summary Next Line.

. More text here.

Some more text

")) checkPageSummary(t, p, "Summary Next Line. . More text here. Some more text") checkPageType(t, p, "page") } diff --git a/hugolib/shortcode_test.go b/hugolib/shortcode_test.go index 7f206a788..bce95b527 100644 --- a/hugolib/shortcode_test.go +++ b/hugolib/shortcode_test.go @@ -242,8 +242,8 @@ func TestInnerSCWithMarkdown(t *testing.T) { func TestEmbeddedSC(t *testing.T) { t.Parallel() - CheckShortCodeMatch(t, `{{% figure src="/found/here" class="bananas orange" %}}`, "
\n \n
", nil) - CheckShortCodeMatch(t, `{{% figure src="/found/here" class="bananas orange" caption="This is a caption" %}}`, "
\n \"This
\n

This is a caption

\n
\n
", nil) + CheckShortCodeMatch(t, `{{% figure src="/found/here" class="bananas orange" %}}`, "
\n
", nil) + CheckShortCodeMatch(t, `{{% figure src="/found/here" class="bananas orange" caption="This is a caption" %}}`, "
\"This
\n

This is a caption

\n
\n
", nil) } func TestNestedSC(t *testing.T) { @@ -288,43 +288,43 @@ func TestParentShortcode(t *testing.T) { func TestFigureOnlySrc(t *testing.T) { t.Parallel() - CheckShortCodeMatch(t, `{{< figure src="/found/here" >}}`, "
\n \n
", nil) + CheckShortCodeMatch(t, `{{< figure src="/found/here" >}}`, "
\n
", nil) } func TestFigureCaptionAttrWithMarkdown(t *testing.T) { t.Parallel() - CheckShortCodeMatch(t, `{{< figure src="/found/here" caption="Something **bold** _italic_" >}}`, "
\n \"Something
\n

Something bold italic

\n
\n
", nil) - CheckShortCodeMatch(t, `{{< figure src="/found/here" attr="Something **bold** _italic_" >}}`, "
\n
\n

Something bold italic

\n
\n
", nil) + CheckShortCodeMatch(t, `{{< figure src="/found/here" caption="Something **bold** _italic_" >}}`, "
\"Something
\n

Something bold italic

\n
\n
", nil) + CheckShortCodeMatch(t, `{{< figure src="/found/here" attr="Something **bold** _italic_" >}}`, "
\n

Something bold italic

\n
\n
", nil) } func TestFigureImgWidth(t *testing.T) { t.Parallel() - CheckShortCodeMatch(t, `{{% figure src="/found/here" class="bananas orange" alt="apple" width="100px" %}}`, "
\n \"apple\" \n
", nil) + CheckShortCodeMatch(t, `{{% figure src="/found/here" class="bananas orange" alt="apple" width="100px" %}}`, "
\"apple\"\n
", nil) } func TestFigureImgHeight(t *testing.T) { t.Parallel() - CheckShortCodeMatch(t, `{{% figure src="/found/here" class="bananas orange" alt="apple" height="100px" %}}`, "
\n \"apple\" \n
", nil) + CheckShortCodeMatch(t, `{{% figure src="/found/here" class="bananas orange" alt="apple" height="100px" %}}`, "
\"apple\"\n
", nil) } func TestFigureImgWidthAndHeight(t *testing.T) { t.Parallel() - CheckShortCodeMatch(t, `{{% figure src="/found/here" class="bananas orange" alt="apple" width="50" height="100" %}}`, "
\n \"apple\" \n
", nil) + CheckShortCodeMatch(t, `{{% figure src="/found/here" class="bananas orange" alt="apple" width="50" height="100" %}}`, "
\"apple\"\n
", nil) } func TestFigureLinkNoTarget(t *testing.T) { t.Parallel() - CheckShortCodeMatch(t, `{{< figure src="/found/here" link="/jump/here/on/clicking" >}}`, "
\n \n
", nil) + CheckShortCodeMatch(t, `{{< figure src="/found/here" link="/jump/here/on/clicking" >}}`, "
\n
", nil) } func TestFigureLinkWithTarget(t *testing.T) { t.Parallel() - CheckShortCodeMatch(t, `{{< figure src="/found/here" link="/jump/here/on/clicking" target="_self" >}}`, "
\n \n
", nil) + CheckShortCodeMatch(t, `{{< figure src="/found/here" link="/jump/here/on/clicking" target="_self" >}}`, "
\n
", nil) } func TestFigureLinkWithTargetAndRel(t *testing.T) { t.Parallel() - CheckShortCodeMatch(t, `{{< figure src="/found/here" link="/jump/here/on/clicking" target="_blank" rel="noopener" >}}`, "
\n \n
", nil) + CheckShortCodeMatch(t, `{{< figure src="/found/here" link="/jump/here/on/clicking" target="_blank" rel="noopener" >}}`, "
\n
", nil) } // #1642 diff --git a/tpl/tplimpl/embedded/templates.autogen.go b/tpl/tplimpl/embedded/templates.autogen.go index 1391e8956..2da6e619e 100644 --- a/tpl/tplimpl/embedded/templates.autogen.go +++ b/tpl/tplimpl/embedded/templates.autogen.go @@ -366,14 +366,14 @@ if (!doNotTrack) { {`shortcodes/figure.html`, ` {{- if .Get "link" -}} - {{- end }} + {{- end -}} {{ with .Get + /> {{- if .Get "link" }}{{ end -}} {{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}}
diff --git a/tpl/tplimpl/embedded/templates/shortcodes/figure.html b/tpl/tplimpl/embedded/templates/shortcodes/figure.html index f81bdadfc..ecabb286e 100644 --- a/tpl/tplimpl/embedded/templates/shortcodes/figure.html +++ b/tpl/tplimpl/embedded/templates/shortcodes/figure.html @@ -1,14 +1,14 @@ {{- if .Get "link" -}} - {{- end }} + {{- end -}} {{ with .Get + /> {{- if .Get "link" }}{{ end -}} {{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}}