@diplodoc/cli-tests 5.19.10 → 5.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,71 @@
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
+
3
+ exports[`Cleanup empty directories with stage filtering > should cleanup directories that contain only presets.yaml when TOC is ignored by stage 1`] = `
4
+ "ignoreStage:
5
+ - internal"
6
+ `;
7
+
8
+ exports[`Cleanup empty directories with stage filtering > should cleanup directories that contain only presets.yaml when TOC is ignored by stage 2`] = `
9
+ "---
10
+ metadata:
11
+ - name: generator
12
+ content: Diplodoc Platform vDIPLODOC-VERSION
13
+ vcsPath: active/page.md
14
+ ---
15
+ # Active Page
16
+
17
+ This is an active page that should be included in the build.
18
+
19
+ Active variable: {{active_var}}"
20
+ `;
21
+
22
+ exports[`Cleanup empty directories with stage filtering > should cleanup directories that contain only presets.yaml when TOC is ignored by stage 3`] = `
23
+ "default:
24
+ active_var: active_value
25
+ "
26
+ `;
27
+
28
+ exports[`Cleanup empty directories with stage filtering > should cleanup directories that contain only presets.yaml when TOC is ignored by stage 4`] = `
29
+ "title: Active Section
30
+ items:
31
+ - name: Active Page
32
+ href: page.md
33
+ path: active/toc.yaml
34
+ "
35
+ `;
36
+
37
+ exports[`Cleanup empty directories with stage filtering > should cleanup directories that contain only presets.yaml when TOC is ignored by stage 5`] = `
38
+ "default:
39
+ empty_var: empty_value
40
+ "
41
+ `;
42
+
43
+ exports[`Cleanup empty directories with stage filtering > should cleanup directories that contain only presets.yaml when TOC is ignored by stage 6`] = `
44
+ "---
45
+ metadata:
46
+ - name: generator
47
+ content: Diplodoc Platform vDIPLODOC-VERSION
48
+ vcsPath: index.md
49
+ ---
50
+ # Main Page
51
+
52
+ This is the main page content.
53
+
54
+ Root variable: {{root_var}}"
55
+ `;
56
+
57
+ exports[`Cleanup empty directories with stage filtering > should cleanup directories that contain only presets.yaml when TOC is ignored by stage 7`] = `
58
+ "default:
59
+ root_var: root_value
60
+ "
61
+ `;
62
+
63
+ exports[`Cleanup empty directories with stage filtering > should cleanup directories that contain only presets.yaml when TOC is ignored by stage 8`] = `
64
+ "title: Test Documentation
65
+ href: index.md
66
+ items:
67
+ - name: Active Section
68
+ href: active/page.md
69
+ path: toc.yaml
70
+ "
71
+ `;
@@ -0,0 +1,131 @@
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
+
3
+ exports[`Conditions > Conditions > filelist 1`] = `
4
+ "[
5
+ ".yfm",
6
+ "index.html",
7
+ "page1.html",
8
+ "page2.html",
9
+ "page5.html",
10
+ "toc.js"
11
+ ]"
12
+ `;
13
+
14
+ exports[`Conditions > Conditions 1`] = `
15
+ "allowHTML: true
16
+ "
17
+ `;
18
+
19
+ exports[`Conditions > Conditions 2`] = `
20
+ "<!DOCTYPE html>
21
+ <html lang="ru" dir="ltr">
22
+ <head>
23
+ <meta charset="utf-8">
24
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
25
+ <base href="./" />
26
+ <title>Index page | Conditions</title>
27
+ <meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
28
+ <style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
29
+ </head>
30
+ <body class="g-root g-root_theme_light">
31
+ <div id="root"></div>
32
+ <script type="application/json" id="diplodoc-state">
33
+ {"data":{"leading":false,"html":"","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"index.md"},"headings":[],"title":"Index page"},"router":{"pathname":"index","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
34
+ </script>
35
+ <script type="application/javascript">
36
+ const data = document.querySelector('script#diplodoc-state');
37
+ window.__DATA__ = JSON.parse((function unescape(string) {
38
+ return string.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
39
+ })(data.innerText));
40
+ window.STATIC_CONTENT = false;
41
+ </script>
42
+ <script type="application/javascript" defer src="toc.js"></script>
43
+ </body>
44
+ </html>"
45
+ `;
46
+
47
+ exports[`Conditions > Conditions 3`] = `
48
+ "<!DOCTYPE html>
49
+ <html lang="ru" dir="ltr">
50
+ <head>
51
+ <meta charset="utf-8">
52
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
53
+ <base href="./" />
54
+ <title>Conditions</title>
55
+ <meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
56
+ <style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
57
+ </head>
58
+ <body class="g-root g-root_theme_light">
59
+ <div id="root"></div>
60
+ <script type="application/json" id="diplodoc-state">
61
+ {"data":{"leading":true,"data":{"blocks":[{"type":"header-block","title":"&lt;p&gt;&lt;a href=\\"https://example.com\\" target=\\"_blank\\" rel=\\"noreferrer noopener\\"&gt;Test&lt;/a&gt;&lt;/p&gt;/n","description":"&lt;p&gt;Description link&lt;/p&gt;/n"}],"links":[]},"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"page1.yaml"},"title":""},"router":{"pathname":"page1","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
62
+ </script>
63
+ <script type="application/javascript">
64
+ const data = document.querySelector('script#diplodoc-state');
65
+ window.__DATA__ = JSON.parse((function unescape(string) {
66
+ return string.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
67
+ })(data.innerText));
68
+ window.STATIC_CONTENT = false;
69
+ </script>
70
+ <script type="application/javascript" defer src="toc.js"></script>
71
+ </body>
72
+ </html>"
73
+ `;
74
+
75
+ exports[`Conditions > Conditions 4`] = `
76
+ "<!DOCTYPE html>
77
+ <html lang="ru" dir="ltr">
78
+ <head>
79
+ <meta charset="utf-8">
80
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
81
+ <base href="./" />
82
+ <title>Conditions</title>
83
+ <meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
84
+ <style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
85
+ </head>
86
+ <body class="g-root g-root_theme_light">
87
+ <div id="root"></div>
88
+ <script type="application/json" id="diplodoc-state">
89
+ {"data":{"leading":false,"html":"&lt;div class=\\"yfm-page-constructor\\" data-content-encoded=\\"%7B%22blocks%22%3A%5B%7B%22type%22%3A%22header-block%22%2C%22title%22%3A%22%3Cp%3EWhen%202%3C%2Fp%3E%5Cn%22%2C%22description%22%3A%22%3Cp%3E%D0%A2%D0%B5%D1%81%D1%82%D0%BE%D0%B2%D1%8B%D0%B9%20%D0%B7%D0%B0%D0%B3%D0%BE%D0%BB%D0%BE%D0%B2%D0%BE%D0%BA%20%D0%B4%D0%BB%D1%8F%20%D0%BF%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B8%20when%202%3C%2Fp%3E%5Cn%22%7D%5D%7D\\" data-hydrated=\\"false\\"&gt;&lt;div class=\\"g-root g-root_theme_light pc-page-constructor\\"&gt;&lt;div class=\\"pc-page-constructor__wrapper\\"&gt;&lt;div class=\\"pc-layout\\"&gt;&lt;main class=\\"pc-layout__content\\"&gt;&lt;header class=\\"pc-header-block pc-header-block_media-view_full pc-header-block_controls-view_light\\"&gt;&lt;div class=\\"pc-Grid pc-header-block\\"&gt;&lt;div class=\\"container-fluid pc-header-block__container-fluid\\"&gt;&lt;div class=\\"row\\"&gt;&lt;div class=\\"col col-reset pc-header-block__content-wrapper\\"&gt;&lt;div class=\\"row\\"&gt;&lt;div class=\\"col pc-header-block__content pc-header-block__content_offset_default pc-header-block__content_theme_light pc-header-block__content_vertical-offset_m\\"&gt;&lt;div class=\\"col col-lg-8 col-md-8 col-sm-12 col-12 pc-header-block__content-inner\\"&gt;&lt;h1 class=\\"pc-header-block__title-container\\"&gt;&lt;div class=\\"yfm yfm_constructor yfm_constructor_theme_light pc-header-block__title\\"&gt;&lt;p&gt;When 2&lt;/p&gt;/n&lt;/div&gt;&lt;/h1&gt;&lt;div class=\\"pc-header-block__description pc-header-block__description_theme_light\\"&gt;&lt;span class=\\"yfm yfm_constructor yfm_constructor_theme_light\\"&gt;&lt;p&gt;Тестовый заголовок для проверки when 2&lt;/p&gt;/n&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/header&gt;&lt;div class=\\"pc-Grid\\"&gt;&lt;div class=\\"container-fluid \\"&gt;&lt;div class=\\"row pc-constructor-row\\"&gt;&lt;div class=\\"col\\"&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/main&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;h1&gt;Page 2&lt;/h1&gt;/n&lt;p&gt;&lt;/p&gt;/n&lt;p&gt;&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"style":["_bundle/page-constructor-extension.css"],"script":["_bundle/page-constructor-extension.js"],"vcsPath":"page2.md"},"headings":[],"title":""},"router":{"pathname":"page2","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
90
+ </script>
91
+ <script type="application/javascript">
92
+ const data = document.querySelector('script#diplodoc-state');
93
+ window.__DATA__ = JSON.parse((function unescape(string) {
94
+ return string.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
95
+ })(data.innerText));
96
+ window.STATIC_CONTENT = false;
97
+ </script>
98
+ <script type="application/javascript" defer src="toc.js"></script>
99
+ </body>
100
+ </html>"
101
+ `;
102
+
103
+ exports[`Conditions > Conditions 5`] = `
104
+ "<!DOCTYPE html>
105
+ <html lang="ru" dir="ltr">
106
+ <head>
107
+ <meta charset="utf-8">
108
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
109
+ <base href="./" />
110
+ <title>Conditions</title>
111
+ <meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
112
+ <style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
113
+ </head>
114
+ <body class="g-root g-root_theme_light">
115
+ <div id="root"></div>
116
+ <script type="application/json" id="diplodoc-state">
117
+ {"data":{"leading":true,"data":{"blocks":[],"links":[]},"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"page5.yaml"},"title":""},"router":{"pathname":"page5","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
118
+ </script>
119
+ <script type="application/javascript">
120
+ const data = document.querySelector('script#diplodoc-state');
121
+ window.__DATA__ = JSON.parse((function unescape(string) {
122
+ return string.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
123
+ })(data.innerText));
124
+ window.STATIC_CONTENT = false;
125
+ </script>
126
+ <script type="application/javascript" defer src="toc.js"></script>
127
+ </body>
128
+ </html>"
129
+ `;
130
+
131
+ exports[`Conditions > Conditions 6`] = `"window.__DATA__.data.toc = {"title":"Conditions","href":"index.html","navigation":{"logo":{"url":"./"},"header":{"leftItems":[{"text":"Always visible","type":"link","url":"./index.md"},{"text":"Visible when var2 is true","type":"link","url":"./page2.md"}],"rightItems":[{"type":"controls"}]}},"items":[{"name":"Page 1","href":"page1.html","id":"UUID"},{"name":"Page 2","href":"page2.html","id":"UUID"},{"name":"Page 5","href":"page5.html","id":"UUID"}],"path":"toc.yaml","id":"UUID"};"`;
@@ -1,6 +1,6 @@
1
1
  // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
