mirror of
https://github.com/gohugoio/hugo.git
synced 2025-03-19 18:11:58 +00:00
Fix missing space before 'width'
The newly introduced width-param on figure did not work in combo with alt or caption due to space-issues. This fixes that.
This commit is contained in:
parent
cafd39eb9b
commit
266511b6d3
2 changed files with 3 additions and 3 deletions
|
@ -78,7 +78,7 @@ func TestEmbeddedSC(t *testing.T) {
|
||||||
|
|
||||||
func TestFigureImgWidth(t *testing.T) {
|
func TestFigureImgWidth(t *testing.T) {
|
||||||
tem := NewTemplate()
|
tem := NewTemplate()
|
||||||
CheckShortCodeMatch(t, `{{% figure src="/found/here" class="bananas orange" width="100px" %}}`, "\n<figure class=\"bananas orange\">\n \n <img src=\"/found/here\" width=\"100px\" />\n \n \n</figure>\n", tem)
|
CheckShortCodeMatch(t, `{{% figure src="/found/here" class="bananas orange" alt="apple" width="100px" %}}`, "\n<figure class=\"bananas orange\">\n \n <img src=\"/found/here\" alt=\"apple\" width=\"100px\" />\n \n \n</figure>\n", tem)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestUnbalancedQuotes(t *testing.T) {
|
func TestUnbalancedQuotes(t *testing.T) {
|
||||||
|
|
|
@ -24,7 +24,7 @@ func (t *GoHtmlTemplate) EmbedShortcodes() {
|
||||||
t.AddInternalShortcode("figure.html", `<!-- image -->
|
t.AddInternalShortcode("figure.html", `<!-- image -->
|
||||||
<figure {{ with .Get "class" }}class="{{.}}"{{ end }}>
|
<figure {{ with .Get "class" }}class="{{.}}"{{ end }}>
|
||||||
{{ with .Get "link"}}<a href="{{.}}">{{ end }}
|
{{ with .Get "link"}}<a href="{{.}}">{{ end }}
|
||||||
<img src="{{ .Get "src" }}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" }}{{ end }}"{{ end }}{{ with .Get "width" }}width="{{.}}"{{ end }} />
|
<img src="{{ .Get "src" }}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" }}{{ end }}" {{ end }}{{ with .Get "width" }}width="{{.}}" {{ end }}/>
|
||||||
{{ if .Get "link"}}</a>{{ end }}
|
{{ if .Get "link"}}</a>{{ end }}
|
||||||
{{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}}
|
{{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}}
|
||||||
<figcaption>{{ if isset .Params "title" }}
|
<figcaption>{{ if isset .Params "title" }}
|
||||||
|
|
Loading…
Reference in a new issue