@diplodoc/cli-tests 5.14.0 → 5.14.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.
@@ -665,6 +665,77 @@ exports[`Translate command > do not filter files on extract > filelist 1`] = `
665
665
  ]"
666
666
  `;
667
667
 
668
+ exports[`Translate command > do not resolve liquid conditions if vars not specified and send content as is for extract > filelist 1`] = `
669
+ "[
670
+ "index.md.skl",
671
+ "index.md.xliff",
672
+ "toc.yaml.skl",
673
+ "toc.yaml.xliff"
674
+ ]"
675
+ `;
676
+
677
+ exports[`Translate command > do not resolve liquid conditions if vars not specified and send content as is for extract 1`] = `
678
+ "#|
679
+ ||
680
+ %%%0%%%
681
+ ||
682
+ ||
683
+ %%%1%%%{% endif %}
684
+ ||
685
+ |#"
686
+ `;
687
+
688
+ exports[`Translate command > do not resolve liquid conditions if vars not specified and send content as is for extract 2`] = `
689
+ "<?xml version="1.0" encoding="UTF-8"?>
690
+ <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
691
+ <file original="file.ext" source-language="ru-RU" target-language="es-ES" datatype="markdown">
692
+ <header>
693
+ <skeleton>
694
+ <external-file href="file.skl"></external-file>
695
+ </skeleton>
696
+ </header>
697
+ <body>
698
+ <trans-unit id="0">
699
+ <source xml:space="preserve"><g ctype="bold" equiv-text="**{{text}}**" id="g-1" x-begin="**" x-end="**">Заголовок</g></source>
700
+ </trans-unit>
701
+ <trans-unit id="1">
702
+ <source xml:space="preserve">Доступны в любом отчете в виде <g ctype="link" equiv-text="[{{text}}](../general/goals.md)" id="g-2" x-begin="[" x-end="](../general/goals.md)">целей</g>, а также в отчетах:<x ctype="lb" equiv-text="&amp;#10;" id="x-1"/><x ctype="liquid_Literal" equiv-text="{% if tld == &quot;ru&quot; or tld == &quot;es&quot; or tld == &quot;pt&quot; or tld == &quot;com&quot; or tld == &quot;tr&quot; %}" id="x-2"/>- <g ctype="link" equiv-text="[{{text}}](../reports/ecommerce.md)" id="g-3" x-begin="[" x-end="](../reports/ecommerce.md)">электронной коммерции</g><x ctype="liquid_Literal" equiv-text="{% endif %}" id="x-3"/><x ctype="liquid_Literal" equiv-text="{% if tld == &quot;zh&quot; %}" id="x-4"/>- электронной коммерции<x ctype="liquid_Literal" equiv-text="{% endif %}" id="x-5"/>;<x ctype="lb" equiv-text="&amp;#10;" id="x-6"/><x ctype="liquid_Literal" equiv-text="{% if tld == &quot;ru&quot;%}" id="x-7"/>- <g ctype="link" equiv-text="[{{text}}](../data/user-params-data.md)" id="g-4" x-begin="[" x-end="](../data/user-params-data.md)">по параметрам посетителей</g><x ctype="liquid_Literal" equiv-text="{% endif %}" id="x-8"/><x ctype="liquid_Literal" equiv-text="{% if tld == &quot;es&quot; or tld == &quot;pt&quot; or tld == &quot;com&quot; or tld == &quot;zh&quot; or tld == &quot;tr&quot; %}" id="x-9"/>- по параметрам посетителей<x ctype="liquid_Literal" equiv-text="{% endif %}" id="x-10"/>;<x ctype="lb" equiv-text="&amp;#10;" id="x-11"/><x ctype="liquid_Literal" equiv-text="{% if tld == &quot;ru&quot; or tld == &quot;es&quot; or tld == &quot;pt&quot; or tld == &quot;com&quot; or tld == &quot;tr&quot; %}" id="x-12"/>- <g ctype="link" equiv-text="[{{text}}](../data/visit-params-data.md)" id="g-5" x-begin="[" x-end="](../data/visit-params-data.md)">по параметрам визитов</g><x ctype="liquid_Literal" equiv-text="{% endif %}" id="x-13"/><x ctype="liquid_Literal" equiv-text="{% if tld == &quot;zh&quot; %}" id="x-14"/>- по параметрам визитов</source>
703
+ </trans-unit>
704
+ </body>
705
+ </file>
706
+ </xliff>"
707
+ `;
708
+
709
+ exports[`Translate command > do not resolve liquid conditions if vars not specified and send content as is for extract 3`] = `
710
+ "title: '%%%0%%%'
711
+ href: index.md
712
+ items:
713
+ - name: '%%%1%%%'
714
+ href: index.md
715
+ "
716
+ `;
717
+
718
+ exports[`Translate command > do not resolve liquid conditions if vars not specified and send content as is for extract 4`] = `
719
+ "<?xml version="1.0" encoding="UTF-8"?>
720
+ <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
721
+ <file original="file.ext" source-language="ru-RU" target-language="es-ES" datatype="markdown">
722
+ <header>
723
+ <skeleton>
724
+ <external-file href="file.skl"></external-file>
725
+ </skeleton>
726
+ </header>
727
+ <body>
728
+ <trans-unit id="0">
729
+ <source xml:space="preserve">Conditions</source>
730
+ </trans-unit>
731
+ <trans-unit id="1">
732
+ <source xml:space="preserve">Example</source>
733
+ </trans-unit>
734
+ </body>
735
+ </file>
736
+ </xliff>"
737
+ `;
738
+
668
739
  exports[`Translate command > extract openapi spec files > filelist 1`] = `
669
740
  "[
670
741
  "openapi-spec.yaml.skl",
@@ -1261,6 +1332,89 @@ exports[`Translate command > filter files on extract with extra vars option > fi
1261
1332
  ]"
