Debian Codegraph @

markup/asciidocext/asciidoc_integration_test.go

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 // Copyright 2025 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 asciidocext_test
15
16 import (
17 "fmt"
18 "os"
19 "path/filepath"
20 "runtime"
21 "slices"
22 "strings"
23 "testing"
24
25 "github.com/gohugoio/hugo/htesting"
26 "github.com/gohugoio/hugo/hugolib"
27 "github.com/gohugoio/hugo/markup/asciidocext"
28 )
29
30 type contentFile struct {
31 // The path to the content file, relative to the project directory.
32 path string
33 // The title of the content file.
34 title string
35 }
36
37 type publishedContentFile struct {
38 // The path to the published content file, relative to the project directory.
39 path string
40 // The expected string in the content file used for content test assertions.
41 match string
42 }
43
44 type testCase struct {
45 name string
46 baseURL string
47 defaultContentLanguageInSubdir bool
48 langEnBaseURL string
49 langDeBaseURL string
50 langDeDisabled bool
51 uglyURLsS1 bool
52 validate func(b *hugolib.IntegrationTestBuilder)
53 }
54
55 // Issue 9202, Issue 10183, Issue 10473
56 func TestAsciiDocDiagrams(t *testing.T) {
57 if !htesting.IsRealCI() {
58 t.Skip()
59 }
60 if ok, err := asciidocext.Supports(); !ok {
61 t.Skip(err)
62 }
63 if ok, err := asciidocext.SupportsGoATDiagrams(); !ok {
64 t.Skip(err)
65 }
66
67 t.Cleanup(func() {
68 resetDefaultAsciiDocExtConfig()
69 })
70
71 diagramCacheDir := t.TempDir() // we want this to persist for all tests
72
73 files := createContentFiles() + contentAdapter + layouts
74
75 testCases := []testCase{
76 // Test 1 - Monolingual, uglyURLs = false for s1, without subdir in base URL, defaultContentLanguageInSubdir = false
77 {"Test 1", "https://example.org/", false, "", "", true, false, validatePublishedSite_1},
78 // Test 2 - Monolingual, uglyURLs = false for s1, with subdir in base URL, defaultContentLanguageInSubdir = false
79 {"Test 2", "https://example.org/subdir/", false, "", "", true, false, validatePublishedSite_2},
80 // // Test 3 - Monolingual, uglyURLs = true for s1, without subdir in base URL, defaultContentLanguageInSubdir = false
81 {"Test 3", "https://example.org/", false, "", "", true, true, validatePublishedSite_3},
82 // // Test 4 - Monolingual, uglyURLs = true for s1, with subdir in base URL, defaultContentLanguageInSubdir = false
83 {"Test 4", "https://example.org/subdir/", false, "", "", true, true, validatePublishedSite_4},
84 // // Test 5 - Multilingual, single-host, uglyURLs = false for s1, without subdir in base URL, defaultContentLanguageInSubdir = false
85 {"Test 5", "https://example.org/", false, "", "", false, false, validatePublishedSite_5},
86 // Test 6 - Multilingual, single-host, uglyURLs = false for s1, with subdir in base URL, defaultContentLanguageInSubdir = false
87 {"Test 6", "https://example.org/subdir/", false, "", "", false, false, validatePublishedSite_6},
88 // Test 7 - Multilingual, single-host, uglyURLs = true for s1, without subdir in base URL, defaultContentLanguageInSubdir = false
89 {"Test 7", "https://example.org/", false, "", "", false, true, validatePublishedSite_7},
90 // Test 8 - Multilingual, single-host, uglyURLs = true for s1, with subdir in base URL, defaultContentLanguageInSubdir = false
91 {"Test 8", "https://example.org/subdir/", false, "", "", false, true, validatePublishedSite_8},
92 // Test 9 - Multilingual, single-host, uglyURLs = false for s1, without subdir in base URL, defaultContentLanguageInSubdir = true
93 {"Test 9", "https://example.org/", true, "", "", false, false, validatePublishedSite_9},
94 // Test 10 - Multilingual, single-host, uglyURLs = false for s1, with subdir in base URL, defaultContentLanguageInSubdir = true
95 {"Test 10", "https://example.org/subdir/", true, "", "", false, false, validatePublishedSite_10},
96 // Test 11 - Multilingual, single-host, uglyURLs = true for s1, without subdir in base URL, defaultContentLanguageInSubdir = true
97 {"Test 11", "https://example.org/", true, "", "", false, true, validatePublishedSite_11},
98 // Test 12 - Multilingual, single-host, uglyURLs = true for s1, with subdir in base URL, defaultContentLanguageInSubdir = true
99 {"Test 12", "https://example.org/subdir/", true, "", "", false, true, validatePublishedSite_12},
100 // Test 13 - Multilingual, multi-host, uglyURLs = false, without subdir in base URL, defaultContentLanguageInSubdir = false
101 {"Test 13", "", false, `baseURL = "https://.en.example.org/"`, `baseURL = "https://.de.example.org/"`, false, false, validatePublishedSite_13},
102 // Test 14 - Multilingual, multi-host, uglyURLs = false for s1, with subdir in base URL, defaultContentLanguageInSubdir = false
103 {"Test 14", "", false, `baseURL = "https://.en.example.org/subdir/"`, `baseURL = "https://.de.example.org/subdir/"`, false, false, validatePublishedSite_14},
104 // Test 15 - Multilingual, multi-host, uglyURLs = true for s1, without subdir in base URL, defaultContentLanguageInSubdir = false
105 {"Test 15", "", false, `baseURL = "https://.en.example.org/"`, `baseURL = "https://.de.example.org/"`, false, true, validatePublishedSite_15},
106 // Test 16 - Multilingual, multi-host, uglyURLs = true for s1, with subdir in base URL, defaultContentLanguageInSubdir = false
107 {"Test 16", "", false, `baseURL = "https://.en.example.org/subdir/"`, `baseURL = "https://.de.example.org/subdir/"`, false, true, validatePublishedSite_16},
108 // Test 17 - Multilingual, multi-host, uglyURLs = false for s1, without subdir in base URL, defaultContentLanguageInSubdir = true
109 {"Test 17", "", true, `baseURL = "https://.en.example.org/"`, `baseURL = "https://.de.example.org/"`, false, false, validatePublishedSite_17},
110 // Test 18 - Multilingual, multi-host, uglyURLs = false for s1, with subdir in base URL, defaultContentLanguageInSubdir = true
111 {"Test 18", "", true, `baseURL = "https://.en.example.org/subdir/"`, `baseURL = "https://.de.example.org/subdir/"`, false, false, validatePublishedSite_18},
112 // Test 19 - Multilingual, multi-host, uglyURLs = true for s1, without subdir in base URL, defaultContentLanguageInSubdir = true
113 {"Test 19", "", true, `baseURL = "https://.en.example.org/"`, `baseURL = "https://.de.example.org/"`, false, true, validatePublishedSite_19},
114 // Test 20 - Multilingual, multi-host, uglyURLs = true for s1, with subdir in base URL, defaultContentLanguageInSubdir = true
115 {"Test 20", "", true, `baseURL = "https://.en.example.org/subdir/"`, `baseURL = "https://.de.example.org/subdir/"`, false, true, validatePublishedSite_20},
116 }
117
118 for _, tc := range testCases {
119 // Asciidoctor is really, really slow on Windows. Only run a few tests.
120 isExcludedTest := htesting.IsRealCI() && runtime.GOOS == "windows" && !slices.Contains([]string{"Test 4", "Test 8", "Test 16"}, tc.name)
121 if isExcludedTest {
122 continue
123 }
124
125 t.Run(tc.name, func(t *testing.T) {
126 baseURLKV := ""
127 if tc.baseURL != "" {
128 baseURLKV = fmt.Sprintf(`baseURL = %q`, tc.baseURL)
129 }
130
131 replacer := strings.NewReplacer(
132 `BASE_URL_KEY_VALUE_PAIR`, baseURLKV,
133 `DEFAULT_CONTENT_LANGUAGE_IN_SUBDIR`, fmt.Sprintf("%v", tc.defaultContentLanguageInSubdir),
134 `LANGUAGES.EN.BASE_URL_KEY_VALUE_PAIR`, tc.langEnBaseURL,
135 `LANGUAGES.DE.BASE_URL_KEY_VALUE_PAIR`, tc.langDeBaseURL,
136 `LANGUAGES.DE.DISABLED`, fmt.Sprintf("%v", tc.langDeDisabled),
137 `UGLYURLS_S1`, fmt.Sprintf("%v", tc.uglyURLsS1),
138 `DIAGRAM_CACHEDIR`, diagramCacheDir,
139 )
140
141 f := files + replacer.Replace(configFileWithPlaceholders)
142
143 tempDir := t.TempDir()
144 t.Chdir(tempDir)
145
146 b := hugolib.Test(t, f, hugolib.TestOptWithConfig(func(cfg *hugolib.IntegrationTestConfig) {
147 cfg.NeedsOsFS = true
148 cfg.WorkingDir = tempDir
149 }))
150
151 // Verify that asciidoctor-diagram is caching in the correct
152 // location. Checking one file is sufficient.
153 err := fileExistsOsFs(filepath.Join(diagramCacheDir, "filecache/misc/asciidoctor-diagram/home_en.svg"))
154 if err != nil {
155 t.Fatalf("unable to locate file in diagram cache: %v", err.Error())
156 }
157
158 tc.validate(b)
159 })
160 }
161 }
162
163 // fileExistsOsFs checks if a file exists on the OS file system.
164 func fileExistsOsFs(path string) error {
165 fi, err := os.Stat(path)
166 if err != nil {
167 if os.IsNotExist(err) {
168 return fmt.Errorf("the path %q does not exist", path)
169 }
170 return fmt.Errorf("unable to get file status for %q: %v", path, err)
171 }
172 if fi.IsDir() {
173 return fmt.Errorf("the path %q is a directory, not a file", path)
174 }
175 return nil
176 }
177
178 // createContentFiles returns a txtar representation of the content files.
179 func createContentFiles() string {
180 contentFiles := []contentFile{
181 {`content/_index.de.adoc`, `home_de`},
182 {`content/_index.en.adoc`, `home_en`},
183 {`content/s1/_index.de.adoc`, `s1_de`},
184 {`content/s1/_index.en.adoc`, `s1_en`},
185 {`content/s1/p1/index.de.adoc`, `s1_p1_de`},
186 {`content/s1/p1/index.en.adoc`, `s1_p1_en`},
187 {`content/s1/p2.de.adoc`, `s1_p2_de`},
188 {`content/s1/p2.en.adoc`, `s1_p2_en`},
189 {`content/s2/_content.gotmpl`, `s2_content_gotmpl`},
190 {`content/s2/_index.de.adoc`, `s2_de`},
191 {`content/s2/_index.en.adoc`, `s2_en`},
192 {`content/Straßen/Frühling/_index.de.adoc`, `Straßen_Frühling_de`},
193 {`content/Straßen/Frühling/_index.en.adoc`, `Straßen_Frühling_en`},
194 {`content/Straßen/Frühling/Müll Brücke.de.adoc`, `Straßen_Frühling_Müll_Brücke_de`},
195 {`content/Straßen/Frühling/Müll Brücke.en.adoc`, `Straßen_Frühling_Müll_Brücke_en`},
196 {`content/Straßen/_index.de.adoc`, `Straßen_de`},
197 {`content/Straßen/_index.en.adoc`, `Straßen_en`},
198 }
199
200 formatString := `
201 -- %[1]s --
202 ---
203 title: %[2]s
204 ---
205 [goat,%[2]s]
206 ....
207 %[2]s
208 ....`
209
210 var txtarContentFiles strings.Builder
211 for _, f := range contentFiles {
212 txtarContentFiles.WriteString(fmt.Sprintf(formatString, f.path, f.title))
213 }
214
215 return txtarContentFiles.String()
216 }
217
218 var contentAdapter = `
219 -- content/s2/_content.gotmpl --
220 {{ $title := printf "s2_p1_%s" site.Language.Lang }}
221 {{ $markup := printf "[goat,%[1]s]\n....\n%[1]s\n...." $title }}
222 {{ $content := dict
223 "mediaType" "text/asciidoc"
224 "value" $markup
225 }}
226 {{ $page := dict
227 "content" $content
228 "kind" "page"
229 "path" "p1"
230 "title" $title
231 }}
232 {{ .EnableAllLanguages }}
233 {{ .AddPage $page }}`
234
235 var layouts = `
236 -- layouts/all.html --
237 {{ .Content }}|`
238
239 var configFileWithPlaceholders = `
240 -- hugo.toml --
241 BASE_URL_KEY_VALUE_PAIR
242 disableKinds = ['rss', 'sitemap', 'taxonomy', 'term']
243 defaultContentLanguage = 'en'
244 defaultContentLanguageInSubdir = DEFAULT_CONTENT_LANGUAGE_IN_SUBDIR
245
246 [languages.en]
247 LANGUAGES.EN.BASE_URL_KEY_VALUE_PAIR
248 disabled = false
249 weight = 1
250
251 [languages.de]
252 LANGUAGES.DE.BASE_URL_KEY_VALUE_PAIR
253 disabled = LANGUAGES.DE.DISABLED
254 weight = 2
255
256 [uglyurls]
257 s1 = UGLYURLS_S1
258
259 [markup.asciidocext]
260 extensions = ['asciidoctor-diagram']
261 workingFolderCurrent = true
262
263 [caches.misc]
264 dir = 'DIAGRAM_CACHEDIR'
265
266 [security.exec]
267 allow = ['^((dart-)?sass|git|go|node|postcss|tailwindcss|asciidoctor)$']`
268
269 func validatePublishedSite_1(b *hugolib.IntegrationTestBuilder) {
270 for _, file := range []publishedContentFile{
271 {`public/index.html`, `src="home_en.svg"`},
272 {`public/s1/index.html`, `src="s1_en.svg"`},
273 {`public/s1/p1/index.html`, `src="s1_p1_en.svg"`},
274 {`public/s1/p2/index.html`, `src="s1_p2_en.svg"`},
275 {`public/s2/index.html`, `src="s2_en.svg"`},
276 {`public/s2/p1/index.html`, `src="s2_p1_en.svg"`},
277 {`public/straßen/frühling/index.html`, `src="Straßen_Frühling_en.svg"`},
278 {`public/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_en.svg"`},
279 {`public/straßen/index.html`, `src="Straßen_en.svg"`},
280 } {
281 b.AssertFileContent(file.path, file.match)
282 }
283
284 for _, path := range []string{
285 `public/home_en.svg`,
286 `public/s1/p1/s1_p1_en.svg`,
287 `public/s1/p2/s1_p2_en.svg`,
288 `public/s1/s1_en.svg`,
289 `public/s2/p1/s2_p1_en.svg`,
290 `public/s2/s2_en.svg`,
291 `public/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_en.svg`,
292 `public/straßen/frühling/Straßen_Frühling_en.svg`,
293 `public/straßen/Straßen_en.svg`,
294 } {
295 b.AssertFileExists(path, true)
296 }
297 }
298
299 func validatePublishedSite_2(b *hugolib.IntegrationTestBuilder) {
300 for _, file := range []publishedContentFile{
301 {`public/index.html`, `src="home_en.svg"`},
302 {`public/s1/index.html`, `src="s1_en.svg"`},
303 {`public/s1/p1/index.html`, `src="s1_p1_en.svg"`},
304 {`public/s1/p2/index.html`, `src="s1_p2_en.svg"`},
305 {`public/s2/index.html`, `src="s2_en.svg"`},
306 {`public/s2/p1/index.html`, `src="s2_p1_en.svg"`},
307 {`public/straßen/frühling/index.html`, `src="Straßen_Frühling_en.svg"`},
308 {`public/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_en.svg"`},
309 {`public/straßen/index.html`, `src="Straßen_en.svg"`},
310 } {
311 b.AssertFileContent(file.path, file.match)
312 }
313
314 for _, path := range []string{
315 `public/home_en.svg`,
316 `public/s1/p1/s1_p1_en.svg`,
317 `public/s1/p2/s1_p2_en.svg`,
318 `public/s1/s1_en.svg`,
319 `public/s2/p1/s2_p1_en.svg`,
320 `public/s2/s2_en.svg`,
321 `public/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_en.svg`,
322 `public/straßen/frühling/Straßen_Frühling_en.svg`,
323 `public/straßen/Straßen_en.svg`,
324 } {
325 b.AssertFileExists(path, true)
326 }
327 }
328
329 func validatePublishedSite_3(b *hugolib.IntegrationTestBuilder) {
330 for _, file := range []publishedContentFile{
331 {`public/index.html`, `src="home_en.svg"`},
332 {`public/s1/index.html`, `src="s1_en.svg"`},
333 {`public/s1/p1.html`, `src="p1/s1_p1_en.svg"`},
334 {`public/s1/p2.html`, `src="p2/s1_p2_en.svg"`},
335 {`public/s2/index.html`, `src="s2_en.svg"`},
336 {`public/s2/p1/index.html`, `src="s2_p1_en.svg"`},
337 {`public/straßen/frühling/index.html`, `src="Straßen_Frühling_en.svg"`},
338 {`public/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_en.svg"`},
339 {`public/straßen/index.html`, `src="Straßen_en.svg"`},
340 } {
341 b.AssertFileContent(file.path, file.match)
342 }
343
344 for _, path := range []string{
345 `public/home_en.svg`,
346 `public/s1/p1/s1_p1_en.svg`,
347 `public/s1/p2/s1_p2_en.svg`,
348 `public/s1/s1_en.svg`,
349 `public/s2/p1/s2_p1_en.svg`,
350 `public/s2/s2_en.svg`,
351 `public/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_en.svg`,
352 `public/straßen/frühling/Straßen_Frühling_en.svg`,
353 `public/straßen/Straßen_en.svg`,
354 } {
355 b.AssertFileExists(path, true)
356 }
357 }
358
359 func validatePublishedSite_4(b *hugolib.IntegrationTestBuilder) {
360 for _, file := range []publishedContentFile{
361 {`public/index.html`, `src="home_en.svg"`},
362 {`public/s1/index.html`, `src="s1_en.svg"`},
363 {`public/s1/p1.html`, `src="p1/s1_p1_en.svg"`},
364 {`public/s1/p2.html`, `src="p2/s1_p2_en.svg"`},
365 {`public/s2/index.html`, `src="s2_en.svg"`},
366 {`public/s2/p1/index.html`, `src="s2_p1_en.svg"`},
367 {`public/straßen/frühling/index.html`, `src="Straßen_Frühling_en.svg"`},
368 {`public/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_en.svg"`},
369 {`public/straßen/index.html`, `src="Straßen_en.svg"`},
370 } {
371 b.AssertFileContent(file.path, file.match)
372 }
373
374 for _, path := range []string{
375 `public/home_en.svg`,
376 `public/s1/p1/s1_p1_en.svg`,
377 `public/s1/p2/s1_p2_en.svg`,
378 `public/s1/s1_en.svg`,
379 `public/s2/p1/s2_p1_en.svg`,
380 `public/s2/s2_en.svg`,
381 `public/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_en.svg`,
382 `public/straßen/frühling/Straßen_Frühling_en.svg`,
383 `public/straßen/Straßen_en.svg`,
384 } {
385 b.AssertFileExists(path, true)
386 }
387 }
388
389 func validatePublishedSite_5(b *hugolib.IntegrationTestBuilder) {
390 for _, file := range []publishedContentFile{
391 {`public/de/index.html`, `src="home_de.svg"`},
392 {`public/de/s1/index.html`, `src="s1_de.svg"`},
393 {`public/de/s1/p1/index.html`, `src="s1_p1_de.svg"`},
394 {`public/de/s1/p2/index.html`, `src="s1_p2_de.svg"`},
395 {`public/de/s2/index.html`, `src="s2_de.svg"`},
396 {`public/de/s2/p1/index.html`, `src="s2_p1_de.svg"`},
397 {`public/de/straßen/frühling/index.html`, `src="Straßen_Frühling_de.svg"`},
398 {`public/de/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_de.svg"`},
399 {`public/de/straßen/index.html`, `src="Straßen_de.svg"`},
400 {`public/index.html`, `src="home_en.svg"`},
401 {`public/s1/index.html`, `src="s1_en.svg"`},
402 {`public/s1/p1/index.html`, `src="s1_p1_en.svg"`},
403 {`public/s1/p2/index.html`, `src="s1_p2_en.svg"`},
404 {`public/s2/index.html`, `src="s2_en.svg"`},
405 {`public/s2/p1/index.html`, `src="s2_p1_en.svg"`},
406 {`public/straßen/frühling/index.html`, `src="Straßen_Frühling_en.svg"`},
407 {`public/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_en.svg"`},
408 {`public/straßen/index.html`, `src="Straßen_en.svg"`},
409 } {
410 b.AssertFileContent(file.path, file.match)
411 }
412
413 for _, path := range []string{
414 `public/de/home_de.svg`,
415 `public/de/s1/p1/s1_p1_de.svg`,
416 `public/de/s1/p2/s1_p2_de.svg`,
417 `public/de/s1/s1_de.svg`,
418 `public/de/s2/p1/s2_p1_de.svg`,
419 `public/de/s2/s2_de.svg`,
420 `public/de/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_de.svg`,
421 `public/de/straßen/frühling/Straßen_Frühling_de.svg`,
422 `public/de/straßen/Straßen_de.svg`,
423 `public/home_en.svg`,
424 `public/s1/p1/s1_p1_en.svg`,
425 `public/s1/p2/s1_p2_en.svg`,
426 `public/s1/s1_en.svg`,
427 `public/s2/p1/s2_p1_en.svg`,
428 `public/s2/s2_en.svg`,
429 `public/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_en.svg`,
430 `public/straßen/frühling/Straßen_Frühling_en.svg`,
431 `public/straßen/Straßen_en.svg`,
432 } {
433 b.AssertFileExists(path, true)
434 }
435 }
436
437 func validatePublishedSite_6(b *hugolib.IntegrationTestBuilder) {
438 for _, file := range []publishedContentFile{
439 {`public/de/index.html`, `src="home_de.svg"`},
440 {`public/de/s1/index.html`, `src="s1_de.svg"`},
441 {`public/de/s1/p1/index.html`, `src="s1_p1_de.svg"`},
442 {`public/de/s1/p2/index.html`, `src="s1_p2_de.svg"`},
443 {`public/de/s2/index.html`, `src="s2_de.svg"`},
444 {`public/de/s2/p1/index.html`, `src="s2_p1_de.svg"`},
445 {`public/de/straßen/frühling/index.html`, `src="Straßen_Frühling_de.svg"`},
446 {`public/de/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_de.svg"`},
447 {`public/de/straßen/index.html`, `src="Straßen_de.svg"`},
448 {`public/index.html`, `src="home_en.svg"`},
449 {`public/s1/index.html`, `src="s1_en.svg"`},
450 {`public/s1/p1/index.html`, `src="s1_p1_en.svg"`},
451 {`public/s1/p2/index.html`, `src="s1_p2_en.svg"`},
452 {`public/s2/index.html`, `src="s2_en.svg"`},
453 {`public/s2/p1/index.html`, `src="s2_p1_en.svg"`},
454 {`public/straßen/frühling/index.html`, `src="Straßen_Frühling_en.svg"`},
455 {`public/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_en.svg"`},
456 {`public/straßen/index.html`, `src="Straßen_en.svg"`},
457 } {
458 b.AssertFileContent(file.path, file.match)
459 }
460
461 for _, path := range []string{
462 `public/de/home_de.svg`,
463 `public/de/s1/p1/s1_p1_de.svg`,
464 `public/de/s1/p2/s1_p2_de.svg`,
465 `public/de/s1/s1_de.svg`,
466 `public/de/s2/p1/s2_p1_de.svg`,
467 `public/de/s2/s2_de.svg`,
468 `public/de/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_de.svg`,
469 `public/de/straßen/frühling/Straßen_Frühling_de.svg`,
470 `public/de/straßen/Straßen_de.svg`,
471 `public/home_en.svg`,
472 `public/s1/p1/s1_p1_en.svg`,
473 `public/s1/p2/s1_p2_en.svg`,
474 `public/s1/s1_en.svg`,
475 `public/s2/p1/s2_p1_en.svg`,
476 `public/s2/s2_en.svg`,
477 `public/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_en.svg`,
478 `public/straßen/frühling/Straßen_Frühling_en.svg`,
479 `public/straßen/Straßen_en.svg`,
480 } {
481 b.AssertFileExists(path, true)
482 }
483 }
484
485 func validatePublishedSite_7(b *hugolib.IntegrationTestBuilder) {
486 for _, file := range []publishedContentFile{
487 {`public/de/index.html`, `src="home_de.svg"`},
488 {`public/de/s1/index.html`, `src="s1_de.svg"`},
489 {`public/de/s1/p1.html`, `src="p1/s1_p1_de.svg"`},
490 {`public/de/s1/p2.html`, `src="p2/s1_p2_de.svg"`},
491 {`public/de/s2/index.html`, `src="s2_de.svg"`},
492 {`public/de/s2/p1/index.html`, `src="s2_p1_de.svg"`},
493 {`public/de/straßen/frühling/index.html`, `src="Straßen_Frühling_de.svg"`},
494 {`public/de/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_de.svg"`},
495 {`public/de/straßen/index.html`, `src="Straßen_de.svg"`},
496 {`public/index.html`, `src="home_en.svg"`},
497 {`public/s1/index.html`, `src="s1_en.svg"`},
498 {`public/s1/p1.html`, `src="p1/s1_p1_en.svg"`},
499 {`public/s1/p2.html`, `src="p2/s1_p2_en.svg"`},
500 {`public/s2/index.html`, `src="s2_en.svg"`},
501 {`public/s2/p1/index.html`, `src="s2_p1_en.svg"`},
502 {`public/straßen/frühling/index.html`, `src="Straßen_Frühling_en.svg"`},
503 {`public/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_en.svg"`},
504 {`public/straßen/index.html`, `src="Straßen_en.svg"`},
505 } {
506 b.AssertFileContent(file.path, file.match)
507 }
508
509 for _, path := range []string{
510 `public/de/home_de.svg`,
511 `public/de/s1/p1/s1_p1_de.svg`,
512 `public/de/s1/p2/s1_p2_de.svg`,
513 `public/de/s1/s1_de.svg`,
514 `public/de/s2/p1/s2_p1_de.svg`,
515 `public/de/s2/s2_de.svg`,
516 `public/de/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_de.svg`,
517 `public/de/straßen/frühling/Straßen_Frühling_de.svg`,
518 `public/de/straßen/Straßen_de.svg`,
519 `public/home_en.svg`,
520 `public/s1/p1/s1_p1_en.svg`,
521 `public/s1/p2/s1_p2_en.svg`,
522 `public/s1/s1_en.svg`,
523 `public/s2/p1/s2_p1_en.svg`,
524 `public/s2/s2_en.svg`,
525 `public/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_en.svg`,
526 `public/straßen/frühling/Straßen_Frühling_en.svg`,
527 `public/straßen/Straßen_en.svg`,
528 } {
529 b.AssertFileExists(path, true)
530 }
531 }
532
533 func validatePublishedSite_8(b *hugolib.IntegrationTestBuilder) {
534 for _, file := range []publishedContentFile{
535 {`public/de/index.html`, `src="home_de.svg"`},
536 {`public/de/s1/index.html`, `src="s1_de.svg"`},
537 {`public/de/s1/p1.html`, `src="p1/s1_p1_de.svg"`},
538 {`public/de/s1/p2.html`, `src="p2/s1_p2_de.svg"`},
539 {`public/de/s2/index.html`, `src="s2_de.svg"`},
540 {`public/de/s2/p1/index.html`, `src="s2_p1_de.svg"`},
541 {`public/de/straßen/frühling/index.html`, `src="Straßen_Frühling_de.svg"`},
542 {`public/de/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_de.svg"`},
543 {`public/de/straßen/index.html`, `src="Straßen_de.svg"`},
544 {`public/index.html`, `src="home_en.svg"`},
545 {`public/s1/index.html`, `src="s1_en.svg"`},
546 {`public/s1/p1.html`, `src="p1/s1_p1_en.svg"`},
547 {`public/s1/p2.html`, `src="p2/s1_p2_en.svg"`},
548 {`public/s2/index.html`, `src="s2_en.svg"`},
549 {`public/s2/p1/index.html`, `src="s2_p1_en.svg"`},
550 {`public/straßen/frühling/index.html`, `src="Straßen_Frühling_en.svg"`},
551 {`public/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_en.svg"`},
552 {`public/straßen/index.html`, `src="Straßen_en.svg"`},
553 } {
554 b.AssertFileContent(file.path, file.match)
555 }
556
557 for _, path := range []string{
558 `public/de/home_de.svg`,
559 `public/de/s1/p1/s1_p1_de.svg`,
560 `public/de/s1/p2/s1_p2_de.svg`,
561 `public/de/s1/s1_de.svg`,
562 `public/de/s2/p1/s2_p1_de.svg`,
563 `public/de/s2/s2_de.svg`,
564 `public/de/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_de.svg`,
565 `public/de/straßen/frühling/Straßen_Frühling_de.svg`,
566 `public/de/straßen/Straßen_de.svg`,
567 `public/home_en.svg`,
568 `public/s1/p1/s1_p1_en.svg`,
569 `public/s1/p2/s1_p2_en.svg`,
570 `public/s1/s1_en.svg`,
571 `public/s2/p1/s2_p1_en.svg`,
572 `public/s2/s2_en.svg`,
573 `public/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_en.svg`,
574 `public/straßen/frühling/Straßen_Frühling_en.svg`,
575 `public/straßen/Straßen_en.svg`,
576 } {
577 b.AssertFileExists(path, true)
578 }
579 }
580
581 func validatePublishedSite_9(b *hugolib.IntegrationTestBuilder) {
582 for _, file := range []publishedContentFile{
583 {`public/de/index.html`, `src="home_de.svg"`},
584 {`public/de/s1/index.html`, `src="s1_de.svg"`},
585 {`public/de/s1/p1/index.html`, `src="s1_p1_de.svg"`},
586 {`public/de/s1/p2/index.html`, `src="s1_p2_de.svg"`},
587 {`public/de/s2/index.html`, `src="s2_de.svg"`},
588 {`public/de/s2/p1/index.html`, `src="s2_p1_de.svg"`},
589 {`public/de/straßen/frühling/index.html`, `src="Straßen_Frühling_de.svg"`},
590 {`public/de/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_de.svg"`},
591 {`public/de/straßen/index.html`, `src="Straßen_de.svg"`},
592 {`public/en/index.html`, `src="home_en.svg"`},
593 {`public/en/s1/index.html`, `src="s1_en.svg"`},
594 {`public/en/s1/p1/index.html`, `src="s1_p1_en.svg"`},
595 {`public/en/s1/p2/index.html`, `src="s1_p2_en.svg"`},
596 {`public/en/s2/index.html`, `src="s2_en.svg"`},
597 {`public/en/s2/p1/index.html`, `src="s2_p1_en.svg"`},
598 {`public/en/straßen/frühling/index.html`, `src="Straßen_Frühling_en.svg"`},
599 {`public/en/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_en.svg"`},
600 {`public/en/straßen/index.html`, `src="Straßen_en.svg"`},
601 } {
602 b.AssertFileContent(file.path, file.match)
603 }
604
605 for _, path := range []string{
606 `public/de/home_de.svg`,
607 `public/de/s1/p1/s1_p1_de.svg`,
608 `public/de/s1/p2/s1_p2_de.svg`,
609 `public/de/s1/s1_de.svg`,
610 `public/de/s2/p1/s2_p1_de.svg`,
611 `public/de/s2/s2_de.svg`,
612 `public/de/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_de.svg`,
613 `public/de/straßen/frühling/Straßen_Frühling_de.svg`,
614 `public/de/straßen/Straßen_de.svg`,
615 `public/en/home_en.svg`,
616 `public/en/s1/p1/s1_p1_en.svg`,
617 `public/en/s1/p2/s1_p2_en.svg`,
618 `public/en/s1/s1_en.svg`,
619 `public/en/s2/p1/s2_p1_en.svg`,
620 `public/en/s2/s2_en.svg`,
621 `public/en/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_en.svg`,
622 `public/en/straßen/frühling/Straßen_Frühling_en.svg`,
623 `public/en/straßen/Straßen_en.svg`,
624 } {
625 b.AssertFileExists(path, true)
626 }
627 }
628
629 func validatePublishedSite_10(b *hugolib.IntegrationTestBuilder) {
630 for _, file := range []publishedContentFile{
631 {`public/de/index.html`, `src="home_de.svg"`},
632 {`public/de/s1/index.html`, `src="s1_de.svg"`},
633 {`public/de/s1/p1/index.html`, `src="s1_p1_de.svg"`},
634 {`public/de/s1/p2/index.html`, `src="s1_p2_de.svg"`},
635 {`public/de/s2/index.html`, `src="s2_de.svg"`},
636 {`public/de/s2/p1/index.html`, `src="s2_p1_de.svg"`},
637 {`public/de/straßen/frühling/index.html`, `src="Straßen_Frühling_de.svg"`},
638 {`public/de/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_de.svg"`},
639 {`public/de/straßen/index.html`, `src="Straßen_de.svg"`},
640 {`public/en/index.html`, `src="home_en.svg"`},
641 {`public/en/s1/index.html`, `src="s1_en.svg"`},
642 {`public/en/s1/p1/index.html`, `src="s1_p1_en.svg"`},
643 {`public/en/s1/p2/index.html`, `src="s1_p2_en.svg"`},
644 {`public/en/s2/index.html`, `src="s2_en.svg"`},
645 {`public/en/s2/p1/index.html`, `src="s2_p1_en.svg"`},
646 {`public/en/straßen/frühling/index.html`, `src="Straßen_Frühling_en.svg"`},
647 {`public/en/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_en.svg"`},
648 {`public/en/straßen/index.html`, `src="Straßen_en.svg"`},
649 } {
650 b.AssertFileContent(file.path, file.match)
651 }
652
653 for _, path := range []string{
654 `public/de/home_de.svg`,
655 `public/de/s1/p1/s1_p1_de.svg`,
656 `public/de/s1/p2/s1_p2_de.svg`,
657 `public/de/s1/s1_de.svg`,
658 `public/de/s2/p1/s2_p1_de.svg`,
659 `public/de/s2/s2_de.svg`,
660 `public/de/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_de.svg`,
661 `public/de/straßen/frühling/Straßen_Frühling_de.svg`,
662 `public/de/straßen/Straßen_de.svg`,
663 `public/en/home_en.svg`,
664 `public/en/s1/p1/s1_p1_en.svg`,
665 `public/en/s1/p2/s1_p2_en.svg`,
666 `public/en/s1/s1_en.svg`,
667 `public/en/s2/p1/s2_p1_en.svg`,
668 `public/en/s2/s2_en.svg`,
669 `public/en/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_en.svg`,
670 `public/en/straßen/frühling/Straßen_Frühling_en.svg`,
671 `public/en/straßen/Straßen_en.svg`,
672 } {
673 b.AssertFileExists(path, true)
674 }
675 }
676
677 func validatePublishedSite_11(b *hugolib.IntegrationTestBuilder) {
678 for _, file := range []publishedContentFile{
679 {`public/de/index.html`, `src="home_de.svg"`},
680 {`public/de/s1/index.html`, `src="s1_de.svg"`},
681 {`public/de/s1/p1.html`, `src="p1/s1_p1_de.svg"`},
682 {`public/de/s1/p2.html`, `src="p2/s1_p2_de.svg"`},
683 {`public/de/s2/index.html`, `src="s2_de.svg"`},
684 {`public/de/s2/p1/index.html`, `src="s2_p1_de.svg"`},
685 {`public/de/straßen/frühling/index.html`, `src="Straßen_Frühling_de.svg"`},
686 {`public/de/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_de.svg"`},
687 {`public/de/straßen/index.html`, `src="Straßen_de.svg"`},
688 {`public/en/index.html`, `src="home_en.svg"`},
689 {`public/en/s1/index.html`, `src="s1_en.svg"`},
690 {`public/en/s1/p1.html`, `src="p1/s1_p1_en.svg"`},
691 {`public/en/s1/p2.html`, `src="p2/s1_p2_en.svg"`},
692 {`public/en/s2/index.html`, `src="s2_en.svg"`},
693 {`public/en/s2/p1/index.html`, `src="s2_p1_en.svg"`},
694 {`public/en/straßen/frühling/index.html`, `src="Straßen_Frühling_en.svg"`},
695 {`public/en/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_en.svg"`},
696 {`public/en/straßen/index.html`, `src="Straßen_en.svg"`},
697 } {
698 b.AssertFileContent(file.path, file.match)
699 }
700
701 for _, path := range []string{
702 `public/de/home_de.svg`,
703 `public/de/s1/p1/s1_p1_de.svg`,
704 `public/de/s1/p2/s1_p2_de.svg`,
705 `public/de/s1/s1_de.svg`,
706 `public/de/s2/p1/s2_p1_de.svg`,
707 `public/de/s2/s2_de.svg`,
708 `public/de/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_de.svg`,
709 `public/de/straßen/frühling/Straßen_Frühling_de.svg`,
710 `public/de/straßen/Straßen_de.svg`,
711 `public/en/home_en.svg`,
712 `public/en/s1/p1/s1_p1_en.svg`,
713 `public/en/s1/p2/s1_p2_en.svg`,
714 `public/en/s1/s1_en.svg`,
715 `public/en/s2/p1/s2_p1_en.svg`,
716 `public/en/s2/s2_en.svg`,
717 `public/en/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_en.svg`,
718 `public/en/straßen/frühling/Straßen_Frühling_en.svg`,
719 `public/en/straßen/Straßen_en.svg`,
720 } {
721 b.AssertFileExists(path, true)
722 }
723 }
724
725 func validatePublishedSite_12(b *hugolib.IntegrationTestBuilder) {
726 for _, file := range []publishedContentFile{
727 {`public/de/index.html`, `src="home_de.svg"`},
728 {`public/de/s1/index.html`, `src="s1_de.svg"`},
729 {`public/de/s1/p1.html`, `src="p1/s1_p1_de.svg"`},
730 {`public/de/s1/p2.html`, `src="p2/s1_p2_de.svg"`},
731 {`public/de/s2/index.html`, `src="s2_de.svg"`},
732 {`public/de/s2/p1/index.html`, `src="s2_p1_de.svg"`},
733 {`public/de/straßen/frühling/index.html`, `src="Straßen_Frühling_de.svg"`},
734 {`public/de/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_de.svg"`},
735 {`public/de/straßen/index.html`, `src="Straßen_de.svg"`},
736 {`public/en/index.html`, `src="home_en.svg"`},
737 {`public/en/s1/index.html`, `src="s1_en.svg"`},
738 {`public/en/s1/p1.html`, `src="p1/s1_p1_en.svg"`},
739 {`public/en/s1/p2.html`, `src="p2/s1_p2_en.svg"`},
740 {`public/en/s2/index.html`, `src="s2_en.svg"`},
741 {`public/en/s2/p1/index.html`, `src="s2_p1_en.svg"`},
742 {`public/en/straßen/frühling/index.html`, `src="Straßen_Frühling_en.svg"`},
743 {`public/en/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_en.svg"`},
744 {`public/en/straßen/index.html`, `src="Straßen_en.svg"`},
745 } {
746 b.AssertFileContent(file.path, file.match)
747 }
748
749 for _, path := range []string{
750 `public/de/home_de.svg`,
751 `public/de/s1/p1/s1_p1_de.svg`,
752 `public/de/s1/p2/s1_p2_de.svg`,
753 `public/de/s1/s1_de.svg`,
754 `public/de/s2/p1/s2_p1_de.svg`,
755 `public/de/s2/s2_de.svg`,
756 `public/de/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_de.svg`,
757 `public/de/straßen/frühling/Straßen_Frühling_de.svg`,
758 `public/de/straßen/Straßen_de.svg`,
759 `public/en/home_en.svg`,
760 `public/en/s1/p1/s1_p1_en.svg`,
761 `public/en/s1/p2/s1_p2_en.svg`,
762 `public/en/s1/s1_en.svg`,
763 `public/en/s2/p1/s2_p1_en.svg`,
764 `public/en/s2/s2_en.svg`,
765 `public/en/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_en.svg`,
766 `public/en/straßen/frühling/Straßen_Frühling_en.svg`,
767 `public/en/straßen/Straßen_en.svg`,
768 } {
769 b.AssertFileExists(path, true)
770 }
771 }
772
773 func validatePublishedSite_13(b *hugolib.IntegrationTestBuilder) {
774 for _, file := range []publishedContentFile{
775 {`public/de/index.html`, `src="home_de.svg"`},
776 {`public/de/s1/index.html`, `src="s1_de.svg"`},
777 {`public/de/s1/p1/index.html`, `src="s1_p1_de.svg"`},
778 {`public/de/s1/p2/index.html`, `src="s1_p2_de.svg"`},
779 {`public/de/s2/index.html`, `src="s2_de.svg"`},
780 {`public/de/s2/p1/index.html`, `src="s2_p1_de.svg"`},
781 {`public/de/straßen/frühling/index.html`, `src="Straßen_Frühling_de.svg"`},
782 {`public/de/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_de.svg"`},
783 {`public/de/straßen/index.html`, `src="Straßen_de.svg"`},
784 {`public/en/index.html`, `src="home_en.svg"`},
785 {`public/en/s1/index.html`, `src="s1_en.svg"`},
786 {`public/en/s1/p1/index.html`, `src="s1_p1_en.svg"`},
787 {`public/en/s1/p2/index.html`, `src="s1_p2_en.svg"`},
788 {`public/en/s2/index.html`, `src="s2_en.svg"`},
789 {`public/en/s2/p1/index.html`, `src="s2_p1_en.svg"`},
790 {`public/en/straßen/frühling/index.html`, `src="Straßen_Frühling_en.svg"`},
791 {`public/en/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_en.svg"`},
792 {`public/en/straßen/index.html`, `src="Straßen_en.svg"`},
793 } {
794 b.AssertFileContent(file.path, file.match)
795 }
796
797 for _, path := range []string{
798 `public/de/home_de.svg`,
799 `public/de/s1/p1/s1_p1_de.svg`,
800 `public/de/s1/p2/s1_p2_de.svg`,
801 `public/de/s1/s1_de.svg`,
802 `public/de/s2/p1/s2_p1_de.svg`,
803 `public/de/s2/s2_de.svg`,
804 `public/de/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_de.svg`,
805 `public/de/straßen/frühling/Straßen_Frühling_de.svg`,
806 `public/de/straßen/Straßen_de.svg`,
807 `public/en/home_en.svg`,
808 `public/en/s1/p1/s1_p1_en.svg`,
809 `public/en/s1/p2/s1_p2_en.svg`,
810 `public/en/s1/s1_en.svg`,
811 `public/en/s2/p1/s2_p1_en.svg`,
812 `public/en/s2/s2_en.svg`,
813 `public/en/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_en.svg`,
814 `public/en/straßen/frühling/Straßen_Frühling_en.svg`,
815 `public/en/straßen/Straßen_en.svg`,
816 } {
817 b.AssertFileExists(path, true)
818 }
819 }
820
821 func validatePublishedSite_14(b *hugolib.IntegrationTestBuilder) {
822 for _, file := range []publishedContentFile{
823 {`public/de/index.html`, `src="home_de.svg"`},
824 {`public/de/s1/index.html`, `src="s1_de.svg"`},
825 {`public/de/s1/p1/index.html`, `src="s1_p1_de.svg"`},
826 {`public/de/s1/p2/index.html`, `src="s1_p2_de.svg"`},
827 {`public/de/s2/index.html`, `src="s2_de.svg"`},
828 {`public/de/s2/p1/index.html`, `src="s2_p1_de.svg"`},
829 {`public/de/straßen/frühling/index.html`, `src="Straßen_Frühling_de.svg"`},
830 {`public/de/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_de.svg"`},
831 {`public/de/straßen/index.html`, `src="Straßen_de.svg"`},
832 {`public/en/index.html`, `src="home_en.svg"`},
833 {`public/en/s1/index.html`, `src="s1_en.svg"`},
834 {`public/en/s1/p1/index.html`, `src="s1_p1_en.svg"`},
835 {`public/en/s1/p2/index.html`, `src="s1_p2_en.svg"`},
836 {`public/en/s2/index.html`, `src="s2_en.svg"`},
837 {`public/en/s2/p1/index.html`, `src="s2_p1_en.svg"`},
838 {`public/en/straßen/frühling/index.html`, `src="Straßen_Frühling_en.svg"`},
839 {`public/en/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_en.svg"`},
840 {`public/en/straßen/index.html`, `src="Straßen_en.svg"`},
841 } {
842 b.AssertFileContent(file.path, file.match)
843 }
844
845 for _, path := range []string{
846 `public/de/home_de.svg`,
847 `public/de/s1/p1/s1_p1_de.svg`,
848 `public/de/s1/p2/s1_p2_de.svg`,
849 `public/de/s1/s1_de.svg`,
850 `public/de/s2/p1/s2_p1_de.svg`,
851 `public/de/s2/s2_de.svg`,
852 `public/de/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_de.svg`,
853 `public/de/straßen/frühling/Straßen_Frühling_de.svg`,
854 `public/de/straßen/Straßen_de.svg`,
855 `public/en/home_en.svg`,
856 `public/en/s1/p1/s1_p1_en.svg`,
857 `public/en/s1/p2/s1_p2_en.svg`,
858 `public/en/s1/s1_en.svg`,
859 `public/en/s2/p1/s2_p1_en.svg`,
860 `public/en/s2/s2_en.svg`,
861 `public/en/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_en.svg`,
862 `public/en/straßen/frühling/Straßen_Frühling_en.svg`,
863 `public/en/straßen/Straßen_en.svg`,
864 } {
865 b.AssertFileExists(path, true)
866 }
867 }
868
869 func validatePublishedSite_15(b *hugolib.IntegrationTestBuilder) {
870 for _, file := range []publishedContentFile{
871 {`public/de/index.html`, `src="home_de.svg"`},
872 {`public/de/s1/index.html`, `src="s1_de.svg"`},
873 {`public/de/s1/p1.html`, `src="p1/s1_p1_de.svg"`},
874 {`public/de/s1/p2.html`, `src="p2/s1_p2_de.svg"`},
875 {`public/de/s2/index.html`, `src="s2_de.svg"`},
876 {`public/de/s2/p1/index.html`, `src="s2_p1_de.svg"`},
877 {`public/de/straßen/frühling/index.html`, `src="Straßen_Frühling_de.svg"`},
878 {`public/de/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_de.svg"`},
879 {`public/de/straßen/index.html`, `src="Straßen_de.svg"`},
880 {`public/en/index.html`, `src="home_en.svg"`},
881 {`public/en/s1/index.html`, `src="s1_en.svg"`},
882 {`public/en/s1/p1.html`, `src="p1/s1_p1_en.svg"`},
883 {`public/en/s1/p2.html`, `src="p2/s1_p2_en.svg"`},
884 {`public/en/s2/index.html`, `src="s2_en.svg"`},
885 {`public/en/s2/p1/index.html`, `src="s2_p1_en.svg"`},
886 {`public/en/straßen/frühling/index.html`, `src="Straßen_Frühling_en.svg"`},
887 {`public/en/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_en.svg"`},
888 {`public/en/straßen/index.html`, `src="Straßen_en.svg"`},
889 } {
890 b.AssertFileContent(file.path, file.match)
891 }
892
893 for _, path := range []string{
894 `public/de/home_de.svg`,
895 `public/de/s1/p1/s1_p1_de.svg`,
896 `public/de/s1/p2/s1_p2_de.svg`,
897 `public/de/s1/s1_de.svg`,
898 `public/de/s2/p1/s2_p1_de.svg`,
899 `public/de/s2/s2_de.svg`,
900 `public/de/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_de.svg`,
901 `public/de/straßen/frühling/Straßen_Frühling_de.svg`,
902 `public/de/straßen/Straßen_de.svg`,
903 `public/en/home_en.svg`,
904 `public/en/s1/p1/s1_p1_en.svg`,
905 `public/en/s1/p2/s1_p2_en.svg`,
906 `public/en/s1/s1_en.svg`,
907 `public/en/s2/p1/s2_p1_en.svg`,
908 `public/en/s2/s2_en.svg`,
909 `public/en/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_en.svg`,
910 `public/en/straßen/frühling/Straßen_Frühling_en.svg`,
911 `public/en/straßen/Straßen_en.svg`,
912 } {
913 b.AssertFileExists(path, true)
914 }
915 }
916
917 func validatePublishedSite_16(b *hugolib.IntegrationTestBuilder) {
918 for _, file := range []publishedContentFile{
919 {`public/de/index.html`, `src="home_de.svg"`},
920 {`public/de/s1/index.html`, `src="s1_de.svg"`},
921 {`public/de/s1/p1.html`, `src="p1/s1_p1_de.svg"`},
922 {`public/de/s1/p2.html`, `src="p2/s1_p2_de.svg"`},
923 {`public/de/s2/index.html`, `src="s2_de.svg"`},
924 {`public/de/s2/p1/index.html`, `src="s2_p1_de.svg"`},
925 {`public/de/straßen/frühling/index.html`, `src="Straßen_Frühling_de.svg"`},
926 {`public/de/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_de.svg"`},
927 {`public/de/straßen/index.html`, `src="Straßen_de.svg"`},
928 {`public/en/index.html`, `src="home_en.svg"`},
929 {`public/en/s1/index.html`, `src="s1_en.svg"`},
930 {`public/en/s1/p1.html`, `src="p1/s1_p1_en.svg"`},
931 {`public/en/s1/p2.html`, `src="p2/s1_p2_en.svg"`},
932 {`public/en/s2/index.html`, `src="s2_en.svg"`},
933 {`public/en/s2/p1/index.html`, `src="s2_p1_en.svg"`},
934 {`public/en/straßen/frühling/index.html`, `src="Straßen_Frühling_en.svg"`},
935 {`public/en/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_en.svg"`},
936 {`public/en/straßen/index.html`, `src="Straßen_en.svg"`},
937 } {
938 b.AssertFileContent(file.path, file.match)
939 }
940
941 for _, path := range []string{
942 `public/de/home_de.svg`,
943 `public/de/s1/p1/s1_p1_de.svg`,
944 `public/de/s1/p2/s1_p2_de.svg`,
945 `public/de/s1/s1_de.svg`,
946 `public/de/s2/p1/s2_p1_de.svg`,
947 `public/de/s2/s2_de.svg`,
948 `public/de/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_de.svg`,
949 `public/de/straßen/frühling/Straßen_Frühling_de.svg`,
950 `public/de/straßen/Straßen_de.svg`,
951 `public/en/home_en.svg`,
952 `public/en/s1/p1/s1_p1_en.svg`,
953 `public/en/s1/p2/s1_p2_en.svg`,
954 `public/en/s1/s1_en.svg`,
955 `public/en/s2/p1/s2_p1_en.svg`,
956 `public/en/s2/s2_en.svg`,
957 `public/en/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_en.svg`,
958 `public/en/straßen/frühling/Straßen_Frühling_en.svg`,
959 `public/en/straßen/Straßen_en.svg`,
960 } {
961 b.AssertFileExists(path, true)
962 }
963 }
964
965 func validatePublishedSite_17(b *hugolib.IntegrationTestBuilder) {
966 for _, file := range []publishedContentFile{
967 {`public/de/index.html`, `src="home_de.svg"`},
968 {`public/de/s1/index.html`, `src="s1_de.svg"`},
969 {`public/de/s1/p1/index.html`, `src="s1_p1_de.svg"`},
970 {`public/de/s1/p2/index.html`, `src="s1_p2_de.svg"`},
971 {`public/de/s2/index.html`, `src="s2_de.svg"`},
972 {`public/de/s2/p1/index.html`, `src="s2_p1_de.svg"`},
973 {`public/de/straßen/frühling/index.html`, `src="Straßen_Frühling_de.svg"`},
974 {`public/de/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_de.svg"`},
975 {`public/de/straßen/index.html`, `src="Straßen_de.svg"`},
976 {`public/en/index.html`, `src="home_en.svg"`},
977 {`public/en/s1/index.html`, `src="s1_en.svg"`},
978 {`public/en/s1/p1/index.html`, `src="s1_p1_en.svg"`},
979 {`public/en/s1/p2/index.html`, `src="s1_p2_en.svg"`},
980 {`public/en/s2/index.html`, `src="s2_en.svg"`},
981 {`public/en/s2/p1/index.html`, `src="s2_p1_en.svg"`},
982 {`public/en/straßen/frühling/index.html`, `src="Straßen_Frühling_en.svg"`},
983 {`public/en/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_en.svg"`},
984 {`public/en/straßen/index.html`, `src="Straßen_en.svg"`},
985 } {
986 b.AssertFileContent(file.path, file.match)
987 }
988
989 for _, path := range []string{
990 `public/de/home_de.svg`,
991 `public/de/s1/p1/s1_p1_de.svg`,
992 `public/de/s1/p2/s1_p2_de.svg`,
993 `public/de/s1/s1_de.svg`,
994 `public/de/s2/p1/s2_p1_de.svg`,
995 `public/de/s2/s2_de.svg`,
996 `public/de/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_de.svg`,
997 `public/de/straßen/frühling/Straßen_Frühling_de.svg`,
998 `public/de/straßen/Straßen_de.svg`,
999 `public/en/home_en.svg`,
1000 `public/en/s1/p1/s1_p1_en.svg`,
1001 `public/en/s1/p2/s1_p2_en.svg`,
1002 `public/en/s1/s1_en.svg`,
1003 `public/en/s2/p1/s2_p1_en.svg`,
1004 `public/en/s2/s2_en.svg`,
1005 `public/en/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_en.svg`,
1006 `public/en/straßen/frühling/Straßen_Frühling_en.svg`,
1007 `public/en/straßen/Straßen_en.svg`,
1008 } {
1009 b.AssertFileExists(path, true)
1010 }
1011 }
1012
1013 func validatePublishedSite_18(b *hugolib.IntegrationTestBuilder) {
1014 for _, file := range []publishedContentFile{
1015 {`public/de/index.html`, `src="home_de.svg"`},
1016 {`public/de/s1/index.html`, `src="s1_de.svg"`},
1017 {`public/de/s1/p1/index.html`, `src="s1_p1_de.svg"`},
1018 {`public/de/s1/p2/index.html`, `src="s1_p2_de.svg"`},
1019 {`public/de/s2/index.html`, `src="s2_de.svg"`},
1020 {`public/de/s2/p1/index.html`, `src="s2_p1_de.svg"`},
1021 {`public/de/straßen/frühling/index.html`, `src="Straßen_Frühling_de.svg"`},
1022 {`public/de/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_de.svg"`},
1023 {`public/de/straßen/index.html`, `src="Straßen_de.svg"`},
1024 {`public/en/index.html`, `src="home_en.svg"`},
1025 {`public/en/s1/index.html`, `src="s1_en.svg"`},
1026 {`public/en/s1/p1/index.html`, `src="s1_p1_en.svg"`},
1027 {`public/en/s1/p2/index.html`, `src="s1_p2_en.svg"`},
1028 {`public/en/s2/index.html`, `src="s2_en.svg"`},
1029 {`public/en/s2/p1/index.html`, `src="s2_p1_en.svg"`},
1030 {`public/en/straßen/frühling/index.html`, `src="Straßen_Frühling_en.svg"`},
1031 {`public/en/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_en.svg"`},
1032 {`public/en/straßen/index.html`, `src="Straßen_en.svg"`},
1033 } {
1034 b.AssertFileContent(file.path, file.match)
1035 }
1036
1037 for _, path := range []string{
1038 `public/de/home_de.svg`,
1039 `public/de/s1/p1/s1_p1_de.svg`,
1040 `public/de/s1/p2/s1_p2_de.svg`,
1041 `public/de/s1/s1_de.svg`,
1042 `public/de/s2/p1/s2_p1_de.svg`,
1043 `public/de/s2/s2_de.svg`,
1044 `public/de/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_de.svg`,
1045 `public/de/straßen/frühling/Straßen_Frühling_de.svg`,
1046 `public/de/straßen/Straßen_de.svg`,
1047 `public/en/home_en.svg`,
1048 `public/en/s1/p1/s1_p1_en.svg`,
1049 `public/en/s1/p2/s1_p2_en.svg`,
1050 `public/en/s1/s1_en.svg`,
1051 `public/en/s2/p1/s2_p1_en.svg`,
1052 `public/en/s2/s2_en.svg`,
1053 `public/en/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_en.svg`,
1054 `public/en/straßen/frühling/Straßen_Frühling_en.svg`,
1055 `public/en/straßen/Straßen_en.svg`,
1056 } {
1057 b.AssertFileExists(path, true)
1058 }
1059 }
1060
1061 func validatePublishedSite_19(b *hugolib.IntegrationTestBuilder) {
1062 for _, file := range []publishedContentFile{
1063 {`public/de/index.html`, `src="home_de.svg"`},
1064 {`public/de/s1/index.html`, `src="s1_de.svg"`},
1065 {`public/de/s1/p1.html`, `src="p1/s1_p1_de.svg"`},
1066 {`public/de/s1/p2.html`, `src="p2/s1_p2_de.svg"`},
1067 {`public/de/s2/index.html`, `src="s2_de.svg"`},
1068 {`public/de/s2/p1/index.html`, `src="s2_p1_de.svg"`},
1069 {`public/de/straßen/frühling/index.html`, `src="Straßen_Frühling_de.svg"`},
1070 {`public/de/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_de.svg"`},
1071 {`public/de/straßen/index.html`, `src="Straßen_de.svg"`},
1072 {`public/en/index.html`, `src="home_en.svg"`},
1073 {`public/en/s1/index.html`, `src="s1_en.svg"`},
1074 {`public/en/s1/p1.html`, `src="p1/s1_p1_en.svg"`},
1075 {`public/en/s1/p2.html`, `src="p2/s1_p2_en.svg"`},
1076 {`public/en/s2/index.html`, `src="s2_en.svg"`},
1077 {`public/en/s2/p1/index.html`, `src="s2_p1_en.svg"`},
1078 {`public/en/straßen/frühling/index.html`, `src="Straßen_Frühling_en.svg"`},
1079 {`public/en/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_en.svg"`},
1080 {`public/en/straßen/index.html`, `src="Straßen_en.svg"`},
1081 } {
1082 b.AssertFileContent(file.path, file.match)
1083 }
1084
1085 for _, path := range []string{
1086 `public/de/home_de.svg`,
1087 `public/de/s1/p1/s1_p1_de.svg`,
1088 `public/de/s1/p2/s1_p2_de.svg`,
1089 `public/de/s1/s1_de.svg`,
1090 `public/de/s2/p1/s2_p1_de.svg`,
1091 `public/de/s2/s2_de.svg`,
1092 `public/de/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_de.svg`,
1093 `public/de/straßen/frühling/Straßen_Frühling_de.svg`,
1094 `public/de/straßen/Straßen_de.svg`,
1095 `public/en/home_en.svg`,
1096 `public/en/s1/p1/s1_p1_en.svg`,
1097 `public/en/s1/p2/s1_p2_en.svg`,
1098 `public/en/s1/s1_en.svg`,
1099 `public/en/s2/p1/s2_p1_en.svg`,
1100 `public/en/s2/s2_en.svg`,
1101 `public/en/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_en.svg`,
1102 `public/en/straßen/frühling/Straßen_Frühling_en.svg`,
1103 `public/en/straßen/Straßen_en.svg`,
1104 } {
1105 b.AssertFileExists(path, true)
1106 }
1107 }
1108
1109 func validatePublishedSite_20(b *hugolib.IntegrationTestBuilder) {
1110 for _, file := range []publishedContentFile{
1111 {`public/de/index.html`, `src="home_de.svg"`},
1112 {`public/de/s1/index.html`, `src="s1_de.svg"`},
1113 {`public/de/s1/p1.html`, `src="p1/s1_p1_de.svg"`},
1114 {`public/de/s1/p2.html`, `src="p2/s1_p2_de.svg"`},
1115 {`public/de/s2/index.html`, `src="s2_de.svg"`},
1116 {`public/de/s2/p1/index.html`, `src="s2_p1_de.svg"`},
1117 {`public/de/straßen/frühling/index.html`, `src="Straßen_Frühling_de.svg"`},
1118 {`public/de/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_de.svg"`},
1119 {`public/de/straßen/index.html`, `src="Straßen_de.svg"`},
1120 {`public/en/index.html`, `src="home_en.svg"`},
1121 {`public/en/s1/index.html`, `src="s1_en.svg"`},
1122 {`public/en/s1/p1.html`, `src="p1/s1_p1_en.svg"`},
1123 {`public/en/s1/p2.html`, `src="p2/s1_p2_en.svg"`},
1124 {`public/en/s2/index.html`, `src="s2_en.svg"`},
1125 {`public/en/s2/p1/index.html`, `src="s2_p1_en.svg"`},
1126 {`public/en/straßen/frühling/index.html`, `src="Straßen_Frühling_en.svg"`},
1127 {`public/en/straßen/frühling/müll-brücke/index.html`, `src="Straßen_Frühling_Müll_Brücke_en.svg"`},
1128 {`public/en/straßen/index.html`, `src="Straßen_en.svg"`},
1129 } {
1130 b.AssertFileContent(file.path, file.match)
1131 }
1132
1133 for _, path := range []string{
1134 `public/de/home_de.svg`,
1135 `public/de/s1/p1/s1_p1_de.svg`,
1136 `public/de/s1/p2/s1_p2_de.svg`,
1137 `public/de/s1/s1_de.svg`,
1138 `public/de/s2/p1/s2_p1_de.svg`,
1139 `public/de/s2/s2_de.svg`,
1140 `public/de/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_de.svg`,
1141 `public/de/straßen/frühling/Straßen_Frühling_de.svg`,
1142 `public/de/straßen/Straßen_de.svg`,
1143 `public/en/home_en.svg`,
1144 `public/en/s1/p1/s1_p1_en.svg`,
1145 `public/en/s1/p2/s1_p2_en.svg`,
1146 `public/en/s1/s1_en.svg`,
1147 `public/en/s2/p1/s2_p1_en.svg`,
1148 `public/en/s2/s2_en.svg`,
1149 `public/en/straßen/frühling/müll-brücke/Straßen_Frühling_Müll_Brücke_en.svg`,
1150 `public/en/straßen/frühling/Straßen_Frühling_en.svg`,
1151 `public/en/straßen/Straßen_en.svg`,
1152 } {
1153 b.AssertFileExists(path, true)
1154 }
1155 }
1156
1157 // See issue 15121
1158 func TestAsciiDocHTML5BackendTOC(t *testing.T) {
1159 if !htesting.IsRealCI() {
1160 t.Skip()
1161 }
1162 if ok, err := asciidocext.Supports(); !ok {
1163 t.Skip(err)
1164 }
1165
1166 t.Cleanup(func() {
1167 resetDefaultAsciiDocExtConfig()
1168 })
1169
1170 files := `
1171 -- hugo.toml --
1172 disableKinds = ['home','rss','section','sitemap','taxonomy','term']
1173
1174 [markup.asciidocExt]
1175 backend = 'html5s'
1176 extensions = ['asciidoctor-html5s']
1177
1178 [security.exec]
1179 allow = ['^asciidoctor$']
1180 -- content/p1.adoc --
1181 ---
1182 title: p1
1183 ---
1184
1185 :toc:
1186
1187 ## Section 1
1188
1189 ### Section 1.1
1190
1191 ### Section 1.2
1192
1193 ## Section 2
1194 -- layouts/page.html --
1195 {{ .TableOfContents }}
1196 `
1197
1198 b := hugolib.Test(t, files)
1199
1200 b.AssertFileContentExact("public/p1/index.html", `<nav id="TableOfContents">
1201 <ul>
1202 <li><a href="#_section_1">Section 1</a>
1203 <ul>
1204 <li><a href="#_section_1_1">Section 1.1</a></li>
1205 <li><a href="#_section_1_2">Section 1.2</a></li>
1206 </ul>
1207 </li>
1208 <li><a href="#_section_2">Section 2</a></li>
1209 </ul>
1210 </nav>`)
1211 }