github.com/neohugo/neohugo@v0.123.8/common/paths/paths_integration_test.go (about) 1 // Copyright 2024 The Hugo Authors. All rights reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // http://www.apache.org/licenses/LICENSE-2.0 7 // 8 // Unless required by applicable law or agreed to in writing, software 9 // distributed under the License is distributed on an "AS IS" BASIS, 10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // See the License for the specific language governing permissions and 12 // limitations under the License. 13 14 package paths_test 15 16 import ( 17 "testing" 18 19 "github.com/neohugo/neohugo/hugolib" 20 ) 21 22 func TestRemovePathAccents(t *testing.T) { 23 t.Parallel() 24 25 files := ` 26 -- hugo.toml -- 27 disableKinds = ["taxonomy", "term"] 28 defaultContentLanguage = "en" 29 defaultContentLanguageInSubdir = true 30 [languages] 31 [languages.en] 32 weight = 1 33 [languages.fr] 34 weight = 2 35 removePathAccents = true 36 -- content/διακριτικός.md -- 37 -- content/διακριτικός.fr.md -- 38 -- layouts/_default/single.html -- 39 {{ .Language.Lang }}|Single. 40 -- layouts/_default/list.html -- 41 List 42 ` 43 b := hugolib.Test(t, files) 44 45 b.AssertFileContent("public/en/διακριτικός/index.html", "en|Single") 46 b.AssertFileContent("public/fr/διακριτικος/index.html", "fr|Single") 47 } 48 49 func TestDisablePathToLower(t *testing.T) { 50 t.Parallel() 51 52 files := ` 53 -- hugo.toml -- 54 disableKinds = ["taxonomy", "term"] 55 defaultContentLanguage = "en" 56 defaultContentLanguageInSubdir = true 57 [languages] 58 [languages.en] 59 weight = 1 60 [languages.fr] 61 weight = 2 62 disablePathToLower = true 63 -- content/MySection/MyPage.md -- 64 -- content/MySection/MyPage.fr.md -- 65 -- content/MySection/MyBundle/index.md -- 66 -- content/MySection/MyBundle/index.fr.md -- 67 -- layouts/_default/single.html -- 68 {{ .Language.Lang }}|Single. 69 -- layouts/_default/list.html -- 70 {{ .Language.Lang }}|List. 71 ` 72 b := hugolib.Test(t, files) 73 74 b.AssertFileContent("public/en/mysection/index.html", "en|List") 75 b.AssertFileContent("public/en/mysection/mypage/index.html", "en|Single") 76 b.AssertFileContent("public/fr/MySection/index.html", "fr|List") 77 b.AssertFileContent("public/fr/MySection/MyPage/index.html", "fr|Single") 78 b.AssertFileContent("public/en/mysection/mybundle/index.html", "en|Single") 79 b.AssertFileContent("public/fr/MySection/MyBundle/index.html", "fr|Single") 80 }