1262
1333
  `;
1263
1334
 
1335
+ exports[`Translate command > resolve liquid conditions if vars specified, liquid syntax will be deleted > filelist 1`] = `
1336
+ "[
1337
+ "index.md.skl",
1338
+ "index.md.xliff",
1339
+ "toc.yaml.skl",
1340
+ "toc.yaml.xliff"
1341
+ ]"
1342
+ `;
1343
+
1344
+ exports[`Translate command > resolve liquid conditions if vars specified, liquid syntax will be deleted 1`] = `
1345
+ "#|
1346
+ ||
1347
+ %%%0%%%
1348
+ ||
1349
+ ||
1350
+ %%%1%%%
1351
+ - %%%2%%%
1352
+ - %%%3%%%
1353
+ - %%%4%%%
1354
+ ||
1355
+ |#"
1356
+ `;
1357
+
1358
+ exports[`Translate command > resolve liquid conditions if vars specified, liquid syntax will be deleted 2`] = `
1359
+ "<?xml version="1.0" encoding="UTF-8"?>
1360
+ <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
1361
+ <file original="file.ext" source-language="ru-RU" target-language="es-ES" datatype="markdown">
1362
+ <header>
1363
+ <skeleton>
1364
+ <external-file href="file.skl"></external-file>
1365
+ </skeleton>
1366
+ </header>
1367
+ <body>
1368
+ <trans-unit id="0">
1369
+ <source xml:space="preserve"><g ctype="bold" equiv-text="**{{text}}**" id="g-1" x-begin="**" x-end="**">Заголовок</g></source>
1370
+ </trans-unit>
1371
+ <trans-unit id="1">
1372
+ <source xml:space="preserve">Доступны в любом отчете в виде <g ctype="link" equiv-text="[{{text}}](../general/goals.md)" id="g-2" x-begin="[" x-end="](../general/goals.md)">целей</g>, а также в отчетах:</source>
1373
+ </trans-unit>
1374
+ <trans-unit id="2">
1375
+ <source xml:space="preserve"><g ctype="link" equiv-text="[{{text}}](../reports/ecommerce.md)" id="g-3" x-begin="[" x-end="](../reports/ecommerce.md)">электронной коммерции</g>;</source>
1376
+ </trans-unit>
1377
+ <trans-unit id="3">
1378
+ <source xml:space="preserve"><g ctype="link" equiv-text="[{{text}}](../data/user-params-data.md)" id="g-4" x-begin="[" x-end="](../data/user-params-data.md)">по параметрам посетителей</g>;</source>
1379
+ </trans-unit>
1380
+ <trans-unit id="4">
1381
+ <source xml:space="preserve"><g ctype="link" equiv-text="[{{text}}](../data/visit-params-data.md)" id="g-5" x-begin="[" x-end="](../data/visit-params-data.md)">по параметрам визитов</g></source>
1382
+ </trans-unit>
1383
+ </body>
1384
+ </file>
1385
+ </xliff>"
1386
+ `;
1387
+
1388
+ exports[`Translate command > resolve liquid conditions if vars specified, liquid syntax will be deleted 3`] = `
1389
+ "title: '%%%0%%%'
1390
+ href: index.md
1391
+ items:
1392
+ - name: '%%%1%%%'
1393
+ href: index.md
1394
+ "
1395
+ `;
1396
+
1397
+ exports[`Translate command > resolve liquid conditions if vars specified, liquid syntax will be deleted 4`] = `
1398
+ "<?xml version="1.0" encoding="UTF-8"?>
1399
+ <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
1400
+ <file original="file.ext" source-language="ru-RU" target-language="es-ES" datatype="markdown">
1401
+ <header>
1402
+ <skeleton>
1403
+ <external-file href="file.skl"></external-file>
1404
+ </skeleton>
1405
+ </header>
1406
+ <body>
1407
+ <trans-unit id="0">
1408
+ <source xml:space="preserve">Conditions</source>
1409
+ </trans-unit>
1410
+ <trans-unit id="1">
1411
+ <source xml:space="preserve">Example</source>
1412
+ </trans-unit>
1413
+ </body>
1414
+ </file>
1415
+ </xliff>"
1416
+ `;
1417
+
1264
1418
  exports[`Translate command > test no-translate directive > filelist 1`] = `
