From 3da97656ea4c32fe7619945df7a13bc73cdca3fd Mon Sep 17 00:00:00 2001 From: Raphael Estrada Date: Wed, 8 Oct 2014 15:54:50 +0100 Subject: [PATCH] add 'width' parameter to 'figure' shortcode --- hugolib/shortcode_test.go | 5 +++++ hugolib/template_embedded.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/hugolib/shortcode_test.go b/hugolib/shortcode_test.go index 115c70fdd..5ec793250 100644 --- a/hugolib/shortcode_test.go +++ b/hugolib/shortcode_test.go @@ -76,6 +76,11 @@ func TestEmbeddedSC(t *testing.T) { CheckShortCodeMatch(t, `{{% figure src="/found/here" class="bananas orange" caption="This is a caption" %}}`, "\n
\n \n \"This\n \n \n
\n

\n This is a caption\n \n \n \n

\n
\n \n
\n", tem) } +func TestFigureImgWidth(t *testing.T) { + tem := NewTemplate() + CheckShortCodeMatch(t, `{{% figure src="/found/here" class="bananas orange" width="100px" %}}`, "\n
\n \n \n \n \n
\n", tem) +} + func TestUnbalancedQuotes(t *testing.T) { tem := NewTemplate() diff --git a/hugolib/template_embedded.go b/hugolib/template_embedded.go index 6a1dbd91f..5dec5e6bf 100644 --- a/hugolib/template_embedded.go +++ b/hugolib/template_embedded.go @@ -24,7 +24,7 @@ func (t *GoHtmlTemplate) EmbedShortcodes() { t.AddInternalShortcode("figure.html", `
{{ with .Get "link"}}{{ end }} - + {{ if .Get "link"}}{{ end }} {{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}}
{{ if isset .Params "title" }}