mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
Add "target" and "rel" parameters to figure shortcode
Also: - Remove unnecessary space from `figure` tag if no class is specified. - Update related tests. - Add test cases for the changes made to the figure shortcode. - Document the newly added target and rel parameters - Add more detail to the documentation of all figure shortcode parameters.
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
76d38d5e53
commit
2e95ec6844
@@ -123,22 +123,22 @@ func TestShortcodeFigure(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
`{{< figure src="/img/hugo-logo.png" >}}`,
|
||||
"(?s)\n<figure >.*?<img src=\"/img/hugo-logo.png\" />.*?</figure>\n",
|
||||
"(?s)\n<figure>.*?<img src=\"/img/hugo-logo.png\" />.*?</figure>\n",
|
||||
},
|
||||
{
|
||||
// set alt
|
||||
`{{< figure src="/img/hugo-logo.png" alt="Hugo logo" >}}`,
|
||||
"(?s)\n<figure >.*?<img src=\"/img/hugo-logo.png\" alt=\"Hugo logo\" />.*?</figure>\n",
|
||||
"(?s)\n<figure>.*?<img src=\"/img/hugo-logo.png\" alt=\"Hugo logo\" />.*?</figure>\n",
|
||||
},
|
||||
// set title
|
||||
{
|
||||
`{{< figure src="/img/hugo-logo.png" title="Hugo logo" >}}`,
|
||||
"(?s)\n<figure >.*?<img src=\"/img/hugo-logo.png\" />.*?<figcaption>.*?<h4>Hugo logo</h4>.*?</figcaption>.*?</figure>\n",
|
||||
"(?s)\n<figure>.*?<img src=\"/img/hugo-logo.png\" />.*?<figcaption>.*?<h4>Hugo logo</h4>.*?</figcaption>.*?</figure>\n",
|
||||
},
|
||||
// set attr and attrlink
|
||||
{
|
||||
`{{< figure src="/img/hugo-logo.png" attr="Hugo logo" attrlink="/img/hugo-logo.png" >}}`,
|
||||
"(?s)\n<figure >.*?<img src=\"/img/hugo-logo.png\" />.*?<figcaption>.*?<p>.*?<a href=\"/img/hugo-logo.png\">.*?Hugo logo.*?</a>.*?</p>.*?</figcaption>.*?</figure>\n",
|
||||
"(?s)\n<figure>.*?<img src=\"/img/hugo-logo.png\" />.*?<figcaption>.*?<p>.*?<a href=\"/img/hugo-logo.png\">.*?Hugo logo.*?</a>.*?</p>.*?</figcaption>.*?</figure>\n",
|
||||
},
|
||||
} {
|
||||
|
||||
|
Reference in New Issue
Block a user