1265
1419
  "[
1266
1420
  "index.md.skl",
@@ -103,6 +103,30 @@ describe('Translate command', () => {
103
103
  },
104
104
  );
105
105
 
106
+ const conditions = {tld: 'ru'};
107
+ generateMapTestTemplate(
108
+ 'resolve liquid conditions if vars specified, liquid syntax will be deleted',
109
+ 'mocks/translation/conditions',
110
+ {
111
+ subcommand: 'extract',
112
+ source: 'ru-RU',
113
+ target: 'es-ES',
114
+ additionalArgs: `--vars ${JSON.stringify(conditions)}`,
115
+ },
116
+ false,
117
+ );
118
+
119
+ generateMapTestTemplate(
120
+ 'do not resolve liquid conditions if vars not specified and send content as is for extract',
121
+ 'mocks/translation/conditions',
122
+ {
123
+ subcommand: 'extract',
124
+ source: 'ru-RU',
125
+ target: 'es-ES',
126
+ },
127
+ false,
128
+ );
129
+
106
130
  generateMapTestTemplate(
107
131
  'test no-translate directive',
108
132
  'mocks/translation/no-translate',
@@ -0,0 +1,11 @@
1
+ #|
2
+ ||
3
+ **Заголовок**
4
+ ||
5
+ ||
6
+ Доступны в любом отчете в виде [целей](../general/goals.md), а также в отчетах:
7
+ {% if tld == "ru" or tld == "es" or tld == "pt" or tld == "com" or tld == "tr" %}- [электронной коммерции](../reports/ecommerce.md){% endif %}{% if tld == "zh" %}- электронной коммерции{% endif %};
8
+ {% if tld == "ru"%}- [по параметрам посетителей](../data/user-params-data.md){% endif %}{% if tld == "es" or tld == "pt" or tld == "com" or tld == "zh" or tld == "tr" %}- по параметрам посетителей{% endif %};
9
+ {% if tld == "ru" or tld == "es" or tld == "pt" or tld == "com" or tld == "tr" %}- [по параметрам визитов](../data/visit-params-data.md){% endif %}{% if tld == "zh" %}- по параметрам визитов{% endif %}
10
+ ||
11
+ |#
@@ -0,0 +1,5 @@
1
+ title: Conditions
2
+ href: index.md
3
+ items:
4
+ - name: Example
5
+ href: index.md
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diplodoc/cli-tests",
3
- "version": "5.14.0",
3
+ "version": "5.14.1",
4
4
  "bin": {
5
5
  "diplodoc-cli-test": "bin.mjs"
6
6
  },