@diplodoc/cli-tests 5.12.1 → 5.12.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__/preprocess.test.ts.snap +279 -21
- package/e2e/alternates.test.ts +1 -0
- package/e2e/bundles.spec.ts +1 -0
- package/e2e/errors.spec.ts +18 -8
- package/e2e/generate-map.spec.ts +6 -2
- package/e2e/include-toc.test.ts +1 -0
- package/e2e/load-custom-resources.spec.ts +1 -0
- package/e2e/metadata.spec.ts +1 -0
- package/e2e/plugin-corner-cases.spec.ts +1 -0
- package/e2e/preprocess.test.ts +8 -5
- package/e2e/redirects-validation.spec.ts +5 -4
- package/e2e/regression.test.ts +1 -0
- package/e2e/restricted-access.test.ts +3 -5
- package/e2e/rtl.spec.ts +1 -0
- package/e2e/search.test.ts +1 -0
- package/e2e/single-page.spec.ts +1 -0
- package/e2e/skip-html-extension.spec.ts +1 -0
- package/e2e/translation.spec.ts +17 -6
- package/fixtures/cliAdapter.ts +7 -3
- package/fixtures/globals.d.ts +1 -1
- package/fixtures/runners/binary.ts +5 -2
- package/fixtures/runners/index.ts +2 -1
- package/fixtures/runners/source.ts +1 -1
- package/fixtures/utils/file.ts +20 -16
- package/fixtures/utils/test.ts +19 -19
- package/mocks/preprocess/input/autotitle.md +3 -0
- package/mocks/preprocess/input/includes/level1.md +9 -0
- package/mocks/preprocess/input/includes/level11.md +1 -0
- package/mocks/preprocess/input/includes/sub/level2.md +7 -0
- package/mocks/preprocess/input/level0.md +7 -0
- package/mocks/preprocess/input/level1/level1.md +7 -0
- package/mocks/preprocess/input/level1/level2/level2.md +6 -0
- package/mocks/preprocess/input/level1/toc.yaml +5 -0
- package/mocks/preprocess/input/toc.yaml +8 -0
- package/package.json +1 -1
|
@@ -12,11 +12,16 @@ exports[`Preprocess > HashIncludes=true,Autotitles=false > filelist 1`] = `
|
|
|
12
12
|
"includes.md",
|
|
13
13
|
"includes/deep-hash.md",
|
|
14
14
|
"includes/deepWithIndent-hash.md",
|
|
15
|
+
"includes/level11.md",
|
|
15
16
|
"includes/sub/user-hash.md",
|
|
16
17
|
"includes/sub/userWithIndent-hash.md",
|
|
17
18
|
"includes/test-hash.md",
|
|
18
19
|
"includes/user-hash.md",
|
|
19
20
|
"latex.md",
|
|
21
|
+
"level0.md",
|
|
22
|
+
"level1/level1.md",
|
|
23
|
+
"level1/level2/level2.md",
|
|
24
|
+
"level1/toc.yaml",
|
|
20
25
|
"mermaid.md",
|
|
21
26
|
"sub/folder/item-1.md",
|
|
22
27
|
"toc.yaml"
|
|
@@ -105,6 +110,9 @@ Reference link with hash
|
|
|
105
110
|
[link]: ./mermaid.md
|
|
106
111
|
[link-with-hash]: ./1.md#subtitle
|
|
107
112
|
|
|
113
|
+
Link another level
|
|
114
|
+
[{#T}](./includes/level11.md)
|
|
115
|
+
|
|
108
116
|
## Header {#header}
|
|
109
117
|
|
|
110
118
|
Content
|
|
@@ -285,11 +293,22 @@ Link to mermaid diagram from 1 level
|
|
|
285
293
|
`;
|
|
286
294
|
|
|
287
295
|
exports[`Preprocess > HashIncludes=true,Autotitles=false 9`] = `
|
|
288
|
-
"
|
|
296
|
+
"---
|
|
297
|
+
metadata:
|
|
298
|
+
- name: generator
|
|
299
|
+
content: Diplodoc Platform vDIPLODOC-VERSION
|
|
300
|
+
vcsPath: includes/level11.md
|
|
301
|
+
---
|
|
302
|
+
# Level 11 svg header 
|
|
289
303
|
"
|
|
290
304
|
`;
|
|
291
305
|
|
|
292
306
|
exports[`Preprocess > HashIncludes=true,Autotitles=false 10`] = `
|
|
307
|
+
"Bob
|
|
308
|
+
"
|
|
309
|
+
`;
|
|
310
|
+
|
|
311
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=false 11`] = `
|
|
293
312
|
"Link to mermaid diagram from 2 level
|
|
294
313
|
[](../../mermaid.md)
|
|
295
314
|
|
|
@@ -297,17 +316,17 @@ exports[`Preprocess > HashIncludes=true,Autotitles=false 10`] = `
|
|
|
297
316
|
Bob"
|
|
298
317
|
`;
|
|
299
318
|
|
|
300
|
-
exports[`Preprocess > HashIncludes=true,Autotitles=false
|
|
319
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=false 12`] = `
|
|
301
320
|
"Test
|
|
302
321
|
"
|
|
303
322
|
`;
|
|
304
323
|
|
|
305
|
-
exports[`Preprocess > HashIncludes=true,Autotitles=false
|
|
324
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=false 13`] = `
|
|
306
325
|
"Bob
|
|
307
326
|
"
|
|
308
327
|
`;
|
|
309
328
|
|
|
310
|
-
exports[`Preprocess > HashIncludes=true,Autotitles=false
|
|
329
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=false 14`] = `
|
|
311
330
|
"---
|
|
312
331
|
metadata:
|
|
313
332
|
- name: generator
|
|
@@ -320,7 +339,66 @@ $/sqrt{3x-1}+(1+x)^2$
|
|
|
320
339
|
"
|
|
321
340
|
`;
|
|
322
341
|
|
|
323
|
-
exports[`Preprocess > HashIncludes=true,Autotitles=false
|
|
342
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=false 15`] = `
|
|
343
|
+
"---
|
|
344
|
+
metadata:
|
|
345
|
+
- name: generator
|
|
346
|
+
content: Diplodoc Platform vDIPLODOC-VERSION
|
|
347
|
+
vcsPath: level0.md
|
|
348
|
+
---
|
|
349
|
+
# Level root svg header 
|
|
350
|
+
|
|
351
|
+
[{#T}](images.md)
|
|
352
|
+
|
|
353
|
+
[{#T}](level1/level1.md)
|
|
354
|
+
|
|
355
|
+
[{#T}](level1/level2/level2.md)
|
|
356
|
+
"
|
|
357
|
+
`;
|
|
358
|
+
|
|
359
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=false 16`] = `
|
|
360
|
+
"---
|
|
361
|
+
metadata:
|
|
362
|
+
- name: generator
|
|
363
|
+
content: Diplodoc Platform vDIPLODOC-VERSION
|
|
364
|
+
vcsPath: level1/level1.md
|
|
365
|
+
---
|
|
366
|
+
# Level 1 svg header 
|
|
367
|
+
|
|
368
|
+
[{#T}](../level0.md)
|
|
369
|
+
|
|
370
|
+
[{#T}](level2/level2.md)
|
|
371
|
+
|
|
372
|
+
[{#T}](../includes/level11.md)"
|
|
373
|
+
`;
|
|
374
|
+
|
|
375
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=false 17`] = `
|
|
376
|
+
"---
|
|
377
|
+
metadata:
|
|
378
|
+
- name: generator
|
|
379
|
+
content: Diplodoc Platform vDIPLODOC-VERSION
|
|
380
|
+
vcsPath: level1/level2/level2.md
|
|
381
|
+
---
|
|
382
|
+
# Level 2 svg header 
|
|
383
|
+
|
|
384
|
+
[{#T}](../level1.md)
|
|
385
|
+
|
|
386
|
+
[{#T}](../../level0.md)
|
|
387
|
+
|
|
388
|
+
"
|
|
389
|
+
`;
|
|
390
|
+
|
|
391
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=false 18`] = `
|
|
392
|
+
"items:
|
|
393
|
+
- name: level1
|
|
394
|
+
href: level1.md
|
|
395
|
+
- name: level2
|
|
396
|
+
href: level2/level2.md
|
|
397
|
+
path: level1/toc.yaml
|
|
398
|
+
"
|
|
399
|
+
`;
|
|
400
|
+
|
|
401
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=false 19`] = `
|
|
324
402
|
"---
|
|
325
403
|
metadata:
|
|
326
404
|
- name: generator
|
|
@@ -343,7 +421,7 @@ Some mermaid info
|
|
|
343
421
|
"
|
|
344
422
|
`;
|
|
345
423
|
|
|
346
|
-
exports[`Preprocess > HashIncludes=true,Autotitles=false
|
|
424
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=false 20`] = `
|
|
347
425
|
"---
|
|
348
426
|
metadata:
|
|
349
427
|
- name: generator
|
|
@@ -360,7 +438,7 @@ Item 1 text
|
|
|
360
438
|
"
|
|
361
439
|
`;
|
|
362
440
|
|
|
363
|
-
exports[`Preprocess > HashIncludes=true,Autotitles=false
|
|
441
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=false 21`] = `
|
|
364
442
|
"items:
|
|
365
443
|
- name: Md item with not_var syntax
|
|
366
444
|
href: 1.md
|
|
@@ -382,6 +460,14 @@ exports[`Preprocess > HashIncludes=true,Autotitles=false 16`] = `
|
|
|
382
460
|
href: autotitle.md
|
|
383
461
|
- name: includes
|
|
384
462
|
href: includes.md
|
|
463
|
+
- name: level11
|
|
464
|
+
href: includes/level11.md
|
|
465
|
+
- name: level0
|
|
466
|
+
href: level0.md
|
|
467
|
+
- name: level1
|
|
468
|
+
href: level1/level1.md
|
|
469
|
+
- name: level2
|
|
470
|
+
href: level1/level2/level2.md
|
|
385
471
|
path: toc.yaml
|
|
386
472
|
"
|
|
387
473
|
`;
|
|
@@ -398,11 +484,16 @@ exports[`Preprocess > HashIncludes=true,Autotitles=true > filelist 1`] = `
|
|
|
398
484
|
"includes.md",
|
|
399
485
|
"includes/deep-hash.md",
|
|
400
486
|
"includes/deepWithIndent-hash.md",
|
|
487
|
+
"includes/level11.md",
|
|
401
488
|
"includes/sub/user-hash.md",
|
|
402
489
|
"includes/sub/userWithIndent-hash.md",
|
|
403
490
|
"includes/test-hash.md",
|
|
404
491
|
"includes/user-hash.md",
|
|
405
492
|
"latex.md",
|
|
493
|
+
"level0.md",
|
|
494
|
+
"level1/level1.md",
|
|
495
|
+
"level1/level2/level2.md",
|
|
496
|
+
"level1/toc.yaml",
|
|
406
497
|
"mermaid.md",
|
|
407
498
|
"sub/folder/item-1.md",
|
|
408
499
|
"toc.yaml"
|
|
@@ -491,6 +582,9 @@ Reference link with hash
|
|
|
491
582
|
[link]: ./mermaid.md
|
|
492
583
|
[link-with-hash]: ./1.md#subtitle
|
|
493
584
|
|
|
585
|
+
Link another level
|
|
586
|
+
[Level 11 svg header ](./includes/level11.md)
|
|
587
|
+
|
|
494
588
|
## Header {#header}
|
|
495
589
|
|
|
496
590
|
Content
|
|
@@ -671,11 +765,22 @@ Link to mermaid diagram from 1 level
|
|
|
671
765
|
`;
|
|
672
766
|
|
|
673
767
|
exports[`Preprocess > HashIncludes=true,Autotitles=true 9`] = `
|
|
674
|
-
"
|
|
768
|
+
"---
|
|
769
|
+
metadata:
|
|
770
|
+
- name: generator
|
|
771
|
+
content: Diplodoc Platform vDIPLODOC-VERSION
|
|
772
|
+
vcsPath: includes/level11.md
|
|
773
|
+
---
|
|
774
|
+
# Level 11 svg header 
|
|
675
775
|
"
|
|
676
776
|
`;
|
|
677
777
|
|
|
678
778
|
exports[`Preprocess > HashIncludes=true,Autotitles=true 10`] = `
|
|
779
|
+
"Bob
|
|
780
|
+
"
|
|
781
|
+
`;
|
|
782
|
+
|
|
783
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=true 11`] = `
|
|
679
784
|
"Link to mermaid diagram from 2 level
|
|
680
785
|
[Mermaid usage](../../mermaid.md)
|
|
681
786
|
|
|
@@ -683,17 +788,17 @@ exports[`Preprocess > HashIncludes=true,Autotitles=true 10`] = `
|
|
|
683
788
|
Bob"
|
|
684
789
|
`;
|
|
685
790
|
|
|
686
|
-
exports[`Preprocess > HashIncludes=true,Autotitles=true
|
|
791
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=true 12`] = `
|
|
687
792
|
"Test
|
|
688
793
|
"
|
|
689
794
|
`;
|
|
690
795
|
|
|
691
|
-
exports[`Preprocess > HashIncludes=true,Autotitles=true
|
|
796
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=true 13`] = `
|
|
692
797
|
"Bob
|
|
693
798
|
"
|
|
694
799
|
`;
|
|
695
800
|
|
|
696
|
-
exports[`Preprocess > HashIncludes=true,Autotitles=true
|
|
801
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=true 14`] = `
|
|
697
802
|
"---
|
|
698
803
|
metadata:
|
|
699
804
|
- name: generator
|
|
@@ -706,7 +811,66 @@ $/sqrt{3x-1}+(1+x)^2$
|
|
|
706
811
|
"
|
|
707
812
|
`;
|
|
708
813
|
|
|
709
|
-
exports[`Preprocess > HashIncludes=true,Autotitles=true
|
|
814
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=true 15`] = `
|
|
815
|
+
"---
|
|
816
|
+
metadata:
|
|
817
|
+
- name: generator
|
|
818
|
+
content: Diplodoc Platform vDIPLODOC-VERSION
|
|
819
|
+
vcsPath: level0.md
|
|
820
|
+
---
|
|
821
|
+
# Level root svg header 
|
|
822
|
+
|
|
823
|
+
[Images ](images.md)
|
|
824
|
+
|
|
825
|
+
[Level 1 svg header ](level1/level1.md)
|
|
826
|
+
|
|
827
|
+
[Level 2 svg header ](level1/level2/level2.md)
|
|
828
|
+
"
|
|
829
|
+
`;
|
|
830
|
+
|
|
831
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=true 16`] = `
|
|
832
|
+
"---
|
|
833
|
+
metadata:
|
|
834
|
+
- name: generator
|
|
835
|
+
content: Diplodoc Platform vDIPLODOC-VERSION
|
|
836
|
+
vcsPath: level1/level1.md
|
|
837
|
+
---
|
|
838
|
+
# Level 1 svg header 
|
|
839
|
+
|
|
840
|
+
[Level root svg header ](../level0.md)
|
|
841
|
+
|
|
842
|
+
[Level 2 svg header ](level2/level2.md)
|
|
843
|
+
|
|
844
|
+
[Level 11 svg header ](../includes/level11.md)"
|
|
845
|
+
`;
|
|
846
|
+
|
|
847
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=true 17`] = `
|
|
848
|
+
"---
|
|
849
|
+
metadata:
|
|
850
|
+
- name: generator
|
|
851
|
+
content: Diplodoc Platform vDIPLODOC-VERSION
|
|
852
|
+
vcsPath: level1/level2/level2.md
|
|
853
|
+
---
|
|
854
|
+
# Level 2 svg header 
|
|
855
|
+
|
|
856
|
+
[Level 1 svg header ](../level1.md)
|
|
857
|
+
|
|
858
|
+
[Level root svg header ](../../level0.md)
|
|
859
|
+
|
|
860
|
+
"
|
|
861
|
+
`;
|
|
862
|
+
|
|
863
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=true 18`] = `
|
|
864
|
+
"items:
|
|
865
|
+
- name: level1
|
|
866
|
+
href: level1.md
|
|
867
|
+
- name: level2
|
|
868
|
+
href: level2/level2.md
|
|
869
|
+
path: level1/toc.yaml
|
|
870
|
+
"
|
|
871
|
+
`;
|
|
872
|
+
|
|
873
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=true 19`] = `
|
|
710
874
|
"---
|
|
711
875
|
metadata:
|
|
712
876
|
- name: generator
|
|
@@ -729,7 +893,7 @@ Some mermaid info
|
|
|
729
893
|
"
|
|
730
894
|
`;
|
|
731
895
|
|
|
732
|
-
exports[`Preprocess > HashIncludes=true,Autotitles=true
|
|
896
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=true 20`] = `
|
|
733
897
|
"---
|
|
734
898
|
metadata:
|
|
735
899
|
- name: generator
|
|
@@ -746,7 +910,7 @@ Item 1 text
|
|
|
746
910
|
"
|
|
747
911
|
`;
|
|
748
912
|
|
|
749
|
-
exports[`Preprocess > HashIncludes=true,Autotitles=true
|
|
913
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=true 21`] = `
|
|
750
914
|
"items:
|
|
751
915
|
- name: Md item with not_var syntax
|
|
752
916
|
href: 1.md
|
|
@@ -768,6 +932,14 @@ exports[`Preprocess > HashIncludes=true,Autotitles=true 16`] = `
|
|
|
768
932
|
href: autotitle.md
|
|
769
933
|
- name: includes
|
|
770
934
|
href: includes.md
|
|
935
|
+
- name: level11
|
|
936
|
+
href: includes/level11.md
|
|
937
|
+
- name: level0
|
|
938
|
+
href: level0.md
|
|
939
|
+
- name: level1
|
|
940
|
+
href: level1/level1.md
|
|
941
|
+
- name: level2
|
|
942
|
+
href: level1/level2/level2.md
|
|
771
943
|
path: toc.yaml
|
|
772
944
|
"
|
|
773
945
|
`;
|
|
@@ -784,11 +956,16 @@ exports[`Preprocess > HashIncludes=true,Autotitles=true,Svg=true > filelist 1`]
|
|
|
784
956
|
"includes.md",
|
|
785
957
|
"includes/deep-hash.md",
|
|
786
958
|
"includes/deepWithIndent-hash.md",
|
|
959
|
+
"includes/level11.md",
|
|
787
960
|
"includes/sub/user-hash.md",
|
|
788
961
|
"includes/sub/userWithIndent-hash.md",
|
|
789
962
|
"includes/test-hash.md",
|
|
790
963
|
"includes/user-hash.md",
|
|
791
964
|
"latex.md",
|
|
965
|
+
"level0.md",
|
|
966
|
+
"level1/level1.md",
|
|
967
|
+
"level1/level2/level2.md",
|
|
968
|
+
"level1/toc.yaml",
|
|
792
969
|
"mermaid.md",
|
|
793
970
|
"sub/folder/item-1.md",
|
|
794
971
|
"toc.yaml"
|
|
@@ -877,6 +1054,9 @@ Reference link with hash
|
|
|
877
1054
|
[link]: ./mermaid.md
|
|
878
1055
|
[link-with-hash]: ./1.md#subtitle
|
|
879
1056
|
|
|
1057
|
+
Link another level
|
|
1058
|
+
[Level 11 svg header ](./includes/level11.md)
|
|
1059
|
+
|
|
880
1060
|
## Header {#header}
|
|
881
1061
|
|
|
882
1062
|
Content
|
|
@@ -1057,11 +1237,22 @@ Link to mermaid diagram from 1 level
|
|
|
1057
1237
|
`;
|
|
1058
1238
|
|
|
1059
1239
|
exports[`Preprocess > HashIncludes=true,Autotitles=true,Svg=true 9`] = `
|
|
1060
|
-
"
|
|
1240
|
+
"---
|
|
1241
|
+
metadata:
|
|
1242
|
+
- name: generator
|
|
1243
|
+
content: Diplodoc Platform vDIPLODOC-VERSION
|
|
1244
|
+
vcsPath: includes/level11.md
|
|
1245
|
+
---
|
|
1246
|
+
# Level 11 svg header <svg width="20px" height="20px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" id="rnd-hash__search" version="1.1" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g id="rnd-hash__search_1_"><linearGradient gradientUnits="userSpaceOnUse" id="rnd-hash__SVGID_1_" x1="57.9473" x2="407.9511" y1="351.4531" y2="149.3783"><stop offset="0" stop-color="#F14D5C"/><stop offset="0.1309" stop-color="#F05454"/><stop offset="0.3346" stop-color="#3bf488"/><stop offset="0.3492" stop-color="#ED683C"/><stop offset="0.714" stop-color="#1e15a3"/><stop offset="1" stop-color="#FDC70C"/></linearGradient><path d="M300.766,87.509c-33.056,0-64.133,12.873-87.507,36.246c-23.374,23.374-36.247,54.451-36.247,87.507 c0,24.234,6.927,47.4,19.83,67.252l-12.669,12.669c0,0.001-0.001,0.001-0.001,0.001l-90.664,90.665 c-8.353,8.354-7.88,22.418,1.055,31.353l4.261,4.262c4.669,4.668,10.736,7.028,16.658,7.028c5.417,0,10.713-1.976,14.703-5.966 l15.405-15.405l75.259-75.259l12.671-12.672c19.85,12.9,43.014,19.826,67.246,19.826c33.056,0,64.133-12.873,87.506-36.247 c48.252-48.251,48.252-126.762,0-175.014C364.898,100.382,333.821,87.509,300.766,87.509z M138.518,396.049 c-4.454,4.453-12.178,3.979-17.219-1.063l-4.261-4.262c-5.036-5.035-5.509-12.756-1.055-17.21l71.38-71.38 c3.284,4.164,6.834,8.16,10.601,11.926c3.766,3.766,7.764,7.318,11.935,10.607L138.518,396.049z M105.894,410.391l-4.261-4.26 c-5.036-5.036-5.509-12.757-1.055-17.211l2.902-2.902c0.936,4.27,3.101,8.393,6.486,11.779l4.261,4.26 c3.392,3.393,7.523,5.549,11.799,6.483l-2.914,2.914C118.658,415.908,110.934,415.432,105.894,410.391z M213.788,320.779 c0.002-0.003,0.005-0.006,0.007-0.008l0,0L213.788,320.779z M217.033,317.534c-4.201-3.248-8.229-6.775-11.998-10.544 c-3.771-3.771-7.295-7.797-10.537-11.99l8.214-8.214c3.233,4.181,6.749,8.185,10.547,11.982c3.8,3.8,7.806,7.317,11.989,10.552 L217.033,317.534z M381.201,291.697c-21.485,21.485-50.052,33.318-80.436,33.318c-30.385,0-58.951-11.833-80.436-33.318 c-21.485-21.484-33.318-50.051-33.318-80.436s11.833-58.95,33.318-80.436c21.485-21.485,50.051-33.317,80.436-33.317 c30.384,0,58.95,11.832,80.436,33.317C425.553,175.179,425.553,247.346,381.201,291.697z" fill="url(#rnd-hash__SVGID_1_)"/><path d="M258.117,115.27l3.604,9.328c2.592-1.001,5.267-1.887,7.949-2.632l-2.676-9.636 C263.998,113.162,261.012,114.151,258.117,115.27z" fill="#3bf488ff"/><path d="M206.264,162.886l8.985,4.389c8.299-16.992,22.191-30.997,39.118-39.433l-4.46-8.95 C231.022,128.304,215.523,143.928,206.264,162.886z" fill="#1e15a3ff"/></g></svg>
|
|
1061
1247
|
"
|
|
1062
1248
|
`;
|
|
1063
1249
|
|
|
1064
1250
|
exports[`Preprocess > HashIncludes=true,Autotitles=true,Svg=true 10`] = `
|
|
1251
|
+
"Bob
|
|
1252
|
+
"
|
|
1253
|
+
`;
|
|
1254
|
+
|
|
1255
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=true,Svg=true 11`] = `
|
|
1065
1256
|
"Link to mermaid diagram from 2 level
|
|
1066
1257
|
[Mermaid usage](../../mermaid.md)
|
|
1067
1258
|
|
|
@@ -1069,17 +1260,17 @@ exports[`Preprocess > HashIncludes=true,Autotitles=true,Svg=true 10`] = `
|
|
|
1069
1260
|
Bob"
|
|
1070
1261
|
`;
|
|
1071
1262
|
|
|
1072
|
-
exports[`Preprocess > HashIncludes=true,Autotitles=true,Svg=true
|
|
1263
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=true,Svg=true 12`] = `
|
|
1073
1264
|
"Test
|
|
1074
1265
|
"
|
|
1075
1266
|
`;
|
|
1076
1267
|
|
|
1077
|
-
exports[`Preprocess > HashIncludes=true,Autotitles=true,Svg=true
|
|
1268
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=true,Svg=true 13`] = `
|
|
1078
1269
|
"Bob
|
|
1079
1270
|
"
|
|
1080
1271
|
`;
|
|
1081
1272
|
|
|
1082
|
-
exports[`Preprocess > HashIncludes=true,Autotitles=true,Svg=true
|
|
1273
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=true,Svg=true 14`] = `
|
|
1083
1274
|
"---
|
|
1084
1275
|
metadata:
|
|
1085
1276
|
- name: generator
|
|
@@ -1092,7 +1283,66 @@ $/sqrt{3x-1}+(1+x)^2$
|
|
|
1092
1283
|
"
|
|
1093
1284
|
`;
|
|
1094
1285
|
|
|
1095
|
-
exports[`Preprocess > HashIncludes=true,Autotitles=true,Svg=true
|
|
1286
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=true,Svg=true 15`] = `
|
|
1287
|
+
"---
|
|
1288
|
+
metadata:
|
|
1289
|
+
- name: generator
|
|
1290
|
+
content: Diplodoc Platform vDIPLODOC-VERSION
|
|
1291
|
+
vcsPath: level0.md
|
|
1292
|
+
---
|
|
1293
|
+
# Level root svg header <svg width="20px" height="20px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" id="rnd-hash__search" version="1.1" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g id="rnd-hash__search_1_"><linearGradient gradientUnits="userSpaceOnUse" id="rnd-hash__SVGID_1_" x1="57.9473" x2="407.9511" y1="351.4531" y2="149.3783"><stop offset="0" stop-color="#F14D5C"/><stop offset="0.1309" stop-color="#F05454"/><stop offset="0.3346" stop-color="#3bf488"/><stop offset="0.3492" stop-color="#ED683C"/><stop offset="0.714" stop-color="#1e15a3"/><stop offset="1" stop-color="#FDC70C"/></linearGradient><path d="M300.766,87.509c-33.056,0-64.133,12.873-87.507,36.246c-23.374,23.374-36.247,54.451-36.247,87.507 c0,24.234,6.927,47.4,19.83,67.252l-12.669,12.669c0,0.001-0.001,0.001-0.001,0.001l-90.664,90.665 c-8.353,8.354-7.88,22.418,1.055,31.353l4.261,4.262c4.669,4.668,10.736,7.028,16.658,7.028c5.417,0,10.713-1.976,14.703-5.966 l15.405-15.405l75.259-75.259l12.671-12.672c19.85,12.9,43.014,19.826,67.246,19.826c33.056,0,64.133-12.873,87.506-36.247 c48.252-48.251,48.252-126.762,0-175.014C364.898,100.382,333.821,87.509,300.766,87.509z M138.518,396.049 c-4.454,4.453-12.178,3.979-17.219-1.063l-4.261-4.262c-5.036-5.035-5.509-12.756-1.055-17.21l71.38-71.38 c3.284,4.164,6.834,8.16,10.601,11.926c3.766,3.766,7.764,7.318,11.935,10.607L138.518,396.049z M105.894,410.391l-4.261-4.26 c-5.036-5.036-5.509-12.757-1.055-17.211l2.902-2.902c0.936,4.27,3.101,8.393,6.486,11.779l4.261,4.26 c3.392,3.393,7.523,5.549,11.799,6.483l-2.914,2.914C118.658,415.908,110.934,415.432,105.894,410.391z M213.788,320.779 c0.002-0.003,0.005-0.006,0.007-0.008l0,0L213.788,320.779z M217.033,317.534c-4.201-3.248-8.229-6.775-11.998-10.544 c-3.771-3.771-7.295-7.797-10.537-11.99l8.214-8.214c3.233,4.181,6.749,8.185,10.547,11.982c3.8,3.8,7.806,7.317,11.989,10.552 L217.033,317.534z M381.201,291.697c-21.485,21.485-50.052,33.318-80.436,33.318c-30.385,0-58.951-11.833-80.436-33.318 c-21.485-21.484-33.318-50.051-33.318-80.436s11.833-58.95,33.318-80.436c21.485-21.485,50.051-33.317,80.436-33.317 c30.384,0,58.95,11.832,80.436,33.317C425.553,175.179,425.553,247.346,381.201,291.697z" fill="url(#rnd-hash__SVGID_1_)"/><path d="M258.117,115.27l3.604,9.328c2.592-1.001,5.267-1.887,7.949-2.632l-2.676-9.636 C263.998,113.162,261.012,114.151,258.117,115.27z" fill="#3bf488ff"/><path d="M206.264,162.886l8.985,4.389c8.299-16.992,22.191-30.997,39.118-39.433l-4.46-8.95 C231.022,128.304,215.523,143.928,206.264,162.886z" fill="#1e15a3ff"/></g></svg>
|
|
1294
|
+
|
|
1295
|
+
[Images ](images.md)
|
|
1296
|
+
|
|
1297
|
+
[Level 1 svg header ](level1/level1.md)
|
|
1298
|
+
|
|
1299
|
+
[Level 2 svg header ](level1/level2/level2.md)
|
|
1300
|
+
"
|
|
1301
|
+
`;
|
|
1302
|
+
|
|
1303
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=true,Svg=true 16`] = `
|
|
1304
|
+
"---
|
|
1305
|
+
metadata:
|
|
1306
|
+
- name: generator
|
|
1307
|
+
content: Diplodoc Platform vDIPLODOC-VERSION
|
|
1308
|
+
vcsPath: level1/level1.md
|
|
1309
|
+
---
|
|
1310
|
+
# Level 1 svg header <svg width="20px" height="20px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" id="rnd-hash__search" version="1.1" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g id="rnd-hash__search_1_"><linearGradient gradientUnits="userSpaceOnUse" id="rnd-hash__SVGID_1_" x1="57.9473" x2="407.9511" y1="351.4531" y2="149.3783"><stop offset="0" stop-color="#F14D5C"/><stop offset="0.1309" stop-color="#F05454"/><stop offset="0.3346" stop-color="#3bf488"/><stop offset="0.3492" stop-color="#ED683C"/><stop offset="0.714" stop-color="#1e15a3"/><stop offset="1" stop-color="#FDC70C"/></linearGradient><path d="M300.766,87.509c-33.056,0-64.133,12.873-87.507,36.246c-23.374,23.374-36.247,54.451-36.247,87.507 c0,24.234,6.927,47.4,19.83,67.252l-12.669,12.669c0,0.001-0.001,0.001-0.001,0.001l-90.664,90.665 c-8.353,8.354-7.88,22.418,1.055,31.353l4.261,4.262c4.669,4.668,10.736,7.028,16.658,7.028c5.417,0,10.713-1.976,14.703-5.966 l15.405-15.405l75.259-75.259l12.671-12.672c19.85,12.9,43.014,19.826,67.246,19.826c33.056,0,64.133-12.873,87.506-36.247 c48.252-48.251,48.252-126.762,0-175.014C364.898,100.382,333.821,87.509,300.766,87.509z M138.518,396.049 c-4.454,4.453-12.178,3.979-17.219-1.063l-4.261-4.262c-5.036-5.035-5.509-12.756-1.055-17.21l71.38-71.38 c3.284,4.164,6.834,8.16,10.601,11.926c3.766,3.766,7.764,7.318,11.935,10.607L138.518,396.049z M105.894,410.391l-4.261-4.26 c-5.036-5.036-5.509-12.757-1.055-17.211l2.902-2.902c0.936,4.27,3.101,8.393,6.486,11.779l4.261,4.26 c3.392,3.393,7.523,5.549,11.799,6.483l-2.914,2.914C118.658,415.908,110.934,415.432,105.894,410.391z M213.788,320.779 c0.002-0.003,0.005-0.006,0.007-0.008l0,0L213.788,320.779z M217.033,317.534c-4.201-3.248-8.229-6.775-11.998-10.544 c-3.771-3.771-7.295-7.797-10.537-11.99l8.214-8.214c3.233,4.181,6.749,8.185,10.547,11.982c3.8,3.8,7.806,7.317,11.989,10.552 L217.033,317.534z M381.201,291.697c-21.485,21.485-50.052,33.318-80.436,33.318c-30.385,0-58.951-11.833-80.436-33.318 c-21.485-21.484-33.318-50.051-33.318-80.436s11.833-58.95,33.318-80.436c21.485-21.485,50.051-33.317,80.436-33.317 c30.384,0,58.95,11.832,80.436,33.317C425.553,175.179,425.553,247.346,381.201,291.697z" fill="url(#rnd-hash__SVGID_1_)"/><path d="M258.117,115.27l3.604,9.328c2.592-1.001,5.267-1.887,7.949-2.632l-2.676-9.636 C263.998,113.162,261.012,114.151,258.117,115.27z" fill="#3bf488ff"/><path d="M206.264,162.886l8.985,4.389c8.299-16.992,22.191-30.997,39.118-39.433l-4.46-8.95 C231.022,128.304,215.523,143.928,206.264,162.886z" fill="#1e15a3ff"/></g></svg>
|
|
1311
|
+
|
|
1312
|
+
[Level root svg header ](../level0.md)
|
|
1313
|
+
|
|
1314
|
+
[Level 2 svg header ](level2/level2.md)
|
|
1315
|
+
|
|
1316
|
+
[Level 11 svg header ](../includes/level11.md)"
|
|
1317
|
+
`;
|
|
1318
|
+
|
|
1319
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=true,Svg=true 17`] = `
|
|
1320
|
+
"---
|
|
1321
|
+
metadata:
|
|
1322
|
+
- name: generator
|
|
1323
|
+
content: Diplodoc Platform vDIPLODOC-VERSION
|
|
1324
|
+
vcsPath: level1/level2/level2.md
|
|
1325
|
+
---
|
|
1326
|
+
# Level 2 svg header <svg width="20px" height="20px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" id="rnd-hash__search" version="1.1" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g id="rnd-hash__search_1_"><linearGradient gradientUnits="userSpaceOnUse" id="rnd-hash__SVGID_1_" x1="57.9473" x2="407.9511" y1="351.4531" y2="149.3783"><stop offset="0" stop-color="#F14D5C"/><stop offset="0.1309" stop-color="#F05454"/><stop offset="0.3346" stop-color="#3bf488"/><stop offset="0.3492" stop-color="#ED683C"/><stop offset="0.714" stop-color="#1e15a3"/><stop offset="1" stop-color="#FDC70C"/></linearGradient><path d="M300.766,87.509c-33.056,0-64.133,12.873-87.507,36.246c-23.374,23.374-36.247,54.451-36.247,87.507 c0,24.234,6.927,47.4,19.83,67.252l-12.669,12.669c0,0.001-0.001,0.001-0.001,0.001l-90.664,90.665 c-8.353,8.354-7.88,22.418,1.055,31.353l4.261,4.262c4.669,4.668,10.736,7.028,16.658,7.028c5.417,0,10.713-1.976,14.703-5.966 l15.405-15.405l75.259-75.259l12.671-12.672c19.85,12.9,43.014,19.826,67.246,19.826c33.056,0,64.133-12.873,87.506-36.247 c48.252-48.251,48.252-126.762,0-175.014C364.898,100.382,333.821,87.509,300.766,87.509z M138.518,396.049 c-4.454,4.453-12.178,3.979-17.219-1.063l-4.261-4.262c-5.036-5.035-5.509-12.756-1.055-17.21l71.38-71.38 c3.284,4.164,6.834,8.16,10.601,11.926c3.766,3.766,7.764,7.318,11.935,10.607L138.518,396.049z M105.894,410.391l-4.261-4.26 c-5.036-5.036-5.509-12.757-1.055-17.211l2.902-2.902c0.936,4.27,3.101,8.393,6.486,11.779l4.261,4.26 c3.392,3.393,7.523,5.549,11.799,6.483l-2.914,2.914C118.658,415.908,110.934,415.432,105.894,410.391z M213.788,320.779 c0.002-0.003,0.005-0.006,0.007-0.008l0,0L213.788,320.779z M217.033,317.534c-4.201-3.248-8.229-6.775-11.998-10.544 c-3.771-3.771-7.295-7.797-10.537-11.99l8.214-8.214c3.233,4.181,6.749,8.185,10.547,11.982c3.8,3.8,7.806,7.317,11.989,10.552 L217.033,317.534z M381.201,291.697c-21.485,21.485-50.052,33.318-80.436,33.318c-30.385,0-58.951-11.833-80.436-33.318 c-21.485-21.484-33.318-50.051-33.318-80.436s11.833-58.95,33.318-80.436c21.485-21.485,50.051-33.317,80.436-33.317 c30.384,0,58.95,11.832,80.436,33.317C425.553,175.179,425.553,247.346,381.201,291.697z" fill="url(#rnd-hash__SVGID_1_)"/><path d="M258.117,115.27l3.604,9.328c2.592-1.001,5.267-1.887,7.949-2.632l-2.676-9.636 C263.998,113.162,261.012,114.151,258.117,115.27z" fill="#3bf488ff"/><path d="M206.264,162.886l8.985,4.389c8.299-16.992,22.191-30.997,39.118-39.433l-4.46-8.95 C231.022,128.304,215.523,143.928,206.264,162.886z" fill="#1e15a3ff"/></g></svg>
|
|
1327
|
+
|
|
1328
|
+
[Level 1 svg header ](../level1.md)
|
|
1329
|
+
|
|
1330
|
+
[Level root svg header ](../../level0.md)
|
|
1331
|
+
|
|
1332
|
+
"
|
|
1333
|
+
`;
|
|
1334
|
+
|
|
1335
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=true,Svg=true 18`] = `
|
|
1336
|
+
"items:
|
|
1337
|
+
- name: level1
|
|
1338
|
+
href: level1.md
|
|
1339
|
+
- name: level2
|
|
1340
|
+
href: level2/level2.md
|
|
1341
|
+
path: level1/toc.yaml
|
|
1342
|
+
"
|
|
1343
|
+
`;
|
|
1344
|
+
|
|
1345
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=true,Svg=true 19`] = `
|
|
1096
1346
|
"---
|
|
1097
1347
|
metadata:
|
|
1098
1348
|
- name: generator
|
|
@@ -1115,7 +1365,7 @@ Some mermaid info
|
|
|
1115
1365
|
"
|
|
1116
1366
|
`;
|
|
1117
1367
|
|
|
1118
|
-
exports[`Preprocess > HashIncludes=true,Autotitles=true,Svg=true
|
|
1368
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=true,Svg=true 20`] = `
|
|
1119
1369
|
"---
|
|
1120
1370
|
metadata:
|
|
1121
1371
|
- name: generator
|
|
@@ -1132,7 +1382,7 @@ Item 1 text
|
|
|
1132
1382
|
"
|
|
1133
1383
|
`;
|
|
1134
1384
|
|
|
1135
|
-
exports[`Preprocess > HashIncludes=true,Autotitles=true,Svg=true
|
|
1385
|
+
exports[`Preprocess > HashIncludes=true,Autotitles=true,Svg=true 21`] = `
|
|
1136
1386
|
"items:
|
|
1137
1387
|
- name: Md item with not_var syntax
|
|
1138
1388
|
href: 1.md
|
|
@@ -1154,6 +1404,14 @@ exports[`Preprocess > HashIncludes=true,Autotitles=true,Svg=true 16`] = `
|
|
|
1154
1404
|
href: autotitle.md
|
|
1155
1405
|
- name: includes
|
|
1156
1406
|
href: includes.md
|
|
1407
|
+
- name: level11
|
|
1408
|
+
href: includes/level11.md
|
|
1409
|
+
- name: level0
|
|
1410
|
+
href: level0.md
|
|
1411
|
+
- name: level1
|
|
1412
|
+
href: level1/level1.md
|
|
1413
|
+
- name: level2
|
|
1414
|
+
href: level1/level2/level2.md
|
|
1157
1415
|
path: toc.yaml
|
|
1158
1416
|
"
|
|
1159
1417
|
`;
|
package/e2e/alternates.test.ts
CHANGED
package/e2e/bundles.spec.ts
CHANGED
package/e2e/errors.spec.ts
CHANGED
|
@@ -1,45 +1,55 @@
|
|
|
1
1
|
import type {Report} from '../fixtures/runners/types';
|
|
2
2
|
|
|
3
3
|
import {describe, expect, it} from 'vitest';
|
|
4
|
+
|
|
4
5
|
import {TestAdapter, getTestPaths} from '../fixtures';
|
|
5
6
|
|
|
6
7
|
type TestResult = {
|
|
7
8
|
md: Report;
|
|
8
9
|
html: Report;
|
|
9
|
-
}
|
|
10
|
+
};
|
|
10
11
|
|
|
11
12
|
function test(path: string, expect: Function) {
|
|
12
13
|
it(path, async () => {
|
|
13
14
|
const {inputPath, outputPath} = getTestPaths(path);
|
|
14
15
|
|
|
15
16
|
const md = await TestAdapter.build.run(inputPath, outputPath, ['-j2', '-f', 'md']);
|
|
16
|
-
const html = await TestAdapter.build.run(inputPath, outputPath + '-html', [
|
|
17
|
+
const html = await TestAdapter.build.run(inputPath, outputPath + '-html', [
|
|
18
|
+
'-j2',
|
|
19
|
+
'-f',
|
|
20
|
+
'html',
|
|
21
|
+
]);
|
|
17
22
|
return expect({md, html});
|
|
18
23
|
});
|
|
19
24
|
}
|
|
20
25
|
|
|
21
|
-
|
|
22
26
|
describe('Errors', () => {
|
|
23
27
|
test('mocks/errors/unreachable-link', ({html}: TestResult) => {
|
|
24
28
|
expectErrors(html, [
|
|
25
29
|
'ERR index.md: 1: YFM003 / unreachable-link Link is unreachable [Context: "[Unreachable link: "exists.html"][existing file](./exists.md)"]',
|
|
26
|
-
'ERR index.md: 2: YFM003 / unreachable-link Link is unreachable [Context: "[Unreachable link: "missed.html"][missed file](./missed.md)"]'
|
|
30
|
+
'ERR index.md: 2: YFM003 / unreachable-link Link is unreachable [Context: "[Unreachable link: "missed.html"][missed file](./missed.md)"]',
|
|
27
31
|
]);
|
|
28
32
|
});
|
|
29
33
|
|
|
30
34
|
it('translate extract with filtered links', async () => {
|
|
31
35
|
const {inputPath, outputPath} = getTestPaths('mocks/errors/extract-filtered-link');
|
|
32
36
|
|
|
33
|
-
const result = await TestAdapter.extract.run(inputPath, outputPath, [
|
|
34
|
-
|
|
37
|
+
const result = await TestAdapter.extract.run(inputPath, outputPath, [
|
|
38
|
+
'--source',
|
|
39
|
+
'ru-RU',
|
|
40
|
+
'--target',
|
|
41
|
+
'es-ES',
|
|
42
|
+
'--filter',
|
|
43
|
+
]);
|
|
44
|
+
|
|
35
45
|
expect(result.code).toEqual(1);
|
|
36
|
-
|
|
46
|
+
|
|
37
47
|
expect(result.errors).toEqual([
|
|
38
48
|
"ERR File index.md contains link to filtered.md, which was filtered from toc.yaml or it's not been included initially",
|
|
39
49
|
"ERR File index.md contains link to filtered2.md, which was filtered from toc.yaml or it's not been included initially",
|
|
40
50
|
"ERR File index.md contains link to filtered2.md, which was filtered from toc.yaml or it's not been included initially",
|
|
41
51
|
"ERR File index.md contains link to filtered3.md, which was filtered from toc.yaml or it's not been included initially",
|
|
42
|
-
])
|
|
52
|
+
]);
|
|
43
53
|
});
|
|
44
54
|
});
|
|
45
55
|
|
package/e2e/generate-map.spec.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {describe, expect, test} from 'vitest';
|
|
2
|
-
import {TestAdapter, bundleless, getFileContent, getTestPaths} from '../fixtures';
|
|
3
2
|
import {join} from 'node:path';
|
|
4
3
|
import {readFile} from 'node:fs/promises';
|
|
5
4
|
|
|
5
|
+
import {TestAdapter, bundleless, getFileContent, getTestPaths} from '../fixtures';
|
|
6
|
+
|
|
6
7
|
const generateMapTestTemplate = (
|
|
7
8
|
testTitle: string,
|
|
8
9
|
testRootPath: string,
|
|
@@ -19,7 +20,10 @@ const generateMapTestTemplate = (
|
|
|
19
20
|
});
|
|
20
21
|
|
|
21
22
|
const content = getFileContent(join(outputPath, 'files.json'));
|
|
22
|
-
const manifestContent = await readFile(
|
|
23
|
+
const manifestContent = await readFile(
|
|
24
|
+
join(outputPath, 'yfm-build-manifest.json'),
|
|
25
|
+
'utf-8',
|
|
26
|
+
);
|
|
23
27
|
|
|
24
28
|
expect(bundleless(content)).toMatchSnapshot();
|
|
25
29
|
expect(JSON.parse(manifestContent)).toMatchSnapshot();
|
package/e2e/include-toc.test.ts
CHANGED
package/e2e/metadata.spec.ts
CHANGED
package/e2e/preprocess.test.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {describe, test} from 'vitest';
|
|
2
|
+
|
|
2
3
|
import {TestAdapter, compareDirectories, getTestPaths} from '../fixtures';
|
|
3
4
|
|
|
4
5
|
const generateFilesYamlTestTemplate = (
|
|
@@ -9,7 +10,7 @@ const generateFilesYamlTestTemplate = (
|
|
|
9
10
|
test(testTitle, async () => {
|
|
10
11
|
const {inputPath, outputPath} = getTestPaths(testRootPath);
|
|
11
12
|
await TestAdapter.testBuildPass(inputPath, outputPath, {
|
|
12
|
-
md2md:true,
|
|
13
|
+
md2md: true,
|
|
13
14
|
md2html: false,
|
|
14
15
|
args: args.join(' '),
|
|
15
16
|
});
|
|
@@ -24,14 +25,16 @@ const generateFilesYamlTestTemplate = (
|
|
|
24
25
|
|
|
25
26
|
describe('Preprocess', () => {
|
|
26
27
|
generateFilesYamlTestTemplate('HashIncludes=true,Autotitles=false', 'mocks/preprocess', [
|
|
27
|
-
'--no-merge-autotitles'
|
|
28
|
+
'--no-merge-autotitles',
|
|
28
29
|
]);
|
|
29
30
|
|
|
30
31
|
generateFilesYamlTestTemplate('HashIncludes=true,Autotitles=true', 'mocks/preprocess');
|
|
31
32
|
|
|
32
|
-
generateFilesYamlTestTemplate(
|
|
33
|
-
'
|
|
34
|
-
|
|
33
|
+
generateFilesYamlTestTemplate(
|
|
34
|
+
'HashIncludes=true,Autotitles=true,Svg=true',
|
|
35
|
+
'mocks/preprocess',
|
|
36
|
+
['--merge-svg'],
|
|
37
|
+
);
|
|
35
38
|
|
|
36
39
|
// generateFilesYamlTestTemplate('Nested toc restricted access', 'mocks/preprocess/test3');
|
|
37
40
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {describe, expect, it} from 'vitest';
|
|
2
|
+
|
|
2
3
|
import {TestAdapter, getTestPaths} from '../fixtures';
|
|
3
4
|
|
|
4
5
|
describe('Redirects validation', () => {
|
|
@@ -38,7 +39,9 @@ describe('Redirects validation', () => {
|
|
|
38
39
|
});
|
|
39
40
|
|
|
40
41
|
it('should emit an error when a redirect is malformed', async () => {
|
|
41
|
-
const {inputPath, outputPath} = getTestPaths(
|
|
42
|
+
const {inputPath, outputPath} = getTestPaths(
|
|
43
|
+
'mocks/redirects-validation/malformed-redirect',
|
|
44
|
+
);
|
|
42
45
|
|
|
43
46
|
const report = await TestAdapter.build.run(inputPath, outputPath, ['-f', 'md']);
|
|
44
47
|
|
|
@@ -54,8 +57,6 @@ describe('Redirects validation', () => {
|
|
|
54
57
|
const report = await TestAdapter.build.run(inputPath, outputPath, ['-f', 'md']);
|
|
55
58
|
|
|
56
59
|
expect(report.code).toBe(1);
|
|
57
|
-
expect(report.errors).toContainEqual(
|
|
58
|
-
expect.stringMatching(/Parameters must be different/),
|
|
59
|
-
);
|
|
60
|
+
expect(report.errors).toContainEqual(expect.stringMatching(/Parameters must be different/));
|
|
60
61
|
});
|
|
61
62
|
});
|
package/e2e/regression.test.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import {describe, test} from 'vitest';
|
|
2
|
+
|
|
2
3
|
import {TestAdapter, compareDirectories, getTestPaths} from '../fixtures';
|
|
3
4
|
|
|
4
|
-
const generateFilesYamlTestTemplate = (
|
|
5
|
-
testTitle: string,
|
|
6
|
-
testRootPath: string
|
|
7
|
-
) => {
|
|
5
|
+
const generateFilesYamlTestTemplate = (testTitle: string, testRootPath: string) => {
|
|
8
6
|
test(testTitle, async () => {
|
|
9
7
|
const {inputPath, outputPath} = getTestPaths(testRootPath);
|
|
10
|
-
await TestAdapter.testBuildPass(inputPath, outputPath, {md2md:true});
|
|
8
|
+
await TestAdapter.testBuildPass(inputPath, outputPath, {md2md: true});
|
|
11
9
|
await compareDirectories(outputPath);
|
|
12
10
|
});
|
|
13
11
|
};
|
package/e2e/rtl.spec.ts
CHANGED
package/e2e/search.test.ts
CHANGED
package/e2e/single-page.spec.ts
CHANGED
package/e2e/translation.spec.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import type {TranslateRunArgs} from '../fixtures';
|
|
2
|
+
|
|
1
3
|
import {describe, test} from 'vitest';
|
|
2
|
-
|
|
4
|
+
|
|
5
|
+
import {TestAdapter, compareDirectories, getTestPaths} from '../fixtures';
|
|
3
6
|
|
|
4
7
|
const generateMapTestTemplate = (
|
|
5
8
|
testTitle: string,
|
|
@@ -46,9 +49,17 @@ const buildFilesYamlTestTemplate = (
|
|
|
46
49
|
};
|
|
47
50
|
|
|
48
51
|
describe('Translate command', () => {
|
|
49
|
-
buildFilesYamlTestTemplate(
|
|
52
|
+
buildFilesYamlTestTemplate(
|
|
53
|
+
'build translated md files and remove no-translate directives',
|
|
54
|
+
'mocks/translation/no-translate',
|
|
55
|
+
{md2md: true},
|
|
56
|
+
);
|
|
50
57
|
|
|
51
|
-
buildFilesYamlTestTemplate(
|
|
58
|
+
buildFilesYamlTestTemplate(
|
|
59
|
+
'build translated static files and remove no-translate directives',
|
|
60
|
+
'mocks/translation/no-translate',
|
|
61
|
+
{md2html: true},
|
|
62
|
+
);
|
|
52
63
|
|
|
53
64
|
generateFilesYamlTestTemplate('extract openapi spec files', 'mocks/translation/openapi', {
|
|
54
65
|
subcommand: 'extract',
|
|
@@ -66,7 +77,7 @@ describe('Translate command', () => {
|
|
|
66
77
|
subcommand: 'extract',
|
|
67
78
|
source: 'ru-RU',
|
|
68
79
|
target: 'es-ES',
|
|
69
|
-
additionalArgs: '--filter'
|
|
80
|
+
additionalArgs: '--filter',
|
|
70
81
|
});
|
|
71
82
|
|
|
72
83
|
generateMapTestTemplate(
|
|
@@ -80,7 +91,7 @@ describe('Translate command', () => {
|
|
|
80
91
|
},
|
|
81
92
|
);
|
|
82
93
|
|
|
83
|
-
const vars = {skip: 'prod'}
|
|
94
|
+
const vars = {skip: 'prod'};
|
|
84
95
|
generateMapTestTemplate(
|
|
85
96
|
'filter files on extract with extra vars option',
|
|
86
97
|
'mocks/translation/dir-files',
|
|
@@ -98,7 +109,7 @@ describe('Translate command', () => {
|
|
|
98
109
|
{
|
|
99
110
|
subcommand: 'extract',
|
|
100
111
|
source: 'ru-RU',
|
|
101
|
-
target: 'es-ES',
|
|
112
|
+
target: 'es-ES',
|
|
102
113
|
},
|
|
103
114
|
false,
|
|
104
115
|
);
|
package/fixtures/cliAdapter.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {Runner
|
|
1
|
+
import type {Runner} from './runners';
|
|
2
|
+
|
|
3
|
+
import {createRunner} from './runners';
|
|
2
4
|
import {cleanupDirectory} from './utils/file';
|
|
3
5
|
|
|
4
6
|
export interface BuildRunArgs {
|
|
@@ -76,8 +78,10 @@ export class CliTestAdapter {
|
|
|
76
78
|
const tasks = [];
|
|
77
79
|
|
|
78
80
|
if (md2md && md2html) {
|
|
79
|
-
tasks.push(() => this.build.run(inputPath, outputPath,[...baseArgs, '-f', 'md']));
|
|
80
|
-
tasks.push(() =>
|
|
81
|
+
tasks.push(() => this.build.run(inputPath, outputPath, [...baseArgs, '-f', 'md']));
|
|
82
|
+
tasks.push(() =>
|
|
83
|
+
this.build.run(inputPath, `${outputPath}-html`, [...baseArgs, '-f', 'html']),
|
|
84
|
+
);
|
|
81
85
|
} else if (md2md) {
|
|
82
86
|
tasks.push(() => this.build.run(inputPath, outputPath, [...baseArgs, '-f', 'md']));
|
|
83
87
|
} else {
|
package/fixtures/globals.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {Runner} from './types';
|
|
1
|
+
import type {Runner} from './types';
|
|
2
|
+
|
|
2
3
|
import {execa} from 'execa';
|
|
3
4
|
import strip from 'strip-ansi';
|
|
4
5
|
|
|
@@ -20,6 +21,7 @@ export class BinaryRunner implements Runner {
|
|
|
20
21
|
const restLog = fillLog(/^(?!INFO|WARN|ERR)/, stderr);
|
|
21
22
|
if (restLog.length) {
|
|
22
23
|
for (const line of restLog) {
|
|
24
|
+
// eslint-disable-next-line no-console
|
|
23
25
|
console.log(line);
|
|
24
26
|
}
|
|
25
27
|
}
|
|
@@ -29,7 +31,8 @@ export class BinaryRunner implements Runner {
|
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
function fillLog(filter: RegExp, source: string) {
|
|
32
|
-
return source
|
|
34
|
+
return source
|
|
35
|
+
.split('\n')
|
|
33
36
|
.map((line) => strip(line).trim())
|
|
34
37
|
.filter(Boolean)
|
|
35
38
|
.filter((line) => line.match(filter));
|
|
@@ -7,7 +7,8 @@ import {Runner} from './types';
|
|
|
7
7
|
export {Runner};
|
|
8
8
|
|
|
9
9
|
export function createRunner(): Runner {
|
|
10
|
-
const binaryPath =
|
|
10
|
+
const binaryPath =
|
|
11
|
+
process.env.DIPLODOC_BINARY_PATH || resolve(__dirname, '../../../build/index.js');
|
|
11
12
|
|
|
12
13
|
if (binaryPath) {
|
|
13
14
|
return new BinaryRunner(binaryPath);
|
package/fixtures/utils/file.ts
CHANGED
|
@@ -2,29 +2,29 @@ import {readFileSync} from 'node:fs';
|
|
|
2
2
|
import {rm} from 'node:fs/promises';
|
|
3
3
|
import {join, resolve} from 'node:path';
|
|
4
4
|
import {glob} from 'glob';
|
|
5
|
-
import {bundleless, hashless, platformless} from './test';
|
|
6
5
|
import {expect} from 'vitest';
|
|
7
6
|
|
|
7
|
+
import {bundleless, hashless, platformless} from './test';
|
|
8
|
+
|
|
8
9
|
const SYSTEM_DIRS = ['_bundle/', '_search/'];
|
|
9
10
|
|
|
10
11
|
export function getFileContent(filePath: string) {
|
|
11
12
|
return platformless(bundleless(readFileSync(filePath, 'utf8')));
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
const uselessFile = (file: string, dirs: string[]) =>
|
|
15
|
-
!dirs.some((part) => file.includes(part));
|
|
15
|
+
const uselessFile = (file: string, dirs: string[]) => !dirs.some((part) => file.includes(part));
|
|
16
16
|
|
|
17
17
|
export function stripSystemLinks(content: string) {
|
|
18
|
-
const dirPattern = SYSTEM_DIRS.map(d => d.replace('/', '\\/')).join('|');
|
|
18
|
+
const dirPattern = SYSTEM_DIRS.map((d) => d.replace('/', '\\/')).join('|');
|
|
19
19
|
|
|
20
20
|
content = content.replace(
|
|
21
21
|
new RegExp(`<script[^>]+src="(?:${dirPattern})[^"]*"[^>]*></script>`, 'g'),
|
|
22
|
-
''
|
|
22
|
+
'',
|
|
23
23
|
);
|
|
24
24
|
|
|
25
25
|
content = content.replace(
|
|
26
26
|
new RegExp(`<link[^>]+href="(?:${dirPattern})[^"]*"[^>]*\\/?>`, 'g'),
|
|
27
|
-
''
|
|
27
|
+
'',
|
|
28
28
|
);
|
|
29
29
|
|
|
30
30
|
content = content.replace(/^[ \t]*\r?\n/gm, '');
|
|
@@ -45,34 +45,38 @@ export async function compareDirectories(
|
|
|
45
45
|
nodir: true,
|
|
46
46
|
posix: true,
|
|
47
47
|
})
|
|
48
|
-
)
|
|
48
|
+
)
|
|
49
|
+
.map(bundleless)
|
|
50
|
+
.sort();
|
|
49
51
|
|
|
50
52
|
let filesForSnapshot;
|
|
51
53
|
|
|
52
54
|
if (checkBundle) {
|
|
53
55
|
filesForSnapshot = filesFromOutput;
|
|
54
56
|
} else {
|
|
55
|
-
filesForSnapshot = filesFromOutput.filter(file => uselessFile(file, SYSTEM_DIRS));
|
|
57
|
+
filesForSnapshot = filesFromOutput.filter((file) => uselessFile(file, SYSTEM_DIRS));
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
// Here we sort the order of the included files after all processing
|
|
59
61
|
// This is necessary for better test stability
|
|
60
62
|
// We do not care in what order these files were received and processed
|
|
61
63
|
// We sort only the final list and put it in the snapshot
|
|
62
|
-
filesForSnapshot = filesForSnapshot.map(hashless).sort();
|
|
64
|
+
filesForSnapshot = filesForSnapshot.map(hashless).sort();
|
|
63
65
|
|
|
64
66
|
expect(JSON.stringify(filesForSnapshot, null, 2)).toMatchSnapshot('filelist');
|
|
65
67
|
|
|
66
68
|
if (!ignoreFileContent) {
|
|
67
|
-
filesFromOutput
|
|
68
|
-
|
|
69
|
+
filesFromOutput
|
|
70
|
+
.filter((file) => uselessFile(file, ['_assets/', ...SYSTEM_DIRS]))
|
|
71
|
+
.forEach((filePath) => {
|
|
72
|
+
let content = getFileContent(resolve(outputPath, filePath));
|
|
69
73
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
74
|
+
if (!checkBundle && filePath.endsWith('.html')) {
|
|
75
|
+
content = stripSystemLinks(content);
|
|
76
|
+
}
|
|
73
77
|
|
|
74
|
-
|
|
75
|
-
|
|
78
|
+
expect(content).toMatchSnapshot();
|
|
79
|
+
});
|
|
76
80
|
}
|
|
77
81
|
}
|
|
78
82
|
|
package/fixtures/utils/test.ts
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
|
|
2
1
|
import assets from '@diplodoc/cli/manifest';
|
|
3
2
|
|
|
4
3
|
export function platformless(text: string): string {
|
|
5
4
|
let index = 1;
|
|
6
5
|
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
6
|
+
return (
|
|
7
|
+
hashless(text)
|
|
8
|
+
.replace(/\r\n/g, '\n')
|
|
9
|
+
// Fix for XML equiv-text attributes in Windows - handle various patterns
|
|
10
|
+
.replace(/equiv-text="[\r\n]+ "/g, 'equiv-text=" "')
|
|
11
|
+
.replace(/equiv-text="[\r\n]+&#10;"/g, 'equiv-text="&#10;"')
|
|
12
|
+
// Also normalize any other attributes that might have line ending issues
|
|
13
|
+
.replace(/(ctype|id)="[\r\n]+(.*?)"/g, '$1="$2"')
|
|
14
|
+
.replace(/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}/g, 'UUID')
|
|
15
|
+
.replace(
|
|
16
|
+
/(content"?[:=]{1}[" ]{1}Diplodoc.*? )v\d+\.\d+\.\d+(?:-[\w-]+)?/g,
|
|
17
|
+
`$1vDIPLODOC-VERSION`,
|
|
18
|
+
)
|
|
19
|
+
.replace(/(\\(?![/"'])){1,2}/g, '/')
|
|
20
|
+
.replace(
|
|
21
|
+
/id=\\"inline-code-id-[a-zA-Z0-9]{8}\\"/g,
|
|
22
|
+
() => `id="inline-code-id-${index++}"`,
|
|
23
|
+
)
|
|
24
|
+
);
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
export function hashless(text: string): string {
|
|
@@ -45,4 +46,3 @@ export function bundleless(text: string): string {
|
|
|
45
46
|
|
|
46
47
|
return text;
|
|
47
48
|
}
|
|
48
|
-
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Level 11 svg header 
|