})
}
}
+
+func TestRenderHookMultilingual(t *testing.T) {
+ t.Parallel()
+
+ files := `
+-- hugo.toml --
+baseURL = 'https://example.org/'
+defaultContentLanguage = 'en'
+[markup.goldmark.renderHooks.image]
+enableDefault = false
+[languages.en]
+weight = 1
+[languages.tr]
+weight = 2
+-- content/p1.en.md --
+---
+title: p1
+---
+
+-- content/p1.tr.md --
+---
+title: p1
+---
+
+-- layouts/_markup/render-image.tr.html --
+TR-IMAGE
+-- layouts/_default/single.html --
+{{ .Content }}
+`
+
+ b := hugolib.Test(t, files)
+
+ b.AssertFileContent("public/p1/index.html", "<img src=\"img.jpg\" alt=\"alt\">")
+ b.AssertFileContent("public/tr/p1/index.html", "TR-IMAGE")
+}
b.AssertFileContent("public/en/p1/index.html", " |sc1: true|sc2: false|inc: true|")
b.AssertFileContent("public/sv/p1/index.html", " |sc1: false|sc2: true|inc: true|")
}
+
+func TestShortcodeMultilingualHTML(t *testing.T) {
+ t.Parallel()
+
+ files := `
+-- hugo.toml --
+baseURL = 'https://example.org/'
+defaultContentLanguage = 'tr'
+defaultContentLanguageInSubdir = true
+[languages.tr]
+weight = 1
+[languages.en]
+weight = 2
+-- content/posts/test-post.tr.md --
++++
+title = 'Test Post TR'
++++
+
+{{< myhtml >}}
+-- content/posts/test-post.en.md --
++++
+title = 'Test Post EN'
++++
+
+{{< myhtml >}}
+-- layouts/_shortcodes/myhtml.en.html --
+HTML-EN
+-- layouts/_shortcodes/myhtml.tr.html --
+HTML-TR
+-- layouts/_default/single.html --
+{{ .Content }}
+`
+
+ b := hugolib.Test(t, files)
+
+ b.AssertFileContent("public/tr/posts/test-post/index.html",
+ "HTML-TR",
+ )
+
+ b.AssertFileContent("public/en/posts/test-post/index.html",
+ "HTML-EN",
+ )
+}
+
+func TestShortcodeMultilingualMarkdown(t *testing.T) {
+ t.Parallel()
+
+ files := `
+-- hugo.toml --
+baseURL = 'https://example.org/'
+defaultContentLanguage = 'tr'
+defaultContentLanguageInSubdir = true
+[languages.tr]
+weight = 1
+[languages.en]
+weight = 2
+-- content/posts/test-post.tr.md --
++++
+title = 'Test Post TR'
++++
+
+{{% mymd %}}
+-- content/posts/test-post.en.md --
++++
+title = 'Test Post EN'
++++
+
+{{% mymd %}}
+-- layouts/_shortcodes/mymd.en.md --
+MD-EN
+-- layouts/_shortcodes/mymd.tr.md --
+MD-TR
+-- layouts/_default/single.html --
+{{ .Content }}
+`
+
+ b := hugolib.Test(t, files)
+
+ b.AssertFileContent("public/tr/posts/test-post/index.html",
+ "MD-TR",
+ )
+
+ b.AssertFileContent("public/en/posts/test-post/index.html",
+ "MD-EN",
+ )
+}
w := this.doCompare(category, other, sitesMatrixThis, sitesMatrixOther)
if w.w1 <= 0 {
+ if sitesMatrixOther != nil {
+ if sitesMatrixThis == nil || !sitesMatrixOther.HasAnyVector(sitesMatrixThis) {
+ return w
+ }
+ }
+
if category == CategoryMarkup && (this.Variant1 == other.Variant1) && (this.Variant2 == other.Variant2 || this.Variant2 != "" && other.Variant2 == "") {
// See issue 13242.
if this.OutputFormat != other.OutputFormat && this.OutputFormat == s.opts.DefaultOutputFormat {