honkit 6.0.3 → 6.1.4
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/lib/__tests__/__fixtures__/honkit/book.d.ts +7 -0
- package/lib/__tests__/__fixtures__/honkit/book.d.ts.map +1 -0
- package/lib/__tests__/__fixtures__/honkit/book.js +9 -0
- package/lib/__tests__/e2e.test.d.ts +2 -0
- package/lib/__tests__/e2e.test.d.ts.map +1 -0
- package/lib/__tests__/e2e.test.js +81 -0
- package/lib/__tests__/init.d.ts +2 -0
- package/lib/__tests__/init.d.ts.map +1 -0
- package/lib/__tests__/init.js +19 -0
- package/lib/__tests__/satisfies.d.ts +2 -0
- package/lib/__tests__/satisfies.d.ts.map +1 -0
- package/lib/__tests__/satisfies.js +11 -0
- package/lib/__tests__/snapshot-asciidoc.d.ts +2 -0
- package/lib/__tests__/snapshot-asciidoc.d.ts.map +1 -0
- package/lib/__tests__/snapshot-asciidoc.js +48 -0
- package/lib/__tests__/snapshot-honkit.d.ts +2 -0
- package/lib/__tests__/snapshot-honkit.d.ts.map +1 -0
- package/lib/__tests__/snapshot-honkit.js +48 -0
- package/lib/cli/server.d.ts.map +1 -1
- package/lib/constants/__tests__/configSchema.d.ts +2 -0
- package/lib/constants/__tests__/configSchema.d.ts.map +1 -0
- package/lib/constants/__tests__/configSchema.js +41 -0
- package/lib/fs/__tests__/mock.d.ts +2 -0
- package/lib/fs/__tests__/mock.d.ts.map +1 -0
- package/lib/fs/__tests__/mock.js +68 -0
- package/lib/models/__tests__/config.d.ts +2 -0
- package/lib/models/__tests__/config.d.ts.map +1 -0
- package/lib/models/__tests__/config.js +164 -0
- package/lib/models/__tests__/glossary.d.ts +2 -0
- package/lib/models/__tests__/glossary.d.ts.map +1 -0
- package/lib/models/__tests__/glossary.js +38 -0
- package/lib/models/__tests__/glossaryEntry.d.ts +2 -0
- package/lib/models/__tests__/glossaryEntry.d.ts.map +1 -0
- package/lib/models/__tests__/glossaryEntry.js +16 -0
- package/lib/models/__tests__/page.d.ts +2 -0
- package/lib/models/__tests__/page.d.ts.map +1 -0
- package/lib/models/__tests__/page.js +26 -0
- package/lib/models/__tests__/plugin.d.ts +2 -0
- package/lib/models/__tests__/plugin.d.ts.map +1 -0
- package/lib/models/__tests__/plugin.js +50 -0
- package/lib/models/__tests__/pluginDependency.d.ts +2 -0
- package/lib/models/__tests__/pluginDependency.d.ts.map +1 -0
- package/lib/models/__tests__/pluginDependency.js +71 -0
- package/lib/models/__tests__/summary.d.ts +2 -0
- package/lib/models/__tests__/summary.d.ts.map +1 -0
- package/lib/models/__tests__/summary.js +115 -0
- package/lib/models/__tests__/summaryArticle.d.ts +2 -0
- package/lib/models/__tests__/summaryArticle.d.ts.map +1 -0
- package/lib/models/__tests__/summaryArticle.js +117 -0
- package/lib/models/__tests__/summaryPart.d.ts +2 -0
- package/lib/models/__tests__/summaryPart.d.ts.map +1 -0
- package/lib/models/__tests__/summaryPart.js +24 -0
- package/lib/models/__tests__/templateBlock.d.ts +2 -0
- package/lib/models/__tests__/templateBlock.d.ts.map +1 -0
- package/lib/models/__tests__/templateBlock.js +172 -0
- package/lib/models/__tests__/templateEngine.d.ts +2 -0
- package/lib/models/__tests__/templateEngine.d.ts.map +1 -0
- package/lib/models/__tests__/templateEngine.js +49 -0
- package/lib/models/pluginDependency.d.ts.map +1 -1
- package/lib/modifiers/config/__tests__/addPlugin.d.ts +2 -0
- package/lib/modifiers/config/__tests__/addPlugin.d.ts.map +1 -0
- package/lib/modifiers/config/__tests__/addPlugin.js +30 -0
- package/lib/modifiers/config/__tests__/removePlugin.d.ts +2 -0
- package/lib/modifiers/config/__tests__/removePlugin.d.ts.map +1 -0
- package/lib/modifiers/config/__tests__/removePlugin.js +29 -0
- package/lib/modifiers/config/__tests__/togglePlugin.d.ts +2 -0
- package/lib/modifiers/config/__tests__/togglePlugin.d.ts.map +1 -0
- package/lib/modifiers/config/__tests__/togglePlugin.js +28 -0
- package/lib/modifiers/summary/__tests__/editPartTitle.d.ts +2 -0
- package/lib/modifiers/summary/__tests__/editPartTitle.d.ts.map +1 -0
- package/lib/modifiers/summary/__tests__/editPartTitle.js +41 -0
- package/lib/modifiers/summary/__tests__/insertArticle.d.ts +2 -0
- package/lib/modifiers/summary/__tests__/insertArticle.d.ts.map +1 -0
- package/lib/modifiers/summary/__tests__/insertArticle.js +72 -0
- package/lib/modifiers/summary/__tests__/insertPart.d.ts +2 -0
- package/lib/modifiers/summary/__tests__/insertPart.d.ts.map +1 -0
- package/lib/modifiers/summary/__tests__/insertPart.js +56 -0
- package/lib/modifiers/summary/__tests__/mergeAtLevel.d.ts +2 -0
- package/lib/modifiers/summary/__tests__/mergeAtLevel.d.ts.map +1 -0
- package/lib/modifiers/summary/__tests__/mergeAtLevel.js +45 -0
- package/lib/modifiers/summary/__tests__/moveArticle.d.ts +2 -0
- package/lib/modifiers/summary/__tests__/moveArticle.d.ts.map +1 -0
- package/lib/modifiers/summary/__tests__/moveArticle.js +66 -0
- package/lib/modifiers/summary/__tests__/moveArticleAfter.d.ts +2 -0
- package/lib/modifiers/summary/__tests__/moveArticleAfter.d.ts.map +1 -0
- package/lib/modifiers/summary/__tests__/moveArticleAfter.js +75 -0
- package/lib/modifiers/summary/__tests__/removeArticle.d.ts +2 -0
- package/lib/modifiers/summary/__tests__/removeArticle.d.ts.map +1 -0
- package/lib/modifiers/summary/__tests__/removeArticle.js +54 -0
- package/lib/output/__tests__/ebook.d.ts +2 -0
- package/lib/output/__tests__/ebook.d.ts.map +1 -0
- package/lib/output/__tests__/ebook.js +17 -0
- package/lib/output/__tests__/json.d.ts +2 -0
- package/lib/output/__tests__/json.d.ts.map +1 -0
- package/lib/output/__tests__/json.js +43 -0
- package/lib/output/__tests__/plugin-hooks.d.ts +2 -0
- package/lib/output/__tests__/plugin-hooks.d.ts.map +1 -0
- package/lib/output/__tests__/plugin-hooks.js +57 -0
- package/lib/output/__tests__/website.d.ts +2 -0
- package/lib/output/__tests__/website.d.ts.map +1 -0
- package/lib/output/__tests__/website.js +121 -0
- package/lib/output/generatePages.d.ts.map +1 -1
- package/lib/output/modifiers/__tests__/addHeadingId.d.ts +2 -0
- package/lib/output/modifiers/__tests__/addHeadingId.d.ts.map +1 -0
- package/lib/output/modifiers/__tests__/addHeadingId.js +23 -0
- package/lib/output/modifiers/__tests__/annotateText.d.ts +2 -0
- package/lib/output/modifiers/__tests__/annotateText.d.ts.map +1 -0
- package/lib/output/modifiers/__tests__/annotateText.js +71 -0
- package/lib/output/modifiers/__tests__/fetchRemoteImages.d.ts +2 -0
- package/lib/output/modifiers/__tests__/fetchRemoteImages.d.ts.map +1 -0
- package/lib/output/modifiers/__tests__/fetchRemoteImages.js +69 -0
- package/lib/output/modifiers/__tests__/highlightCode.d.ts +2 -0
- package/lib/output/modifiers/__tests__/highlightCode.d.ts.map +1 -0
- package/lib/output/modifiers/__tests__/highlightCode.js +48 -0
- package/lib/output/modifiers/__tests__/inlinePng.d.ts +2 -0
- package/lib/output/modifiers/__tests__/inlinePng.d.ts.map +1 -0
- package/lib/output/modifiers/__tests__/inlinePng.js +22 -0
- package/lib/output/modifiers/__tests__/inlineSvg.d.ts +2 -0
- package/lib/output/modifiers/__tests__/inlineSvg.d.ts.map +1 -0
- package/lib/output/modifiers/__tests__/inlineSvg.js +42 -0
- package/lib/output/modifiers/__tests__/resolveImages.d.ts +2 -0
- package/lib/output/modifiers/__tests__/resolveImages.d.ts.map +1 -0
- package/lib/output/modifiers/__tests__/resolveImages.js +39 -0
- package/lib/output/modifiers/__tests__/resolveLinks.d.ts +2 -0
- package/lib/output/modifiers/__tests__/resolveLinks.d.ts.map +1 -0
- package/lib/output/modifiers/__tests__/resolveLinks.js +81 -0
- package/lib/output/modifiers/__tests__/svgToImg.d.ts +2 -0
- package/lib/output/modifiers/__tests__/svgToImg.d.ts.map +1 -0
- package/lib/output/modifiers/__tests__/svgToImg.js +29 -0
- package/lib/output/website/__tests__/i18n.d.ts +2 -0
- package/lib/output/website/__tests__/i18n.d.ts.map +1 -0
- package/lib/output/website/__tests__/i18n.js +40 -0
- package/lib/parse/__tests__/listAssets.d.ts +2 -0
- package/lib/parse/__tests__/listAssets.d.ts.map +1 -0
- package/lib/parse/__tests__/listAssets.js +63 -0
- package/lib/parse/__tests__/parseBook.d.ts +2 -0
- package/lib/parse/__tests__/parseBook.d.ts.map +1 -0
- package/lib/parse/__tests__/parseBook.js +77 -0
- package/lib/parse/__tests__/parseGlossary.d.ts +2 -0
- package/lib/parse/__tests__/parseGlossary.d.ts.map +1 -0
- package/lib/parse/__tests__/parseGlossary.js +32 -0
- package/lib/parse/__tests__/parseIgnore.d.ts +2 -0
- package/lib/parse/__tests__/parseIgnore.d.ts.map +1 -0
- package/lib/parse/__tests__/parseIgnore.js +37 -0
- package/lib/parse/__tests__/parsePageFromString.d.ts +2 -0
- package/lib/parse/__tests__/parsePageFromString.d.ts.map +1 -0
- package/lib/parse/__tests__/parsePageFromString.js +34 -0
- package/lib/parse/__tests__/parseReadme.d.ts +2 -0
- package/lib/parse/__tests__/parseReadme.d.ts.map +1 -0
- package/lib/parse/__tests__/parseReadme.js +33 -0
- package/lib/parse/__tests__/parseSummary.d.ts +2 -0
- package/lib/parse/__tests__/parseSummary.d.ts.map +1 -0
- package/lib/parse/__tests__/parseSummary.js +30 -0
- package/lib/plugins/__tests__/listDependencies.d.ts +2 -0
- package/lib/plugins/__tests__/listDependencies.d.ts.map +1 -0
- package/lib/plugins/__tests__/listDependencies.js +28 -0
- package/lib/plugins/__tests__/sortDependencies.d.ts +2 -0
- package/lib/plugins/__tests__/sortDependencies.d.ts.map +1 -0
- package/lib/plugins/__tests__/sortDependencies.js +28 -0
- package/lib/plugins/__tests__/validatePlugin.d.ts +2 -0
- package/lib/plugins/__tests__/validatePlugin.d.ts.map +1 -0
- package/lib/plugins/__tests__/validatePlugin.js +99 -0
- package/lib/plugins/package-name-util.d.ts.map +1 -1
- package/lib/plugins/package-name-util.js +1 -2
- package/lib/templating/__tests__/conrefsLoader.d.ts +2 -0
- package/lib/templating/__tests__/conrefsLoader.d.ts.map +1 -0
- package/lib/templating/__tests__/conrefsLoader.js +90 -0
- package/lib/templating/__tests__/postRender.d.ts +2 -0
- package/lib/templating/__tests__/postRender.d.ts.map +1 -0
- package/lib/templating/__tests__/postRender.js +52 -0
- package/lib/templating/__tests__/replaceShortcuts.d.ts +2 -0
- package/lib/templating/__tests__/replaceShortcuts.d.ts.map +1 -0
- package/lib/templating/__tests__/replaceShortcuts.js +27 -0
- package/lib/utils/__tests__/git.d.ts +2 -0
- package/lib/utils/__tests__/git.d.ts.map +1 -0
- package/lib/utils/__tests__/git.js +46 -0
- package/lib/utils/__tests__/location.d.ts +2 -0
- package/lib/utils/__tests__/location.d.ts.map +1 -0
- package/lib/utils/__tests__/location.js +81 -0
- package/lib/utils/__tests__/path.d.ts +2 -0
- package/lib/utils/__tests__/path.d.ts.map +1 -0
- package/lib/utils/__tests__/path.js +19 -0
- package/package.json +19 -22
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const templateEngine_1 = __importDefault(require("../templateEngine"));
|
|
7
|
+
describe("TemplateBlock", () => {
|
|
8
|
+
describe("create", () => {
|
|
9
|
+
test("must initialize with a list of filters", () => {
|
|
10
|
+
const engine = templateEngine_1.default.create({
|
|
11
|
+
filters: {
|
|
12
|
+
hello: function (name) {
|
|
13
|
+
return `Hello ${name}!`;
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
const env = engine.toNunjucks();
|
|
18
|
+
const res = env.renderString('{{ "Luke"|hello }}', {});
|
|
19
|
+
expect(res).toBe("Hello Luke!");
|
|
20
|
+
});
|
|
21
|
+
test("must initialize with a list of globals", () => {
|
|
22
|
+
const engine = templateEngine_1.default.create({
|
|
23
|
+
globals: {
|
|
24
|
+
hello: function (name) {
|
|
25
|
+
return `Hello ${name}!`;
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
const env = engine.toNunjucks();
|
|
30
|
+
const res = env.renderString('{{ hello("Luke") }}', {});
|
|
31
|
+
expect(res).toBe("Hello Luke!");
|
|
32
|
+
});
|
|
33
|
+
test("must pass context to filters and blocks", () => {
|
|
34
|
+
const engine = templateEngine_1.default.create({
|
|
35
|
+
filters: {
|
|
36
|
+
hello: function (name) {
|
|
37
|
+
return `Hello ${name} ${this.lastName}!`;
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
context: {
|
|
41
|
+
lastName: "Skywalker",
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
const env = engine.toNunjucks();
|
|
45
|
+
const res = env.renderString('{{ "Luke"|hello }}', {});
|
|
46
|
+
expect(res).toBe("Hello Luke Skywalker!");
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pluginDependency.d.ts","sourceRoot":"","sources":["../../src/models/pluginDependency.ts"],"names":[],"mappings":"AAEA,OAAO,SAAS,MAAM,WAAW,CAAC;;
|
|
1
|
+
{"version":3,"file":"pluginDependency.d.ts","sourceRoot":"","sources":["../../src/models/pluginDependency.ts"],"names":[],"mappings":"AAEA,OAAO,SAAS,MAAM,WAAW,CAAC;;AAQlC,cAAM,gBAAiB,SAAQ,qBAc9B;IACG,OAAO;IAIP,UAAU;IAIV,OAAO;IAIP,SAAS;IAIT;;;OAGG;IACH,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO;IAQtB;;;OAGG;IACH,eAAe;IAIf;;;OAGG;IACH,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO;IAY9D;;;;OAIG;IACH,MAAM,CAAC,gBAAgB,CAAC,CAAC,KAAA;IAqDzB;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,CAAC,KAAA;IAKvB;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC,gBAAgB,GAAG,MAAM,CAAC,EAAE;IAiBvD;;;;OAIG;IACH,MAAM,CAAC,WAAW,CAAC,IAAI,KAAA;CAkB1B;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addPlugin.d.ts","sourceRoot":"","sources":["../../../../src/modifiers/config/__tests__/addPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const addPlugin_1 = __importDefault(require("../addPlugin"));
|
|
7
|
+
const config_1 = __importDefault(require("../../../models/config"));
|
|
8
|
+
describe("addPlugin", () => {
|
|
9
|
+
const config = config_1.default.createWithValues({
|
|
10
|
+
plugins: ["hello", "world", "-disabled"],
|
|
11
|
+
});
|
|
12
|
+
test("should have correct state of dependencies", () => {
|
|
13
|
+
const disabledDep = config.getPluginDependency("disabled");
|
|
14
|
+
expect(disabledDep).toBeDefined();
|
|
15
|
+
expect(disabledDep.getVersion()).toEqual("*");
|
|
16
|
+
expect(disabledDep.isEnabled()).toBeFalsy();
|
|
17
|
+
});
|
|
18
|
+
test("should add the plugin to the list", () => {
|
|
19
|
+
// @ts-expect-error ts-migrate(2554) FIXME: Expected 3 arguments, but got 2.
|
|
20
|
+
const newConfig = (0, addPlugin_1.default)(config, "test");
|
|
21
|
+
const testDep = newConfig.getPluginDependency("test");
|
|
22
|
+
expect(testDep).toBeDefined();
|
|
23
|
+
expect(testDep.getVersion()).toEqual("*");
|
|
24
|
+
expect(testDep.isEnabled()).toBeTruthy();
|
|
25
|
+
const disabledDep = newConfig.getPluginDependency("disabled");
|
|
26
|
+
expect(disabledDep).toBeDefined();
|
|
27
|
+
expect(disabledDep.getVersion()).toEqual("*");
|
|
28
|
+
expect(disabledDep.isEnabled()).toBeFalsy();
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removePlugin.d.ts","sourceRoot":"","sources":["../../../../src/modifiers/config/__tests__/removePlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const removePlugin_1 = __importDefault(require("../removePlugin"));
|
|
7
|
+
const config_1 = __importDefault(require("../../../models/config"));
|
|
8
|
+
describe("removePlugin", () => {
|
|
9
|
+
const config = config_1.default.createWithValues({
|
|
10
|
+
plugins: ["hello", "world", "-disabled"],
|
|
11
|
+
});
|
|
12
|
+
test("should remove the plugin from the list", () => {
|
|
13
|
+
const newConfig = (0, removePlugin_1.default)(config, "hello");
|
|
14
|
+
const testDep = newConfig.getPluginDependency("hello");
|
|
15
|
+
expect(testDep).toBeUndefined();
|
|
16
|
+
});
|
|
17
|
+
test("should remove the disabled plugin from the list", () => {
|
|
18
|
+
const newConfig = (0, removePlugin_1.default)(config, "disabled");
|
|
19
|
+
const testDep = newConfig.getPluginDependency("disabled");
|
|
20
|
+
expect(testDep).toBeUndefined();
|
|
21
|
+
});
|
|
22
|
+
test("should disable default plugin", () => {
|
|
23
|
+
const newConfig = (0, removePlugin_1.default)(config, "search");
|
|
24
|
+
const disabledDep = newConfig.getPluginDependency("search");
|
|
25
|
+
expect(disabledDep).toBeDefined();
|
|
26
|
+
expect(disabledDep.getVersion()).toEqual("*");
|
|
27
|
+
expect(disabledDep.isEnabled()).toBeFalsy();
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"togglePlugin.d.ts","sourceRoot":"","sources":["../../../../src/modifiers/config/__tests__/togglePlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const togglePlugin_1 = __importDefault(require("../togglePlugin"));
|
|
7
|
+
const config_1 = __importDefault(require("../../../models/config"));
|
|
8
|
+
describe("togglePlugin", () => {
|
|
9
|
+
const config = config_1.default.createWithValues({
|
|
10
|
+
plugins: ["hello", "world", "-disabled"],
|
|
11
|
+
});
|
|
12
|
+
test("should enable plugin", () => {
|
|
13
|
+
// @ts-expect-error ts-migrate(2554) FIXME: Expected 3 arguments, but got 2.
|
|
14
|
+
const newConfig = (0, togglePlugin_1.default)(config, "disabled");
|
|
15
|
+
const testDep = newConfig.getPluginDependency("disabled");
|
|
16
|
+
expect(testDep).toBeDefined();
|
|
17
|
+
expect(testDep.getVersion()).toEqual("*");
|
|
18
|
+
expect(testDep.isEnabled()).toBeTruthy();
|
|
19
|
+
});
|
|
20
|
+
test("should disable plugin", () => {
|
|
21
|
+
// @ts-expect-error ts-migrate(2554) FIXME: Expected 3 arguments, but got 2.
|
|
22
|
+
const newConfig = (0, togglePlugin_1.default)(config, "world");
|
|
23
|
+
const testDep = newConfig.getPluginDependency("world");
|
|
24
|
+
expect(testDep).toBeDefined();
|
|
25
|
+
expect(testDep.getVersion()).toEqual("*");
|
|
26
|
+
expect(testDep.isEnabled()).toBeFalsy();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editPartTitle.d.ts","sourceRoot":"","sources":["../../../../src/modifiers/summary/__tests__/editPartTitle.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const summary_1 = __importDefault(require("../../../models/summary"));
|
|
7
|
+
const file_1 = __importDefault(require("../../../models/file"));
|
|
8
|
+
const editPartTitle_1 = __importDefault(require("../editPartTitle"));
|
|
9
|
+
describe("editPartTitle", () => {
|
|
10
|
+
const summary = summary_1.default.createFromParts(new file_1.default(), [
|
|
11
|
+
{
|
|
12
|
+
articles: [
|
|
13
|
+
{
|
|
14
|
+
title: "My First Article",
|
|
15
|
+
path: "README.md",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
title: "My Second Article",
|
|
19
|
+
path: "article.md",
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
title: "Test",
|
|
25
|
+
},
|
|
26
|
+
]);
|
|
27
|
+
test("should correctly set title of first part", () => {
|
|
28
|
+
const newSummary = (0, editPartTitle_1.default)(summary, 0, "Hello World");
|
|
29
|
+
const part = newSummary.getPart(0);
|
|
30
|
+
expect(part.getTitle()).toBe("Hello World");
|
|
31
|
+
});
|
|
32
|
+
test("should correctly set title of second part", () => {
|
|
33
|
+
const newSummary = (0, editPartTitle_1.default)(summary, 1, "Hello");
|
|
34
|
+
const part = newSummary.getPart(1);
|
|
35
|
+
expect(part.getTitle()).toBe("Hello");
|
|
36
|
+
});
|
|
37
|
+
test("should not fail if part doesn't exist", () => {
|
|
38
|
+
const newSummary = (0, editPartTitle_1.default)(summary, 3, "Hello");
|
|
39
|
+
expect(newSummary.getParts().size).toBe(2);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insertArticle.d.ts","sourceRoot":"","sources":["../../../../src/modifiers/summary/__tests__/insertArticle.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const summary_1 = __importDefault(require("../../../models/summary"));
|
|
7
|
+
const summaryArticle_1 = __importDefault(require("../../../models/summaryArticle"));
|
|
8
|
+
const file_1 = __importDefault(require("../../../models/file"));
|
|
9
|
+
const insertArticle_1 = __importDefault(require("../insertArticle"));
|
|
10
|
+
describe("insertArticle", () => {
|
|
11
|
+
const summary = summary_1.default.createFromParts(new file_1.default(), [
|
|
12
|
+
{
|
|
13
|
+
articles: [
|
|
14
|
+
{
|
|
15
|
+
title: "1.1",
|
|
16
|
+
path: "1.1",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
title: "1.2",
|
|
20
|
+
path: "1.2",
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
title: "Part I",
|
|
26
|
+
articles: [
|
|
27
|
+
{
|
|
28
|
+
title: "2.1",
|
|
29
|
+
path: "2.1",
|
|
30
|
+
articles: [
|
|
31
|
+
{
|
|
32
|
+
title: "2.1.1",
|
|
33
|
+
path: "2.1.1",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
title: "2.1.2",
|
|
37
|
+
path: "2.1.2",
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
title: "2.2",
|
|
43
|
+
path: "2.2",
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
]);
|
|
48
|
+
test("should insert an article at a given level", () => {
|
|
49
|
+
const article = summaryArticle_1.default.create({
|
|
50
|
+
title: "Inserted",
|
|
51
|
+
}, "fake.level");
|
|
52
|
+
const newSummary = (0, insertArticle_1.default)(summary, article, "2.1.1");
|
|
53
|
+
const inserted = newSummary.getByLevel("2.1.1");
|
|
54
|
+
const nextOne = newSummary.getByLevel("2.1.2");
|
|
55
|
+
expect(inserted.getTitle()).toBe("Inserted");
|
|
56
|
+
expect(inserted.getLevel()).toBe("2.1.1");
|
|
57
|
+
expect(nextOne.getTitle()).toBe("2.1.1");
|
|
58
|
+
expect(nextOne.getLevel()).toBe("2.1.2");
|
|
59
|
+
});
|
|
60
|
+
test("should insert an article in last position", () => {
|
|
61
|
+
const article = summaryArticle_1.default.create({
|
|
62
|
+
title: "Inserted",
|
|
63
|
+
}, "fake.level");
|
|
64
|
+
const newSummary = (0, insertArticle_1.default)(summary, article, "2.2");
|
|
65
|
+
const inserted = newSummary.getByLevel("2.2");
|
|
66
|
+
const previousOne = newSummary.getByLevel("2.1");
|
|
67
|
+
expect(inserted.getTitle()).toBe("Inserted");
|
|
68
|
+
expect(inserted.getLevel()).toBe("2.2");
|
|
69
|
+
expect(previousOne.getTitle()).toBe("2.1"); // Unchanged
|
|
70
|
+
expect(previousOne.getLevel()).toBe("2.1");
|
|
71
|
+
});
|
|
72
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insertPart.d.ts","sourceRoot":"","sources":["../../../../src/modifiers/summary/__tests__/insertPart.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const summary_1 = __importDefault(require("../../../models/summary"));
|
|
7
|
+
const summaryPart_1 = __importDefault(require("../../../models/summaryPart"));
|
|
8
|
+
const file_1 = __importDefault(require("../../../models/file"));
|
|
9
|
+
const insertPart_1 = __importDefault(require("../insertPart"));
|
|
10
|
+
describe("insertPart", () => {
|
|
11
|
+
const summary = summary_1.default.createFromParts(new file_1.default(), [
|
|
12
|
+
{
|
|
13
|
+
articles: [
|
|
14
|
+
{
|
|
15
|
+
title: "1.1",
|
|
16
|
+
path: "1.1",
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
title: "Part I",
|
|
22
|
+
articles: [
|
|
23
|
+
{
|
|
24
|
+
title: "2.1",
|
|
25
|
+
path: "2.1",
|
|
26
|
+
articles: [],
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
title: "2.2",
|
|
30
|
+
path: "2.2",
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
]);
|
|
35
|
+
test("should insert an part at a given level", () => {
|
|
36
|
+
const part = summaryPart_1.default.create({
|
|
37
|
+
title: "Inserted",
|
|
38
|
+
}, "meaningless.level");
|
|
39
|
+
const newSummary = (0, insertPart_1.default)(summary, part, 1);
|
|
40
|
+
const inserted = newSummary.getPart(1);
|
|
41
|
+
expect(inserted.getTitle()).toBe("Inserted");
|
|
42
|
+
expect(newSummary.getParts().count()).toBe(3);
|
|
43
|
+
const otherArticle = newSummary.getByLevel("3.1");
|
|
44
|
+
expect(otherArticle.getTitle()).toBe("2.1");
|
|
45
|
+
expect(otherArticle.getLevel()).toBe("3.1");
|
|
46
|
+
});
|
|
47
|
+
test("should insert an part in last position", () => {
|
|
48
|
+
const part = summaryPart_1.default.create({
|
|
49
|
+
title: "Inserted",
|
|
50
|
+
}, "meaningless.level");
|
|
51
|
+
const newSummary = (0, insertPart_1.default)(summary, part, 2);
|
|
52
|
+
const inserted = newSummary.getPart(2);
|
|
53
|
+
expect(inserted.getTitle()).toBe("Inserted");
|
|
54
|
+
expect(newSummary.getParts().count()).toBe(3);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mergeAtLevel.d.ts","sourceRoot":"","sources":["../../../../src/modifiers/summary/__tests__/mergeAtLevel.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const immutable_1 = __importDefault(require("immutable"));
|
|
7
|
+
const summary_1 = __importDefault(require("../../../models/summary"));
|
|
8
|
+
const file_1 = __importDefault(require("../../../models/file"));
|
|
9
|
+
const mergeAtLevel_1 = __importDefault(require("../mergeAtLevel"));
|
|
10
|
+
describe("mergeAtLevel", () => {
|
|
11
|
+
const summary = summary_1.default.createFromParts(new file_1.default(), [
|
|
12
|
+
{
|
|
13
|
+
articles: [
|
|
14
|
+
{
|
|
15
|
+
title: "1.1",
|
|
16
|
+
path: "1.1",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
title: "1.2",
|
|
20
|
+
path: "1.2",
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
title: "Part I",
|
|
26
|
+
articles: [],
|
|
27
|
+
},
|
|
28
|
+
]);
|
|
29
|
+
test("should edit a part", () => {
|
|
30
|
+
const beforeChildren = summary.getByLevel("1").getArticles();
|
|
31
|
+
const newSummary = (0, mergeAtLevel_1.default)(summary, "1", { title: "Part O" });
|
|
32
|
+
const edited = newSummary.getByLevel("1");
|
|
33
|
+
expect(edited.getTitle()).toBe("Part O");
|
|
34
|
+
// Same children
|
|
35
|
+
expect(immutable_1.default.is(beforeChildren, edited.getArticles())).toBe(true);
|
|
36
|
+
});
|
|
37
|
+
test("should edit a part", () => {
|
|
38
|
+
const beforePath = summary.getByLevel("1.2").getPath();
|
|
39
|
+
const newSummary = (0, mergeAtLevel_1.default)(summary, "1.2", { title: "Renamed article" });
|
|
40
|
+
const edited = newSummary.getByLevel("1.2");
|
|
41
|
+
expect(edited.getTitle()).toBe("Renamed article");
|
|
42
|
+
// Same children
|
|
43
|
+
expect(immutable_1.default.is(beforePath, edited.getPath())).toBe(true);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moveArticle.d.ts","sourceRoot":"","sources":["../../../../src/modifiers/summary/__tests__/moveArticle.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const immutable_1 = __importDefault(require("immutable"));
|
|
7
|
+
const summary_1 = __importDefault(require("../../../models/summary"));
|
|
8
|
+
const file_1 = __importDefault(require("../../../models/file"));
|
|
9
|
+
const moveArticle_1 = __importDefault(require("../moveArticle"));
|
|
10
|
+
describe("moveArticle", () => {
|
|
11
|
+
const summary = summary_1.default.createFromParts(new file_1.default(), [
|
|
12
|
+
{
|
|
13
|
+
articles: [
|
|
14
|
+
{
|
|
15
|
+
title: "1.1",
|
|
16
|
+
path: "1.1",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
title: "1.2",
|
|
20
|
+
path: "1.2",
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
title: "Part I",
|
|
26
|
+
articles: [
|
|
27
|
+
{
|
|
28
|
+
title: "2.1",
|
|
29
|
+
path: "2.1",
|
|
30
|
+
articles: [
|
|
31
|
+
{
|
|
32
|
+
title: "2.1.1",
|
|
33
|
+
path: "2.1.1",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
title: "2.1.2",
|
|
37
|
+
path: "2.1.2",
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
title: "2.2",
|
|
43
|
+
path: "2.2",
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
]);
|
|
48
|
+
test("should move an article to the same place", () => {
|
|
49
|
+
const newSummary = (0, moveArticle_1.default)(summary, "2.1", "2.1");
|
|
50
|
+
expect(immutable_1.default.is(summary, newSummary)).toBe(true);
|
|
51
|
+
});
|
|
52
|
+
test("should move an article to an previous level", () => {
|
|
53
|
+
const newSummary = (0, moveArticle_1.default)(summary, "2.2", "2.1");
|
|
54
|
+
const moved = newSummary.getByLevel("2.1");
|
|
55
|
+
const other = newSummary.getByLevel("2.2");
|
|
56
|
+
expect(moved.getTitle()).toBe("2.2");
|
|
57
|
+
expect(other.getTitle()).toBe("2.1");
|
|
58
|
+
});
|
|
59
|
+
test("should move an article to a next level", () => {
|
|
60
|
+
const newSummary = (0, moveArticle_1.default)(summary, "2.1", "2.2");
|
|
61
|
+
const moved = newSummary.getByLevel("2.1");
|
|
62
|
+
const other = newSummary.getByLevel("2.2");
|
|
63
|
+
expect(moved.getTitle()).toBe("2.2");
|
|
64
|
+
expect(other.getTitle()).toBe("2.1");
|
|
65
|
+
});
|
|
66
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moveArticleAfter.d.ts","sourceRoot":"","sources":["../../../../src/modifiers/summary/__tests__/moveArticleAfter.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const immutable_1 = __importDefault(require("immutable"));
|
|
7
|
+
const summary_1 = __importDefault(require("../../../models/summary"));
|
|
8
|
+
const file_1 = __importDefault(require("../../../models/file"));
|
|
9
|
+
const moveArticleAfter_1 = __importDefault(require("../moveArticleAfter"));
|
|
10
|
+
describe("moveArticleAfter", () => {
|
|
11
|
+
const summary = summary_1.default.createFromParts(new file_1.default(), [
|
|
12
|
+
{
|
|
13
|
+
articles: [
|
|
14
|
+
{
|
|
15
|
+
title: "1.1",
|
|
16
|
+
path: "1.1",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
title: "1.2",
|
|
20
|
+
path: "1.2",
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
title: "Part I",
|
|
26
|
+
articles: [
|
|
27
|
+
{
|
|
28
|
+
title: "2.1",
|
|
29
|
+
path: "2.1",
|
|
30
|
+
articles: [
|
|
31
|
+
{
|
|
32
|
+
title: "2.1.1",
|
|
33
|
+
path: "2.1.1",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
title: "2.1.2",
|
|
37
|
+
path: "2.1.2",
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
title: "2.2",
|
|
43
|
+
path: "2.2",
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
]);
|
|
48
|
+
test("moving right after itself should be invariant", () => {
|
|
49
|
+
const newSummary = (0, moveArticleAfter_1.default)(summary, "2.1", "2.1");
|
|
50
|
+
expect(immutable_1.default.is(summary, newSummary)).toBe(true);
|
|
51
|
+
});
|
|
52
|
+
test("moving after previous one should be invariant too", () => {
|
|
53
|
+
const newSummary = (0, moveArticleAfter_1.default)(summary, "2.1", "2.0");
|
|
54
|
+
expect(immutable_1.default.is(summary, newSummary)).toBe(true);
|
|
55
|
+
});
|
|
56
|
+
test("should move an article after a previous level", () => {
|
|
57
|
+
const newSummary = (0, moveArticleAfter_1.default)(summary, "2.2", "2.0");
|
|
58
|
+
const moved = newSummary.getByLevel("2.1");
|
|
59
|
+
expect(moved.getTitle()).toBe("2.2");
|
|
60
|
+
expect(newSummary.getByLevel("2.2").getTitle()).toBe("2.1");
|
|
61
|
+
});
|
|
62
|
+
test("should move an article after a previous and less deep level", () => {
|
|
63
|
+
const newSummary = (0, moveArticleAfter_1.default)(summary, "2.1.1", "2.0");
|
|
64
|
+
const moved = newSummary.getByLevel("2.1");
|
|
65
|
+
expect(moved.getTitle()).toBe("2.1.1");
|
|
66
|
+
expect(newSummary.getByLevel("2.2.1").getTitle()).toBe("2.1.2");
|
|
67
|
+
expect(newSummary.getByLevel("2.2").getTitle()).toBe("2.1");
|
|
68
|
+
});
|
|
69
|
+
test("should move an article after a next level", () => {
|
|
70
|
+
const newSummary = (0, moveArticleAfter_1.default)(summary, "2.1", "2.2");
|
|
71
|
+
const moved = newSummary.getByLevel("2.2");
|
|
72
|
+
expect(moved.getTitle()).toBe("2.1");
|
|
73
|
+
expect(newSummary.getByLevel("2.1").getTitle()).toBe("2.2");
|
|
74
|
+
});
|
|
75
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeArticle.d.ts","sourceRoot":"","sources":["../../../../src/modifiers/summary/__tests__/removeArticle.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const summary_1 = __importDefault(require("../../../models/summary"));
|
|
7
|
+
const file_1 = __importDefault(require("../../../models/file"));
|
|
8
|
+
const removeArticle_1 = __importDefault(require("../removeArticle"));
|
|
9
|
+
describe("removeArticle", () => {
|
|
10
|
+
const summary = summary_1.default.createFromParts(new file_1.default(), [
|
|
11
|
+
{
|
|
12
|
+
articles: [
|
|
13
|
+
{
|
|
14
|
+
title: "1.1",
|
|
15
|
+
path: "1.1",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
title: "1.2",
|
|
19
|
+
path: "1.2",
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
title: "Part I",
|
|
25
|
+
articles: [
|
|
26
|
+
{
|
|
27
|
+
title: "2.1",
|
|
28
|
+
path: "2.1",
|
|
29
|
+
articles: [
|
|
30
|
+
{
|
|
31
|
+
title: "2.1.1",
|
|
32
|
+
path: "2.1.1",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
title: "2.1.2",
|
|
36
|
+
path: "2.1.2",
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
title: "2.2",
|
|
42
|
+
path: "2.2",
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
]);
|
|
47
|
+
test("should remove an article at a given level", () => {
|
|
48
|
+
const newSummary = (0, removeArticle_1.default)(summary, "2.1.1");
|
|
49
|
+
const removed = newSummary.getByLevel("2.1.1");
|
|
50
|
+
const nextOne = newSummary.getByLevel("2.1.2");
|
|
51
|
+
expect(removed.getTitle()).toBe("2.1.2");
|
|
52
|
+
expect(nextOne).toBe(null);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ebook.d.ts","sourceRoot":"","sources":["../../../src/output/__tests__/ebook.ts"],"names":[],"mappings":""}
|