@diplodoc/cli-tests 5.0.10 → 5.0.12

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,70 @@
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
+
3
+ exports[`Local search > internal > filelist 1`] = `
4
+ "[
5
+ "_bundle/search-async-1",
6
+ "_bundle/search-async-0",
7
+ "_bundle/app-css-1",
8
+ "_bundle/app-js-1",
9
+ "_bundle/app-css-3",
10
+ "_bundle/latex-extension.css",
11
+ "_bundle/latex-extension.js",
12
+ "_bundle/mermaid-extension.js",
13
+ "_bundle/page-constructor-extension.css",
14
+ "_bundle/page-constructor-extension.js",
15
+ "_bundle/search-js-0",
16
+ "_bundle/search-css-0",
17
+ "_bundle/search-js-1",
18
+ "_bundle/search-css-3",
19
+ "_bundle/search-css-1",
20
+ "_bundle/search-js-2",
21
+ "_bundle/search-css-2",
22
+ "_search/api.js",
23
+ "_search/ru/hash-index.js",
24
+ "_search/ru/hash-resources.js",
25
+ "_search/ru/hash-registry.js",
26
+ "_search/ru/index.html",
27
+ "_search/ru/language.js",
28
+ "index.html",
29
+ "toc.js"
30
+ ]"
31
+ `;
32
+
33
+ exports[`Local search > internal 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>Header</title>
41
+ <meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
42
+
43
+ <style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
44
+
45
+ <link type="text/css" rel="stylesheet" href="_bundle/search-css-1"/>
46
+ <link type="text/css" rel="stylesheet" href="_bundle/app-css-1"/>
47
+ </head>
48
+ <body class="g-root g-root_theme_light">
49
+ <div id="root"></div>
50
+ <script type="application/json" id="diplodoc-state">
51
+ {"data":{"leading":false,"html":"&lt;p&gt;Content&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}]},"headings":[],"title":"Header"},"router":{"pathname":"index","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"search":{"enabled":true,"provider":"local","api":"_search/api.js","link":"_search/ru/index.html"}}
52
+ </script>
53
+ <script type="application/javascript">
54
+ const data = document.querySelector('script#diplodoc-state');
55
+ window.__DATA__ = JSON.parse((function unescape(string) {
56
+ return string.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
57
+ })(data.innerText));
58
+ window.STATIC_CONTENT = false;
59
+ </script>
60
+ <script type="application/javascript" defer src="toc.js"></script>
61
+ <script type="application/javascript" defer src="_search/ru/hash-resources.js"></script>
62
+ <script type="application/javascript" defer src="_bundle/search-js-0"></script>
63
+ <script type="application/javascript" defer src="_bundle/app-js-1"></script>
64
+ <script type="application/javascript" defer src="_bundle/search-js-2"></script>
65
+
66
+ </body>
67
+ </html>"
68
+ `;
69
+
70
+ exports[`Local search > internal 2`] = `"window.__DATA__.data.toc = {"href":"index.html","path":"toc.yaml","id":"UUID"};"`;
@@ -1,5 +1,581 @@
1
1
  // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
+ exports[`Translate command > build translated md files and remove no-translate directives > filelist 1`] = `
4
+ "[
5
+ "index.md",
6
+ "no-translate.md",
7
+ "openapi/index.md",
8
+ "openapi/test-controller/getWithPayloadResponse.md",
9
+ "openapi/test-controller/index.md",
10
+ "toc.yaml"
11
+ ]"
12
+ `;
13
+
14
+ exports[`Translate command > build translated md files and remove no-translate directives 1`] = `
15
+ "---
16
+ metadata:
17
+ - name: generator
18
+ content: Diplodoc Platform vDIPLODOC-VERSION
19
+ ---
20
+ ## Index header
21
+
22
+ adsfasdfasdfasdfasdf
23
+
24
+ lorem
25
+
26
+ asdfasdfasdf"
27
+ `;
28
+
29
+ exports[`Translate command > build translated md files and remove no-translate directives 2`] = `
30
+ "---
31
+ metadata:
32
+ - name: generator
33
+ content: Diplodoc Platform vDIPLODOC-VERSION
34
+ ---
35
+ # No-translate directive
36
+
37
+ ## Block directive
38
+ ### No-translate header
39
+ Should not be translated.
40
+ Can use **markup** inside.
41
+
42
+ ## Leaf directive
43
+
44
+ ## /usr/local/bin/application
45
+ **C:/Program Files/Application/config.ini**
46
+ ~/Documents/project/src/main.rs
47
+
48
+
49
+ - GET /api/v1/users — get all users
50
+ - POST /api/v1/auth/login — authorization
51
+ - PUT /api/v1/users/{id} — update users data
52
+
53
+ ## Simple case leaf
54
+ Install using command.
55
+ The default port is unless specified. Next sentence.
56
+ Set NODE_ENV=production for production builds.
57
+
58
+ ## Simple case inline
59
+ Install using npm install @company/package command.
60
+ The default port is 8080 unless specified.
61
+ Set NODE_ENV=production for production builds.
62
+
63
+ ## Few inline directives
64
+ Use **GET /api/v1/users** to list users and POST /api/v1/users to create.
65
+
66
+ ## Empty inline directive
67
+ This is text with empty directive.
68
+
69
+
70
+ "
71
+ `;
72
+
73
+ exports[`Translate command > build translated md files and remove no-translate directives 3`] = `
74
+ "---
75
+ metadata:
76
+ - name: generator
77
+ content: Diplodoc Platform vDIPLODOC-VERSION
78
+ ---
79
+ # OpenAPI definition
80
+
81
+ ##version: v0##
82
+
83
+ ## Sections
84
+
85
+ - [test-controller](test-controller/index.md)
86
+
87
+
88
+ ## Specification
89
+
90
+ {% cut "Open API" %}
91
+
92
+
93
+ \`\`\`text translate=no
94
+ {
95
+ "openapi": "3.0.1",
96
+ "info": {
97
+ "title": "OpenAPI definition",
98
+ "version": "v0"
99
+ },
100
+ "servers": [
101
+ {
102
+ "url": "http://localhost:8080",
103
+ "description": "Generated server url"
104
+ }
105
+ ],
106
+ "paths": {
107
+ "/test": {
108
+ "get": {
109
+ "tags": [
110
+ "test-controller"
111
+ ],
112
+ "summary": "Simple get operation. тест новой верстки 3",
113
+ "description": "Defines a simple get skip this operation with no inputs and a complex",
114
+ "operationId": "getWithPayloadResponse",
115
+ "responses": {
116
+ "200": {
117
+ "description": "200!!!!",
118
+ "content": {
119
+ "application/json": {
120
+ "schema": {
121
+ "type": "object",
122
+ "properties": {
123
+ "A": {
124
+ "type": "string"
125
+ }
126
+ }
127
+ }
128
+ }
129
+ }
130
+ }
131
+ }
132
+ }
133
+ }
134
+ },
135
+ "components": {
136
+ "schemas": {
137
+ "RecurceTop": {
138
+ "type": "object",
139
+ "properties": {
140
+ "A": {
141
+ "type": "string"
142
+ }
143
+ }
144
+ },
145
+ "RecurceMiddle": {
146
+ "type": "object",
147
+ "properties": {
148
+ "B": {
149
+ "type": "array",
150
+ "items": {
151
+ "type": "object",
152
+ "properties": {
153
+ "A": {
154
+ "type": "string"
155
+ }
156
+ }
157
+ }
158
+ }
159
+ }
160
+ }
161
+ }
162
+ }
163
+ }
164
+ \`\`\`
165
+
166
+
167
+ {% endcut %}
168
+
169
+ <!-- markdownlint-disable-file -->"
170
+ `;
171
+
172
+ exports[`Translate command > build translated md files and remove no-translate directives 4`] = `
173
+ "---
174
+ metadata:
175
+ - name: generator
176
+ content: Diplodoc Platform vDIPLODOC-VERSION
177
+ ---
178
+ <div class="openapi">
179
+
180
+ # Simple get operation. тест новой верстки 3
181
+
182
+ Defines a simple get skip this operation with no inputs and a complex
183
+
184
+ ## Request
185
+
186
+ <div class="openapi__requests">
187
+
188
+ <div class="openapi__request__wrapper" style="--method: var(--dc-openapi-methods-get);margin-bottom: 12px">
189
+
190
+ <div class="openapi__request">
191
+
192
+ GET {.openapi__method}
193
+ \`\`\`text translate=no
194
+ http://localhost:8080/test
195
+ \`\`\`
196
+
197
+
198
+
199
+ </div>
200
+
201
+ Generated server url
202
+
203
+ </div>
204
+
205
+ </div>
206
+
207
+ ## Responses
208
+
209
+ <div class="openapi__response__code__200">
210
+
211
+ ## 200 OK
212
+
213
+ 200!!!!
214
+
215
+ <div class="openapi-entity">
216
+
217
+ ### Body
218
+
219
+ {% cut "application/json" %}
220
+
221
+
222
+ \`\`\`json translate=no
223
+ {
224
+ "A": "string"
225
+ }
226
+ \`\`\`
227
+
228
+
229
+ {% endcut %}
230
+
231
+
232
+ #|||
233
+ **Name**
234
+ |
235
+ **Description**
236
+ ||
237
+
238
+ ||
239
+ A {.openapi-table-parameter-name}
240
+ |
241
+ **Type:** string
242
+ |||#
243
+
244
+ </div>
245
+
246
+ </div>
247
+ <!-- markdownlint-disable-file -->
248
+
249
+ </div>
250
+
251
+
252
+
253
+ [*Deprecated]: No longer supported, please use an alternative and newer version."
254
+ `;
255
+
256
+ exports[`Translate command > build translated md files and remove no-translate directives 5`] = `
257
+ "---
258
+ metadata:
259
+ - name: generator
260
+ content: Diplodoc Platform vDIPLODOC-VERSION
261
+ ---
262
+ # test-controller
263
+
264
+ ## Endpoints
265
+
266
+ - [Simple get operation. тест новой верстки 3](getWithPayloadResponse.md)
267
+
268
+ <!-- markdownlint-disable-file -->"
269
+ `;
270
+
271
+ exports[`Translate command > build translated md files and remove no-translate directives 6`] = `
272
+ "title: Test123
273
+ href: index.md
274
+ items:
275
+ - name: Не переводить
276
+ href: no-translate.md
277
+ - name: openapi
278
+ items:
279
+ - name: Overview
280
+ href: openapi/index.md
281
+ - name: test-controller
282
+ items:
283
+ - name: Overview
284
+ href: openapi/test-controller/index.md
285
+ - href: openapi/test-controller/getWithPayloadResponse.md
286
+ name: Simple get operation. тест новой верстки 3
287
+ path: toc.yaml
288
+ "
289
+ `;
290
+
291
+ exports[`Translate command > build translated static files and remove no-translate directives > filelist 1`] = `
292
+ "[
293
+ "index.md",
294
+ "no-translate.md",
295
+ "openapi/index.md",
296
+ "openapi/test-controller/getWithPayloadResponse.md",
297
+ "openapi/test-controller/index.md",
298
+ "toc.yaml"
299
+ ]"
300
+ `;
301
+
302
+ exports[`Translate command > build translated static files and remove no-translate directives 1`] = `
303
+ "---
304
+ metadata:
305
+ - name: generator
306
+ content: Diplodoc Platform vDIPLODOC-VERSION
307
+ ---
308
+ ## Index header
309
+
310
+ adsfasdfasdfasdfasdf
311
+
312
+ lorem
313
+
314
+ asdfasdfasdf"
315
+ `;
316
+
317
+ exports[`Translate command > build translated static files and remove no-translate directives 2`] = `
318
+ "---
319
+ metadata:
320
+ - name: generator
321
+ content: Diplodoc Platform vDIPLODOC-VERSION
322
+ ---
323
+ # No-translate directive
324
+
325
+ ## Block directive
326
+ ### No-translate header
327
+ Should not be translated.
328
+ Can use **markup** inside.
329
+
330
+ ## Leaf directive
331
+
332
+ ## /usr/local/bin/application
333
+ **C:/Program Files/Application/config.ini**
334
+ ~/Documents/project/src/main.rs
335
+
336
+
337
+ - GET /api/v1/users — get all users
338
+ - POST /api/v1/auth/login — authorization
339
+ - PUT /api/v1/users/{id} — update users data
340
+
341
+ ## Simple case leaf
342
+ Install using command.
343
+ The default port is unless specified. Next sentence.
344
+ Set NODE_ENV=production for production builds.
345
+
346
+ ## Simple case inline
347
+ Install using npm install @company/package command.
348
+ The default port is 8080 unless specified.
349
+ Set NODE_ENV=production for production builds.
350
+
351
+ ## Few inline directives
352
+ Use **GET /api/v1/users** to list users and POST /api/v1/users to create.
353
+
354
+ ## Empty inline directive
355
+ This is text with empty directive.
356
+
357
+
358
+ "
359
+ `;
360
+
361
+ exports[`Translate command > build translated static files and remove no-translate directives 3`] = `
362
+ "---
363
+ metadata:
364
+ - name: generator
365
+ content: Diplodoc Platform vDIPLODOC-VERSION
366
+ ---
367
+ # OpenAPI definition
368
+
369
+ ##version: v0##
370
+
371
+ ## Sections
372
+
373
+ - [test-controller](test-controller/index.md)
374
+
375
+
376
+ ## Specification
377
+
378
+ {% cut "Open API" %}
379
+
380
+
381
+ \`\`\`text translate=no
382
+ {
383
+ "openapi": "3.0.1",
384
+ "info": {
385
+ "title": "OpenAPI definition",
386
+ "version": "v0"
387
+ },
388
+ "servers": [
389
+ {
390
+ "url": "http://localhost:8080",
391
+ "description": "Generated server url"
392
+ }
393
+ ],
394
+ "paths": {
395
+ "/test": {
396
+ "get": {
397
+ "tags": [
398
+ "test-controller"
399
+ ],
400
+ "summary": "Simple get operation. тест новой верстки 3",
401
+ "description": "Defines a simple get skip this operation with no inputs and a complex",
402
+ "operationId": "getWithPayloadResponse",
403
+ "responses": {
404
+ "200": {
405
+ "description": "200!!!!",
406
+ "content": {
407
+ "application/json": {
408
+ "schema": {
409
+ "type": "object",
410
+ "properties": {
411
+ "A": {
412
+ "type": "string"
413
+ }
414
+ }
415
+ }
416
+ }
417
+ }
418
+ }
419
+ }
420
+ }
421
+ }
422
+ },
423
+ "components": {
424
+ "schemas": {
425
+ "RecurceTop": {
426
+ "type": "object",
427
+ "properties": {
428
+ "A": {
429
+ "type": "string"
430
+ }
431
+ }
432
+ },
433
+ "RecurceMiddle": {
434
+ "type": "object",
435
+ "properties": {
436
+ "B": {
437
+ "type": "array",
438
+ "items": {
439
+ "type": "object",
440
+ "properties": {
441
+ "A": {
442
+ "type": "string"
443
+ }
444
+ }
445
+ }
446
+ }
447
+ }
448
+ }
449
+ }
450
+ }
451
+ }
452
+ \`\`\`
453
+
454
+
455
+ {% endcut %}
456
+
457
+ <!-- markdownlint-disable-file -->"
458
+ `;
459
+
460
+ exports[`Translate command > build translated static files and remove no-translate directives 4`] = `
461
+ "---
462
+ metadata:
463
+ - name: generator
464
+ content: Diplodoc Platform vDIPLODOC-VERSION
465
+ ---
466
+ <div class="openapi">
467
+
468
+ # Simple get operation. тест новой верстки 3
469
+
470
+ Defines a simple get skip this operation with no inputs and a complex
471
+
472
+ ## Request
473
+
474
+ <div class="openapi__requests">
475
+
476
+ <div class="openapi__request__wrapper" style="--method: var(--dc-openapi-methods-get);margin-bottom: 12px">
477
+
478
+ <div class="openapi__request">
479
+
480
+ GET {.openapi__method}
481
+ \`\`\`text translate=no
482
+ http://localhost:8080/test
483
+ \`\`\`
484
+
485
+
486
+
487
+ </div>
488
+
489
+ Generated server url
490
+
491
+ </div>
492
+
493
+ </div>
494
+
495
+ ## Responses
496
+
497
+ <div class="openapi__response__code__200">
498
+
499
+ ## 200 OK
500
+
501
+ 200!!!!
502
+
503
+ <div class="openapi-entity">
504
+
505
+ ### Body
506
+
507
+ {% cut "application/json" %}
508
+
509
+
510
+ \`\`\`json translate=no
511
+ {
512
+ "A": "string"
513
+ }
514
+ \`\`\`
515
+
516
+
517
+ {% endcut %}
518
+
519
+
520
+ #|||
521
+ **Name**
522
+ |
523
+ **Description**
524
+ ||
525
+
526
+ ||
527
+ A {.openapi-table-parameter-name}
528
+ |
529
+ **Type:** string
530
+ |||#
531
+
532
+ </div>
533
+
534
+ </div>
535
+ <!-- markdownlint-disable-file -->
536
+
537
+ </div>
538
+
539
+
540
+
541
+ [*Deprecated]: No longer supported, please use an alternative and newer version."
542
+ `;
543
+
544
+ exports[`Translate command > build translated static files and remove no-translate directives 5`] = `
545
+ "---
546
+ metadata:
547
+ - name: generator
548
+ content: Diplodoc Platform vDIPLODOC-VERSION
549
+ ---
550
+ # test-controller
551
+
552
+ ## Endpoints
553
+
554
+ - [Simple get operation. тест новой верстки 3](getWithPayloadResponse.md)
555
+
556
+ <!-- markdownlint-disable-file -->"
557
+ `;
558
+
559
+ exports[`Translate command > build translated static files and remove no-translate directives 6`] = `
560
+ "title: Test123
561
+ href: index.md
562
+ items:
563
+ - name: Не переводить
564
+ href: no-translate.md
565
+ - name: openapi
566
+ items:
567
+ - name: Overview
568
+ href: openapi/index.md
569
+ - name: test-controller
570
+ items:
571
+ - name: Overview
572
+ href: openapi/test-controller/index.md
573
+ - href: openapi/test-controller/getWithPayloadResponse.md
574
+ name: Simple get operation. тест новой верстки 3
575
+ path: toc.yaml
576
+ "
577
+ `;
578
+
3
579
  exports[`Translate command > extract openapi spec files > filelist 1`] = `
4
580
  "[
5
581
  "openapi-spec.yaml.skl",
@@ -1117,3 +1693,535 @@ exports[`Translate command > filter files on extract with extra exclude option >
1117
1693
  "es/toc.yaml.xliff"
1118
1694
  ]"
