Skip to content

Commit f42a4b6

Browse files
jmooringbep
authored andcommitted
tpl/tplimpl: Deprecate gist shortcode
Closes #13211
1 parent a563783 commit f42a4b6

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
{{- warnf "The %q shortcode was deprecated in v0.143.0 and will be removed in a future release. See https://gohugo.io/shortcodes/gist for instructions to create a replacement." .Name -}}
12
<script src="https://gist.github.com/{{ index .Params 0 }}/{{ index .Params 1 }}.js{{if len .Params | eq 3 }}?file={{ index .Params 2 }}{{end}}"></script>

tpl/tplimpl/shortcodes_integration_test.go

+23
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ disableKinds = ['page','rss','section','sitemap','taxonomy','term']
3030
-- layouts/index.html --
3131
{{ .Content }}
3232
-- content/_index.md --
33+
---
34+
title: home
35+
---
3336
a{{< comment >}}b{{< /comment >}}c
3437
`
3538

@@ -87,6 +90,26 @@ E: An _emphasized_ word.
8790
)
8891
}
8992

93+
func TestGistShortcode(t *testing.T) {
94+
t.Parallel()
95+
96+
files := `
97+
-- hugo.toml --
98+
disableKinds = ['page','rss','section','sitemap','taxonomy','term']
99+
-- layouts/index.html --
100+
{{ .Content }}
101+
-- content/_index.md --
102+
---
103+
title: home
104+
---
105+
{{< gist jmooring 23932424365401ffa5e9d9810102a477 >}}
106+
`
107+
108+
b := hugolib.Test(t, files, hugolib.TestOptWarn())
109+
b.AssertFileContent("public/index.html", `<script src="https://gist.github.com/jmooring/23932424365401ffa5e9d9810102a477.js"></script>`)
110+
b.AssertLogContains(`WARN The "gist" shortcode was deprecated in v0.143.0 and will be removed in a future release. See https://gohugo.io/shortcodes/gist for instructions to create a replacement.`)
111+
}
112+
90113
func TestInstagramShortcode(t *testing.T) {
91114
t.Parallel()
92115

0 commit comments

Comments
 (0)