@diplodoc/cli-tests 5.22.4 → 5.22.5

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.
@@ -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",
@@ -804,6 +800,23 @@ exports[`Translate command > do not resolve liquid conditions if vars not specif
804
800
  </xliff>"
805
801
  `;
806
802
 
803
+ exports[`Translate command > do not translate merged entries with included toc > filelist 1`] = `
804
+ "[
805
+ "included-toc.md.skl",
806
+ "included-toc.md.xliff",
807
+ "index.md.skl",
808
+ "index.md.xliff",
809
+ "merged-included-toc-item.md.skl",
810
+ "merged-included-toc-item.md.xliff",
811
+ "no-translate.md.skl",
812
+ "no-translate.md.xliff",
813
+ "openapi-spec.yaml.skl",
814
+ "openapi-spec.yaml.xliff",
815
+ "toc.yaml.skl",
816
+ "toc.yaml.xliff"
817
+ ]"
818
+ `;
819
+
807
820
  exports[`Translate command > extract openapi spec files > filelist 1`] = `
808
821
  "[
809
822
  "openapi-spec.yaml.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
+ });
@@ -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',
@@ -0,0 +1,4 @@
1
+ #### Section title {#section}
2
+
3
+ {% include notitle [page](../other/page.md) %}
4
+
@@ -0,0 +1,4 @@
1
+ # Nested page
2
+
3
+ [link to target](../target.md)
4
+
@@ -0,0 +1,8 @@
1
+ - вы подключаете устройство, для которого не [popup](*popup);
2
+ - другие способы настройки не сработали.
3
+
4
+
5
+
6
+ [*popup]:
7
+ {% include notitle [section](../../includes/middle.md#section) %}
8
+
@@ -0,0 +1,4 @@
1
+ # Target page
2
+
3
+ This is the target page that the link should point to.
4
+
@@ -0,0 +1,6 @@
1
+ items:
2
+ - name: Target
3
+ href: target.md
4
+ - name: Entry
5
+ href: sub/deep/entry.md
6
+
@@ -0,0 +1,3 @@
1
+ items:
2
+ - name: Included TOC Item
3
+ href: merged-included-toc-item.md
@@ -0,0 +1 @@
1
+ ### Included toc
@@ -0,0 +1,7 @@
1
+ ## Index header
2
+
3
+ ::no-translate [adsfasdfasdfasdfasdf]
4
+
5
+ lorem
6
+
7
+ asdfasdfasdf
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diplodoc/cli-tests",
3
- "version": "5.22.4",
3
+ "version": "5.22.5",
4
4
  "bin": {
5
5
  "diplodoc-cli-test": "bin.mjs"
6
6
  },
package/tsconfig.json CHANGED
@@ -12,5 +12,5 @@
12
12
  "rootDir": "."
13
13
  },
14
14
  "include": ["fixtures/**/*", "**/*.test.ts", "**/*.spec.ts", "vitest.config.ts"],
15
- "exclude": ["dist"]
15
+ "exclude": ["mocks/**/*"]
16
16
  }