@diplodoc/cli-tests 5.19.2 → 5.19.4

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.
@@ -1,5 +1,35 @@
1
1
  // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
+ exports[`Pdf generation with md2md phase, only files structure > Generates md2md content, then uses it for md2html render with pdf when .yfm options is specified > filelist 1`] = `
4
+ "[
5
+ ".yfm",
6
+ "__assets/start-page.css",
7
+ "__images/mountain.jpg",
8
+ "__includes/include1-hash.md",
9
+ "index.md",
10
+ "page1.md",
11
+ "page2.md",
12
+ "pdf-titles/pdf-title-page1.md",
13
+ "pdf-titles/pdf-title-page2.md",
14
+ "toc.yaml"
15
+ ]"
16
+ `;
17
+
18
+ exports[`Pdf generation with md2md phase, only files structure > Generates md2md content, then uses it for md2html render with pdf when .yfm options is specified > filelist 2`] = `
19
+ "[
20
+ ".yfm",
21
+ "__assets/start-page.css",
22
+ "__images/mountain.jpg",
23
+ "index.html",
24
+ "page1.html",
25
+ "page2.html",
26
+ "pdf/pdf-page-toc.js",
27
+ "pdf/pdf-page.html",
28
+ "pdf/pdf-page.json",
29
+ "toc.js"
30
+ ]"
31
+ `;
32
+
3
33
  exports[`Pdf page mode > creates a pdf folder when the .yfm option is specified > filelist 1`] = `
4
34
  "[
5
35
  "pdf-page-toc.js",
@@ -105,7 +135,7 @@ exports[`Pdf page with titles > Generates content for pdf genrator with title pa
105
135
  <body class="g-root g-root_theme_light">
106
136
  <div id="root"></div>
107
137
  <script type="application/json" id="diplodoc-state">