- exports[`Skip html extension > Neuro-expert > filelist 1`] = `
3
+ exports[`Neuro-expert > Neuro-expert > filelist 1`] = `
4
4
  "[
5
5
  ".yfm",
6
6
  "en/folder/index.html",
@@ -19,7 +19,7 @@ exports[`Skip html extension > Neuro-expert > filelist 1`] = `
19
19
  ]"
20
20
  `;
21
21
 
22
- exports[`Skip html extension > Neuro-expert 1`] = `
22
+ exports[`Neuro-expert > Neuro-expert 1`] = `
23
23
  "allowHTML: true
24
24
  langs: ['en','ru']
25
25
 
@@ -33,7 +33,7 @@ neuroExpert:
33
33
  "
34
34
  `;
35
35
 
36
- exports[`Skip html extension > Neuro-expert 2`] = `
36
+ exports[`Neuro-expert > Neuro-expert 2`] = `
37
37
  "<!DOCTYPE html>
38
38
  <html lang="en" dir="ltr">
39
39
  <head>
@@ -86,7 +86,7 @@ exports[`Skip html extension > Neuro-expert 2`] = `
86
86
  </html>"
87
87
  `;
88
88
 
89
- exports[`Skip html extension > Neuro-expert 3`] = `
89
+ exports[`Neuro-expert > Neuro-expert 3`] = `
90
90
  "<!DOCTYPE html>
91
91
  <html lang="en" dir="ltr">
92
92
  <head>
@@ -139,7 +139,7 @@ exports[`Skip html extension > Neuro-expert 3`] = `
139
139
  </html>"
