@diplodoc/cli-tests 5.22.4 → 5.23.0
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 +368 -30
- package/e2e/nested-include-links.spec.ts +26 -0
- package/e2e/translation.spec.ts +36 -0
- package/mocks/errors/extract-filtered-link/input/index.md +1 -1
- package/mocks/nested-include-links/input/includes/middle.md +4 -0
- package/mocks/nested-include-links/input/other/page.md +4 -0
- package/mocks/nested-include-links/input/sub/deep/entry.md +8 -0
- package/mocks/nested-include-links/input/target.md +4 -0
- package/mocks/nested-include-links/input/toc.yaml +6 -0
- package/mocks/translation/conditions/input/index.md +37 -11
- package/mocks/translation/toc-include/input/included-toc/merged-included-toc-item.md +1 -0
- package/mocks/translation/toc-include/input/included-toc/toc.yaml +3 -0
- package/mocks/translation/toc-include/input/included-toc.md +1 -0
- package/mocks/translation/toc-include/input/index.md +7 -0
- package/mocks/translation/toc-include/input/merged-included-toc-item.md +1 -0
- package/mocks/translation/toc-include/input/no-translate.md +57 -0
- package/mocks/translation/toc-include/input/openapi-spec.yaml +37 -0
- package/mocks/translation/toc-include/input/toc.yaml +14 -0
- package/package.json +1 -1
- package/tsconfig.json +1 -1
|
@@ -702,10 +702,6 @@ exports[`Translate command > do not filter files on extract > filelist 1`] = `
|
|
|
702
702
|
"es/index.md.xliff",
|
|
703
703
|
"es/nested/a1.md.skl",
|
|
704
704
|
"es/nested/a1.md.xliff",
|
|
705
|
-
"es/nested/folder1/a1.md.skl",
|
|
706
|
-
"es/nested/folder1/a1.md.xliff",
|
|
707
|
-
"es/nested/folder1/toc-i.yaml.skl",
|
|
708
|
-
"es/nested/folder1/toc-i.yaml.xliff",
|
|
709
705
|
"es/nested/index-yfm.md.skl",
|
|
710
706
|
"es/nested/index-yfm.md.xliff",
|
|
711
707
|
"es/nested/index.yaml.skl",
|
|
@@ -743,14 +739,44 @@ exports[`Translate command > do not resolve liquid conditions if vars not specif
|
|
|
743
739
|
`;
|
|
744
740
|
|
|
745
741
|
exports[`Translate command > do not resolve liquid conditions if vars not specified and send content as is for extract 1`] = `
|
|
746
|
-
"
|
|
747
|
-
|
|
748
|
-
%%%
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
742
|
+
"%%%0%%%
|
|
743
|
+
<!-- [missed file](./missed.md) -->
|
|
744
|
+
{% if prod == true %}%%%1%%%{% endif %}
|
|
745
|
+
|
|
746
|
+
{% if inner == true %}%%%2%%%{% endif %}
|
|
747
|
+
|
|
748
|
+
{% if prod == true %}%%%3%%%{% endif %}{% endif %}
|
|
749
|
+
|
|
750
|
+
{% if prod == true %}
|
|
751
|
+
|
|
752
|
+
{% if list contains "item" %}
|
|
753
|
+
|
|
754
|
+
%%%4%%%
|
|
755
|
+
|
|
756
|
+
{% if item == true %}%%%5%%% %%%6%%% {% endif %}
|
|
757
|
+
|
|
758
|
+
%%%7%%%
|
|
759
|
+
|
|
760
|
+
{% endif %}
|
|
761
|
+
|
|
762
|
+
{% endif %}
|
|
763
|
+
|
|
764
|
+
#### %%%8%%%
|
|
765
|
+
|
|
766
|
+
{% if list contains "item" %}
|
|
767
|
+
|
|
768
|
+
%%%9%%%
|
|
769
|
+
|
|
770
|
+
{% endif %}
|
|
771
|
+
|
|
772
|
+
#### %%%10%%%
|
|
773
|
+
|
|
774
|
+
{% if prod == true %}
|
|
775
|
+
|
|
776
|
+
%%%11%%% {% endif %}
|
|
777
|
+
|
|
778
|
+
{% endif %}
|
|
779
|
+
"
|
|
754
780
|
`;
|
|
755
781
|
|
|
756
782
|
exports[`Translate command > do not resolve liquid conditions if vars not specified and send content as is for extract 2`] = `
|
|
@@ -764,10 +790,40 @@ exports[`Translate command > do not resolve liquid conditions if vars not specif
|
|
|
764
790
|
</header>
|
|
765
791
|
<body>
|
|
766
792
|
<trans-unit id="0">
|
|
767
|
-
<source xml:space="preserve"><g ctype="
|
|
793
|
+
<source xml:space="preserve"><g ctype="link" equiv-text="[{{text}}](./exists.md)" id="g-1" x-begin="[" x-end="](./exists.md)">existing file</g></source>
|
|
768
794
|
</trans-unit>
|
|
769
795
|
<trans-unit id="1">
|
|
770
|
-
<source xml:space="preserve"
|
|
796
|
+
<source xml:space="preserve">Test text</source>
|
|
797
|
+
</trans-unit>
|
|
798
|
+
<trans-unit id="2">
|
|
799
|
+
<source xml:space="preserve">inner test text</source>
|
|
800
|
+
</trans-unit>
|
|
801
|
+
<trans-unit id="3">
|
|
802
|
+
<source xml:space="preserve">Test text<x ctype="liquid_Literal" equiv-text="{% if inner == true %}" id="x-1"/>inner test text</source>
|
|
803
|
+
</trans-unit>
|
|
804
|
+
<trans-unit id="4">
|
|
805
|
+
<source xml:space="preserve">#### List</source>
|
|
806
|
+
</trans-unit>
|
|
807
|
+
<trans-unit id="5">
|
|
808
|
+
<source xml:space="preserve">1.</source>
|
|
809
|
+
</trans-unit>
|
|
810
|
+
<trans-unit id="6">
|
|
811
|
+
<source xml:space="preserve">Item</source>
|
|
812
|
+
</trans-unit>
|
|
813
|
+
<trans-unit id="7">
|
|
814
|
+
<source xml:space="preserve">Some text</source>
|
|
815
|
+
</trans-unit>
|
|
816
|
+
<trans-unit id="8">
|
|
817
|
+
<source xml:space="preserve">Standalone contains condition</source>
|
|
818
|
+
</trans-unit>
|
|
819
|
+
<trans-unit id="9">
|
|
820
|
+
<source xml:space="preserve">#### List</source>
|
|
821
|
+
</trans-unit>
|
|
822
|
+
<trans-unit id="10">
|
|
823
|
+
<source xml:space="preserve">Inline contains condition</source>
|
|
824
|
+
</trans-unit>
|
|
825
|
+
<trans-unit id="11">
|
|
826
|
+
<source xml:space="preserve">#### List <x ctype="liquid_Literal" equiv-text="{% if list contains "item" %}" id="x-2"/> sub text</source>
|
|
771
827
|
</trans-unit>
|
|
772
828
|
</body>
|
|
773
829
|
</file>
|
|
@@ -804,6 +860,23 @@ exports[`Translate command > do not resolve liquid conditions if vars not specif
|
|
|
804
860
|
</xliff>"
|
|
805
861
|
`;
|
|
806
862
|
|
|
863
|
+
exports[`Translate command > do not translate merged entries with included toc > filelist 1`] = `
|
|
864
|
+
"[
|
|
865
|
+
"included-toc.md.skl",
|
|
866
|
+
"included-toc.md.xliff",
|
|
867
|
+
"index.md.skl",
|
|
868
|
+
"index.md.xliff",
|
|
869
|
+
"merged-included-toc-item.md.skl",
|
|
870
|
+
"merged-included-toc-item.md.xliff",
|
|
871
|
+
"no-translate.md.skl",
|
|
872
|
+
"no-translate.md.xliff",
|
|
873
|
+
"openapi-spec.yaml.skl",
|
|
874
|
+
"openapi-spec.yaml.xliff",
|
|
875
|
+
"toc.yaml.skl",
|
|
876
|
+
"toc.yaml.xliff"
|
|
877
|
+
]"
|
|
878
|
+
`;
|
|
879
|
+
|
|
807
880
|
exports[`Translate command > extract openapi spec files > filelist 1`] = `
|
|
808
881
|
"[
|
|
809
882
|
"openapi-spec.yaml.skl",
|
|
@@ -1682,6 +1755,92 @@ exports[`Translate command > filter files on extract with extra vars option > fi
|
|
|
1682
1755
|
]"
|
|
1683
1756
|
`;
|
|
1684
1757
|
|
|
1758
|
+
exports[`Translate command > remove falsy liquid conditions structures > filelist 1`] = `
|
|
1759
|
+
"[
|
|
1760
|
+
"index.md.skl",
|
|
1761
|
+
"index.md.xliff",
|
|
1762
|
+
"toc.yaml.skl",
|
|
1763
|
+
"toc.yaml.xliff"
|
|
1764
|
+
]"
|
|
1765
|
+
`;
|
|
1766
|
+
|
|
1767
|
+
exports[`Translate command > remove falsy liquid conditions structures 1`] = `
|
|
1768
|
+
"%%%0%%%
|
|
1769
|
+
<!-- [missed file](./missed.md) -->
|
|
1770
|
+
|
|
1771
|
+
|
|
1772
|
+
|
|
1773
|
+
|
|
1774
|
+
#### %%%1%%%
|
|
1775
|
+
|
|
1776
|
+
{% if list contains "item" %}
|
|
1777
|
+
|
|
1778
|
+
%%%2%%%
|
|
1779
|
+
|
|
1780
|
+
{% endif %}
|
|
1781
|
+
|
|
1782
|
+
#### %%%3%%%
|
|
1783
|
+
|
|
1784
|
+
"
|
|
1785
|
+
`;
|
|
1786
|
+
|
|
1787
|
+
exports[`Translate command > remove falsy liquid conditions structures 2`] = `
|
|
1788
|
+
"<?xml version="1.0" encoding="UTF-8"?>
|
|
1789
|
+
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
|
|
1790
|
+
<file original="file.ext" source-language="ru-RU" target-language="es-ES" datatype="markdown">
|
|
1791
|
+
<header>
|
|
1792
|
+
<skeleton>
|
|
1793
|
+
<external-file href="file.skl"></external-file>
|
|
1794
|
+
</skeleton>
|
|
1795
|
+
</header>
|
|
1796
|
+
<body>
|
|
1797
|
+
<trans-unit id="0">
|
|
1798
|
+
<source xml:space="preserve"><g ctype="link" equiv-text="[{{text}}](./exists.md)" id="g-1" x-begin="[" x-end="](./exists.md)">existing file</g></source>
|
|
1799
|
+
</trans-unit>
|
|
1800
|
+
<trans-unit id="1">
|
|
1801
|
+
<source xml:space="preserve">Standalone contains condition</source>
|
|
1802
|
+
</trans-unit>
|
|
1803
|
+
<trans-unit id="2">
|
|
1804
|
+
<source xml:space="preserve">#### List</source>
|
|
1805
|
+
</trans-unit>
|
|
1806
|
+
<trans-unit id="3">
|
|
1807
|
+
<source xml:space="preserve">Inline contains condition</source>
|
|
1808
|
+
</trans-unit>
|
|
1809
|
+
</body>
|
|
1810
|
+
</file>
|
|
1811
|
+
</xliff>"
|
|
1812
|
+
`;
|
|
1813
|
+
|
|
1814
|
+
exports[`Translate command > remove falsy liquid conditions structures 3`] = `
|
|
1815
|
+
"title: '%%%0%%%'
|
|
1816
|
+
href: index.md
|
|
1817
|
+
items:
|
|
1818
|
+
- name: '%%%1%%%'
|
|
1819
|
+
href: index.md
|
|
1820
|
+
"
|
|
1821
|
+
`;
|
|
1822
|
+
|
|
1823
|
+
exports[`Translate command > remove falsy liquid conditions structures 4`] = `
|
|
1824
|
+
"<?xml version="1.0" encoding="UTF-8"?>
|
|
1825
|
+
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
|
|
1826
|
+
<file original="file.ext" source-language="ru-RU" target-language="es-ES" datatype="markdown">
|
|
1827
|
+
<header>
|
|
1828
|
+
<skeleton>
|
|
1829
|
+
<external-file href="file.skl"></external-file>
|
|
1830
|
+
</skeleton>
|
|
1831
|
+
</header>
|
|
1832
|
+
<body>
|
|
1833
|
+
<trans-unit id="0">
|
|
1834
|
+
<source xml:space="preserve">Conditions</source>
|
|
1835
|
+
</trans-unit>
|
|
1836
|
+
<trans-unit id="1">
|
|
1837
|
+
<source xml:space="preserve">Example</source>
|
|
1838
|
+
</trans-unit>
|
|
1839
|
+
</body>
|
|
1840
|
+
</file>
|
|
1841
|
+
</xliff>"
|
|
1842
|
+
`;
|
|
1843
|
+
|
|
1685
1844
|
exports[`Translate command > resolve liquid conditions if vars specified, liquid syntax will be deleted > filelist 1`] = `
|
|
1686
1845
|
"[
|
|
1687
1846
|
"index.md.skl",
|
|
@@ -1692,17 +1851,44 @@ exports[`Translate command > resolve liquid conditions if vars specified, liquid
|
|
|
1692
1851
|
`;
|
|
1693
1852
|
|
|
1694
1853
|
exports[`Translate command > resolve liquid conditions if vars specified, liquid syntax will be deleted 1`] = `
|
|
1695
|
-
"
|
|
1696
|
-
|
|
1697
|
-
%%%
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1854
|
+
"%%%0%%%
|
|
1855
|
+
<!-- [missed file](./missed.md) -->
|
|
1856
|
+
{% if prod == true %}%%%1%%%{% endif %}
|
|
1857
|
+
|
|
1858
|
+
{% if inner == true %}%%%2%%%{% endif %}
|
|
1859
|
+
|
|
1860
|
+
{% if prod == true %}%%%3%%%{% endif %}{% endif %}
|
|
1861
|
+
|
|
1862
|
+
{% if prod == true %}
|
|
1863
|
+
|
|
1864
|
+
{% if list contains "item" %}
|
|
1865
|
+
|
|
1866
|
+
%%%4%%%
|
|
1867
|
+
|
|
1868
|
+
{% if item == true %}%%%5%%% %%%6%%% {% endif %}
|
|
1869
|
+
|
|
1870
|
+
%%%7%%%
|
|
1871
|
+
|
|
1872
|
+
{% endif %}
|
|
1873
|
+
|
|
1874
|
+
{% endif %}
|
|
1875
|
+
|
|
1876
|
+
#### %%%8%%%
|
|
1877
|
+
|
|
1878
|
+
{% if list contains "item" %}
|
|
1879
|
+
|
|
1880
|
+
%%%9%%%
|
|
1881
|
+
|
|
1882
|
+
{% endif %}
|
|
1883
|
+
|
|
1884
|
+
#### %%%10%%%
|
|
1885
|
+
|
|
1886
|
+
{% if prod == true %}
|
|
1887
|
+
|
|
1888
|
+
%%%11%%% {% endif %}
|
|
1889
|
+
|
|
1890
|
+
{% endif %}
|
|
1891
|
+
"
|
|
1706
1892
|
`;
|
|
1707
1893
|
|
|
1708
1894
|
exports[`Translate command > resolve liquid conditions if vars specified, liquid syntax will be deleted 2`] = `
|
|
@@ -1716,19 +1902,40 @@ exports[`Translate command > resolve liquid conditions if vars specified, liquid
|
|
|
1716
1902
|
</header>
|
|
1717
1903
|
<body>
|
|
1718
1904
|
<trans-unit id="0">
|
|
1719
|
-
<source xml:space="preserve"><g ctype="
|
|
1905
|
+
<source xml:space="preserve"><g ctype="link" equiv-text="[{{text}}](./exists.md)" id="g-1" x-begin="[" x-end="](./exists.md)">existing file</g></source>
|
|
1720
1906
|
</trans-unit>
|
|
1721
1907
|
<trans-unit id="1">
|
|
1722
|
-
<source xml:space="preserve"
|
|
1908
|
+
<source xml:space="preserve">Test text</source>
|
|
1723
1909
|
</trans-unit>
|
|
1724
1910
|
<trans-unit id="2">
|
|
1725
|
-
<source xml:space="preserve"
|
|
1911
|
+
<source xml:space="preserve">inner test text</source>
|
|
1726
1912
|
</trans-unit>
|
|
1727
1913
|
<trans-unit id="3">
|
|
1728
|
-
<source xml:space="preserve"
|
|
1914
|
+
<source xml:space="preserve">Test text<x ctype="liquid_Literal" equiv-text="{% if inner == true %}" id="x-1"/>inner test text</source>
|
|
1729
1915
|
</trans-unit>
|
|
1730
1916
|
<trans-unit id="4">
|
|
1731
|
-
<source xml:space="preserve"
|
|
1917
|
+
<source xml:space="preserve">#### List</source>
|
|
1918
|
+
</trans-unit>
|
|
1919
|
+
<trans-unit id="5">
|
|
1920
|
+
<source xml:space="preserve">1.</source>
|
|
1921
|
+
</trans-unit>
|
|
1922
|
+
<trans-unit id="6">
|
|
1923
|
+
<source xml:space="preserve">Item</source>
|
|
1924
|
+
</trans-unit>
|
|
1925
|
+
<trans-unit id="7">
|
|
1926
|
+
<source xml:space="preserve">Some text</source>
|
|
1927
|
+
</trans-unit>
|
|
1928
|
+
<trans-unit id="8">
|
|
1929
|
+
<source xml:space="preserve">Standalone contains condition</source>
|
|
1930
|
+
</trans-unit>
|
|
1931
|
+
<trans-unit id="9">
|
|
1932
|
+
<source xml:space="preserve">#### List</source>
|
|
1933
|
+
</trans-unit>
|
|
1934
|
+
<trans-unit id="10">
|
|
1935
|
+
<source xml:space="preserve">Inline contains condition</source>
|
|
1936
|
+
</trans-unit>
|
|
1937
|
+
<trans-unit id="11">
|
|
1938
|
+
<source xml:space="preserve">#### List <x ctype="liquid_Literal" equiv-text="{% if list contains "item" %}" id="x-2"/> sub text</source>
|
|
1732
1939
|
</trans-unit>
|
|
1733
1940
|
</body>
|
|
1734
1941
|
</file>
|
|
@@ -1765,6 +1972,137 @@ exports[`Translate command > resolve liquid conditions if vars specified, liquid
|
|
|
1765
1972
|
</xliff>"
|
|
1766
1973
|
`;
|
|
1767
1974
|
|
|
1975
|
+
exports[`Translate command > save truthy liquid conditions structures > filelist 1`] = `
|
|
1976
|
+
"[
|
|
1977
|
+
"index.md.skl",
|
|
1978
|
+
"index.md.xliff",
|
|
1979
|
+
"toc.yaml.skl",
|
|
1980
|
+
"toc.yaml.xliff"
|
|
1981
|
+
]"
|
|
1982
|
+
`;
|
|
1983
|
+
|
|
1984
|
+
exports[`Translate command > save truthy liquid conditions structures 1`] = `
|
|
1985
|
+
"%%%0%%%
|
|
1986
|
+
<!-- [missed file](./missed.md) -->
|
|
1987
|
+
{% if prod == true %}%%%1%%%{% endif %}
|
|
1988
|
+
|
|
1989
|
+
{% if inner == true %}%%%2%%%{% endif %}
|
|
1990
|
+
|
|
1991
|
+
{% if prod == true %}%%%3%%%{% endif %}{% endif %}
|
|
1992
|
+
|
|
1993
|
+
{% if prod == true %}
|
|
1994
|
+
|
|
1995
|
+
{% if list contains "item" %}
|
|
1996
|
+
|
|
1997
|
+
%%%4%%%
|
|
1998
|
+
|
|
1999
|
+
{% if item == true %}%%%5%%% %%%6%%% {% endif %}
|
|
2000
|
+
|
|
2001
|
+
%%%7%%%
|
|
2002
|
+
|
|
2003
|
+
{% endif %}
|
|
2004
|
+
|
|
2005
|
+
{% endif %}
|
|
2006
|
+
|
|
2007
|
+
#### %%%8%%%
|
|
2008
|
+
|
|
2009
|
+
{% if list contains "item" %}
|
|
2010
|
+
|
|
2011
|
+
%%%9%%%
|
|
2012
|
+
|
|
2013
|
+
{% endif %}
|
|
2014
|
+
|
|
2015
|
+
#### %%%10%%%
|
|
2016
|
+
|
|
2017
|
+
{% if prod == true %}
|
|
2018
|
+
|
|
2019
|
+
%%%11%%% {% endif %}
|
|
2020
|
+
|
|
2021
|
+
{% endif %}
|
|
2022
|
+
"
|
|
2023
|
+
`;
|
|
2024
|
+
|
|
2025
|
+
exports[`Translate command > save truthy liquid conditions structures 2`] = `
|
|
2026
|
+
"<?xml version="1.0" encoding="UTF-8"?>
|
|
2027
|
+
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
|
|
2028
|
+
<file original="file.ext" source-language="ru-RU" target-language="es-ES" datatype="markdown">
|
|
2029
|
+
<header>
|
|
2030
|
+
<skeleton>
|
|
2031
|
+
<external-file href="file.skl"></external-file>
|
|
2032
|
+
</skeleton>
|
|
2033
|
+
</header>
|
|
2034
|
+
<body>
|
|
2035
|
+
<trans-unit id="0">
|
|
2036
|
+
<source xml:space="preserve"><g ctype="link" equiv-text="[{{text}}](./exists.md)" id="g-1" x-begin="[" x-end="](./exists.md)">existing file</g></source>
|
|
2037
|
+
</trans-unit>
|
|
2038
|
+
<trans-unit id="1">
|
|
2039
|
+
<source xml:space="preserve">Test text</source>
|
|
2040
|
+
</trans-unit>
|
|
2041
|
+
<trans-unit id="2">
|
|
2042
|
+
<source xml:space="preserve">inner test text</source>
|
|
2043
|
+
</trans-unit>
|
|
2044
|
+
<trans-unit id="3">
|
|
2045
|
+
<source xml:space="preserve">Test text<x ctype="liquid_Literal" equiv-text="{% if inner == true %}" id="x-1"/>inner test text</source>
|
|
2046
|
+
</trans-unit>
|
|
2047
|
+
<trans-unit id="4">
|
|
2048
|
+
<source xml:space="preserve">#### List</source>
|
|
2049
|
+
</trans-unit>
|
|
2050
|
+
<trans-unit id="5">
|
|
2051
|
+
<source xml:space="preserve">1.</source>
|
|
2052
|
+
</trans-unit>
|
|
2053
|
+
<trans-unit id="6">
|
|
2054
|
+
<source xml:space="preserve">Item</source>
|
|
2055
|
+
</trans-unit>
|
|
2056
|
+
<trans-unit id="7">
|
|
2057
|
+
<source xml:space="preserve">Some text</source>
|
|
2058
|
+
</trans-unit>
|
|
2059
|
+
<trans-unit id="8">
|
|
2060
|
+
<source xml:space="preserve">Standalone contains condition</source>
|
|
2061
|
+
</trans-unit>
|
|
2062
|
+
<trans-unit id="9">
|
|
2063
|
+
<source xml:space="preserve">#### List</source>
|
|
2064
|
+
</trans-unit>
|
|
2065
|
+
<trans-unit id="10">
|
|
2066
|
+
<source xml:space="preserve">Inline contains condition</source>
|
|
2067
|
+
</trans-unit>
|
|
2068
|
+
<trans-unit id="11">
|
|
2069
|
+
<source xml:space="preserve">#### List <x ctype="liquid_Literal" equiv-text="{% if list contains "item" %}" id="x-2"/> sub text</source>
|
|
2070
|
+
</trans-unit>
|
|
2071
|
+
</body>
|
|
2072
|
+
</file>
|
|
2073
|
+
</xliff>"
|
|
2074
|
+
`;
|
|
2075
|
+
|
|
2076
|
+
exports[`Translate command > save truthy liquid conditions structures 3`] = `
|
|
2077
|
+
"title: '%%%0%%%'
|
|
2078
|
+
href: index.md
|
|
2079
|
+
items:
|
|
2080
|
+
- name: '%%%1%%%'
|
|
2081
|
+
href: index.md
|
|
2082
|
+
"
|
|
2083
|
+
`;
|
|
2084
|
+
|
|
2085
|
+
exports[`Translate command > save truthy liquid conditions structures 4`] = `
|
|
2086
|
+
"<?xml version="1.0" encoding="UTF-8"?>
|
|
2087
|
+
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
|
|
2088
|
+
<file original="file.ext" source-language="ru-RU" target-language="es-ES" datatype="markdown">
|
|
2089
|
+
<header>
|
|
2090
|
+
<skeleton>
|
|
2091
|
+
<external-file href="file.skl"></external-file>
|
|
2092
|
+
</skeleton>
|
|
2093
|
+
</header>
|
|
2094
|
+
<body>
|
|
2095
|
+
<trans-unit id="0">
|
|
2096
|
+
<source xml:space="preserve">Conditions</source>
|
|
2097
|
+
</trans-unit>
|
|
2098
|
+
<trans-unit id="1">
|
|
2099
|
+
<source xml:space="preserve">Example</source>
|
|
2100
|
+
</trans-unit>
|
|
2101
|
+
</body>
|
|
2102
|
+
</file>
|
|
2103
|
+
</xliff>"
|
|
2104
|
+
`;
|
|
2105
|
+
|
|
1768
2106
|
exports[`Translate command > test no-translate directive > filelist 1`] = `
|
|
1769
2107
|
"[
|
|
1770
2108
|
"index.md.skl",
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {readFileSync} from 'node:fs';
|
|
2
|
+
import {resolve} from 'node:path';
|
|
3
|
+
import {describe, expect, test} from 'vitest';
|
|
4
|
+
|
|
5
|
+
import {TestAdapter, getTestPaths} from '../fixtures';
|
|
6
|
+
|
|
7
|
+
describe('Nested include links', () => {
|
|
8
|
+
test('Links in nested includes should resolve relative to the include file, not the entry file', async () => {
|
|
9
|
+
const {inputPath, outputPath} = getTestPaths('mocks/nested-include-links');
|
|
10
|
+
|
|
11
|
+
// Build directly to HTML
|
|
12
|
+
await TestAdapter.testBuildPass(inputPath, outputPath, {
|
|
13
|
+
md2md: false,
|
|
14
|
+
md2html: true,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const htmlPath = resolve(outputPath, 'sub/deep/entry.html');
|
|
18
|
+
const html = readFileSync(htmlPath, 'utf8');
|
|
19
|
+
|
|
20
|
+
// The link from other/page.md is [link to target](../target.md)
|
|
21
|
+
// It should resolve relative to other/page.md → target.md → target.html
|
|
22
|
+
// NOT relative to the entry file sub/deep/entry.md → sub/deep/target.html
|
|
23
|
+
expect(html).toContain('target.html');
|
|
24
|
+
expect(html).not.toContain('sub/deep/target.html');
|
|
25
|
+
});
|
|
26
|
+
});
|
package/e2e/translation.spec.ts
CHANGED
|
@@ -100,6 +100,16 @@ describe('Translate command', () => {
|
|
|
100
100
|
target: 'es-ES',
|
|
101
101
|
});
|
|
102
102
|
|
|
103
|
+
generateMapTestTemplate(
|
|
104
|
+
'do not translate merged entries with included toc',
|
|
105
|
+
'mocks/translation/toc-include',
|
|
106
|
+
{
|
|
107
|
+
subcommand: 'extract',
|
|
108
|
+
source: 'ru-RU',
|
|
109
|
+
target: 'es-ES',
|
|
110
|
+
},
|
|
111
|
+
);
|
|
112
|
+
|
|
103
113
|
generateMapTestTemplate('do not filter files on extract', 'mocks/translation/dir-files', {
|
|
104
114
|
subcommand: 'extract',
|
|
105
115
|
source: 'ru-RU',
|
|
@@ -176,4 +186,30 @@ describe('Translate command', () => {
|
|
|
176
186
|
source: 'ru-RU',
|
|
177
187
|
target: 'en-US',
|
|
178
188
|
});
|
|
189
|
+
|
|
190
|
+
let conditionVars = {prod: true, inner: true, list: ['item']};
|
|
191
|
+
generateMapTestTemplate(
|
|
192
|
+
'save truthy liquid conditions structures',
|
|
193
|
+
'mocks/translation/conditions',
|
|
194
|
+
{
|
|
195
|
+
subcommand: 'extract',
|
|
196
|
+
source: 'ru-RU',
|
|
197
|
+
target: 'es-ES',
|
|
198
|
+
additionalArgs: `--vars ${JSON.stringify(conditionVars)}`,
|
|
199
|
+
},
|
|
200
|
+
false,
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
conditionVars = {prod: false, inner: false, list: ['item']};
|
|
204
|
+
generateMapTestTemplate(
|
|
205
|
+
'remove falsy liquid conditions structures',
|
|
206
|
+
'mocks/translation/conditions',
|
|
207
|
+
{
|
|
208
|
+
subcommand: 'extract',
|
|
209
|
+
source: 'ru-RU',
|
|
210
|
+
target: 'es-ES',
|
|
211
|
+
additionalArgs: `--vars ${JSON.stringify(conditionVars)}`,
|
|
212
|
+
},
|
|
213
|
+
false,
|
|
214
|
+
);
|
|
179
215
|
});
|
|
@@ -1,11 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
{% if
|
|
8
|
-
|
|
9
|
-
{% if
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
[existing file](./exists.md)
|
|
2
|
+
<!-- [missed file](./missed.md) -->
|
|
3
|
+
{% if prod == true %}Test text{% endif %}
|
|
4
|
+
|
|
5
|
+
{% if inner == true %}inner test text{% endif %}
|
|
6
|
+
|
|
7
|
+
{% if prod == true %}Test text{% if inner == true %}inner test text{% endif %}{% endif %}
|
|
8
|
+
|
|
9
|
+
{% if prod == true %}
|
|
10
|
+
|
|
11
|
+
{% if list contains "item" %}
|
|
12
|
+
|
|
13
|
+
#### List
|
|
14
|
+
|
|
15
|
+
{% if item == true %}1. Item {% endif %}
|
|
16
|
+
|
|
17
|
+
Some text
|
|
18
|
+
|
|
19
|
+
{% endif %}
|
|
20
|
+
|
|
21
|
+
{% endif %}
|
|
22
|
+
|
|
23
|
+
#### Standalone contains condition
|
|
24
|
+
|
|
25
|
+
{% if list contains "item" %}
|
|
26
|
+
|
|
27
|
+
#### List
|
|
28
|
+
|
|
29
|
+
{% endif %}
|
|
30
|
+
|
|
31
|
+
#### Inline contains condition
|
|
32
|
+
|
|
33
|
+
{% if prod == true %}
|
|
34
|
+
|
|
35
|
+
#### List {% if list contains "item" %} sub text {% endif %}
|
|
36
|
+
|
|
37
|
+
{% endif %}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#### Included toc item
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
### Included toc
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#### Included toc item
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# No-translate directive
|
|
2
|
+
|
|
3
|
+
## Block directive
|
|
4
|
+
:::no-translate
|
|
5
|
+
### No-translate header
|
|
6
|
+
|
|
7
|
+
:::html-block
|
|
8
|
+
testsetsets
|
|
9
|
+
:::
|
|
10
|
+
|
|
11
|
+
::: any-other-directive
|
|
12
|
+
content test
|
|
13
|
+
:::
|
|
14
|
+
|
|
15
|
+
Should not be translated.
|
|
16
|
+
Can use **markup** inside.
|
|
17
|
+
:::
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
::: some-other-directive
|
|
21
|
+
content here
|
|
22
|
+
:::
|
|
23
|
+
::: no-translate
|
|
24
|
+
content here
|
|
25
|
+
::: some-other-directive
|
|
26
|
+
nested content
|
|
27
|
+
:::
|
|
28
|
+
:::
|
|
29
|
+
|
|
30
|
+
## Leaf directive
|
|
31
|
+
|
|
32
|
+
::no-translate [## /usr/local/bin/application]
|
|
33
|
+
::no-translate[**C:\Program Files\Application\config.ini**]
|
|
34
|
+
::no-translate [~/Documents/project/src/main.rs]
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
- :no-translate[GET /api/v1/users] — get all users
|
|
38
|
+
- :no-translate[POST /api/v1/auth/login] — authorization
|
|
39
|
+
- :no-translate[PUT /api/v1/users/{id}] — update users data
|
|
40
|
+
|
|
41
|
+
## Simple case leaf
|
|
42
|
+
Install using command.
|
|
43
|
+
:no-translate[The default port is unless specified.] Next sentence.
|
|
44
|
+
Set NODE_ENV=production for production builds.
|
|
45
|
+
|
|
46
|
+
## Simple case inline
|
|
47
|
+
Install using :no-translate[npm install @company/package] command.
|
|
48
|
+
The default port is :no-translate[8080] unless specified.
|
|
49
|
+
Set :no-translate[NODE_ENV=production] for production builds.
|
|
50
|
+
|
|
51
|
+
## Few inline directives
|
|
52
|
+
Use :no-translate[**GET /api/v1/users**] to list users and :no-translate[POST /api/v1/users] to create.
|
|
53
|
+
|
|
54
|
+
## Empty inline directive
|
|
55
|
+
This is text with empty :no-translate[] directive.
|
|
56
|
+
|
|
57
|
+
|
|
@@ -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,14 @@
|
|
|
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
|
|
12
|
+
- name: Included TOC
|
|
13
|
+
href: included-toc.md
|
|
14
|
+
include: { mode: merge, path: included-toc/toc.yaml }
|
package/package.json
CHANGED
package/tsconfig.json
CHANGED