@diplodoc/cli-tests 5.8.4 → 5.9.1
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__/translation.spec.ts.snap +365 -2
- package/e2e/errors.spec.ts +16 -0
- package/e2e/translation.spec.ts +21 -2
- package/fixtures/cliAdapter.ts +23 -0
- package/fixtures/utils/test.ts +5 -0
- package/mocks/errors/extract-filtered-link/input/filtered.md +1 -0
- package/mocks/errors/extract-filtered-link/input/filtered2.md +0 -0
- package/mocks/errors/extract-filtered-link/input/index.md +7 -0
- package/mocks/errors/extract-filtered-link/input/toc.yaml +1 -0
- package/mocks/translation/dir-files/input/.yfm +6 -0
- package/mocks/translation/dir-files/input/ru/aboba.md +2 -4
- package/mocks/translation/dir-files/input/ru/nested/a1.md +3 -0
- package/mocks/translation/dir-files/input/ru/nested/folder1/a1.md +3 -0
- package/mocks/translation/dir-files/input/ru/nested/folder1/toc-i.yaml +3 -0
- package/mocks/translation/dir-files/input/ru/nested/syntax/base.md +2 -0
- package/mocks/translation/dir-files/input/ru/nested/toc.yaml +1 -0
- package/mocks/translation/dir-files/input/ru/no-var-page.md +3 -0
- package/mocks/translation/dir-files/input/ru/to-be-excluded.md +1 -0
- package/mocks/translation/dir-files/input/ru/toc.yaml +7 -1
- package/mocks/translation/openapi/input/toc.yaml +1 -1
- package/package.json +2 -1
|
@@ -612,6 +612,47 @@ path: toc.yaml
|
|
|
612
612
|
"
|
|
613
613
|
`;
|
|
614
614
|
|
|
615
|
+
exports[`Translate command > do not filter files on extract > filelist 1`] = `
|
|
616
|
+
"[
|
|
617
|
+
"es/_includes/test.md.skl",
|
|
618
|
+
"es/_includes/test.md.xliff",
|
|
619
|
+
"es/_no-translate/exclude.md.skl",
|
|
620
|
+
"es/_no-translate/exclude.md.xliff",
|
|
621
|
+
"es/aboba.md.skl",
|
|
622
|
+
"es/aboba.md.xliff",
|
|
623
|
+
"es/index.md.skl",
|
|
624
|
+
"es/index.md.xliff",
|
|
625
|
+
"es/nested/a1.md.skl",
|
|
626
|
+
"es/nested/a1.md.xliff",
|
|
627
|
+
"es/nested/folder1/a1.md.skl",
|
|
628
|
+
"es/nested/folder1/a1.md.xliff",
|
|
629
|
+
"es/nested/folder1/toc-i.yaml.skl",
|
|
630
|
+
"es/nested/folder1/toc-i.yaml.xliff",
|
|
631
|
+
"es/nested/index-yfm.md.skl",
|
|
632
|
+
"es/nested/index-yfm.md.xliff",
|
|
633
|
+
"es/nested/index.yaml.skl",
|
|
634
|
+
"es/nested/index.yaml.xliff",
|
|
635
|
+
"es/nested/not-in-toc.md.skl",
|
|
636
|
+
"es/nested/not-in-toc.md.xliff",
|
|
637
|
+
"es/nested/syntax/base.md.skl",
|
|
638
|
+
"es/nested/syntax/base.md.xliff",
|
|
639
|
+
"es/nested/syntax/index.md.skl",
|
|
640
|
+
"es/nested/syntax/index.md.xliff",
|
|
641
|
+
"es/nested/syntax/lists.md.skl",
|
|
642
|
+
"es/nested/syntax/lists.md.xliff",
|
|
643
|
+
"es/nested/toc.yaml.skl",
|
|
644
|
+
"es/nested/toc.yaml.xliff",
|
|
645
|
+
"es/no-var-page.md.skl",
|
|
646
|
+
"es/no-var-page.md.xliff",
|
|
647
|
+
"es/not-in-toc.md.skl",
|
|
648
|
+
"es/not-in-toc.md.xliff",
|
|
649
|
+
"es/to-be-excluded.md.skl",
|
|
650
|
+
"es/to-be-excluded.md.xliff",
|
|
651
|
+
"es/toc.yaml.skl",
|
|
652
|
+
"es/toc.yaml.xliff"
|
|
653
|
+
]"
|
|
654
|
+
`;
|
|
655
|
+
|
|
615
656
|
exports[`Translate command > extract openapi spec files > filelist 1`] = `
|
|
616
657
|
"[
|
|
617
658
|
"openapi-spec.yaml.skl",
|
|
@@ -716,6 +757,7 @@ exports[`Translate command > extract openapi spec files 3`] = `
|
|
|
716
757
|
includers:
|
|
717
758
|
- name: openapi
|
|
718
759
|
input: openapi-spec.yaml
|
|
760
|
+
mode: link
|
|
719
761
|
"
|
|
720
762
|
`;
|
|
721
763
|
|
|
@@ -1686,12 +1728,12 @@ exports[`Translate command > filter files on extract > filelist 1`] = `
|
|
|
1686
1728
|
"[
|
|
1687
1729
|
"es/_includes/test.md.skl",
|
|
1688
1730
|
"es/_includes/test.md.xliff",
|
|
1689
|
-
"es/_no-translate/exclude.md.skl",
|
|
1690
|
-
"es/_no-translate/exclude.md.xliff",
|
|
1691
1731
|
"es/aboba.md.skl",
|
|
1692
1732
|
"es/aboba.md.xliff",
|
|
1693
1733
|
"es/index.md.skl",
|
|
1694
1734
|
"es/index.md.xliff",
|
|
1735
|
+
"es/nested/a1.md.skl",
|
|
1736
|
+
"es/nested/a1.md.xliff",
|
|
1695
1737
|
"es/nested/index-yfm.md.skl",
|
|
1696
1738
|
"es/nested/index-yfm.md.xliff",
|
|
1697
1739
|
"es/nested/index.yaml.skl",
|
|
@@ -1702,6 +1744,10 @@ exports[`Translate command > filter files on extract > filelist 1`] = `
|
|
|
1702
1744
|
"es/nested/syntax/lists.md.xliff",
|
|
1703
1745
|
"es/nested/toc.yaml.skl",
|
|
1704
1746
|
"es/nested/toc.yaml.xliff",
|
|
1747
|
+
"es/no-var-page.md.skl",
|
|
1748
|
+
"es/no-var-page.md.xliff",
|
|
1749
|
+
"es/to-be-excluded.md.skl",
|
|
1750
|
+
"es/to-be-excluded.md.xliff",
|
|
1705
1751
|
"es/toc.yaml.skl",
|
|
1706
1752
|
"es/toc.yaml.xliff"
|
|
1707
1753
|
]"
|
|
@@ -1715,6 +1761,8 @@ exports[`Translate command > filter files on extract with extra exclude option >
|
|
|
1715
1761
|
"es/aboba.md.xliff",
|
|
1716
1762
|
"es/index.md.skl",
|
|
1717
1763
|
"es/index.md.xliff",
|
|
1764
|
+
"es/nested/a1.md.skl",
|
|
1765
|
+
"es/nested/a1.md.xliff",
|
|
1718
1766
|
"es/nested/index-yfm.md.skl",
|
|
1719
1767
|
"es/nested/index-yfm.md.xliff",
|
|
1720
1768
|
"es/nested/index.yaml.skl",
|
|
@@ -1725,6 +1773,39 @@ exports[`Translate command > filter files on extract with extra exclude option >
|
|
|
1725
1773
|
"es/nested/syntax/lists.md.xliff",
|
|
1726
1774
|
"es/nested/toc.yaml.skl",
|
|
1727
1775
|
"es/nested/toc.yaml.xliff",
|
|
1776
|
+
"es/no-var-page.md.skl",
|
|
1777
|
+
"es/no-var-page.md.xliff",
|
|
1778
|
+
"es/toc.yaml.skl",
|
|
1779
|
+
"es/toc.yaml.xliff"
|
|
1780
|
+
]"
|
|
1781
|
+
`;
|
|
1782
|
+
|
|
1783
|
+
exports[`Translate command > filter files on extract with extra vars option > filelist 1`] = `
|
|
1784
|
+
"[
|
|
1785
|
+
"es/_includes/test.md.skl",
|
|
1786
|
+
"es/_includes/test.md.xliff",
|
|
1787
|
+
"es/_no-translate/exclude.md.skl",
|
|
1788
|
+
"es/_no-translate/exclude.md.xliff",
|
|
1789
|
+
"es/aboba.md.skl",
|
|
1790
|
+
"es/aboba.md.xliff",
|
|
1791
|
+
"es/index.md.skl",
|
|
1792
|
+
"es/index.md.xliff",
|
|
1793
|
+
"es/nested/a1.md.skl",
|
|
1794
|
+
"es/nested/a1.md.xliff",
|
|
1795
|
+
"es/nested/index-yfm.md.skl",
|
|
1796
|
+
"es/nested/index-yfm.md.xliff",
|
|
1797
|
+
"es/nested/index.yaml.skl",
|
|
1798
|
+
"es/nested/index.yaml.xliff",
|
|
1799
|
+
"es/nested/syntax/base.md.skl",
|
|
1800
|
+
"es/nested/syntax/base.md.xliff",
|
|
1801
|
+
"es/nested/syntax/lists.md.skl",
|
|
1802
|
+
"es/nested/syntax/lists.md.xliff",
|
|
1803
|
+
"es/nested/toc.yaml.skl",
|
|
1804
|
+
"es/nested/toc.yaml.xliff",
|
|
1805
|
+
"es/no-var-page.md.skl",
|
|
1806
|
+
"es/no-var-page.md.xliff",
|
|
1807
|
+
"es/to-be-excluded.md.skl",
|
|
1808
|
+
"es/to-be-excluded.md.xliff",
|
|
1728
1809
|
"es/toc.yaml.skl",
|
|
1729
1810
|
"es/toc.yaml.xliff"
|
|
1730
1811
|
]"
|
|
@@ -2261,3 +2342,285 @@ exports[`Translate command > skip no-translate marked content 8`] = `
|
|
|
2261
2342
|
</file>
|
|
2262
2343
|
</xliff>"
|
|
2263
2344
|
`;
|
|
2345
|
+
|
|
2346
|
+
exports[`Translate command > test no-translate directive > filelist 1`] = `
|
|
2347
|
+
"[
|
|
2348
|
+
"index.md.skl",
|
|
2349
|
+
"index.md.xliff",
|
|
2350
|
+
"no-translate.md.skl",
|
|
2351
|
+
"no-translate.md.xliff",
|
|
2352
|
+
"openapi-spec.yaml.skl",
|
|
2353
|
+
"openapi-spec.yaml.xliff",
|
|
2354
|
+
"toc.yaml.skl",
|
|
2355
|
+
"toc.yaml.xliff"
|
|
2356
|
+
]"
|
|
2357
|
+
`;
|
|
2358
|
+
|
|
2359
|
+
exports[`Translate command > test no-translate directive 1`] = `
|
|
2360
|
+
"## %%%0%%%
|
|
2361
|
+
|
|
2362
|
+
::no-translate [adsfasdfasdfasdfasdf]
|
|
2363
|
+
|
|
2364
|
+
%%%1%%%
|
|
2365
|
+
|
|
2366
|
+
%%%2%%%"
|
|
2367
|
+
`;
|
|
2368
|
+
|
|
2369
|
+
exports[`Translate command > test no-translate directive 2`] = `
|
|
2370
|
+
"<?xml version="1.0" encoding="UTF-8"?>
|
|
2371
|
+
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
|
|
2372
|
+
<file original="file.ext" source-language="ru-RU" target-language="es-ES" datatype="markdown">
|
|
2373
|
+
<header>
|
|
2374
|
+
<skeleton>
|
|
2375
|
+
<external-file href="file.skl"></external-file>
|
|
2376
|
+
</skeleton>
|
|
2377
|
+
</header>
|
|
2378
|
+
<body>
|
|
2379
|
+
<trans-unit id="0">
|
|
2380
|
+
<source xml:space="preserve">Index header</source>
|
|
2381
|
+
</trans-unit>
|
|
2382
|
+
<trans-unit id="1">
|
|
2383
|
+
<source xml:space="preserve">lorem</source>
|
|
2384
|
+
</trans-unit>
|
|
2385
|
+
<trans-unit id="2">
|
|
2386
|
+
<source xml:space="preserve">asdfasdfasdf</source>
|
|
2387
|
+
</trans-unit>
|
|
2388
|
+
</body>
|
|
2389
|
+
</file>
|
|
2390
|
+
</xliff>"
|
|
2391
|
+
`;
|
|
2392
|
+
|
|
2393
|
+
exports[`Translate command > test no-translate directive 3`] = `
|
|
2394
|
+
"# %%%0%%%
|
|
2395
|
+
|
|
2396
|
+
## %%%1%%%
|
|
2397
|
+
:::no-translate
|
|
2398
|
+
### No-translate header
|
|
2399
|
+
|
|
2400
|
+
:::html-block
|
|
2401
|
+
testsetsets
|
|
2402
|
+
:::
|
|
2403
|
+
|
|
2404
|
+
::: any-other-directive
|
|
2405
|
+
content test
|
|
2406
|
+
:::
|
|
2407
|
+
|
|
2408
|
+
Should not be translated.
|
|
2409
|
+
Can use **markup** inside.
|
|
2410
|
+
:::
|
|
2411
|
+
|
|
2412
|
+
|
|
2413
|
+
%%%2%%%
|
|
2414
|
+
|
|
2415
|
+
## %%%3%%%
|
|
2416
|
+
|
|
2417
|
+
::no-translate [## /usr/local/bin/application]
|
|
2418
|
+
::no-translate[**C:/Program Files/Application/config.ini**]
|
|
2419
|
+
::no-translate [~/Documents/project/src/main.rs]
|
|
2420
|
+
|
|
2421
|
+
|
|
2422
|
+
- :no-translate[GET /api/v1/users] %%%4%%%
|
|
2423
|
+
- :no-translate[POST /api/v1/auth/login] %%%5%%%
|
|
2424
|
+
- :no-translate[PUT /api/v1/users/{id}] %%%6%%%
|
|
2425
|
+
|
|
2426
|
+
## %%%7%%%
|
|
2427
|
+
%%%8%%%
|
|
2428
|
+
:no-translate[The default port is unless specified.] %%%9%%%
|
|
2429
|
+
%%%10%%%
|
|
2430
|
+
|
|
2431
|
+
## %%%11%%%
|
|
2432
|
+
%%%12%%%
|
|
2433
|
+
%%%13%%%
|
|
2434
|
+
%%%14%%%
|
|
2435
|
+
|
|
2436
|
+
## %%%15%%%
|
|
2437
|
+
%%%16%%%
|
|
2438
|
+
|
|
2439
|
+
## %%%17%%%
|
|
2440
|
+
%%%18%%%
|
|
2441
|
+
|
|
2442
|
+
|
|
2443
|
+
"
|
|
2444
|
+
`;
|
|
2445
|
+
|
|
2446
|
+
exports[`Translate command > test no-translate directive 4`] = `
|
|
2447
|
+
"<?xml version="1.0" encoding="UTF-8"?>
|
|
2448
|
+
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
|
|
2449
|
+
<file original="file.ext" source-language="ru-RU" target-language="es-ES" datatype="markdown">
|
|
2450
|
+
<header>
|
|
2451
|
+
<skeleton>
|
|
2452
|
+
<external-file href="file.skl"></external-file>
|
|
2453
|
+
</skeleton>
|
|
2454
|
+
</header>
|
|
2455
|
+
<body>
|
|
2456
|
+
<trans-unit id="0">
|
|
2457
|
+
<source xml:space="preserve">No-translate directive</source>
|
|
2458
|
+
</trans-unit>
|
|
2459
|
+
<trans-unit id="1">
|
|
2460
|
+
<source xml:space="preserve">Block directive</source>
|
|
2461
|
+
</trans-unit>
|
|
2462
|
+
<trans-unit id="2">
|
|
2463
|
+
<source xml:space="preserve">::: some-other-directive<x ctype="lb" equiv-text="&#10;" id="x-1"/>content here<x ctype="lb" equiv-text="&#10;" id="x-2"/>:::<x ctype="lb" equiv-text="&#10;" id="x-3"/>::: no-translate<x ctype="lb" equiv-text="&#10;" id="x-4"/>content here<x ctype="lb" equiv-text="&#10;" id="x-5"/>::: some-other-directive<x ctype="lb" equiv-text="&#10;" id="x-6"/>nested content<x ctype="lb" equiv-text="&#10;" id="x-7"/>:::<x ctype="lb" equiv-text="&#10;" id="x-8"/>:::</source>
|
|
2464
|
+
</trans-unit>
|
|
2465
|
+
<trans-unit id="3">
|
|
2466
|
+
<source xml:space="preserve">Leaf directive</source>
|
|
2467
|
+
</trans-unit>
|
|
2468
|
+
<trans-unit id="4">
|
|
2469
|
+
<source xml:space="preserve">— get all users</source>
|
|
2470
|
+
</trans-unit>
|
|
2471
|
+
<trans-unit id="5">
|
|
2472
|
+
<source xml:space="preserve">— authorization</source>
|
|
2473
|
+
</trans-unit>
|
|
2474
|
+
<trans-unit id="6">
|
|
2475
|
+
<source xml:space="preserve">— update users data</source>
|
|
2476
|
+
</trans-unit>
|
|
2477
|
+
<trans-unit id="7">
|
|
2478
|
+
<source xml:space="preserve">Simple case leaf</source>
|
|
2479
|
+
</trans-unit>
|
|
2480
|
+
<trans-unit id="8">
|
|
2481
|
+
<source xml:space="preserve">Install using command.</source>
|
|
2482
|
+
</trans-unit>
|
|
2483
|
+
<trans-unit id="9">
|
|
2484
|
+
<source xml:space="preserve">Next sentence.</source>
|
|
2485
|
+
</trans-unit>
|
|
2486
|
+
<trans-unit id="10">
|
|
2487
|
+
<source xml:space="preserve">Set NODE_ENV=production for production builds.</source>
|
|
2488
|
+
</trans-unit>
|
|
2489
|
+
<trans-unit id="11">
|
|
2490
|
+
<source xml:space="preserve">Simple case inline</source>
|
|
2491
|
+
</trans-unit>
|
|
2492
|
+
<trans-unit id="12">
|
|
2493
|
+
<source xml:space="preserve">Install using <x ctype="no_translate_inline" equiv-text=":no-translate[npm install @company/package]" id="x-9"/> command.</source>
|
|
2494
|
+
</trans-unit>
|
|
2495
|
+
<trans-unit id="13">
|
|
2496
|
+
<source xml:space="preserve">The default port is <x ctype="no_translate_inline" equiv-text=":no-translate[8080]" id="x-10"/> unless specified.</source>
|
|
2497
|
+
</trans-unit>
|
|
2498
|
+
<trans-unit id="14">
|
|
2499
|
+
<source xml:space="preserve">Set <x ctype="no_translate_inline" equiv-text=":no-translate[NODE_ENV=production]" id="x-11"/> for production builds.</source>
|
|
2500
|
+
</trans-unit>
|
|
2501
|
+
<trans-unit id="15">
|
|
2502
|
+
<source xml:space="preserve">Few inline directives</source>
|
|
2503
|
+
</trans-unit>
|
|
2504
|
+
<trans-unit id="16">
|
|
2505
|
+
<source xml:space="preserve">Use <x ctype="no_translate_inline" equiv-text=":no-translate[**GET /api/v1/users**]" id="x-12"/> to list users and <x ctype="no_translate_inline" equiv-text=":no-translate[POST /api/v1/users]" id="x-13"/> to create.</source>
|
|
2506
|
+
</trans-unit>
|
|
2507
|
+
<trans-unit id="17">
|
|
2508
|
+
<source xml:space="preserve">Empty inline directive</source>
|
|
2509
|
+
</trans-unit>
|
|
2510
|
+
<trans-unit id="18">
|
|
2511
|
+
<source xml:space="preserve">This is text with empty <x ctype="no_translate_inline" equiv-text=":no-translate[]" id="x-14"/> directive.</source>
|
|
2512
|
+
</trans-unit>
|
|
2513
|
+
</body>
|
|
2514
|
+
</file>
|
|
2515
|
+
</xliff>"
|
|
2516
|
+
`;
|
|
2517
|
+
|
|
2518
|
+
exports[`Translate command > test no-translate directive 5`] = `
|
|
2519
|
+
"openapi: 3.0.1
|
|
2520
|
+
info:
|
|
2521
|
+
title: '%%%0%%%'
|
|
2522
|
+
version: v0
|
|
2523
|
+
servers:
|
|
2524
|
+
- url: http://localhost:8080
|
|
2525
|
+
description: '%%%1%%%'
|
|
2526
|
+
paths:
|
|
2527
|
+
/test:
|
|
2528
|
+
get:
|
|
2529
|
+
tags:
|
|
2530
|
+
- test-controller
|
|
2531
|
+
summary: '%%%2%%%'
|
|
2532
|
+
description: '%%%3%%%'
|
|
2533
|
+
operationId: getWithPayloadResponse
|
|
2534
|
+
responses:
|
|
2535
|
+
'200':
|
|
2536
|
+
description: '%%%4%%%'
|
|
2537
|
+
content:
|
|
2538
|
+
application/json:
|
|
2539
|
+
schema:
|
|
2540
|
+
$ref: '#/components/schemas/RecurceTop'
|
|
2541
|
+
components:
|
|
2542
|
+
schemas:
|
|
2543
|
+
RecurceTop:
|
|
2544
|
+
type: object
|
|
2545
|
+
properties:
|
|
2546
|
+
A:
|
|
2547
|
+
type: string
|
|
2548
|
+
RecurceMiddle:
|
|
2549
|
+
type: object
|
|
2550
|
+
properties:
|
|
2551
|
+
B:
|
|
2552
|
+
type: array
|
|
2553
|
+
items:
|
|
2554
|
+
$ref: '#/components/schemas/RecurceTop'
|
|
2555
|
+
"
|
|
2556
|
+
`;
|
|
2557
|
+
|
|
2558
|
+
exports[`Translate command > test no-translate directive 6`] = `
|
|
2559
|
+
"<?xml version="1.0" encoding="UTF-8"?>
|
|
2560
|
+
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
|
|
2561
|
+
<file original="file.ext" source-language="ru-RU" target-language="es-ES" datatype="markdown">
|
|
2562
|
+
<header>
|
|
2563
|
+
<skeleton>
|
|
2564
|
+
<external-file href="file.skl"></external-file>
|
|
2565
|
+
</skeleton>
|
|
2566
|
+
</header>
|
|
2567
|
+
<body>
|
|
2568
|
+
<trans-unit id="0">
|
|
2569
|
+
<source xml:space="preserve">OpenAPI definition</source>
|
|
2570
|
+
</trans-unit>
|
|
2571
|
+
<trans-unit id="1">
|
|
2572
|
+
<source xml:space="preserve">Generated server url</source>
|
|
2573
|
+
</trans-unit>
|
|
2574
|
+
<trans-unit id="2">
|
|
2575
|
+
<source xml:space="preserve">Simple get operation. тест новой верстки 3</source>
|
|
2576
|
+
</trans-unit>
|
|
2577
|
+
<trans-unit id="3">
|
|
2578
|
+
<source xml:space="preserve">Defines a simple get <x ctype="no_translate_inline" equiv-text=":no-translate[skip this]" id="x-15"/> operation with no inputs and a complex</source>
|
|
2579
|
+
</trans-unit>
|
|
2580
|
+
<trans-unit id="4">
|
|
2581
|
+
<source xml:space="preserve">200!!!!</source>
|
|
2582
|
+
</trans-unit>
|
|
2583
|
+
</body>
|
|
2584
|
+
</file>
|
|
2585
|
+
</xliff>"
|
|
2586
|
+
`;
|
|
2587
|
+
|
|
2588
|
+
exports[`Translate command > test no-translate directive 7`] = `
|
|
2589
|
+
"title: '%%%0%%%'
|
|
2590
|
+
href: index.md
|
|
2591
|
+
items:
|
|
2592
|
+
- name: '%%%1%%%'
|
|
2593
|
+
href: no-translate.md
|
|
2594
|
+
- name: '%%%2%%%'
|
|
2595
|
+
include:
|
|
2596
|
+
path: openapi
|
|
2597
|
+
includers:
|
|
2598
|
+
- name: openapi
|
|
2599
|
+
input: openapi-spec.yaml
|
|
2600
|
+
mode: link
|
|
2601
|
+
"
|
|
2602
|
+
`;
|
|
2603
|
+
|
|
2604
|
+
exports[`Translate command > test no-translate directive 8`] = `
|
|
2605
|
+
"<?xml version="1.0" encoding="UTF-8"?>
|
|
2606
|
+
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
|
|
2607
|
+
<file original="file.ext" source-language="ru-RU" target-language="es-ES" datatype="markdown">
|
|
2608
|
+
<header>
|
|
2609
|
+
<skeleton>
|
|
2610
|
+
<external-file href="file.skl"></external-file>
|
|
2611
|
+
</skeleton>
|
|
2612
|
+
</header>
|
|
2613
|
+
<body>
|
|
2614
|
+
<trans-unit id="0">
|
|
2615
|
+
<source xml:space="preserve">Test123</source>
|
|
2616
|
+
</trans-unit>
|
|
2617
|
+
<trans-unit id="1">
|
|
2618
|
+
<source xml:space="preserve">Не переводить</source>
|
|
2619
|
+
</trans-unit>
|
|
2620
|
+
<trans-unit id="2">
|
|
2621
|
+
<source xml:space="preserve">openapi</source>
|
|
2622
|
+
</trans-unit>
|
|
2623
|
+
</body>
|
|
2624
|
+
</file>
|
|
2625
|
+
</xliff>"
|
|
2626
|
+
`;
|
package/e2e/errors.spec.ts
CHANGED
|
@@ -18,6 +18,7 @@ function test(path: string, expect: Function) {
|
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
|
|
21
22
|
describe('Errors', () => {
|
|
22
23
|
test('mocks/errors/unreachable-link', ({html}: TestResult) => {
|
|
23
24
|
expectErrors(html, [
|
|
@@ -25,6 +26,21 @@ describe('Errors', () => {
|
|
|
25
26
|
'ERR index.md: 2: YFM003 / unreachable-link Link is unreachable [Context: "[Unreachable link: "missed.html"][missed file](./missed.md)"]'
|
|
26
27
|
]);
|
|
27
28
|
});
|
|
29
|
+
|
|
30
|
+
it('translate extract with filtered links', async () => {
|
|
31
|
+
const {inputPath, outputPath} = getTestPaths('mocks/errors/extract-filtered-link');
|
|
32
|
+
|
|
33
|
+
const result = await TestAdapter.extract.run(inputPath, outputPath, ['--source', 'ru-RU', '--target', 'es-ES', '--filter']);
|
|
34
|
+
|
|
35
|
+
expect(result.code).toEqual(1);
|
|
36
|
+
|
|
37
|
+
expect(result.errors).toEqual([
|
|
38
|
+
"ERR File index.md contains link to filtered.md, which was filtered from toc.yaml or it's not been included initially",
|
|
39
|
+
"ERR File index.md contains link to filtered2.md, which was filtered from toc.yaml or it's not been included initially",
|
|
40
|
+
"ERR File index.md contains link to filtered2.md, which was filtered from toc.yaml or it's not been included initially",
|
|
41
|
+
"ERR File index.md contains link to filtered3.md, which was filtered from toc.yaml or it's not been included initially",
|
|
42
|
+
])
|
|
43
|
+
});
|
|
28
44
|
});
|
|
29
45
|
|
|
30
46
|
describe('Warnings', () => {
|
package/e2e/translation.spec.ts
CHANGED
|
@@ -7,7 +7,7 @@ const generateMapTestTemplate = (
|
|
|
7
7
|
args: TranslateRunArgs,
|
|
8
8
|
ignoreFileContent = true,
|
|
9
9
|
) => {
|
|
10
|
-
test
|
|
10
|
+
test(testTitle, async () => {
|
|
11
11
|
const {inputPath, outputPath} = getTestPaths(testRootPath);
|
|
12
12
|
|
|
13
13
|
await TestAdapter.testTranslatePass(inputPath, outputPath, args);
|
|
@@ -56,10 +56,17 @@ describe('Translate command', () => {
|
|
|
56
56
|
target: 'es-ES',
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
+
generateMapTestTemplate('do not filter files on extract', 'mocks/translation/dir-files', {
|
|
60
|
+
subcommand: 'extract',
|
|
61
|
+
source: 'ru-RU',
|
|
62
|
+
target: 'es-ES',
|
|
63
|
+
});
|
|
64
|
+
|
|
59
65
|
generateMapTestTemplate('filter files on extract', 'mocks/translation/dir-files', {
|
|
60
66
|
subcommand: 'extract',
|
|
61
67
|
source: 'ru-RU',
|
|
62
68
|
target: 'es-ES',
|
|
69
|
+
additionalArgs: '--filter'
|
|
63
70
|
});
|
|
64
71
|
|
|
65
72
|
generateMapTestTemplate(
|
|
@@ -69,7 +76,19 @@ describe('Translate command', () => {
|
|
|
69
76
|
subcommand: 'extract',
|
|
70
77
|
source: 'ru-RU',
|
|
71
78
|
target: 'es-ES',
|
|
72
|
-
additionalArgs: '--exclude ru/
|
|
79
|
+
additionalArgs: '--exclude ru/to-be-excluded.md --filter',
|
|
80
|
+
},
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
const vars = {skip: 'prod'}
|
|
84
|
+
generateMapTestTemplate(
|
|
85
|
+
'filter files on extract with extra vars option',
|
|
86
|
+
'mocks/translation/dir-files',
|
|
87
|
+
{
|
|
88
|
+
subcommand: 'extract',
|
|
89
|
+
source: 'ru-RU',
|
|
90
|
+
target: 'es-ES',
|
|
91
|
+
additionalArgs: `--vars ${JSON.stringify(vars)} --filter`,
|
|
73
92
|
},
|
|
74
93
|
);
|
|
75
94
|
|
package/fixtures/cliAdapter.ts
CHANGED
|
@@ -34,11 +34,34 @@ class Build {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
class Extract {
|
|
38
|
+
private readonly runner: Runner;
|
|
39
|
+
|
|
40
|
+
constructor(runner: Runner) {
|
|
41
|
+
this.runner = runner;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
run(input: string, output: string, args: string[]) {
|
|
45
|
+
return this.runner.runYfmDocs([
|
|
46
|
+
'translate',
|
|
47
|
+
'extract',
|
|
48
|
+
'--input',
|
|
49
|
+
input,
|
|
50
|
+
'--output',
|
|
51
|
+
output,
|
|
52
|
+
'--quiet',
|
|
53
|
+
...args,
|
|
54
|
+
]);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
37
58
|
export class CliTestAdapter {
|
|
38
59
|
readonly runner: Runner = createRunner();
|
|
39
60
|
|
|
40
61
|
readonly build = new Build(this.runner);
|
|
41
62
|
|
|
63
|
+
readonly extract = new Extract(this.runner);
|
|
64
|
+
|
|
42
65
|
async testBuildPass(
|
|
43
66
|
inputPath: string,
|
|
44
67
|
outputPath: string,
|
package/fixtures/utils/test.ts
CHANGED
|
@@ -5,6 +5,11 @@ export function platformless(text: string): string {
|
|
|
5
5
|
|
|
6
6
|
return hashless(text)
|
|
7
7
|
.replace(/\r\n/g, '\n')
|
|
8
|
+
// Fix for XML equiv-text attributes in Windows - handle various patterns
|
|
9
|
+
.replace(/equiv-text="[\r\n]+ "/g, 'equiv-text=" "')
|
|
10
|
+
.replace(/equiv-text="[\r\n]+&#10;"/g, 'equiv-text="&#10;"')
|
|
11
|
+
// Also normalize any other attributes that might have line ending issues
|
|
12
|
+
.replace(/(ctype|id)="[\r\n]+(.*?)"/g, '$1="$2"')
|
|
8
13
|
.replace(/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}/g, 'UUID')
|
|
9
14
|
.replace(
|
|
10
15
|
/(content"?[:=]{1}[" ]{1}Diplodoc.*? )v\d+\.\d+\.\d+(?:-[\w-]+)?/g,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
File exists but not attached to toc
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
href: index.md
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
## Excluded title
|
|
@@ -4,4 +4,10 @@ items:
|
|
|
4
4
|
- name: Aboba
|
|
5
5
|
href: aboba.md
|
|
6
6
|
- name: Не переводить
|
|
7
|
-
|
|
7
|
+
when: skip == 'prod'
|
|
8
|
+
href: _no-translate/exclude.md
|
|
9
|
+
- name: Нет переменной в vars
|
|
10
|
+
when: novar == 'test'
|
|
11
|
+
href: no-var-page.md
|
|
12
|
+
- name: exclude-test
|
|
13
|
+
href: to-be-excluded.md
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diplodoc/cli-tests",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.9.1",
|
|
4
4
|
"bin": {
|
|
5
5
|
"diplodoc-cli-test": "bin.mjs"
|
|
6
6
|
},
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"@diplodoc/cli": "file:.."
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
+
"@diplodoc/liquid": "^1.3.4",
|
|
30
31
|
"@types/node": "18.x",
|
|
31
32
|
"@vitest/coverage-istanbul": "^3.1.1",
|
|
32
33
|
"@vitest/coverage-v8": "^3.1.1",
|