140
140
  `;
141
141
 
142
- exports[`Skip html extension > Neuro-expert 4`] = `
142
+ exports[`Neuro-expert > Neuro-expert 4`] = `
143
143
  "<!DOCTYPE html>
144
144
  <html lang="en" dir="ltr">
145
145
  <head>
@@ -171,7 +171,7 @@ exports[`Skip html extension > Neuro-expert 4`] = `
171
171
  </html>"
172
172
  `;
173
173
 
174
- exports[`Skip html extension > Neuro-expert 5`] = `
174
+ exports[`Neuro-expert > Neuro-expert 5`] = `
175
175
  "<!DOCTYPE html>
176
176
  <html lang="en" dir="ltr">
177
177
  <head>
@@ -225,7 +225,7 @@ exports[`Skip html extension > Neuro-expert 5`] = `
225
225
  </html>"
226
226
  `;
227
227
 
228
- exports[`Skip html extension > Neuro-expert 6`] = `
228
+ exports[`Neuro-expert > Neuro-expert 6`] = `
229
229
  "<!DOCTYPE html>
230
230
  <html lang="en" dir="ltr">
231
231
  <head>
@@ -278,9 +278,9 @@ exports[`Skip html extension > Neuro-expert 6`] = `
278
278
  </html>"
279
279
  `;
280
280
 
281
- exports[`Skip html extension > Neuro-expert 7`] = `"window.__DATA__.data.toc = {"title":"Neuroexpert","href":"en/index.html","items":[{"name":"Title 1","href":"en/page1.html","id":"UUID"},{"name":"Title 2","href":"en/page2.html","id":"UUID"},{"name":"Title 3","href":"en/folder/index.html","id":"UUID"},{"name":"Title 4","href":"en/index-test-html/index.html","id":"UUID"}],"path":"en/toc.yaml","id":"UUID"};"`;
281
+ exports[`Neuro-expert > Neuro-expert 7`] = `"window.__DATA__.data.toc = {"title":"Neuroexpert","href":"en/index.html","items":[{"name":"Title 1","href":"en/page1.html","id":"UUID"},{"name":"Title 2","href":"en/page2.html","id":"UUID"},{"name":"Title 3","href":"en/folder/index.html","id":"UUID"},{"name":"Title 4","href":"en/index-test-html/index.html","id":"UUID"}],"path":"en/toc.yaml","id":"UUID"};"`;
282
282
 
283
- exports[`Skip html extension > Neuro-expert 8`] = `
283
+ exports[`Neuro-expert > Neuro-expert 8`] = `
284
284
  "<!DOCTYPE html>
285
285
  <html lang="en" dir="ltr">
286
286
  <head>
@@ -300,7 +300,7 @@ exports[`Skip html extension > Neuro-expert 8`] = `
300
300
  </html>"
