summaryrefslogtreecommitdiffstats
path: root/hugolib
diff options
context:
space:
mode:
authorJoe Mooring <joe.mooring@veriphor.com>2021-04-09 19:03:01 -0700
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-04-15 14:43:32 +0200
commit9b34d42bb2ff05deaeeef63ff4b5b993f35f0451 (patch)
tree8011eac37b3b4c1c2e625015ebf6eedb87967484 /hugolib
parentc2d8f87cfc1c4ae666fbb1fb5b8983d43492333f (diff)
Remove extraneous space from figure shortcode
Fixes #8401
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/page_test.go2
-rw-r--r--hugolib/shortcode_test.go22
2 files changed, 12 insertions, 12 deletions
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, "<p>Summary Next Line. <figure> <img src=\"/not/real\"/> </figure> . More text here.</p><p>Some more text</p>"))
+ checkPageContent(t, p, normalizeExpected(ext, "<p>Summary Next Line. <figure><img src=\"/not/real\"/> </figure> . More text here.</p><p>Some more text</p>"))
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" %}}`, "<figure class=\"bananas orange\">\n <img src=\"/found/here\"/> \n</figure>", nil)
- CheckShortCodeMatch(t, `{{% figure src="/found/here" class="bananas orange" caption="This is a caption" %}}`, "<figure class=\"bananas orange\">\n <img src=\"/found/here\"\n alt=\"This is a caption\"/> <figcaption>\n <p>This is a caption</p>\n </figcaption>\n</figure>", nil)
+ CheckShortCodeMatch(t, `{{% figure src="/found/here" class="bananas orange" %}}`, "<figure class=\"bananas orange\"><img src=\"/found/here\"/>\n</figure>", nil)
+ CheckShortCodeMatch(t, `{{% figure src="/found/here" class="bananas orange" caption="This is a caption" %}}`, "<figure class=\"bananas orange\"><img src=\"/found/here\"\n alt=\"This is a caption\"/><figcaption>\n <p>This is a caption</p>\n </figcaption>\n</figure>", 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" >}}`, "<figure>\n <img src=\"/found/here\"/> \n</figure>", nil)
+ CheckShortCodeMatch(t, `{{< figure src="/found/here" >}}`, "<figure><img src=\"/found/here\"/>\n</figure>", nil)
}
func TestFigureCaptionAttrWithMarkdown(t *testing.T) {
t.Parallel()
- CheckShortCodeMatch(t, `{{< figure src="/found/here" caption="Something **bold** _italic_" >}}`, "<figure>\n <img src=\"/found/here\"\n alt=\"Something bold italic\"/> <figcaption>\n <p>Something <strong>bold</strong> <em>italic</em></p>\n </figcaption>\n</figure>", nil)
- CheckShortCodeMatch(t, `{{< figure src="/found/here" attr="Something **bold** _italic_" >}}`, "<figure>\n <img src=\"/found/here\"/> <figcaption>\n <p>Something <strong>bold</strong> <em>italic</em></p>\n </figcaption>\n</figure>", nil)
+ CheckShortCodeMatch(t, `{{< figure src="/found/here" caption="Something **bold** _italic_" >}}`, "<figure><img src=\"/found/here\"\n alt=\"Something bold italic\"/><figcaption>\n <p>Something <strong>bold</strong> <em>italic</em></p>\n </figcaption>\n</figure>", nil)
+ CheckShortCodeMatch(t, `{{< figure src="/found/here" attr="Something **bold** _italic_" >}}`, "<figure><img src=\"/found/here\"/><figcaption>\n <p>Something <strong>bold</strong> <em>italic</em></p>\n </figcaption>\n</figure>", nil)
}
func TestFigureImgWidth(t *testing.T) {
t.Parallel()
- CheckShortCodeMatch(t, `{{% figure src="/found/here" class="bananas orange" alt="apple" width="100px" %}}`, "<figure class=\"bananas orange\">\n <img src=\"/found/here\"\n alt=\"apple\" width=\"100px\"/> \n</figure>", nil)
+ CheckShortCodeMatch(t, `{{% figure src="/found/here" class="bananas orange" alt="apple" width="100px" %}}`, "<figure class=\"bananas orange\"><img src=\"/found/here\"\n alt=\"apple\" width=\"100px\"/>\n</figure>", nil)
}
func TestFigureImgHeight(t *testing.T) {
t.Parallel()
- CheckShortCodeMatch(t, `{{% figure src="/found/here" class="bananas orange" alt="apple" height="100px" %}}`, "<figure class=\"bananas orange\">\n <img src=\"/found/here\"\n alt=\"apple\" height=\"100px\"/> \n</figure>", nil)
+ CheckShortCodeMatch(t, `{{% figure src="/found/here" class="bananas orange" alt="apple" height="100px" %}}`, "<figure class=\"bananas orange\"><img src=\"/found/here\"\n alt=\"apple\" height=\"100px\"/>\n</figure>", nil)
}
func TestFigureImgWidthAndHeight(t *testing.T) {
t.Parallel()
- CheckShortCodeMatch(t, `{{% figure src="/found/here" class="bananas orange" alt="apple" width="50" height="100" %}}`, "<figure class=\"bananas orange\">\n <img src=\"/found/here\"\n alt=\"apple\" width=\"50\" height=\"100\"/> \n</figure>", nil)
+ CheckShortCodeMatch(t, `{{% figure src="/found/here" class="bananas orange" alt="apple" width="50" height="100" %}}`, "<figure class=\"bananas orange\"><img src=\"/found/here\"\n alt=\"apple\" width=\"50\" height=\"100\"/>\n</figure>", nil)
}
func TestFigureLinkNoTarget(t *testing.T) {
t.Parallel()
- CheckShortCodeMatch(t, `{{< figure src="/found/here" link="/jump/here/on/clicking" >}}`, "<figure><a href=\"/jump/here/on/clicking\">\n <img src=\"/found/here\"/> </a>\n</figure>", nil)
+ CheckShortCodeMatch(t, `{{< figure src="/found/here" link="/jump/here/on/clicking" >}}`, "<figure><a href=\"/jump/here/on/clicking\"><img src=\"/found/here\"/></a>\n</figure>", nil)
}
func TestFigureLinkWithTarget(t *testing.T) {
t.Parallel()
- CheckShortCodeMatch(t, `{{< figure src="/found/here" link="/jump/here/on/clicking" target="_self" >}}`, "<figure><a href=\"/jump/here/on/clicking\" target=\"_self\">\n <img src=\"/found/here\"/> </a>\n</figure>", nil)
+ CheckShortCodeMatch(t, `{{< figure src="/found/here" link="/jump/here/on/clicking" target="_self" >}}`, "<figure><a href=\"/jump/here/on/clicking\" target=\"_self\"><img src=\"/found/here\"/></a>\n</figure>", nil)
}
func TestFigureLinkWithTargetAndRel(t *testing.T) {
t.Parallel()
- CheckShortCodeMatch(t, `{{< figure src="/found/here" link="/jump/here/on/clicking" target="_blank" rel="noopener" >}}`, "<figure><a href=\"/jump/here/on/clicking\" target=\"_blank\" rel=\"noopener\">\n <img src=\"/found/here\"/> </a>\n</figure>", nil)
+ CheckShortCodeMatch(t, `{{< figure src="/found/here" link="/jump/here/on/clicking" target="_blank" rel="noopener" >}}`, "<figure><a href=\"/jump/here/on/clicking\" target=\"_blank\" rel=\"noopener\"><img src=\"/found/here\"/></a>\n</figure>", nil)
}
// #1642