@diplodoc/cli-tests 5.9.3 → 5.9.5
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__/regression.test.ts.snap +4 -1
- package/e2e/__snapshots__/single-page.spec.ts.snap +216 -0
- package/e2e/single-page.spec.ts +22 -0
- package/mocks/regression/input/autotitle.md +3 -0
- package/mocks/single-page/input/ru/index.yaml +9 -0
- package/mocks/single-page/input/ru/page.md +14 -0
- package/mocks/single-page/input/ru/project/config.md +1 -0
- package/mocks/single-page/input/ru/toc.yaml +7 -0
- package/package.json +1 -1
|
@@ -157,6 +157,9 @@ Empty local title
|
|
|
157
157
|
Special local title
|
|
158
158
|
[Header](#header)
|
|
159
159
|
|
|
160
|
+
Circular title
|
|
161
|
+
[Header](./autotitle.md#header)
|
|
162
|
+
|
|
160
163
|
## Header {#header}
|
|
161
164
|
|
|
162
165
|
Content
|
|
@@ -736,7 +739,7 @@ exports[`Regression > internal 30`] = `
|
|
|
736
739
|
<body class="g-root g-root_theme_light">
|
|
737
740
|
<div id="root"></div>
|
|
738
741
|
<script type="application/json" id="diplodoc-state">
|
|
739
|
-
{"data":{"leading":false,"html":"<p>Empty title<br />/n<a href=\\"1.html\\">Title</a></p>/n<p>Empty subtitle<br />/n<a href=\\"1.html#subtitle\\">Subtitle</a></p>/n<p>Special title<br />/n<a href=\\"1.html\\">Title</a></p>/n<p>Special subtitle<br />/n<a href=\\"1.html#subtitle\\">Subtitle</a></p>/n<p>Empty local title<br />/n<a href=\\"autotitle.html#header\\">Header</a></p>/n<p>Special local title<br />/n<a href=\\"autotitle.html#header\\">Header</a></p>/n<h2 id=\\"header\\"><a href=\\"autotitle.html#header\\" class=\\"yfm-anchor\\" aria-hidden=\\"true\\"><span class=\\"visually-hidden\\" data-no-index=\\"true\\">Header</span></a>Header</h2>/n<p>Content</p>/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}]},"headings":[{"title":"Header","href":"autotitle.html#header","level":2}],"title":"Autotitles"},"router":{"pathname":"autotitle","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
|
|
742
|
+
{"data":{"leading":false,"html":"<p>Empty title<br />/n<a href=\\"1.html\\">Title</a></p>/n<p>Empty subtitle<br />/n<a href=\\"1.html#subtitle\\">Subtitle</a></p>/n<p>Special title<br />/n<a href=\\"1.html\\">Title</a></p>/n<p>Special subtitle<br />/n<a href=\\"1.html#subtitle\\">Subtitle</a></p>/n<p>Empty local title<br />/n<a href=\\"autotitle.html#header\\">Header</a></p>/n<p>Special local title<br />/n<a href=\\"autotitle.html#header\\">Header</a></p>/n<p>Circular title<br />/n<a href=\\"autotitle.html#header\\">Header</a></p>/n<h2 id=\\"header\\"><a href=\\"autotitle.html#header\\" class=\\"yfm-anchor\\" aria-hidden=\\"true\\"><span class=\\"visually-hidden\\" data-no-index=\\"true\\">Header</span></a>Header</h2>/n<p>Content</p>/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}]},"headings":[{"title":"Header","href":"autotitle.html#header","level":2}],"title":"Autotitles"},"router":{"pathname":"autotitle","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
|
|
740
743
|
</script>
|
|
741
744
|
<script type="application/javascript">
|
|
742
745
|
const data = document.querySelector('script#diplodoc-state');
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`Single page mode > simple md2html single page with lang dirs > filelist 1`] = `
|
|
4
|
+
"[
|
|
5
|
+
"_bundle/app-css-1",
|
|
6
|
+
"_bundle/app-js-2",
|
|
7
|
+
"_bundle/latex-extension.css",
|
|
8
|
+
"_bundle/latex-extension.js",
|
|
9
|
+
"_bundle/mermaid-extension.js",
|
|
10
|
+
"_bundle/page-constructor-extension.css",
|
|
11
|
+
"_bundle/page-constructor-extension.js",
|
|
12
|
+
"_bundle/search-async-0",
|
|
13
|
+
"_bundle/search-async-1",
|
|
14
|
+
"_bundle/search-css-0",
|
|
15
|
+
"_bundle/search-css-1",
|
|
16
|
+
"_bundle/search-css-2",
|
|
17
|
+
"_bundle/search-css-3",
|
|
18
|
+
"_bundle/search-css-4",
|
|
19
|
+
"_bundle/search-js-0",
|
|
20
|
+
"_bundle/search-js-1",
|
|
21
|
+
"_bundle/search-js-2",
|
|
22
|
+
"index.html",
|
|
23
|
+
"ru/index.html",
|
|
24
|
+
"ru/page.html",
|
|
25
|
+
"ru/project/config.html",
|
|
26
|
+
"ru/single-page-toc.js",
|
|
27
|
+
"ru/single-page.html",
|
|
28
|
+
"ru/single-page.json",
|
|
29
|
+
"ru/toc.js"
|
|
30
|
+
]"
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
exports[`Single page mode > simple md2html single page with lang dirs 1`] = `
|
|
34
|
+
"<!DOCTYPE html>
|
|
35
|
+
<html lang="ru" dir="ltr">
|
|
36
|
+
<head>
|
|
37
|
+
<meta charset="utf-8">
|
|
38
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
39
|
+
<base href="./" />
|
|
40
|
+
<title>Redirect to ./ru/index.html</title>
|
|
41
|
+
<meta http-equiv="refresh" content="0; url=./ru/index.html">
|
|
42
|
+
|
|
43
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
44
|
+
|
|
45
|
+
<script type="application/javascript">
|
|
46
|
+
window.location.replace("./ru/index.html");
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
</head>
|
|
50
|
+
<body class="g-root g-root_theme_light">
|
|
51
|
+
If you are not redirected automatically, follow this <a href="./ru/index.html">link</a>.
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
</body>
|
|
56
|
+
</html>"
|
|
57
|
+
`;
|
|
58
|
+
|
|
59
|
+
exports[`Single page mode > simple md2html single page with lang dirs 2`] = `
|
|
60
|
+
"<!DOCTYPE html>
|
|
61
|
+
<html lang="ru" dir="ltr">
|
|
62
|
+
<head>
|
|
63
|
+
<meta charset="utf-8">
|
|
64
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
65
|
+
<base href="../" />
|
|
66
|
+
<title>Documentation | Documentation</title>
|
|
67
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
68
|
+
<meta name="noIndex" content="true">
|
|
69
|
+
|
|
70
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
<link type="text/css" rel="stylesheet" href="_bundle/search-css-0"/>
|
|
74
|
+
<link type="text/css" rel="stylesheet" href="_bundle/app-css-1"/>
|
|
75
|
+
</head>
|
|
76
|
+
<body class="g-root g-root_theme_light">
|
|
77
|
+
<div id="root"></div>
|
|
78
|
+
<script type="application/json" id="diplodoc-state">
|
|
79
|
+
{"data":{"leading":true,"data":{"title":"Documentation","description":"","links":[{"title":"Getting started with Documentation","description":"This guide will show you the basics of working with Documentation","href":"ru/page.html"}]},"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"title":"Documentation","noIndex":true},"title":"Documentation"},"router":{"pathname":"ru/index","depth":2,"base":"../"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
|
|
80
|
+
</script>
|
|
81
|
+
<script type="application/javascript">
|
|
82
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
83
|
+
window.__DATA__ = JSON.parse((function unescape(string) {
|
|
84
|
+
return string.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
85
|
+
})(data.innerText));
|
|
86
|
+
window.STATIC_CONTENT = false;
|
|
87
|
+
</script>
|
|
88
|
+
<script type="application/javascript" defer src="ru/toc.js"></script>
|
|
89
|
+
<script type="application/javascript" defer src="_bundle/search-js-1"></script>
|
|
90
|
+
<script type="application/javascript" defer src="_bundle/search-js-2"></script>
|
|
91
|
+
<script type="application/javascript" defer src="_bundle/app-js-2"></script>
|
|
92
|
+
|
|
93
|
+
</body>
|
|
94
|
+
</html>"
|
|
95
|
+
`;
|
|
96
|
+
|
|
97
|
+
exports[`Single page mode > simple md2html single page with lang dirs 3`] = `
|
|
98
|
+
"<!DOCTYPE html>
|
|
99
|
+
<html lang="ru" dir="ltr">
|
|
100
|
+
<head>
|
|
101
|
+
<meta charset="utf-8">
|
|
102
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
103
|
+
<base href="../" />
|
|
104
|
+
<title>Page Title | Documentation</title>
|
|
105
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
106
|
+
<meta name="yfm" content="builder in page">
|
|
107
|
+
<meta name="description" content="Some test description">
|
|
108
|
+
|
|
109
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
110
|
+
<link rel="icon" type="image/x-icon" href="/favicon.ico">
|
|
111
|
+
|
|
112
|
+
<link type="text/css" rel="stylesheet" href="_bundle/search-css-0"/>
|
|
113
|
+
<link type="text/css" rel="stylesheet" href="_bundle/app-css-1"/>
|
|
114
|
+
</head>
|
|
115
|
+
<body class="g-root g-root_theme_light">
|
|
116
|
+
<div id="root"></div>
|
|
117
|
+
<script type="application/json" id="diplodoc-state">
|
|
118
|
+
{"data":{"leading":false,"html":"<p>Lorem</p>/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"},{"name":"yfm","content":"builder in page"},{"name":"description","content":"Some test description"}],"title":"Page Title","description":"Some test description","interface":{"toc":false,"favicon-src":"/favicon.ico"}},"headings":[],"title":"Page Title"},"router":{"pathname":"ru/page","depth":2,"base":"../"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":false,"search":true,"feedback":true,"favicon-src":"/favicon.ico"}}
|
|
119
|
+
</script>
|
|
120
|
+
<script type="application/javascript">
|
|
121
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
122
|
+
window.__DATA__ = JSON.parse((function unescape(string) {
|
|
123
|
+
return string.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
124
|
+
})(data.innerText));
|
|
125
|
+
window.STATIC_CONTENT = false;
|
|
126
|
+
</script>
|
|
127
|
+
<script type="application/javascript" defer src="ru/toc.js"></script>
|
|
128
|
+
<script type="application/javascript" defer src="_bundle/search-js-1"></script>
|
|
129
|
+
<script type="application/javascript" defer src="_bundle/search-js-2"></script>
|
|
130
|
+
<script type="application/javascript" defer src="_bundle/app-js-2"></script>
|
|
131
|
+
|
|
132
|
+
</body>
|
|
133
|
+
</html>"
|
|
134
|
+
`;
|
|
135
|
+
|
|
136
|
+
exports[`Single page mode > simple md2html single page with lang dirs 4`] = `
|
|
137
|
+
"<!DOCTYPE html>
|
|
138
|
+
<html lang="ru" dir="ltr">
|
|
139
|
+
<head>
|
|
140
|
+
<meta charset="utf-8">
|
|
141
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
142
|
+
<base href="../../" />
|
|
143
|
+
<title>Documentation</title>
|
|
144
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
145
|
+
|
|
146
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
<link type="text/css" rel="stylesheet" href="_bundle/search-css-0"/>
|
|
150
|
+
<link type="text/css" rel="stylesheet" href="_bundle/app-css-1"/>
|
|
151
|
+
</head>
|
|
152
|
+
<body class="g-root g-root_theme_light">
|
|
153
|
+
<div id="root"></div>
|
|
154
|
+
<script type="application/json" id="diplodoc-state">
|
|
155
|
+
{"data":{"leading":false,"html":"<p>Lorem</p>/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}]},"headings":[],"title":""},"router":{"pathname":"ru/project/config","depth":3,"base":"../../"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
|
|
156
|
+
</script>
|
|
157
|
+
<script type="application/javascript">
|
|
158
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
159
|
+
window.__DATA__ = JSON.parse((function unescape(string) {
|
|
160
|
+
return string.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
161
|
+
})(data.innerText));
|
|
162
|
+
window.STATIC_CONTENT = false;
|
|
163
|
+
</script>
|
|
164
|
+
<script type="application/javascript" defer src="ru/toc.js"></script>
|
|
165
|
+
<script type="application/javascript" defer src="_bundle/search-js-1"></script>
|
|
166
|
+
<script type="application/javascript" defer src="_bundle/search-js-2"></script>
|
|
167
|
+
<script type="application/javascript" defer src="_bundle/app-js-2"></script>
|
|
168
|
+
|
|
169
|
+
</body>
|
|
170
|
+
</html>"
|
|
171
|
+
`;
|
|
172
|
+
|
|
173
|
+
exports[`Single page mode > simple md2html single page with lang dirs 5`] = `"window.__DATA__.data.toc = {"title":"Documentation","href":"ru/single-page.html#ru_index","items":[{"name":"Documentation","href":"ru/single-page.html#ru_page","id":"UUID"},{"name":"Config","href":"ru/single-page.html#ru_project_config","id":"UUID"}],"path":"ru/toc.yaml","id":"UUID"};"`;
|
|
174
|
+
|
|
175
|
+
exports[`Single page mode > simple md2html single page with lang dirs 6`] = `
|
|
176
|
+
"<!DOCTYPE html>
|
|
177
|
+
<html lang="ru" dir="ltr">
|
|
178
|
+
<head>
|
|
179
|
+
<meta charset="utf-8">
|
|
180
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
181
|
+
<base href="../" />
|
|
182
|
+
<title>Page Title | Documentation</title>
|
|
183
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
184
|
+
<meta name="yfm" content="builder in page">
|
|
185
|
+
<meta name="description" content="Some test description">
|
|
186
|
+
|
|
187
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
188
|
+
<link rel="icon" type="image/x-icon" href="/favicon.ico">
|
|
189
|
+
|
|
190
|
+
<link type="text/css" rel="stylesheet" href="_bundle/search-css-0"/>
|
|
191
|
+
<link type="text/css" rel="stylesheet" href="_bundle/app-css-1"/>
|
|
192
|
+
</head>
|
|
193
|
+
<body class="g-root g-root_theme_light">
|
|
194
|
+
<div id="root"></div>
|
|
195
|
+
<script type="application/json" id="diplodoc-state">
|
|
196
|
+
{"data":{"leading":false,"html":"<h2 data-original-article=\\"ru/page.html\\">Page Title<a class=\\"yfm-anchor\\" aria-hidden=\\"true\\" href=\\"ru/single-page.html#ru_page\\" id=\\"ru_page\\"></a></h2><p>Lorem</p>/n<hr class=\\"yfm-page__delimeter\\"><p>Lorem</p>/n","headings":[],"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"},{"name":"yfm","content":"builder in page"},{"name":"description","content":"Some test description"}],"title":"Page Title","description":"Some test description","interface":{"toc":false,"favicon-src":"/favicon.ico"}},"title":"Documentation"},"router":{"pathname":"ru/single-page","depth":2,"base":"../"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":false,"search":true,"feedback":true,"favicon-src":"/favicon.ico"}}
|
|
197
|
+
</script>
|
|
198
|
+
<script type="application/javascript">
|
|
199
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
200
|
+
window.__DATA__ = JSON.parse((function unescape(string) {
|
|
201
|
+
return string.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
202
|
+
})(data.innerText));
|
|
203
|
+
window.STATIC_CONTENT = false;
|
|
204
|
+
</script>
|
|
205
|
+
<script type="application/javascript" defer src="ru/single-page-toc.js"></script>
|
|
206
|
+
<script type="application/javascript" defer src="_bundle/search-js-1"></script>
|
|
207
|
+
<script type="application/javascript" defer src="_bundle/search-js-2"></script>
|
|
208
|
+
<script type="application/javascript" defer src="_bundle/app-js-2"></script>
|
|
209
|
+
|
|
210
|
+
</body>
|
|
211
|
+
</html>"
|
|
212
|
+
`;
|
|
213
|
+
|
|
214
|
+
exports[`Single page mode > simple md2html single page with lang dirs 7`] = `"{"data":{"leading":false,"html":"<h2 data-original-article=\\"ru/page.html\\">Page Title<a class=\\"yfm-anchor\\" aria-hidden=\\"true\\" href=\\"ru/single-page.html#ru_page\\" id=\\"ru_page\\"></a></h2><p>Lorem</p>/n<hr class=\\"yfm-page__delimeter\\"><p>Lorem</p>/n","headings":[],"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"},{"name":"yfm","content":"builder in page"},{"name":"description","content":"Some test description"}],"title":"Page Title","description":"Some test description","interface":{"toc":false,"favicon-src":"/favicon.ico"}},"title":"Documentation","toc":{"title":"Documentation","href":"ru/index.html","items":[{"name":"Documentation","href":"ru/page.html","id":"UUID"},{"name":"Config","href":"ru/project/config.html","id":"UUID"}],"path":"ru/toc.yaml","id":"UUID"}},"router":{"pathname":"ru/single-page","depth":2,"base":"../"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":false,"search":true,"feedback":true,"favicon-src":"/favicon.ico"}}"`;
|
|
215
|
+
|
|
216
|
+
exports[`Single page mode > simple md2html single page with lang dirs 8`] = `"window.__DATA__.data.toc = {"title":"Documentation","href":"ru/index.html","items":[{"name":"Documentation","href":"ru/page.html","id":"UUID"},{"name":"Config","href":"ru/project/config.html","id":"UUID"}],"path":"ru/toc.yaml","id":"UUID"};"`;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {describe, test} from 'vitest';
|
|
2
|
+
import {TestAdapter, compareDirectories, getTestPaths} from '../fixtures';
|
|
3
|
+
|
|
4
|
+
const generateMapTestSinglePageTemplate = (
|
|
5
|
+
testTitle: string,
|
|
6
|
+
testRootPath: string,
|
|
7
|
+
{md2md = true, md2html = true, args = '--single-page'},
|
|
8
|
+
) => {
|
|
9
|
+
test(testTitle, async () => {
|
|
10
|
+
const {inputPath, outputPath} = getTestPaths(testRootPath);
|
|
11
|
+
await TestAdapter.testBuildPass(inputPath, outputPath, {md2md, md2html, args});
|
|
12
|
+
await compareDirectories(outputPath);
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
describe('Single page mode', () => {
|
|
17
|
+
generateMapTestSinglePageTemplate(
|
|
18
|
+
'simple md2html single page with lang dirs',
|
|
19
|
+
'mocks/single-page',
|
|
20
|
+
{md2md: false},
|
|
21
|
+
);
|
|
22
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Lorem
|