301
301
  `;
302
302
 
303
- exports[`Skip html extension > Neuro-expert 9`] = `
303
+ exports[`Neuro-expert > Neuro-expert 9`] = `
304
304
  "<!DOCTYPE html>
305
305
  <html lang="ru" dir="ltr">
306
306
  <head>
@@ -353,7 +353,7 @@ exports[`Skip html extension > Neuro-expert 9`] = `
353
353
  </html>"
354
354
  `;
355
355
 
356
- exports[`Skip html extension > Neuro-expert 10`] = `
356
+ exports[`Neuro-expert > Neuro-expert 10`] = `
357
357
  "<!DOCTYPE html>
358
358
  <html lang="ru" dir="ltr">
359
359
  <head>
@@ -406,7 +406,7 @@ exports[`Skip html extension > Neuro-expert 10`] = `
406
406
  </html>"
407
407
  `;
408
408
 
409
- exports[`Skip html extension > Neuro-expert 11`] = `
409
+ exports[`Neuro-expert > Neuro-expert 11`] = `
410
410
  "<!DOCTYPE html>
411
411
  <html lang="ru" dir="ltr">
412
412
  <head>
@@ -459,7 +459,7 @@ exports[`Skip html extension > Neuro-expert 11`] = `
459
459
  </html>"