108
- {"data":{"leading":false,"pdfTitlePages":{"content":"&lt;div class=\\"pdf-page-wrapper\\" data-page-break=\\"true\\"&gt;&lt;h2 id=\\"pdf-titles_pdf-title-page1_pdf-title-page-1\\" data-original-article=\\"./pdf-titles/pdf-title-page1.html\\"&gt;&lt;a href=\\"#pdf-titles_pdf-title-page1_pdf-title-page-1\\" class=\\"yfm-anchor\\" aria-hidden=\\"true\\"&gt;&lt;span class=\\"visually-hidden\\" data-no-index=\\"true\\"&gt;Pdf title page 1&lt;/span&gt;&lt;/a&gt;Pdf title page 1&lt;a class=\\"yfm-anchor\\" aria-hidden=\\"true\\" href=\\"#pdf-titles_pdf-title-page1\\" id=\\"pdf-titles_pdf-title-page1\\"&gt;&lt;/a&gt;&lt;/h2&gt;/n&lt;p&gt;Should be able to use variables pdf&lt;/p&gt;/n&lt;p&gt;Should be able to use link to other pages &lt;a href=\\"#page1\\"&gt;test&lt;/a&gt;&lt;/p&gt;/n&lt;p&gt;Should be able to use inlcudes&lt;/p&gt;/n&lt;h4 id=\\"pdf-titles_pdf-title-page1_include-pdf-title\\"&gt;&lt;a href=\\"#pdf-titles_pdf-title-page1_include-pdf-title\\" class=\\"yfm-anchor\\" aria-hidden=\\"true\\"&gt;&lt;span class=\\"visually-hidden\\" data-no-index=\\"true\\"&gt;Include Pdf title&lt;/span&gt;&lt;/a&gt;Include Pdf title&lt;/h4&gt;/n&lt;p&gt;Should be able to resolve liquid syntax&lt;/p&gt;/n&lt;p&gt;should be visible&lt;/p&gt;/n&lt;/div&gt;&lt;div class=\\"pdf-page-wrapper\\" data-page-break=\\"true\\"&gt;&lt;h2 id=\\"pdf-titles_pdf-title-page2_pdf-title-page-2\\" data-original-article=\\"./pdf-titles/pdf-title-page2.html\\"&gt;&lt;a href=\\"#pdf-titles_pdf-title-page2_pdf-title-page-2\\" class=\\"yfm-anchor\\" aria-hidden=\\"true\\"&gt;&lt;span class=\\"visually-hidden\\" data-no-index=\\"true\\"&gt;Pdf title page 2&lt;/span&gt;&lt;/a&gt;Pdf title page 2&lt;a class=\\"yfm-anchor\\" aria-hidden=\\"true\\" href=\\"#pdf-titles_pdf-title-page2\\" id=\\"pdf-titles_pdf-title-page2\\"&gt;&lt;/a&gt;&lt;/h2&gt;/n&lt;p&gt;&lt;img src=\\"../__images/mountain.jpg\\" alt&gt;&lt;/p&gt;/n&lt;div class=\\"pdf-title-page-wrapper\\"&gt;/n &lt;p&gt;Lorem ipsum title page with var pdf&lt;/p&gt;/n&lt;/div&gt;&lt;/div&gt;","pageCount":2},"cssLink":["_bundle/search-css-0","_bundle/app-css-1","_bundle/search-css-2","_bundle/search-css-3","_bundle/search-css-4"],"html":"&lt;div class=\\"pdf-page-wrapper\\" data-page-break=\\"true\\"&gt;&lt;h2 data-original-article=\\"page1.html\\"&gt;Page 1&lt;a class=\\"yfm-anchor\\" aria-hidden=\\"true\\" href=\\"#page1\\" id=\\"page1\\"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Page 1 content&lt;/p&gt;/n&lt;/div&gt;&lt;div class=\\"pdf-page-wrapper\\" data-page-break=\\"true\\"&gt;&lt;h2 data-original-article=\\"page2.html\\"&gt;Page 2&lt;a class=\\"yfm-anchor\\" aria-hidden=\\"true\\" href=\\"#page2\\" id=\\"page2\\"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Page 2 content&lt;/p&gt;/n&lt;/div&gt;","headings":[],"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"style":["__assets/start-page.css"]},"title":"Pdf title pages"},"router":{"pathname":"pdf-page","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
138
+ {"data":{"leading":false,"pdfTitlePages":{"content":"&lt;div class=\\"pdf-page-wrapper\\" data-page-break=\\"true\\"&gt;&lt;h2 id=\\"pdf-titles_pdf-title-page1_pdf-title-page-1\\" data-original-article=\\"./pdf-titles/pdf-title-page1.html\\"&gt;&lt;a href=\\"#pdf-titles_pdf-title-page1_pdf-title-page-1\\" class=\\"yfm-anchor\\" aria-hidden=\\"true\\"&gt;&lt;span class=\\"visually-hidden\\" data-no-index=\\"true\\"&gt;Pdf title page 1&lt;/span&gt;&lt;/a&gt;Pdf title page 1&lt;a class=\\"yfm-anchor\\" aria-hidden=\\"true\\" href=\\"#pdf-titles_pdf-title-page1\\" id=\\"pdf-titles_pdf-title-page1\\"&gt;&lt;/a&gt;&lt;/h2&gt;/n&lt;p&gt;Should be able to use variables pdf&lt;/p&gt;/n&lt;p&gt;Should be able to use link to other pages &lt;a href=\\"#page1\\"&gt;test&lt;/a&gt;&lt;/p&gt;/n&lt;p&gt;Should be able to use inlcudes&lt;/p&gt;/n&lt;h4 id=\\"pdf-titles_pdf-title-page1_include-pdf-title\\"&gt;&lt;a href=\\"#pdf-titles_pdf-title-page1_include-pdf-title\\" class=\\"yfm-anchor\\" aria-hidden=\\"true\\"&gt;&lt;span class=\\"visually-hidden\\" data-no-index=\\"true\\"&gt;Include Pdf title&lt;/span&gt;&lt;/a&gt;Include Pdf title&lt;/h4&gt;/n&lt;p&gt;Should be able to resolve liquid syntax&lt;/p&gt;/n&lt;p&gt;should be visible&lt;/p&gt;/n&lt;/div&gt;&lt;div class=\\"pdf-page-wrapper\\" data-page-break=\\"true\\"&gt;&lt;div class=\\"pdf-title-page-wrapper\\"&gt;/n &lt;p&gt;Lorem ipsum title page with var pdf&lt;/p&gt;/n&lt;/div&gt;&lt;/div&gt;","pageCount":2},"cssLink":["_bundle/search-css-0","_bundle/app-css-1","_bundle/search-css-2","_bundle/search-css-3","_bundle/search-css-4"],"html":"&lt;div class=\\"pdf-page-wrapper\\" data-page-break=\\"true\\"&gt;&lt;h2 data-original-article=\\"page1.html\\"&gt;Page 1&lt;a class=\\"yfm-anchor\\" aria-hidden=\\"true\\" href=\\"#page1\\" id=\\"page1\\"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Page 1 content&lt;/p&gt;/n&lt;/div&gt;&lt;div class=\\"pdf-page-wrapper\\" data-page-break=\\"true\\"&gt;&lt;h2 data-original-article=\\"page2.html\\"&gt;Page 2&lt;a class=\\"yfm-anchor\\" aria-hidden=\\"true\\" href=\\"#page2\\" id=\\"page2\\"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Page 2 content&lt;/p&gt;/n&lt;/div&gt;","headings":[],"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"style":["__assets/start-page.css"]},"title":"Pdf title pages"},"router":{"pathname":"pdf-page","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
109
139
  </script>
110
140
  <script type="application/javascript">
111
141
  const data = document.querySelector('script#diplodoc-state');
@@ -119,7 +149,7 @@ exports[`Pdf page with titles > Generates content for pdf genrator with title pa
119
149
  </html>"
120
150
  `;
121
151
 
122
- exports[`Pdf page with titles > Generates content for pdf genrator with title pages 3`] = `"{"data":{"leading":false,"pdfTitlePages":{"content":"<div class=\\"pdf-page-wrapper\\" data-page-break=\\"true\\"><h2 id=\\"pdf-titles_pdf-title-page1_pdf-title-page-1\\" data-original-article=\\"./pdf-titles/pdf-title-page1.html\\"><a href=\\"#pdf-titles_pdf-title-page1_pdf-title-page-1\\" class=\\"yfm-anchor\\" aria-hidden=\\"true\\"><span class=\\"visually-hidden\\" data-no-index=\\"true\\">Pdf title page 1</span></a>Pdf title page 1<a class=\\"yfm-anchor\\" aria-hidden=\\"true\\" href=\\"#pdf-titles_pdf-title-page1\\" id=\\"pdf-titles_pdf-title-page1\\"></a></h2>/n<p>Should be able to use variables pdf</p>/n<p>Should be able to use link to other pages <a href=\\"#page1\\">test</a></p>/n<p>Should be able to use inlcudes</p>/n<h4 id=\\"pdf-titles_pdf-title-page1_include-pdf-title\\"><a href=\\"#pdf-titles_pdf-title-page1_include-pdf-title\\" class=\\"yfm-anchor\\" aria-hidden=\\"true\\"><span class=\\"visually-hidden\\" data-no-index=\\"true\\">Include Pdf title</span></a>Include Pdf title</h4>/n<p>Should be able to resolve liquid syntax</p>/n<p>should be visible</p>/n</div><div class=\\"pdf-page-wrapper\\" data-page-break=\\"true\\"><h2 id=\\"pdf-titles_pdf-title-page2_pdf-title-page-2\\" data-original-article=\\"./pdf-titles/pdf-title-page2.html\\"><a href=\\"#pdf-titles_pdf-title-page2_pdf-title-page-2\\" class=\\"yfm-anchor\\" aria-hidden=\\"true\\"><span class=\\"visually-hidden\\" data-no-index=\\"true\\">Pdf title page 2</span></a>Pdf title page 2<a class=\\"yfm-anchor\\" aria-hidden=\\"true\\" href=\\"#pdf-titles_pdf-title-page2\\" id=\\"pdf-titles_pdf-title-page2\\"></a></h2>/n<p><img src=\\"../__images/mountain.jpg\\" alt></p>/n<div class=\\"pdf-title-page-wrapper\\">/n <p>Lorem ipsum title page with var pdf</p>/n</div></div>","pageCount":2},"cssLink":["_bundle/search-css-0","_bundle/app-css-1","_bundle/search-css-2","_bundle/search-css-3","_bundle/search-css-4"],"html":"<div class=\\"pdf-page-wrapper\\" data-page-break=\\"true\\"><h2 data-original-article=\\"page1.html\\">Page 1<a class=\\"yfm-anchor\\" aria-hidden=\\"true\\" href=\\"#page1\\" id=\\"page1\\"></a></h2><p>Page 1 content</p>/n</div><div class=\\"pdf-page-wrapper\\" data-page-break=\\"true\\"><h2 data-original-article=\\"page2.html\\">Page 2<a class=\\"yfm-anchor\\" aria-hidden=\\"true\\" href=\\"#page2\\" id=\\"page2\\"></a></h2><p>Page 2 content</p>/n</div>","headings":[],"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"style":["__assets/start-page.css"]},"title":"Pdf title pages","toc":{"title":"Pdf title pages","href":"index.html","pdf":{"startPages":["./pdf-titles/pdf-title-page1.md","./pdf-titles/pdf-title-page2.md"]},"items":[{"name":"Title 1","href":"page1.html","id":"UUID"},{"name":"Title 2","href":"page2.html","id":"UUID"}],"path":"toc.yaml","id":"UUID"}},"router":{"pathname":"pdf-page","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}"`;
152
+ exports[`Pdf page with titles > Generates content for pdf genrator with title pages 3`] = `"{"data":{"leading":false,"pdfTitlePages":{"content":"<div class=\\"pdf-page-wrapper\\" data-page-break=\\"true\\"><h2 id=\\"pdf-titles_pdf-title-page1_pdf-title-page-1\\" data-original-article=\\"./pdf-titles/pdf-title-page1.html\\"><a href=\\"#pdf-titles_pdf-title-page1_pdf-title-page-1\\" class=\\"yfm-anchor\\" aria-hidden=\\"true\\"><span class=\\"visually-hidden\\" data-no-index=\\"true\\">Pdf title page 1</span></a>Pdf title page 1<a class=\\"yfm-anchor\\" aria-hidden=\\"true\\" href=\\"#pdf-titles_pdf-title-page1\\" id=\\"pdf-titles_pdf-title-page1\\"></a></h2>/n<p>Should be able to use variables pdf</p>/n<p>Should be able to use link to other pages <a href=\\"#page1\\">test</a></p>/n<p>Should be able to use inlcudes</p>/n<h4 id=\\"pdf-titles_pdf-title-page1_include-pdf-title\\"><a href=\\"#pdf-titles_pdf-title-page1_include-pdf-title\\" class=\\"yfm-anchor\\" aria-hidden=\\"true\\"><span class=\\"visually-hidden\\" data-no-index=\\"true\\">Include Pdf title</span></a>Include Pdf title</h4>/n<p>Should be able to resolve liquid syntax</p>/n<p>should be visible</p>/n</div><div class=\\"pdf-page-wrapper\\" data-page-break=\\"true\\"><div class=\\"pdf-title-page-wrapper\\">/n <p>Lorem ipsum title page with var pdf</p>/n</div></div>","pageCount":2},"cssLink":["_bundle/search-css-0","_bundle/app-css-1","_bundle/search-css-2","_bundle/search-css-3","_bundle/search-css-4"],"html":"<div class=\\"pdf-page-wrapper\\" data-page-break=\\"true\\"><h2 data-original-article=\\"page1.html\\">Page 1<a class=\\"yfm-anchor\\" aria-hidden=\\"true\\" href=\\"#page1\\" id=\\"page1\\"></a></h2><p>Page 1 content</p>/n</div><div class=\\"pdf-page-wrapper\\" data-page-break=\\"true\\"><h2 data-original-article=\\"page2.html\\">Page 2<a class=\\"yfm-anchor\\" aria-hidden=\\"true\\" href=\\"#page2\\" id=\\"page2\\"></a></h2><p>Page 2 content</p>/n</div>","headings":[],"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"style":["__assets/start-page.css"]},"title":"Pdf title pages","toc":{"title":"Pdf title pages","href":"index.html","pdf":{"startPages":["./pdf-titles/pdf-title-page1.md","./pdf-titles/pdf-title-page2.md"]},"items":[{"name":"Title 1","href":"page1.html","id":"UUID"},{"name":"Title 2","href":"page2.html","id":"UUID"}],"path":"toc.yaml","id":"UUID"}},"router":{"pathname":"pdf-page","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}"`;
123
153
 
124
154
  exports[`Pdf page with titles > Generates pdf title pages as regular entries for debug purpose > filelist 1`] = `
125
155
  "[
@@ -131,6 +161,9 @@ exports[`Pdf page with titles > Generates pdf title pages as regular entries for
131
161
  "page2.html",
132
162
  "pdf-titles/pdf-title-page1.html",
133
163
  "pdf-titles/pdf-title-page2.html",
164
+ "pdf/pdf-page-toc.js",
165
+ "pdf/pdf-page.html",
166
+ "pdf/pdf-page.json",
134
167
  "toc.js"
135
168
  ]"
136
169
  `;
@@ -23,6 +23,37 @@ const generateMapTestTemplate = (
23
23
  });
24
24
  };
25
25
 
26
+ const generateMd2mdTestTemplate = async (testTitle: string, testRootPath: string) => {
27
+ test(testTitle, async () => {
28
+ const {inputPath, outputPath} = getTestPaths(testRootPath);
29
+
30
+ await TestAdapter.testBuildPass(inputPath, outputPath, {
31
+ md2md: true,
32
+ md2html: false,
33
+ args: '--allow-custom-resources', // this is common arg in arc ci for md2md
34
+ });
35
+
36
+ await compareDirectories(outputPath, true);
37
+
38
+ const midOutputFolder = 'final-output';
39
+ const finalOutputPath = outputPath
40
+ .split('/')
41
+ .slice(0, -1)
42
+ .concat(midOutputFolder)
43
+ .join('/');
44
+
45
+ await TestAdapter.testBuildPass(outputPath, finalOutputPath, {
46
+ md2md: false,
47
+ md2html: true,
48
+ });
49
+
50
+ await compareDirectories(finalOutputPath, true);
51
+
52
+ await cleanupDirectory(outputPath);
53
+ await cleanupDirectory(finalOutputPath);
54
+ });
55
+ };
56
+
26
57
  describe('Pdf page mode', () => {
27
58
  generateMapTestTemplate(
28
59
  'creates a pdf folder when the --pdf flag is specified',
@@ -52,3 +83,10 @@ describe('Pdf page with titles', () => {
52
83
  true,
53
84
  );
54
85
  });
86
+
87
+ describe('Pdf generation with md2md phase, only files structure', () => {
88
+ generateMd2mdTestTemplate(
89
+ 'Generates md2md content, then uses it for md2html render with pdf when .yfm options is specified',
90
+ 'mocks/pdf-page/title-pages',
91
+ );
92
+ });
@@ -1,3 +1,6 @@
1
+ pdf:
2
+ enabled: true
3
+
1
4
  resources:
2
5
  style:
3
6
  - __assets/start-page.css
@@ -5,10 +5,12 @@
5
5
  align-items: center;
6
6
  background-color: grey;
7
7
  padding: 20px;
8
- height: calc(100vh - 200px);
8
+ height: 100vh;
9
+ background-image: url(../__images/mountain.jpg);
10
+ background-size: cover;
9
11
  }
10
12
 
11
13
  img {
12
14
  width: 100px;
13
15
  height: 100px;
14
- }
16
+ }
@@ -1 +1 @@
1
- # PDF mock index
1
+ # PDF mock index
@@ -1,6 +1,3 @@
1
- ### Pdf title page 2
2
-
3
- ![](../__images/mountain.jpg)
4
1
  <div class="pdf-title-page-wrapper">
5
2
  <p>Lorem ipsum title page with var {{test}}</p>
6
3
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diplodoc/cli-tests",
3
- "version": "5.19.2",
3
+ "version": "5.19.4",
4
4
  "bin": {
5
5
  "diplodoc-cli-test": "bin.mjs"
6
6
  },