mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
parent
7bc5d3663f
commit
9ff36c5a8f
2 changed files with 15 additions and 4 deletions
|
@ -95,6 +95,14 @@ func TestHyphenatedSC(t *testing.T) {
|
||||||
CheckShortCodeMatch(t, "{{< hyphenated-video 47238zzb >}}", "Playing Video 47238zzb", tem)
|
CheckShortCodeMatch(t, "{{< hyphenated-video 47238zzb >}}", "Playing Video 47238zzb", tem)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Issue #1753
|
||||||
|
func TestNoTrailingNewline(t *testing.T) {
|
||||||
|
tem := tpl.New()
|
||||||
|
tem.AddInternalShortcode("a.html", `{{ .Get 0 }}`)
|
||||||
|
|
||||||
|
CheckShortCodeMatch(t, "ab{{< a c >}}d", "abcd", tem)
|
||||||
|
}
|
||||||
|
|
||||||
func TestPositionalParamSC(t *testing.T) {
|
func TestPositionalParamSC(t *testing.T) {
|
||||||
tem := tpl.New()
|
tem := tpl.New()
|
||||||
tem.AddInternalShortcode("video.html", `Playing Video {{ .Get 0 }}`)
|
tem.AddInternalShortcode("video.html", `Playing Video {{ .Get 0 }}`)
|
||||||
|
|
|
@ -344,6 +344,9 @@ func doTestCrossrefs(t *testing.T, relative, uglyURLs bool) {
|
||||||
{{< %s "sect/doc1.md" >}}
|
{{< %s "sect/doc1.md" >}}
|
||||||
|
|
||||||
THE END.`, refShortcode))},
|
THE END.`, refShortcode))},
|
||||||
|
// Issue #1753: Should not add a trailing newline after shortcode.
|
||||||
|
{filepath.FromSlash("sect/doc3.md"),
|
||||||
|
[]byte(fmt.Sprintf(`**Ref 1:**{{< %s "sect/doc3.md" >}}.`, refShortcode))},
|
||||||
}
|
}
|
||||||
|
|
||||||
s := &Site{
|
s := &Site{
|
||||||
|
@ -364,6 +367,7 @@ THE END.`, refShortcode))},
|
||||||
}{
|
}{
|
||||||
{filepath.FromSlash(fmt.Sprintf("sect/doc1%s", expectedPathSuffix)), fmt.Sprintf("<p>Ref 2: %s/sect/doc2%s</p>\n", expectedBase, expectedURLSuffix)},
|
{filepath.FromSlash(fmt.Sprintf("sect/doc1%s", expectedPathSuffix)), fmt.Sprintf("<p>Ref 2: %s/sect/doc2%s</p>\n", expectedBase, expectedURLSuffix)},
|
||||||
{filepath.FromSlash(fmt.Sprintf("sect/doc2%s", expectedPathSuffix)), fmt.Sprintf("<p><strong>Ref 1:</strong></p>\n\n%s/sect/doc1%s\n\n<p>THE END.</p>\n", expectedBase, expectedURLSuffix)},
|
{filepath.FromSlash(fmt.Sprintf("sect/doc2%s", expectedPathSuffix)), fmt.Sprintf("<p><strong>Ref 1:</strong></p>\n\n%s/sect/doc1%s\n\n<p>THE END.</p>\n", expectedBase, expectedURLSuffix)},
|
||||||
|
{filepath.FromSlash(fmt.Sprintf("sect/doc3%s", expectedPathSuffix)), fmt.Sprintf("<p><strong>Ref 1:</strong>%s/sect/doc3%s.</p>\n", expectedBase, expectedURLSuffix)},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
|
@ -1038,7 +1042,6 @@ func setupLinkingMockSite(t *testing.T) *Site {
|
||||||
{filepath.FromSlash("level2/index.md"), []byte("")},
|
{filepath.FromSlash("level2/index.md"), []byte("")},
|
||||||
{filepath.FromSlash("level2/common.md"), []byte("")},
|
{filepath.FromSlash("level2/common.md"), []byte("")},
|
||||||
|
|
||||||
|
|
||||||
// {filepath.FromSlash("level2b/2b-root.md"), []byte("")},
|
// {filepath.FromSlash("level2b/2b-root.md"), []byte("")},
|
||||||
// {filepath.FromSlash("level2b/index.md"), []byte("")},
|
// {filepath.FromSlash("level2b/index.md"), []byte("")},
|
||||||
// {filepath.FromSlash("level2b/common.md"), []byte("")},
|
// {filepath.FromSlash("level2b/common.md"), []byte("")},
|
||||||
|
|
Loading…
Reference in a new issue