460
460
  `;
461
461
 
462
- exports[`Skip html extension > Neuro-expert 12`] = `
462
+ exports[`Neuro-expert > Neuro-expert 12`] = `
463
463
  "<!DOCTYPE html>
464
464
  <html lang="ru" dir="ltr">
465
465
  <head>
@@ -512,7 +512,7 @@ exports[`Skip html extension > Neuro-expert 12`] = `
512
512
  </html>"
513
513
  `;
514
514
 
515
- exports[`Skip html extension > Neuro-expert 13`] = `
515
+ exports[`Neuro-expert > Neuro-expert 13`] = `
516
516
  "<!DOCTYPE html>
517
517
  <html lang="ru" dir="ltr">
518
518
  <head>
@@ -565,4 +565,4 @@ exports[`Skip html extension > Neuro-expert 13`] = `
565
565
  </html>"
566
566
  `;
567
567
 
568
- exports[`Skip html extension > Neuro-expert 14`] = `"window.__DATA__.data.toc = {"title":"Нейроэксперт","href":"ru/index.html","items":[{"name":"Заголовок 1","href":"ru/page1.html","id":"UUID"},{"name":"Заголовок 2","href":"ru/page2.html","id":"UUID"},{"name":"Заголовок 3","href":"ru/folder/index.html","id":"UUID"},{"name":"Заголовок 4","href":"ru/index-test-html/index.html","id":"UUID"}],"path":"ru/toc.yaml","id":"UUID"};"`;
568
+ exports[`Neuro-expert > Neuro-expert 14`] = `"window.__DATA__.data.toc = {"title":"Нейроэксперт","href":"ru/index.html","items":[{"name":"Заголовок 1","href":"ru/page1.html","id":"UUID"},{"name":"Заголовок 2","href":"ru/page2.html","id":"UUID"},{"name":"Заголовок 3","href":"ru/folder/index.html","id":"UUID"},{"name":"Заголовок 4","href":"ru/index-test-html/index.html","id":"UUID"}],"path":"ru/toc.yaml","id":"UUID"};"`;
@@ -0,0 +1,59 @@
1
+ import {describe, expect, test} from 'vitest';
2
+ import {existsSync} from 'node:fs';
3
+ import {resolve} from 'node:path';
4
+
5
+ import {TestAdapter, compareDirectories, getTestPaths} from '../fixtures';
6
+
7
+ describe('Cleanup empty directories with stage filtering', () => {
8
+ test('should cleanup directories that contain only presets.yaml when TOC is ignored by stage', async () => {
9
+ const {inputPath, outputPath} = getTestPaths('mocks/cleanup-empty-dirs');
10
+
11
+ // Test with disabled templating to trigger cleanupEmptyDirectories
12
+ await TestAdapter.testBuildPass(inputPath, outputPath, {
13
+ md2md: true,
14
+ args: '--no-template',
15
+ });
16
+
17
+ // Verify that the output directory structure is correct
18
+ await compareDirectories(outputPath, false, false, true);
19
+
20
+ // Check that active section files are present
21
+ expect(existsSync(resolve(outputPath, 'active/page.md'))).toBe(true);
22
+ expect(existsSync(resolve(outputPath, 'active/presets.yaml'))).toBe(true);
23
+ expect(existsSync(resolve(outputPath, 'active/toc.yaml'))).toBe(true);
24
+
25
+ expect(existsSync(resolve(outputPath, 'empty-section'))).toBe(true);
26
+ expect(existsSync(resolve(outputPath, 'empty-section/presets.yaml'))).toBe(true);
27
+
28
+ // Check that root files are present
29
+ expect(existsSync(resolve(outputPath, 'index.md'))).toBe(true);
30
+ expect(existsSync(resolve(outputPath, 'presets.yaml'))).toBe(true);
31
+ expect(existsSync(resolve(outputPath, 'toc.yaml'))).toBe(true);
32
+ });
33
+
34
+ test('should not cleanup directories when templating is enabled', async () => {
35
+ const {inputPath, outputPath} = getTestPaths('mocks/cleanup-empty-dirs');
36
+
37
+ // Test with enabled templating - cleanup should not be triggered
38
+ await TestAdapter.testBuildPass(inputPath, outputPath + '-with-template', {
39
+ md2md: true,
40
+ args: '', // Default template enabled
41
+ });
42
+
43
+ // Check that empty-section directory exists (cleanup should not be triggered)
44
+ expect(existsSync(resolve(outputPath + '-with-template', 'empty-section'))).toBe(false);
45
+ expect(
46
+ existsSync(resolve(outputPath + '-with-template', 'empty-section/presets.yaml')),
47
+ ).toBe(false);
48
+
49
+ // Check that active section files are present
50
+ expect(existsSync(resolve(outputPath + '-with-template', 'active/page.md'))).toBe(true);
51
+ expect(existsSync(resolve(outputPath + '-with-template', 'active/presets.yaml'))).toBe(
52
+ false,
53
+ );
54
+
55
+ // Check that root files are present
56
+ expect(existsSync(resolve(outputPath + '-with-template', 'index.md'))).toBe(true);
57
+ expect(existsSync(resolve(outputPath + '-with-template', 'presets.yaml'))).toBe(false);
58
+ });
59
+ });
@@ -0,0 +1,16 @@
1
+ import {describe, it} from 'vitest';
2
+
3
+ import {TestAdapter, compareDirectories, getTestPaths} from '../fixtures';
4
+
5
+ describe('Conditions', () => {
6
+ it('Conditions', async () => {
7
+ const {inputPath, outputPath} = getTestPaths('mocks/conditions');
8
+
9
+ await TestAdapter.testBuildPass(inputPath, outputPath, {
10
+ md2md: false,
11
+ md2html: true,
12
+ args: '-j2',
13
+ });
14
+ await compareDirectories(outputPath);
15
+ });
16
+ });
@@ -32,8 +32,8 @@ function test(path: string, expect: Function, additionalArgs: string[] = []) {
32
32
  describe('Errors', () => {
33
33
  test('mocks/errors/unreachable-link', ({html}: TestResult) => {
34
34
  expectErrors(html, [
35
- 'ERR index.md: 1: YFM003 / unreachable-link Link is unreachable [Context: "Unreachable link: "exists.html"; Reason: File is not declared in toc; Line: [existing file](./exists.md)"]',
36
- 'ERR index.md: 2: YFM003 / unreachable-link Link is unreachable [Context: "Unreachable link: "missed.html"; Reason: File is not declared in toc; Line: [missed file](./missed.md)"]',
35
+ 'ERR index.md: 1: YFM003 / unreachable-link Link is unreachable [Context: "Unreachable link: "exists.html"; Reason: File is not declared in toc; Line: 1"]',
36
+ 'ERR index.md: 2: YFM003 / unreachable-link Link is unreachable [Context: "Unreachable link: "missed.html"; Reason: File is not declared in toc; Line: 2"]',
37
37
  ]);
38
38
  });
39
39
 
@@ -86,7 +86,7 @@ describe('Errors', () => {
86
86
  describe('Warnings', () => {
87
87
  test('mocks/warning/unreachable-autotitle', ({html}: TestResult) => {
88
88
  expectWarnings(html, [
89
- 'WARN index.md: 1: YFM010 / unreachable-autotitle-anchor Auto title anchor is unreachable [Context: "[Unreachable autotitle anchor: "link.html#unknown_yfm010"][{#T}](./link.md#unknown_yfm010)"]',
89
+ 'WARN index.md: 1: YFM010 / unreachable-autotitle-anchor Auto title anchor is unreachable [Context: "[Unreachable autotitle anchor: "link.html#unknown_yfm010"] [{#T}](./link.md#unknown_yfm010)"]',
90
90
  ]);
91
91
  });
92
92
  });
@@ -2,7 +2,7 @@ import {describe, it} from 'vitest';
2
2
 
3
3
  import {TestAdapter, compareDirectories, getTestPaths} from '../fixtures';
4
4
 
5
- describe('Skip html extension', () => {
5
+ describe('Neuro-expert', () => {
6
6
  it('Neuro-expert', async () => {
7
7
  const {inputPath, outputPath} = getTestPaths('mocks/neuro-expert');
8
8
 
@@ -0,0 +1,2 @@
1
+ ignoreStage:
2
+ - internal
@@ -0,0 +1,5 @@
1
+ # Active Page
2
+
3
+ This is an active page that should be included in the build.
4
+
5
+ Active variable: {{active_var}}
@@ -0,0 +1,2 @@
1
+ default:
2
+ active_var: active_value
@@ -0,0 +1,4 @@
1
+ title: Active Section
2
+ items:
3
+ - name: Active Page
4
+ href: page.md
@@ -0,0 +1,5 @@
1
+ # Empty Page
2
+
3
+ This page should be ignored because the TOC has stage "internal".
4
+
5
+ Empty variable: {{empty_var}}
@@ -0,0 +1,2 @@
1
+ default:
2
+ empty_var: empty_value
@@ -0,0 +1,5 @@
1
+ title: Empty Section
2
+ stage: internal
3
+ items:
4
+ - name: Empty Page
5
+ href: page.md
@@ -0,0 +1,5 @@
1
+ # Main Page
2
+
3
+ This is the main page content.
4
+
5
+ Root variable: {{root_var}}
@@ -0,0 +1,2 @@
1
+ default:
2
+ root_var: root_value
@@ -0,0 +1,5 @@
1
+ title: Test Documentation
2
+ href: index.md
3
+ items:
4
+ - name: Active Section
5
+ href: active/page.md
@@ -0,0 +1 @@
1
+ allowHTML: true
@@ -0,0 +1 @@
1
+ # Index page
@@ -0,0 +1,14 @@
1
+ blocks:
2
+ - type: header-block
3
+ title: '[Test](https://example.com)'
4
+ description: 'Description link'
5
+ when: var3 >= 1
6
+ - type: header-block
7
+ title: When 1
8
+ description: 'Тестовый заголовок для проверки when 1'
9
+ when: var1 != 'aboba'
10
+ - type: header-block
11
+ title: Test title
12
+ description: 'Test description'
13
+ when: var3 < 1
14
+
@@ -0,0 +1,22 @@
1
+ ::: page-constructor
2
+ blocks:
3
+ - type: header-block
4
+ title: When 2
5
+ description: 'Тестовый заголовок для проверки when 2'
6
+ when: var1 == 'aboba'
7
+ :::
8
+
9
+
10
+ # Page 2
11
+
12
+ {% cut "Заголовок ката" %}
13
+
14
+ ::: page-constructor
15
+ blocks:
16
+ - type: header-block
17
+ title: 'Cut block title'
18
+ description: 'Cut block description'
19
+ when: false
20
+ :::
21
+
22
+ {% endcut %}
@@ -0,0 +1 @@
1
+ # Page 3
@@ -0,0 +1 @@
1
+ # Page 4
@@ -0,0 +1,10 @@
1
+ blocks:
2
+ - type: header-block
3
+ title: Page 5 title
4
+ description: 'Page 5 description'
5
+ when: false
6
+ - type: header-block
7
+ title: Page 5 title
8
+ description: 'Page 5 description'
9
+ when: false
10
+
@@ -0,0 +1,4 @@
1
+ default:
2
+ var1: 'aboba'
3
+ var2: true
4
+ var3: 1
@@ -0,0 +1,44 @@
1
+ title: Conditions
2
+ href: index.md
3
+ navigation:
4
+ logo:
5
+ url: "./"
6
+ header:
7
+ leftItems:
8
+ - text: "Always visible"
9
+ type: "link"
10
+ url: "./index.md"
11
+ - text: "Visible when var2 is true"
12
+ type: "link"
13
+ url: "./page2.md"
14
+ when: var2 == true
15
+ - text: "Hidden when false"
16
+ type: "link"
17
+ url: "./page3.md"
18
+ when: false
19
+ - text: "Hidden when var3 > 1"
20
+ type: "link"
21
+ url: "./page4.md"
22
+ when: var3 > 1
23
+ rightItems:
24
+ - type: controls
25
+ - text: "Hidden control"
26
+ type: "link"
27
+ url: "./hidden.md"
28
+ when: var1 == 'not_aboba'
29
+
30
+ items:
31
+ - name: Page 1
32
+ href: page1.yaml
33
+ - name: Page 2
34
+ href: page2.md
35
+ when: var2 == true
36
+ - name: Page 3
37
+ href: page3.md
38
+ when: false
39
+ - name: Page 4
40
+ href: page4.md
41
+ when: var3 > 1
42
+ - name: Page 5
43
+ href: page5.yaml
44
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diplodoc/cli-tests",
3
- "version": "5.19.10",
3
+ "version": "5.20.1",
4
4
  "bin": {
5
5
  "diplodoc-cli-test": "bin.mjs"
6
6
  },