summaryrefslogtreecommitdiffstats
path: root/hugolib
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-05-20 11:17:43 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-05-20 12:40:32 +0200
commit4f085e80da9a415725db3def70e5ce847cf06741 (patch)
tree56e3c5c2e5686a903b920be211bc7870934bb8e6 /hugolib
parent150d190ff041f7da905afea7f3b9ca6bd4a31a48 (diff)
Make language merging of markup etc. config without values in the root
Updates #10953
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/config_test.go53
1 files changed, 53 insertions, 0 deletions
diff --git a/hugolib/config_test.go b/hugolib/config_test.go
index 1d4372e41..24275025c 100644
--- a/hugolib/config_test.go
+++ b/hugolib/config_test.go
@@ -898,6 +898,59 @@ mainSections: []
}
+func TestConfigMergeLanguageDeepEmptyLefSide(t *testing.T) {
+ t.Parallel()
+
+ files := `
+-- hugo.toml --
+[params]
+p1 = "p1base"
+[languages.en]
+languageCode = 'en-US'
+languageName = 'English'
+weight = 1
+[languages.en.markup.goldmark.extensions.typographer]
+leftDoubleQuote = '&ldquo;' # default &ldquo;
+rightDoubleQuote = '&rdquo;' # default &rdquo;
+
+[languages.de]
+languageCode = 'de-DE'
+languageName = 'Deutsch'
+weight = 2
+[languages.de.params]
+p1 = "p1de"
+[languages.de.markup.goldmark.extensions.typographer]
+leftDoubleQuote = '&laquo;' # default &ldquo;
+rightDoubleQuote = '&raquo;' # default &rdquo;
+-- layouts/index.html --
+{{ .Content }}
+p1: {{ site.Params.p1 }}|
+-- content/_index.en.md --
+---
+title: "English Title"
+---
+A "quote" in English.
+-- content/_index.de.md --
+---
+title: "Deutsch Title"
+---
+Ein "Zitat" auf Deutsch.
+
+
+
+`
+ b := NewIntegrationTestBuilder(
+ IntegrationTestConfig{
+ T: t,
+ TxtarString: files,
+ },
+ ).Build()
+
+ b.AssertFileContent("public/index.html", "p1: p1base", "<p>A &ldquo;quote&rdquo; in English.</p>")
+ b.AssertFileContent("public/de/index.html", "p1: p1de", "<p>Ein &laquo;Zitat&raquo; auf Deutsch.</p>")
+
+}
+
func TestConfigLegacyValues(t *testing.T) {
t.Parallel()