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"
|
|
|
|
disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "setion"]
|
|
|
|
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
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
{{< youtube PArFPgHrNZM >}}
|
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 }}|
|
|
|
|
`
|
|
|
|
b := NewIntegrationTestBuilder(
|
|
|
|
IntegrationTestConfig{
|
|
|
|
T: t,
|
|
|
|
TxtarString: files,
|
2021-10-31 06:56:36 -04:00
|
|
|
},
|
2023-01-04 12:24:36 -05:00
|
|
|
).Build()
|
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
|
|
|
|
https://www.youtube.com/embed/PArFPgHrNZM
|
|
|
|
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
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
})
|
2016-11-13 18:04:28 -05:00
|
|
|
}
|