@diplodoc/cli-tests 5.25.1 → 5.25.2
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.
- package/e2e/__snapshots__/assets.spec.ts.snap +0 -0
- package/e2e/__snapshots__/bundles.spec.ts.snap +1 -1
- package/e2e/__snapshots__/neuro-expert.test.ts.snap +1 -1
- package/e2e/__snapshots__/search.test.ts.snap +1 -1
- package/e2e/__snapshots__/skip-html-extension.spec.ts.snap +2 -2
- package/e2e/__snapshots__/toc-label.test.ts.snap +127 -0
- package/e2e/__snapshots__/vars-conditions.spec.ts.snap +1 -1
- package/e2e/toc-label.test.ts +23 -0
- package/fixtures/cliAdapter.ts +1 -1
- package/mocks/assets/input/.yfm +1 -1
- package/mocks/bundles/input/.yfm +1 -1
- package/mocks/neuro-expert/input/.yfm +1 -1
- package/mocks/pdf-page/yfm-config/input/.yfm +1 -1
- package/mocks/search/input/.yfm +1 -1
- package/mocks/skip-html-extension/monolingual/input/.yfm +1 -1
- package/mocks/skip-html-extension/multilingual/input/.yfm +1 -1
- package/mocks/toc-label/input/.yfm +1 -0
- package/mocks/toc-label/input/index.md +3 -0
- package/mocks/toc-label/input/page1.md +3 -0
- package/mocks/toc-label/input/toc.yaml +10 -0
- package/mocks/vars-conditions/input/.yfm +1 -1
- package/package.json +1 -1
|
Binary file
|
|
@@ -13,7 +13,7 @@ exports[`Skip html extension > correctly trims .html and index.html on monolingu
|
|
|
13
13
|
`;
|
|
14
14
|
|
|
15
15
|
exports[`Skip html extension > correctly trims .html and index.html on monolingual docs 1`] = `
|
|
16
|
-
"
|
|
16
|
+
"allowHtml: true
|
|
17
17
|
"
|
|
18
18
|
`;
|
|
19
19
|
|
|
@@ -179,7 +179,7 @@ exports[`Skip html extension > correctly trims .html and index.html on multiling
|
|
|
179
179
|
`;
|
|
180
180
|
|
|
181
181
|
exports[`Skip html extension > correctly trims .html and index.html on multilingual docs 1`] = `
|
|
182
|
-
"
|
|
182
|
+
"allowHtml: true
|
|
183
183
|
langs: ['en','ru']
|
|
184
184
|
"
|
|
185
185
|
`;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`Toc label > should pass TocLabel object through to toc output > filelist 1`] = `
|
|
4
|
+
"[
|
|
5
|
+
".yfm",
|
|
6
|
+
"index.md",
|
|
7
|
+
"page1.md",
|
|
8
|
+
"toc.yaml"
|
|
9
|
+
]"
|
|
10
|
+
`;
|
|
11
|
+
|
|
12
|
+
exports[`Toc label > should pass TocLabel object through to toc output > filelist 2`] = `
|
|
13
|
+
"[
|
|
14
|
+
".yfm",
|
|
15
|
+
"index.html",
|
|
16
|
+
"page1.html",
|
|
17
|
+
"toc.js"
|
|
18
|
+
]"
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
exports[`Toc label > should pass TocLabel object through to toc output 1`] = `
|
|
22
|
+
"allowHtml: true
|
|
23
|
+
"
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
exports[`Toc label > should pass TocLabel object through to toc output 2`] = `
|
|
27
|
+
"---
|
|
28
|
+
metadata:
|
|
29
|
+
- name: generator
|
|
30
|
+
content: Diplodoc Platform vDIPLODOC-VERSION
|
|
31
|
+
vcsPath: index.md
|
|
32
|
+
---
|
|
33
|
+
# Toc Label Test
|
|
34
|
+
|
|
35
|
+
Content
|
|
36
|
+
"
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
exports[`Toc label > should pass TocLabel object through to toc output 3`] = `
|
|
40
|
+
"---
|
|
41
|
+
metadata:
|
|
42
|
+
- name: generator
|
|
43
|
+
content: Diplodoc Platform vDIPLODOC-VERSION
|
|
44
|
+
vcsPath: page1.md
|
|
45
|
+
---
|
|
46
|
+
# Page 1
|
|
47
|
+
|
|
48
|
+
Content
|
|
49
|
+
"
|
|
50
|
+
`;
|
|
51
|
+
|
|
52
|
+
exports[`Toc label > should pass TocLabel object through to toc output 4`] = `
|
|
53
|
+
"title: Toc Label Test
|
|
54
|
+
href: index.md
|
|
55
|
+
label:
|
|
56
|
+
title: Preview
|
|
57
|
+
description: This service is in preview
|
|
58
|
+
theme: info
|
|
59
|
+
items:
|
|
60
|
+
- name: Page 1
|
|
61
|
+
href: page1.md
|
|
62
|
+
path: toc.yaml
|
|
63
|
+
"
|
|
64
|
+
`;
|
|
65
|
+
|
|
66
|
+
exports[`Toc label > should pass TocLabel object through to toc output 5`] = `
|
|
67
|
+
"allowHtml: true
|
|
68
|
+
"
|
|
69
|
+
`;
|
|
70
|
+
|
|
71
|
+
exports[`Toc label > should pass TocLabel object through to toc output 6`] = `
|
|
72
|
+
"<!DOCTYPE html>
|
|
73
|
+
<html lang="ru" dir="ltr">
|
|
74
|
+
<head>
|
|
75
|
+
<meta charset="utf-8">
|
|
76
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
77
|
+
<base href="./" />
|
|
78
|
+
<title>Toc Label Test | Toc Label Test</title>
|
|
79
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
80
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
81
|
+
</head>
|
|
82
|
+
<body class="g-root g-root_theme_light">
|
|
83
|
+
<div id="root"></div>
|
|
84
|
+
<script type="application/json" id="diplodoc-state">
|
|
85
|
+
{"data":{"leading":false,"html":"<p>Content</p>/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"index.md"},"headings":[],"title":"Toc Label Test"},"router":{"pathname":"index","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
|
|
86
|
+
</script>
|
|
87
|
+
<script type="application/javascript">
|
|
88
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
89
|
+
window.__DATA__ = JSON.parse((function unescape(string) {
|
|
90
|
+
return string.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
91
|
+
})(data.innerText));
|
|
92
|
+
window.STATIC_CONTENT = false;
|
|
93
|
+
</script>
|
|
94
|
+
<script type="application/javascript" defer src="toc.js"></script>
|
|
95
|
+
</body>
|
|
96
|
+
</html>"
|
|
97
|
+
`;
|
|
98
|
+
|
|
99
|
+
exports[`Toc label > should pass TocLabel object through to toc output 7`] = `
|
|
100
|
+
"<!DOCTYPE html>
|
|
101
|
+
<html lang="ru" dir="ltr">
|
|
102
|
+
<head>
|
|
103
|
+
<meta charset="utf-8">
|
|
104
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
105
|
+
<base href="./" />
|
|
106
|
+
<title>Page 1 | Toc Label Test</title>
|
|
107
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
108
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
109
|
+
</head>
|
|
110
|
+
<body class="g-root g-root_theme_light">
|
|
111
|
+
<div id="root"></div>
|
|
112
|
+
<script type="application/json" id="diplodoc-state">
|
|
113
|
+
{"data":{"leading":false,"html":"<p>Content</p>/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"page1.md"},"headings":[],"title":"Page 1"},"router":{"pathname":"page1","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
|
|
114
|
+
</script>
|
|
115
|
+
<script type="application/javascript">
|
|
116
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
117
|
+
window.__DATA__ = JSON.parse((function unescape(string) {
|
|
118
|
+
return string.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
119
|
+
})(data.innerText));
|
|
120
|
+
window.STATIC_CONTENT = false;
|
|
121
|
+
</script>
|
|
122
|
+
<script type="application/javascript" defer src="toc.js"></script>
|
|
123
|
+
</body>
|
|
124
|
+
</html>"
|
|
125
|
+
`;
|
|
126
|
+
|
|
127
|
+
exports[`Toc label > should pass TocLabel object through to toc output 8`] = `"window.__DATA__.data.toc = {"title":"Toc Label Test","href":"index.html","label":{"title":"Preview","description":"This service is in preview","theme":"info"},"items":[{"name":"Page 1","href":"page1.html","id":"UUID"}],"path":"toc.yaml","id":"UUID"};"`;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {describe, it} from 'vitest';
|
|
2
|
+
|
|
3
|
+
import {TestAdapter, compareDirectories, getTestPaths} from '../fixtures';
|
|
4
|
+
|
|
5
|
+
describe('Toc label', () => {
|
|
6
|
+
it('should pass TocLabel object through to toc output', async () => {
|
|
7
|
+
const {inputPath, outputPath} = getTestPaths('mocks/toc-label');
|
|
8
|
+
|
|
9
|
+
await TestAdapter.testBuildPass(inputPath, outputPath, {
|
|
10
|
+
md2md: true,
|
|
11
|
+
md2html: false,
|
|
12
|
+
args: '-j2',
|
|
13
|
+
});
|
|
14
|
+
await TestAdapter.testBuildPass(outputPath, outputPath + '-html', {
|
|
15
|
+
md2md: false,
|
|
16
|
+
md2html: true,
|
|
17
|
+
args: '-j2',
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
await compareDirectories(outputPath);
|
|
21
|
+
await compareDirectories(outputPath + '-html');
|
|
22
|
+
});
|
|
23
|
+
});
|
package/fixtures/cliAdapter.ts
CHANGED
|
@@ -26,7 +26,7 @@ class Build {
|
|
|
26
26
|
|
|
27
27
|
run(input: string, output: string, args: string[], env?: Record<string, string>) {
|
|
28
28
|
return this.runner.runYfmDocs(
|
|
29
|
-
['--input', input, '--output', output, '--quiet', '--
|
|
29
|
+
['--input', input, '--output', output, '--quiet', '--allowHtml', ...args],
|
|
30
30
|
env,
|
|
31
31
|
);
|
|
32
32
|
}
|
package/mocks/assets/input/.yfm
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
allowHtml: true
|
package/mocks/bundles/input/.yfm
CHANGED
package/mocks/search/input/.yfm
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
allowHtml: true
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
allowHtml: true
|
|
2
2
|
langs: ['en','ru']
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
allowHtml: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
allowHtml: true
|