honkit 5.1.5 → 6.0.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/lib/api/decodeConfig.js +1 -2
- package/lib/api/decodeGlobal.js +1 -2
- package/lib/api/encodeGlobal.d.ts.map +1 -1
- package/lib/bin.d.ts.map +1 -1
- package/lib/cli/buildEbook.js +1 -1
- package/lib/cli/server.d.ts +0 -1
- package/lib/cli/server.d.ts.map +1 -1
- package/lib/cli/server.js +4 -0
- package/lib/fs/node.js +1 -1
- package/lib/models/file.d.ts +0 -1
- package/lib/models/file.d.ts.map +1 -1
- package/lib/models/fs.d.ts +0 -1
- package/lib/models/fs.d.ts.map +1 -1
- package/lib/models/hash.js +2 -2
- package/lib/output/generateBook.js +2 -3
- package/lib/output/json/onFinish.js +1 -2
- package/lib/output/json/onPage.js +1 -2
- package/lib/output/modifiers/fetchRemoteImages.d.ts +2 -2
- package/lib/output/modifiers/fetchRemoteImages.d.ts.map +1 -1
- package/lib/output/modifiers/inlineSvg.d.ts.map +1 -1
- package/lib/output/modifiers/inlineSvg.js +1 -0
- package/lib/output/modifiers/modifyHTML.d.ts.map +1 -1
- package/lib/output/modifiers/modifyHTML.js +1 -0
- package/lib/output/testing/generateMock.js +1 -2
- package/lib/output/website/onFinish.js +1 -2
- package/lib/output/website/onPage.js +1 -2
- package/lib/plugins/PluginResolver.js +2 -1
- package/lib/plugins/loadPlugin.js +1 -2
- package/lib/utils/command.d.ts +0 -1
- package/lib/utils/command.d.ts.map +1 -1
- package/lib/utils/fs.d.ts +0 -1
- package/lib/utils/fs.d.ts.map +1 -1
- package/lib/utils/promise.js +6 -7
- package/package.json +33 -31
- package/lib/__tests__/__fixtures__/honkit/book.d.ts +0 -7
- package/lib/__tests__/__fixtures__/honkit/book.d.ts.map +0 -1
- package/lib/__tests__/__fixtures__/honkit/book.js +0 -9
- package/lib/__tests__/e2e.test.d.ts +0 -2
- package/lib/__tests__/e2e.test.d.ts.map +0 -1
- package/lib/__tests__/e2e.test.js +0 -81
- package/lib/__tests__/init.d.ts +0 -2
- package/lib/__tests__/init.d.ts.map +0 -1
- package/lib/__tests__/init.js +0 -19
- package/lib/__tests__/satisfies.d.ts +0 -2
- package/lib/__tests__/satisfies.d.ts.map +0 -1
- package/lib/__tests__/satisfies.js +0 -11
- package/lib/__tests__/snapshot-asciidoc.d.ts +0 -2
- package/lib/__tests__/snapshot-asciidoc.d.ts.map +0 -1
- package/lib/__tests__/snapshot-asciidoc.js +0 -48
- package/lib/__tests__/snapshot-honkit.d.ts +0 -2
- package/lib/__tests__/snapshot-honkit.d.ts.map +0 -1
- package/lib/__tests__/snapshot-honkit.js +0 -48
- package/lib/constants/__tests__/configSchema.d.ts +0 -2
- package/lib/constants/__tests__/configSchema.d.ts.map +0 -1
- package/lib/constants/__tests__/configSchema.js +0 -41
- package/lib/fs/__tests__/mock.d.ts +0 -2
- package/lib/fs/__tests__/mock.d.ts.map +0 -1
- package/lib/fs/__tests__/mock.js +0 -68
- package/lib/models/__tests__/config.d.ts +0 -2
- package/lib/models/__tests__/config.d.ts.map +0 -1
- package/lib/models/__tests__/config.js +0 -164
- package/lib/models/__tests__/glossary.d.ts +0 -2
- package/lib/models/__tests__/glossary.d.ts.map +0 -1
- package/lib/models/__tests__/glossary.js +0 -38
- package/lib/models/__tests__/glossaryEntry.d.ts +0 -2
- package/lib/models/__tests__/glossaryEntry.d.ts.map +0 -1
- package/lib/models/__tests__/glossaryEntry.js +0 -16
- package/lib/models/__tests__/page.d.ts +0 -2
- package/lib/models/__tests__/page.d.ts.map +0 -1
- package/lib/models/__tests__/page.js +0 -26
- package/lib/models/__tests__/plugin.d.ts +0 -2
- package/lib/models/__tests__/plugin.d.ts.map +0 -1
- package/lib/models/__tests__/plugin.js +0 -50
- package/lib/models/__tests__/pluginDependency.d.ts +0 -2
- package/lib/models/__tests__/pluginDependency.d.ts.map +0 -1
- package/lib/models/__tests__/pluginDependency.js +0 -71
- package/lib/models/__tests__/summary.d.ts +0 -2
- package/lib/models/__tests__/summary.d.ts.map +0 -1
- package/lib/models/__tests__/summary.js +0 -115
- package/lib/models/__tests__/summaryArticle.d.ts +0 -2
- package/lib/models/__tests__/summaryArticle.d.ts.map +0 -1
- package/lib/models/__tests__/summaryArticle.js +0 -117
- package/lib/models/__tests__/summaryPart.d.ts +0 -2
- package/lib/models/__tests__/summaryPart.d.ts.map +0 -1
- package/lib/models/__tests__/summaryPart.js +0 -24
- package/lib/models/__tests__/templateBlock.d.ts +0 -2
- package/lib/models/__tests__/templateBlock.d.ts.map +0 -1
- package/lib/models/__tests__/templateBlock.js +0 -172
- package/lib/models/__tests__/templateEngine.d.ts +0 -2
- package/lib/models/__tests__/templateEngine.d.ts.map +0 -1
- package/lib/models/__tests__/templateEngine.js +0 -49
- package/lib/modifiers/config/__tests__/addPlugin.d.ts +0 -2
- package/lib/modifiers/config/__tests__/addPlugin.d.ts.map +0 -1
- package/lib/modifiers/config/__tests__/addPlugin.js +0 -30
- package/lib/modifiers/config/__tests__/removePlugin.d.ts +0 -2
- package/lib/modifiers/config/__tests__/removePlugin.d.ts.map +0 -1
- package/lib/modifiers/config/__tests__/removePlugin.js +0 -29
- package/lib/modifiers/config/__tests__/togglePlugin.d.ts +0 -2
- package/lib/modifiers/config/__tests__/togglePlugin.d.ts.map +0 -1
- package/lib/modifiers/config/__tests__/togglePlugin.js +0 -28
- package/lib/modifiers/summary/__tests__/editPartTitle.d.ts +0 -2
- package/lib/modifiers/summary/__tests__/editPartTitle.d.ts.map +0 -1
- package/lib/modifiers/summary/__tests__/editPartTitle.js +0 -41
- package/lib/modifiers/summary/__tests__/insertArticle.d.ts +0 -2
- package/lib/modifiers/summary/__tests__/insertArticle.d.ts.map +0 -1
- package/lib/modifiers/summary/__tests__/insertArticle.js +0 -72
- package/lib/modifiers/summary/__tests__/insertPart.d.ts +0 -2
- package/lib/modifiers/summary/__tests__/insertPart.d.ts.map +0 -1
- package/lib/modifiers/summary/__tests__/insertPart.js +0 -56
- package/lib/modifiers/summary/__tests__/mergeAtLevel.d.ts +0 -2
- package/lib/modifiers/summary/__tests__/mergeAtLevel.d.ts.map +0 -1
- package/lib/modifiers/summary/__tests__/mergeAtLevel.js +0 -45
- package/lib/modifiers/summary/__tests__/moveArticle.d.ts +0 -2
- package/lib/modifiers/summary/__tests__/moveArticle.d.ts.map +0 -1
- package/lib/modifiers/summary/__tests__/moveArticle.js +0 -66
- package/lib/modifiers/summary/__tests__/moveArticleAfter.d.ts +0 -2
- package/lib/modifiers/summary/__tests__/moveArticleAfter.d.ts.map +0 -1
- package/lib/modifiers/summary/__tests__/moveArticleAfter.js +0 -75
- package/lib/modifiers/summary/__tests__/removeArticle.d.ts +0 -2
- package/lib/modifiers/summary/__tests__/removeArticle.d.ts.map +0 -1
- package/lib/modifiers/summary/__tests__/removeArticle.js +0 -54
- package/lib/output/__tests__/ebook.d.ts +0 -2
- package/lib/output/__tests__/ebook.d.ts.map +0 -1
- package/lib/output/__tests__/ebook.js +0 -17
- package/lib/output/__tests__/json.d.ts +0 -2
- package/lib/output/__tests__/json.d.ts.map +0 -1
- package/lib/output/__tests__/json.js +0 -43
- package/lib/output/__tests__/plugin-hooks.d.ts +0 -2
- package/lib/output/__tests__/plugin-hooks.d.ts.map +0 -1
- package/lib/output/__tests__/plugin-hooks.js +0 -57
- package/lib/output/__tests__/website.d.ts +0 -2
- package/lib/output/__tests__/website.d.ts.map +0 -1
- package/lib/output/__tests__/website.js +0 -121
- package/lib/output/modifiers/__tests__/addHeadingId.d.ts +0 -2
- package/lib/output/modifiers/__tests__/addHeadingId.d.ts.map +0 -1
- package/lib/output/modifiers/__tests__/addHeadingId.js +0 -46
- package/lib/output/modifiers/__tests__/annotateText.d.ts +0 -2
- package/lib/output/modifiers/__tests__/annotateText.d.ts.map +0 -1
- package/lib/output/modifiers/__tests__/annotateText.js +0 -76
- package/lib/output/modifiers/__tests__/fetchRemoteImages.d.ts +0 -2
- package/lib/output/modifiers/__tests__/fetchRemoteImages.d.ts.map +0 -1
- package/lib/output/modifiers/__tests__/fetchRemoteImages.js +0 -69
- package/lib/output/modifiers/__tests__/highlightCode.d.ts +0 -2
- package/lib/output/modifiers/__tests__/highlightCode.d.ts.map +0 -1
- package/lib/output/modifiers/__tests__/highlightCode.js +0 -71
- package/lib/output/modifiers/__tests__/inlinePng.d.ts +0 -2
- package/lib/output/modifiers/__tests__/inlinePng.d.ts.map +0 -1
- package/lib/output/modifiers/__tests__/inlinePng.js +0 -45
- package/lib/output/modifiers/__tests__/inlineSvg.d.ts +0 -2
- package/lib/output/modifiers/__tests__/inlineSvg.d.ts.map +0 -1
- package/lib/output/modifiers/__tests__/inlineSvg.js +0 -65
- package/lib/output/modifiers/__tests__/resolveImages.d.ts +0 -2
- package/lib/output/modifiers/__tests__/resolveImages.d.ts.map +0 -1
- package/lib/output/modifiers/__tests__/resolveImages.js +0 -62
- package/lib/output/modifiers/__tests__/resolveLinks.d.ts +0 -2
- package/lib/output/modifiers/__tests__/resolveLinks.d.ts.map +0 -1
- package/lib/output/modifiers/__tests__/resolveLinks.js +0 -104
- package/lib/output/modifiers/__tests__/svgToImg.d.ts +0 -2
- package/lib/output/modifiers/__tests__/svgToImg.d.ts.map +0 -1
- package/lib/output/modifiers/__tests__/svgToImg.js +0 -52
- package/lib/output/website/__tests__/i18n.d.ts +0 -2
- package/lib/output/website/__tests__/i18n.d.ts.map +0 -1
- package/lib/output/website/__tests__/i18n.js +0 -40
- package/lib/parse/__tests__/listAssets.d.ts +0 -2
- package/lib/parse/__tests__/listAssets.d.ts.map +0 -1
- package/lib/parse/__tests__/listAssets.js +0 -63
- package/lib/parse/__tests__/parseBook.d.ts +0 -2
- package/lib/parse/__tests__/parseBook.d.ts.map +0 -1
- package/lib/parse/__tests__/parseBook.js +0 -77
- package/lib/parse/__tests__/parseGlossary.d.ts +0 -2
- package/lib/parse/__tests__/parseGlossary.d.ts.map +0 -1
- package/lib/parse/__tests__/parseGlossary.js +0 -32
- package/lib/parse/__tests__/parseIgnore.d.ts +0 -2
- package/lib/parse/__tests__/parseIgnore.d.ts.map +0 -1
- package/lib/parse/__tests__/parseIgnore.js +0 -37
- package/lib/parse/__tests__/parsePageFromString.d.ts +0 -2
- package/lib/parse/__tests__/parsePageFromString.d.ts.map +0 -1
- package/lib/parse/__tests__/parsePageFromString.js +0 -34
- package/lib/parse/__tests__/parseReadme.d.ts +0 -2
- package/lib/parse/__tests__/parseReadme.d.ts.map +0 -1
- package/lib/parse/__tests__/parseReadme.js +0 -33
- package/lib/parse/__tests__/parseSummary.d.ts +0 -2
- package/lib/parse/__tests__/parseSummary.d.ts.map +0 -1
- package/lib/parse/__tests__/parseSummary.js +0 -30
- package/lib/plugins/__tests__/listDependencies.d.ts +0 -2
- package/lib/plugins/__tests__/listDependencies.d.ts.map +0 -1
- package/lib/plugins/__tests__/listDependencies.js +0 -28
- package/lib/plugins/__tests__/sortDependencies.d.ts +0 -2
- package/lib/plugins/__tests__/sortDependencies.d.ts.map +0 -1
- package/lib/plugins/__tests__/sortDependencies.js +0 -28
- package/lib/plugins/__tests__/validatePlugin.d.ts +0 -2
- package/lib/plugins/__tests__/validatePlugin.d.ts.map +0 -1
- package/lib/plugins/__tests__/validatePlugin.js +0 -99
- package/lib/templating/__tests__/conrefsLoader.d.ts +0 -2
- package/lib/templating/__tests__/conrefsLoader.d.ts.map +0 -1
- package/lib/templating/__tests__/conrefsLoader.js +0 -90
- package/lib/templating/__tests__/postRender.d.ts +0 -2
- package/lib/templating/__tests__/postRender.d.ts.map +0 -1
- package/lib/templating/__tests__/postRender.js +0 -52
- package/lib/templating/__tests__/replaceShortcuts.d.ts +0 -2
- package/lib/templating/__tests__/replaceShortcuts.d.ts.map +0 -1
- package/lib/templating/__tests__/replaceShortcuts.js +0 -27
- package/lib/utils/__tests__/git.d.ts +0 -2
- package/lib/utils/__tests__/git.d.ts.map +0 -1
- package/lib/utils/__tests__/git.js +0 -46
- package/lib/utils/__tests__/location.d.ts +0 -2
- package/lib/utils/__tests__/location.d.ts.map +0 -1
- package/lib/utils/__tests__/location.js +0 -81
- package/lib/utils/__tests__/path.d.ts +0 -2
- package/lib/utils/__tests__/path.d.ts.map +0 -1
- package/lib/utils/__tests__/path.js +0 -19
|
@@ -1,29 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"togglePlugin.d.ts","sourceRoot":"","sources":["../../../../src/modifiers/config/__tests__/togglePlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"editPartTitle.d.ts","sourceRoot":"","sources":["../../../../src/modifiers/summary/__tests__/editPartTitle.ts"],"names":[],"mappings":""}
|
|
@@ -1,41 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"insertArticle.d.ts","sourceRoot":"","sources":["../../../../src/modifiers/summary/__tests__/insertArticle.ts"],"names":[],"mappings":""}
|
|
@@ -1,72 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"insertPart.d.ts","sourceRoot":"","sources":["../../../../src/modifiers/summary/__tests__/insertPart.ts"],"names":[],"mappings":""}
|
|
@@ -1,56 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mergeAtLevel.d.ts","sourceRoot":"","sources":["../../../../src/modifiers/summary/__tests__/mergeAtLevel.ts"],"names":[],"mappings":""}
|
|
@@ -1,45 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"moveArticle.d.ts","sourceRoot":"","sources":["../../../../src/modifiers/summary/__tests__/moveArticle.ts"],"names":[],"mappings":""}
|
|
@@ -1,66 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"moveArticleAfter.d.ts","sourceRoot":"","sources":["../../../../src/modifiers/summary/__tests__/moveArticleAfter.ts"],"names":[],"mappings":""}
|
|
@@ -1,75 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"removeArticle.d.ts","sourceRoot":"","sources":["../../../../src/modifiers/summary/__tests__/removeArticle.ts"],"names":[],"mappings":""}
|
|
@@ -1,54 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ebook.d.ts","sourceRoot":"","sources":["../../../src/output/__tests__/ebook.ts"],"names":[],"mappings":""}
|
|
@@ -1,17 +0,0 @@
|
|
|
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 generateMock_1 = __importDefault(require("../testing/generateMock"));
|
|
7
|
-
const ebook_1 = __importDefault(require("../ebook"));
|
|
8
|
-
describe("EbookGenerator", () => {
|
|
9
|
-
test("should generate a SUMMARY.html", () => {
|
|
10
|
-
return (0, generateMock_1.default)(ebook_1.default, {
|
|
11
|
-
"README.md": "Hello World"
|
|
12
|
-
}).then((folder) => {
|
|
13
|
-
expect(folder).toHaveFile("SUMMARY.html");
|
|
14
|
-
expect(folder).toHaveFile("index.html");
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../../src/output/__tests__/json.ts"],"names":[],"mappings":""}
|
|
@@ -1,43 +0,0 @@
|
|
|
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 generateMock_1 = __importDefault(require("../testing/generateMock"));
|
|
7
|
-
const json_1 = __importDefault(require("../json"));
|
|
8
|
-
describe("JSONGenerator", () => {
|
|
9
|
-
test("should generate a README.json", () => {
|
|
10
|
-
return (0, generateMock_1.default)(json_1.default, {
|
|
11
|
-
"README.md": "Hello World"
|
|
12
|
-
}).then((folder) => {
|
|
13
|
-
expect(folder).toHaveFile("README.json");
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
test("should generate a json file for each articles", () => {
|
|
17
|
-
return (0, generateMock_1.default)(json_1.default, {
|
|
18
|
-
"README.md": "Hello World",
|
|
19
|
-
"SUMMARY.md": "# Summary\n\n* [Page](test/page.md)",
|
|
20
|
-
test: {
|
|
21
|
-
"page.md": "Hello 2"
|
|
22
|
-
}
|
|
23
|
-
}).then((folder) => {
|
|
24
|
-
expect(folder).toHaveFile("README.json");
|
|
25
|
-
expect(folder).toHaveFile("test/page.json");
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
test("should generate a multilingual book", () => {
|
|
29
|
-
return (0, generateMock_1.default)(json_1.default, {
|
|
30
|
-
"LANGS.md": "# Languages\n\n* [en](en)\n* [fr](fr)",
|
|
31
|
-
en: {
|
|
32
|
-
"README.md": "Hello"
|
|
33
|
-
},
|
|
34
|
-
fr: {
|
|
35
|
-
"README.md": "Bonjour"
|
|
36
|
-
}
|
|
37
|
-
}).then((folder) => {
|
|
38
|
-
expect(folder).toHaveFile("en/README.json");
|
|
39
|
-
expect(folder).toHaveFile("fr/README.json");
|
|
40
|
-
expect(folder).toHaveFile("README.json");
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-hooks.d.ts","sourceRoot":"","sources":["../../../src/output/__tests__/plugin-hooks.ts"],"names":[],"mappings":""}
|