1119
1695
  `;
1696
+
1697
+ exports[`Translate command > removes no-translate directive and leaves content as is > filelist 1`] = `
1698
+ "[
1699
+ "index.md.skl",
1700
+ "index.md.xliff",
1701
+ "no-translate.md.skl",
1702
+ "no-translate.md.xliff",
1703
+ "openapi-spec.yaml.skl",
1704
+ "openapi-spec.yaml.xliff",
1705
+ "toc.yaml.skl",
1706
+ "toc.yaml.xliff"
1707
+ ]"
1708
+ `;
1709
+
1710
+ exports[`Translate command > removes no-translate directive and leaves content as is 1`] = `
1711
+ "## %%%0%%%
1712
+
1713
+ ::no-translate [adsfasdfasdfasdfasdf]
1714
+
1715
+ %%%1%%%
1716
+
1717
+ %%%2%%%"
1718
+ `;
1719
+
1720
+ exports[`Translate command > removes no-translate directive and leaves content as is 2`] = `
1721
+ "<?xml version="1.0" encoding="UTF-8"?>
1722
+ <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
1723
+ <file original="file.ext" source-language="ru-RU" target-language="es-ES" datatype="markdown">
1724
+ <header>
1725
+ <skeleton>
1726
+ <external-file href="file.skl"></external-file>
1727
+ </skeleton>
1728
+ </header>
1729
+ <body>
1730
+ <trans-unit id="0">
1731
+ <source xml:space="preserve">Index header</source>
1732
+ </trans-unit>
1733
+ <trans-unit id="1">
1734
+ <source xml:space="preserve">lorem</source>
1735
+ </trans-unit>
1736
+ <trans-unit id="2">
1737
+ <source xml:space="preserve">asdfasdfasdf</source>
1738
+ </trans-unit>
1739
+ </body>
1740
+ </file>
1741
+ </xliff>"
1742
+ `;
1743
+
1744
+ exports[`Translate command > removes no-translate directive and leaves content as is 3`] = `
1745
+ "# %%%0%%%
1746
+
1747
+ ## %%%1%%%
1748
+ :::no-translate
1749
+ ### No-translate header
1750
+ Should not be translated.
1751
+ Can use **markup** inside.
1752
+ :::
1753
+
1754
+ ## %%%2%%%
1755
+
1756
+ ::no-translate [## /usr/local/bin/application]
1757
+ ::no-translate[**C:/Program Files/Application/config.ini**]
1758
+ ::no-translate [~/Documents/project/src/main.rs]
1759
+
1760
+
1761
+ - :no-translate[GET /api/v1/users] %%%3%%%
1762
+ - :no-translate[POST /api/v1/auth/login] %%%4%%%
1763
+ - :no-translate[PUT /api/v1/users/{id}] %%%5%%%
1764
+
1765
+ ## %%%6%%%
1766
+ %%%7%%%
1767
+ :no-translate[The default port is unless specified.] %%%8%%%
1768
+ %%%9%%%
1769
+
1770
+ ## %%%10%%%
1771
+ %%%11%%%
1772
+ %%%12%%%
1773
+ %%%13%%%
1774
+
1775
+ ## %%%14%%%
1776
+ %%%15%%%
1777
+
1778
+ ## %%%16%%%
1779
+ %%%17%%%
1780
+
1781
+
1782
+ "
1783
+ `;
1784
+
1785
+ exports[`Translate command > removes no-translate directive and leaves content as is 4`] = `
1786
+ "<?xml version="1.0" encoding="UTF-8"?>
1787
+ <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
1788
+ <file original="file.ext" source-language="ru-RU" target-language="es-ES" datatype="markdown">
1789
+ <header>
1790
+ <skeleton>
1791
+ <external-file href="file.skl"></external-file>
1792
+ </skeleton>
1793
+ </header>
1794
+ <body>
1795
+ <trans-unit id="0">
1796
+ <source xml:space="preserve">No-translate directive</source>
1797
+ </trans-unit>
1798
+ <trans-unit id="1">
1799
+ <source xml:space="preserve">Block directive</source>
1800
+ </trans-unit>
1801
+ <trans-unit id="2">
1802
+ <source xml:space="preserve">Leaf directive</source>
1803
+ </trans-unit>
1804
+ <trans-unit id="3">
1805
+ <source xml:space="preserve">— get all users</source>
1806
+ </trans-unit>
1807
+ <trans-unit id="4">
1808
+ <source xml:space="preserve">— authorization</source>
1809
+ </trans-unit>
1810
+ <trans-unit id="5">
1811
+ <source xml:space="preserve">— update users data</source>
1812
+ </trans-unit>
1813
+ <trans-unit id="6">
1814
+ <source xml:space="preserve">Simple case leaf</source>
1815
+ </trans-unit>
1816
+ <trans-unit id="7">
1817
+ <source xml:space="preserve">Install using command.</source>
1818
+ </trans-unit>
1819
+ <trans-unit id="8">
1820
+ <source xml:space="preserve">Next sentence.</source>
1821
+ </trans-unit>
1822
+ <trans-unit id="9">
1823
+ <source xml:space="preserve">Set NODE_ENV=production for production builds.</source>
1824
+ </trans-unit>
1825
+ <trans-unit id="10">
1826
+ <source xml:space="preserve">Simple case inline</source>
1827
+ </trans-unit>
1828
+ <trans-unit id="11">
1829
+ <source xml:space="preserve">Install using <x ctype="no_translate_inline" equiv-text=":no-translate[npm install @company/package]" id="x-2"/> command.</source>
1830
+ </trans-unit>
1831
+ <trans-unit id="12">
1832
+ <source xml:space="preserve">The default port is <x ctype="no_translate_inline" equiv-text=":no-translate[8080]" id="x-3"/> unless specified.</source>
1833
+ </trans-unit>
1834
+ <trans-unit id="13">
1835
+ <source xml:space="preserve">Set <x ctype="no_translate_inline" equiv-text=":no-translate[NODE_ENV=production]" id="x-4"/> for production builds.</source>
1836
+ </trans-unit>
1837
+ <trans-unit id="14">
1838
+ <source xml:space="preserve">Few inline directives</source>
1839
+ </trans-unit>
1840
+ <trans-unit id="15">
1841
+ <source xml:space="preserve">Use <x ctype="no_translate_inline" equiv-text=":no-translate[**GET /api/v1/users**]" id="x-5"/> to list users and <x ctype="no_translate_inline" equiv-text=":no-translate[POST /api/v1/users]" id="x-6"/> to create.</source>
1842
+ </trans-unit>
1843
+ <trans-unit id="16">
1844
+ <source xml:space="preserve">Empty inline directive</source>
1845
+ </trans-unit>
1846
+ <trans-unit id="17">
1847
+ <source xml:space="preserve">This is text with empty <x ctype="no_translate_inline" equiv-text=":no-translate[]" id="x-7"/> directive.</source>
1848
+ </trans-unit>
1849
+ </body>
1850
+ </file>
1851
+ </xliff>"
1852
+ `;
1853
+
1854
+ exports[`Translate command > removes no-translate directive and leaves content as is 5`] = `
1855
+ "openapi: 3.0.1
1856
+ info:
1857
+ title: '%%%0%%%'
1858
+ version: v0
1859
+ servers:
1860
+ - url: http://localhost:8080
1861
+ description: '%%%1%%%'
1862
+ paths:
1863
+ /test:
1864
+ get:
1865
+ tags:
1866
+ - test-controller
1867
+ summary: '%%%2%%%'
1868
+ description: '%%%3%%%'
1869
+ operationId: getWithPayloadResponse
1870
+ responses:
1871
+ '200':
1872
+ description: '%%%4%%%'
1873
+ content:
1874
+ application/json:
1875
+ schema:
1876
+ $ref: '#/components/schemas/RecurceTop'
1877
+ components:
1878
+ schemas:
1879
+ RecurceTop:
1880
+ type: object
1881
+ properties:
1882
+ A:
1883
+ type: string
1884
+ RecurceMiddle:
1885
+ type: object
1886
+ properties:
1887
+ B:
1888
+ type: array
1889
+ items:
1890
+ $ref: '#/components/schemas/RecurceTop'
1891
+ "
1892
+ `;
1893
+
1894
+ exports[`Translate command > removes no-translate directive and leaves content as is 6`] = `
1895
+ "<?xml version="1.0" encoding="UTF-8"?>
1896
+ <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
1897
+ <file original="file.ext" source-language="ru-RU" target-language="es-ES" datatype="markdown">
1898
+ <header>
1899
+ <skeleton>
1900
+ <external-file href="file.skl"></external-file>
1901
+ </skeleton>
1902
+ </header>
1903
+ <body>
1904
+ <trans-unit id="0">
1905
+ <source xml:space="preserve">OpenAPI definition</source>
1906
+ </trans-unit>
1907
+ <trans-unit id="1">
1908
+ <source xml:space="preserve">Generated server url</source>
1909
+ </trans-unit>
1910
+ <trans-unit id="2">
1911
+ <source xml:space="preserve">Simple get operation. тест новой верстки 3</source>
1912
+ </trans-unit>
1913
+ <trans-unit id="3">
1914
+ <source xml:space="preserve">Defines a simple get <x ctype="no_translate_inline" equiv-text=":no-translate[skip this]" id="x-1"/> operation with no inputs and a complex</source>
1915
+ </trans-unit>
1916
+ <trans-unit id="4">
1917
+ <source xml:space="preserve">200!!!!</source>
1918
+ </trans-unit>
1919
+ </body>
1920
+ </file>
1921
+ </xliff>"
1922
+ `;
1923
+
1924
+ exports[`Translate command > removes no-translate directive and leaves content as is 7`] = `
1925
+ "title: '%%%0%%%'
1926
+ href: index.md
1927
+ items:
1928
+ - name: '%%%1%%%'
1929
+ href: no-translate.md
1930
+ - name: '%%%2%%%'
1931
+ include:
1932
+ path: openapi
1933
+ includers:
1934
+ - name: openapi
1935
+ input: openapi-spec.yaml
1936
+ "
1937
+ `;
1938
+
1939
+ exports[`Translate command > removes no-translate directive and leaves content as is 8`] = `
1940
+ "<?xml version="1.0" encoding="UTF-8"?>
1941
+ <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
1942
+ <file original="file.ext" source-language="ru-RU" target-language="es-ES" datatype="markdown">
1943
+ <header>
1944
+ <skeleton>
1945
+ <external-file href="file.skl"></external-file>
1946
+ </skeleton>
1947
+ </header>
1948
+ <body>
1949
+ <trans-unit id="0">
1950
+ <source xml:space="preserve">Test123</source>
1951
+ </trans-unit>
1952
+ <trans-unit id="1">
1953
+ <source xml:space="preserve">Не переводить</source>
1954
+ </trans-unit>
1955
+ <trans-unit id="2">
1956
+ <source xml:space="preserve">openapi</source>
1957
+ </trans-unit>
1958
+ </body>
1959
+ </file>
1960
+ </xliff>"
1961
+ `;
1962
+
1963
+ exports[`Translate command > skip no-translate marked content > filelist 1`] = `
1964
+ "[
1965
+ "index.md.skl",
1966
+ "index.md.xliff",
1967
+ "no-translate.md.skl",
1968
+ "no-translate.md.xliff",
1969
+ "openapi-spec.yaml.skl",
1970
+ "openapi-spec.yaml.xliff",
1971
+ "toc.yaml.skl",
1972
+ "toc.yaml.xliff"
1973
+ ]"
1974
+ `;
1975
+
1976
+ exports[`Translate command > skip no-translate marked content 1`] = `
1977
+ "## %%%0%%%
1978
+
1979
+ ::no-translate [adsfasdfasdfasdfasdf]
1980
+
1981
+ %%%1%%%
1982
+
1983
+ %%%2%%%"
1984
+ `;
1985
+
1986
+ exports[`Translate command > skip no-translate marked content 2`] = `
1987
+ "<?xml version="1.0" encoding="UTF-8"?>
1988
+ <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
1989
+ <file original="file.ext" source-language="ru-RU" target-language="es-ES" datatype="markdown">
1990
+ <header>
1991
+ <skeleton>
1992
+ <external-file href="file.skl"></external-file>
1993
+ </skeleton>
1994
+ </header>
1995
+ <body>
1996
+ <trans-unit id="0">
1997
+ <source xml:space="preserve">Index header</source>
1998
+ </trans-unit>
1999
+ <trans-unit id="1">
2000
+ <source xml:space="preserve">lorem</source>
2001
+ </trans-unit>
2002
+ <trans-unit id="2">
2003
+ <source xml:space="preserve">asdfasdfasdf</source>
2004
+ </trans-unit>
2005
+ </body>
2006
+ </file>
2007
+ </xliff>"
2008
+ `;
2009
+
2010
+ exports[`Translate command > skip no-translate marked content 3`] = `
2011
+ "# %%%0%%%
2012
+
2013
+ ## %%%1%%%
2014
+ :::no-translate
2015
+ ### No-translate header
2016
+ Should not be translated.
2017
+ Can use **markup** inside.
2018
+ :::
2019
+
2020
+ ## %%%2%%%
2021
+
2022
+ ::no-translate [## /usr/local/bin/application]
2023
+ ::no-translate[**C:/Program Files/Application/config.ini**]
2024
+ ::no-translate [~/Documents/project/src/main.rs]
2025
+
2026
+
2027
+ - :no-translate[GET /api/v1/users] %%%3%%%
2028
+ - :no-translate[POST /api/v1/auth/login] %%%4%%%
2029
+ - :no-translate[PUT /api/v1/users/{id}] %%%5%%%
2030
+
2031
+ ## %%%6%%%
2032
+ %%%7%%%
2033
+ :no-translate[The default port is unless specified.] %%%8%%%
2034
+ %%%9%%%
2035
+
2036
+ ## %%%10%%%
2037
+ %%%11%%%
2038
+ %%%12%%%
2039
+ %%%13%%%
2040
+
2041
+ ## %%%14%%%
2042
+ %%%15%%%
2043
+
2044
+ ## %%%16%%%
2045
+ %%%17%%%
2046
+
2047
+
2048
+ "
2049
+ `;
2050
+
2051
+ exports[`Translate command > skip no-translate marked content 4`] = `
2052
+ "<?xml version="1.0" encoding="UTF-8"?>
2053
+ <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
2054
+ <file original="file.ext" source-language="ru-RU" target-language="es-ES" datatype="markdown">
2055
+ <header>
2056
+ <skeleton>
2057
+ <external-file href="file.skl"></external-file>
2058
+ </skeleton>
2059
+ </header>
2060
+ <body>
2061
+ <trans-unit id="0">
2062
+ <source xml:space="preserve">No-translate directive</source>
2063
+ </trans-unit>
2064
+ <trans-unit id="1">
2065
+ <source xml:space="preserve">Block directive</source>
2066
+ </trans-unit>
2067
+ <trans-unit id="2">
2068
+ <source xml:space="preserve">Leaf directive</source>
2069
+ </trans-unit>
2070
+ <trans-unit id="3">
2071
+ <source xml:space="preserve">— get all users</source>
2072
+ </trans-unit>
2073
+ <trans-unit id="4">
2074
+ <source xml:space="preserve">— authorization</source>
2075
+ </trans-unit>
2076
+ <trans-unit id="5">
2077
+ <source xml:space="preserve">— update users data</source>
2078
+ </trans-unit>
2079
+ <trans-unit id="6">
2080
+ <source xml:space="preserve">Simple case leaf</source>
2081
+ </trans-unit>
2082
+ <trans-unit id="7">
2083
+ <source xml:space="preserve">Install using command.</source>
2084
+ </trans-unit>
2085
+ <trans-unit id="8">
2086
+ <source xml:space="preserve">Next sentence.</source>
2087
+ </trans-unit>
2088
+ <trans-unit id="9">
2089
+ <source xml:space="preserve">Set NODE_ENV=production for production builds.</source>
2090
+ </trans-unit>
2091
+ <trans-unit id="10">
2092
+ <source xml:space="preserve">Simple case inline</source>
2093
+ </trans-unit>
2094
+ <trans-unit id="11">
2095
+ <source xml:space="preserve">Install using <x ctype="no_translate_inline" equiv-text=":no-translate[npm install @company/package]" id="x-2"/> command.</source>
2096
+ </trans-unit>
2097
+ <trans-unit id="12">
2098
+ <source xml:space="preserve">The default port is <x ctype="no_translate_inline" equiv-text=":no-translate[8080]" id="x-3"/> unless specified.</source>
2099
+ </trans-unit>
2100
+ <trans-unit id="13">
2101
+ <source xml:space="preserve">Set <x ctype="no_translate_inline" equiv-text=":no-translate[NODE_ENV=production]" id="x-4"/> for production builds.</source>
2102
+ </trans-unit>
2103
+ <trans-unit id="14">
2104
+ <source xml:space="preserve">Few inline directives</source>
2105
+ </trans-unit>
2106
+ <trans-unit id="15">
2107
+ <source xml:space="preserve">Use <x ctype="no_translate_inline" equiv-text=":no-translate[**GET /api/v1/users**]" id="x-5"/> to list users and <x ctype="no_translate_inline" equiv-text=":no-translate[POST /api/v1/users]" id="x-6"/> to create.</source>
2108
+ </trans-unit>
2109
+ <trans-unit id="16">
2110
+ <source xml:space="preserve">Empty inline directive</source>
2111
+ </trans-unit>
2112
+ <trans-unit id="17">
2113
+ <source xml:space="preserve">This is text with empty <x ctype="no_translate_inline" equiv-text=":no-translate[]" id="x-7"/> directive.</source>
2114
+ </trans-unit>
2115
+ </body>
2116
+ </file>
2117
+ </xliff>"
2118
+ `;
2119
+
2120
+ exports[`Translate command > skip no-translate marked content 5`] = `
2121
+ "openapi: 3.0.1
2122
+ info:
2123
+ title: '%%%0%%%'
2124
+ version: v0
2125
+ servers:
2126
+ - url: http://localhost:8080
2127
+ description: '%%%1%%%'
2128
+ paths:
2129
+ /test:
2130
+ get:
2131
+ tags:
2132
+ - test-controller
2133
+ summary: '%%%2%%%'
2134
+ description: '%%%3%%%'
2135
+ operationId: getWithPayloadResponse
2136
+ responses:
2137
+ '200':
2138
+ description: '%%%4%%%'
2139
+ content:
2140
+ application/json:
2141
+ schema:
2142
+ $ref: '#/components/schemas/RecurceTop'
2143
+ components:
2144
+ schemas:
2145
+ RecurceTop:
2146
+ type: object
2147
+ properties:
2148
+ A:
2149
+ type: string
2150
+ RecurceMiddle:
2151
+ type: object
2152
+ properties:
2153
+ B:
2154
+ type: array
2155
+ items:
2156
+ $ref: '#/components/schemas/RecurceTop'
2157
+ "
2158
+ `;
2159
+
2160
+ exports[`Translate command > skip no-translate marked content 6`] = `
2161
+ "<?xml version="1.0" encoding="UTF-8"?>
2162
+ <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
2163
+ <file original="file.ext" source-language="ru-RU" target-language="es-ES" datatype="markdown">
2164
+ <header>
2165
+ <skeleton>
2166
+ <external-file href="file.skl"></external-file>
2167
+ </skeleton>
2168
+ </header>
2169
+ <body>
2170
+ <trans-unit id="0">
2171
+ <source xml:space="preserve">OpenAPI definition</source>
2172
+ </trans-unit>
2173
+ <trans-unit id="1">
2174
+ <source xml:space="preserve">Generated server url</source>
2175
+ </trans-unit>
2176
+ <trans-unit id="2">
2177
+ <source xml:space="preserve">Simple get operation. тест новой верстки 3</source>
2178
+ </trans-unit>
2179
+ <trans-unit id="3">
2180
+ <source xml:space="preserve">Defines a simple get <x ctype="no_translate_inline" equiv-text=":no-translate[skip this]" id="x-1"/> operation with no inputs and a complex</source>
2181
+ </trans-unit>
2182
+ <trans-unit id="4">
2183
+ <source xml:space="preserve">200!!!!</source>
2184
+ </trans-unit>
2185
+ </body>
2186
+ </file>
2187
+ </xliff>"
2188
+ `;
2189
+
2190
+ exports[`Translate command > skip no-translate marked content 7`] = `
2191
+ "title: '%%%0%%%'
2192
+ href: index.md
2193
+ items:
2194
+ - name: '%%%1%%%'
2195
+ href: no-translate.md
2196
+ - name: '%%%2%%%'
2197
+ include:
2198
+ path: openapi
2199
+ includers:
2200
+ - name: openapi
2201
+ input: openapi-spec.yaml
2202
+ "
2203
+ `;
2204
+
2205
+ exports[`Translate command > skip no-translate marked content 8`] = `
2206
+ "<?xml version="1.0" encoding="UTF-8"?>
2207
+ <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
2208
+ <file original="file.ext" source-language="ru-RU" target-language="es-ES" datatype="markdown">
2209
+ <header>
2210
+ <skeleton>
2211
+ <external-file href="file.skl"></external-file>
2212
+ </skeleton>
2213
+ </header>
2214
+ <body>
2215
+ <trans-unit id="0">
2216
+ <source xml:space="preserve">Test123</source>
2217
+ </trans-unit>
2218
+ <trans-unit id="1">
2219
+ <source xml:space="preserve">Не переводить</source>
2220
+ </trans-unit>
2221
+ <trans-unit id="2">
2222
+ <source xml:space="preserve">openapi</source>
2223
+ </trans-unit>
2224
+ </body>
2225
+ </file>
2226
+ </xliff>"
2227
+ `;
@@ -0,0 +1,15 @@
1
+ import {describe, it} from 'vitest';
2
+ import {TestAdapter, compareDirectories, getTestPaths} from '../fixtures';
3
+
4
+ describe('Local search', () => {
5
+ it('internal', async () => {
6
+ const {inputPath, outputPath} = getTestPaths('mocks/search');
7
+
8
+ await TestAdapter.testBuildPass(inputPath, outputPath, {
9
+ md2md: false,
10
+ md2html: true,
11
+ args: '-j2 --search',
12
+ });
13
+ await compareDirectories(outputPath);
14
+ });
15
+ });
@@ -5,13 +5,14 @@ const generateMapTestTemplate = (
5
5
  testTitle: string,
6
6
  testRootPath: string,
7
7
  args: TranslateRunArgs,
8
+ ignoreFileContent = true,
8
9
  ) => {
9
10
  test.skip(testTitle, async () => {
10
11
  const {inputPath, outputPath} = getTestPaths(testRootPath);
11
12
 
12
13
  await TestAdapter.testTranslatePass(inputPath, outputPath, args);
13
14
 
14
- await compareDirectories(outputPath, true);
15
+ await compareDirectories(outputPath, ignoreFileContent);
15
16
  });
16
17
  };
17
18
 
@@ -29,7 +30,26 @@ const generateFilesYamlTestTemplate = (
29
30
  });
30
31
  };
31
32
 
33
+ const buildFilesYamlTestTemplate = (
34
+ testTitle: string,
35
+ testRootPath: string,
36
+ buildProps: {md2md?: boolean; md2html?: boolean},
37
+ ) => {
38
+ test(testTitle, async () => {
39
+ const {inputPath, outputPath} = getTestPaths(testRootPath);
40
+ const {md2md, md2html} =buildProps;
41
+
42
+ await TestAdapter.testBuildPass(inputPath, outputPath, {md2html, md2md});
43
+
44
+ await compareDirectories(outputPath);
45
+ });
46
+ };
47
+
32
48
  describe('Translate command', () => {
49
+ buildFilesYamlTestTemplate('build translated md files and remove no-translate directives', 'mocks/translation/no-translate', {md2md: true});
50
+
51
+ buildFilesYamlTestTemplate('build translated static files and remove no-translate directives', 'mocks/translation/no-translate', {md2html: true});
52
+
33
53
  generateFilesYamlTestTemplate('extract openapi spec files', 'mocks/translation/openapi', {
34
54
  subcommand: 'extract',
35
55
  source: 'ru-RU',
@@ -53,6 +73,17 @@ describe('Translate command', () => {
53
73
  },
54
74
  );
55
75
 
76
+ generateMapTestTemplate(
77
+ 'test no-translate directive',
78
+ 'mocks/translation/no-translate',
79
+ {
80
+ subcommand: 'extract',
81
+ source: 'ru-RU',
82
+ target: 'es-ES',
83
+ },
84
+ false,
85
+ );
86
+
56
87
  generateFilesYamlTestTemplate('extract yaml scheme files', 'mocks/translation/yaml-scheme', {
57
88
  subcommand: 'extract',
58
89
  source: 'ru-RU',
@@ -11,6 +11,7 @@ export function platformless(text: string): string {
11
11
  export function hashless(text: string): string {
12
12
  return text
13
13
  .replace(/-[a-z0-9]{12}\./g, '-hash.')
14
+ .replace(/(\/|\\)[a-z0-9]{12,13}-(index|registry|resources)\./g, '/hash-$2.');
14
15
  }
15
16
 
16
17
  export function bundleless(text: string): string {
@@ -0,0 +1,3 @@
1
+ # Header
2
+
3
+ Content
@@ -0,0 +1 @@
1
+ href: index.md
@@ -0,0 +1,7 @@
1
+ ## Index header
2
+
3
+ ::no-translate [adsfasdfasdfasdfasdf]
4
+
5
+ lorem
6
+
7
+ asdfasdfasdf
@@ -0,0 +1,37 @@
1
+ # No-translate directive
2
+
3
+ ## Block directive
4
+ :::no-translate
5
+ ### No-translate header
6
+ Should not be translated.
7
+ Can use **markup** inside.
8
+ :::
9
+
10
+ ## Leaf directive
11
+
12
+ ::no-translate [## /usr/local/bin/application]
13
+ ::no-translate[**C:\Program Files\Application\config.ini**]
14
+ ::no-translate [~/Documents/project/src/main.rs]
15
+
16
+
17
+ - :no-translate[GET /api/v1/users] — get all users
18
+ - :no-translate[POST /api/v1/auth/login] — authorization
19
+ - :no-translate[PUT /api/v1/users/{id}] — update users data
20
+
21
+ ## Simple case leaf
22
+ Install using command.
23
+ :no-translate[The default port is unless specified.] Next sentence.
24
+ Set NODE_ENV=production for production builds.
25
+
26
+ ## Simple case inline
27
+ Install using :no-translate[npm install @company/package] command.
28
+ The default port is :no-translate[8080] unless specified.
29
+ Set :no-translate[NODE_ENV=production] for production builds.
30
+
31
+ ## Few inline directives
32
+ Use :no-translate[**GET /api/v1/users**] to list users and :no-translate[POST /api/v1/users] to create.
33
+
34
+ ## Empty inline directive
35
+ This is text with empty :no-translate[] directive.
36
+
37
+
@@ -0,0 +1,37 @@
1
+ openapi: 3.0.1
2
+ info:
3
+ title: OpenAPI definition
4
+ version: v0
5
+ servers:
6
+ - url: http://localhost:8080
7
+ description: Generated server url
8
+ paths:
9
+ /test:
10
+ get:
11
+ tags:
12
+ - test-controller
13
+ summary: Simple get operation. тест новой верстки 3
14
+ description: Defines a simple get :no-translate[skip this] operation with no inputs and a complex
15
+ operationId: getWithPayloadResponse
16
+ responses:
17
+ "200":
18
+ description: 200!!!!
19
+ content:
20
+ application/json:
21
+ schema:
22
+ $ref: '#/components/schemas/RecurceTop'
23
+ components:
24
+ schemas:
25
+ RecurceTop:
26
+ type: object
27
+ properties:
28
+ A:
29
+ type: string
30
+ # $ref: '#/components/schemas/RecurceMiddle'
31
+ RecurceMiddle:
32
+ type: object
33
+ properties:
34
+ B:
35
+ type: array
36
+ items:
37
+ $ref: '#/components/schemas/RecurceTop'
@@ -0,0 +1,11 @@
1
+ title: Test123
2
+ href: index.md
3
+ items:
4
+ - name: Не переводить
5
+ href: no-translate.md
6
+ - name: openapi
7
+ include:
8
+ path: openapi
9
+ includers:
10
+ - name: openapi
11
+ input: openapi-spec.yaml
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diplodoc/cli-tests",
3
- "version": "5.0.10",
3
+ "version": "5.0.12",
4
4
  "bin": {
5
5
  "diplodoc-cli-test": "bin.mjs"
6
6
  },