2019-01-02 06:33:26 -05:00
|
|
|
// Copyright 2019 The Hugo Authors. All rights reserved.
|
2016-06-12 23:32:26 -04:00
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
package hugolib
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
"github.com/gohugoio/hugo/htesting"
|
2016-06-12 23:32:26 -04:00
|
|
|
)
|
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
func TestEmbeddedShortcodes(t *testing.T) {
|
|
|
|
if !htesting.IsCI() {
|
|
|
|
t.Skip("skip on non-CI for now")
|
2016-06-12 23:32:26 -04:00
|
|
|
}
|
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
t.Run("with theme", func(t *testing.T) {
|
|
|
|
t.Parallel()
|
|
|
|
|
|
|
|
files := `
|
|
|
|
-- hugo.toml --
|
|
|
|
baseURL = "https://example.com"
|
2023-05-22 13:11:12 -04:00
|
|
|
disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "section"]
|
2023-01-04 12:24:36 -05:00
|
|
|
ignoreErrors = ["error-missing-instagram-accesstoken"]
|
|
|
|
[params]
|
|
|
|
foo = "bar"
|
|
|
|
-- content/_index.md --
|
2017-02-04 22:20:06 -05:00
|
|
|
---
|
2023-01-04 12:24:36 -05:00
|
|
|
title: "Home"
|
2017-02-04 22:20:06 -05:00
|
|
|
---
|
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
## Figure
|
2017-02-04 22:20:06 -05:00
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
{{< figure src="image.png" >}}
|
2016-06-12 23:32:26 -04:00
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
## Gist
|
2016-06-12 23:32:26 -04:00
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
{{< gist spf13 7896402 >}}
|
2017-02-04 22:20:06 -05:00
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
## Highlight
|
2016-06-12 23:32:26 -04:00
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
{{< highlight go >}}
|
|
|
|
package main
|
|
|
|
{{< /highlight >}}
|
2016-06-12 23:32:26 -04:00
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
## Instagram
|
2016-06-12 23:32:26 -04:00
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
{{< instagram BWNjjyYFxVx >}}
|
2016-06-12 23:32:26 -04:00
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
## Tweet
|
2017-02-04 22:20:06 -05:00
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
{{< tweet user="1626985695280603138" id="877500564405444608" >}}
|
2016-06-12 23:32:26 -04:00
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
## Vimeo
|
2016-06-12 23:32:26 -04:00
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
{{< vimeo 20097015 >}}
|
2017-02-04 22:20:06 -05:00
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
## YouTube
|
2016-06-12 23:32:26 -04:00
|
|
|
|
2024-04-03 16:09:11 -04:00
|
|
|
{{< youtube 0RKpf3rK57I >}}
|
2016-06-12 23:32:26 -04:00
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
## Param
|
2017-02-04 22:20:06 -05:00
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
Foo: {{< param foo >}}
|
2016-06-12 23:32:26 -04:00
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
-- layouts/index.html --
|
|
|
|
Content: {{ .Content }}|
|
|
|
|
`
|
2024-01-28 16:11:05 -05:00
|
|
|
b := Test(t, files)
|
2017-02-04 22:20:06 -05:00
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
b.AssertFileContent("public/index.html", `
|
|
|
|
<figure>
|
|
|
|
https://gist.github.com/spf13/7896402.js
|
|
|
|
<span style="color:#a6e22e">main</span></span>
|
|
|
|
https://t.co/X94FmYDEZJ
|
2024-04-03 16:09:11 -04:00
|
|
|
https://www.youtube.com/embed/0RKpf3rK57I
|
2023-01-04 12:24:36 -05:00
|
|
|
Foo: bar
|
2021-06-07 06:45:00 -04:00
|
|
|
|
2016-11-13 18:04:28 -05:00
|
|
|
|
2017-02-04 22:20:06 -05:00
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
`)
|
|
|
|
})
|
2016-11-13 18:04:28 -05:00
|
|
|
}
|