honkit 3.6.21 → 3.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/__tests__/init.js +1 -1
- package/lib/__tests__/snapshot-honkit.js +1 -1
- package/lib/api/decodeGlobal.js +1 -1
- package/lib/api/encodeConfig.js +0 -4
- package/lib/api/encodeGlobal.js +9 -9
- package/lib/api/encodeNavigation.js +0 -4
- package/lib/api/encodePage.js +1 -5
- package/lib/api/encodeProgress.js +1 -6
- package/lib/api/encodeSummary.js +3 -5
- package/lib/bin.js +1 -1
- package/lib/cli/build.js +3 -3
- package/lib/cli/buildEbook.js +2 -2
- package/lib/cli/getBook.js +1 -1
- package/lib/cli/index.js +1 -1
- package/lib/cli/init.js +1 -1
- package/lib/cli/parse.js +1 -1
- package/lib/cli/serve.js +7 -7
- package/lib/cli/server.js +3 -3
- package/lib/constants/configDefault.js +1 -1
- package/lib/constants/defaultFilters.js +2 -2
- package/lib/fs/__tests__/mock.js +1 -1
- package/lib/index.js +1 -1
- package/lib/init.js +1 -1
- package/lib/json/encodeBook.js +5 -5
- package/lib/json/encodeBookWithPage.js +3 -3
- package/lib/json/encodeGlossary.js +1 -1
- package/lib/json/encodeLanguages.js +1 -1
- package/lib/json/encodeOutput.js +1 -1
- package/lib/json/encodeOutputWithPage.js +3 -3
- package/lib/json/encodePage.js +9 -8
- package/lib/json/encodeReadme.js +1 -1
- package/lib/json/encodeSummary.js +1 -1
- package/lib/json/encodeSummaryArticle.js +8 -1
- package/lib/json/encodeSummaryArticleWithCache.js +36 -0
- package/lib/models/__tests__/summaryArticle.js +55 -0
- package/lib/models/__tests__/templateBlock.js +2 -2
- package/lib/models/book.js +1 -1
- package/lib/models/config.js +1 -1
- package/lib/models/fs.js +5 -5
- package/lib/models/glossaryEntry.js +1 -1
- package/lib/models/ignore.js +2 -2
- package/lib/models/output.js +1 -1
- package/lib/models/page.js +1 -1
- package/lib/models/parser.js +11 -11
- package/lib/models/templateBlock.js +3 -3
- package/lib/modifiers/config/__tests__/addPlugin.js +1 -1
- package/lib/modifiers/config/__tests__/removePlugin.js +3 -3
- package/lib/modifiers/config/__tests__/togglePlugin.js +2 -2
- package/lib/modifiers/config/addPlugin.js +2 -2
- package/lib/modifiers/config/isDefaultPlugin.js +1 -1
- package/lib/modifiers/config/removePlugin.js +2 -2
- package/lib/modifiers/config/togglePlugin.js +1 -1
- package/lib/modifiers/summary/__tests__/editPartTitle.js +3 -3
- package/lib/modifiers/summary/__tests__/insertArticle.js +2 -2
- package/lib/modifiers/summary/__tests__/insertPart.js +2 -2
- package/lib/modifiers/summary/__tests__/mergeAtLevel.js +2 -2
- package/lib/modifiers/summary/__tests__/moveArticle.js +3 -3
- package/lib/modifiers/summary/__tests__/moveArticleAfter.js +5 -5
- package/lib/modifiers/summary/__tests__/removeArticle.js +1 -1
- package/lib/modifiers/summary/editArticleRef.js +1 -1
- package/lib/modifiers/summary/editArticleTitle.js +1 -1
- package/lib/modifiers/summary/indexPartLevels.js +1 -1
- package/lib/modifiers/summary/insertArticle.js +2 -2
- package/lib/modifiers/summary/insertPart.js +1 -1
- package/lib/modifiers/summary/moveArticle.js +2 -2
- package/lib/modifiers/summary/moveArticleAfter.js +4 -4
- package/lib/modifiers/summary/removeArticle.js +2 -2
- package/lib/modifiers/summary/removePart.js +1 -1
- package/lib/modifiers/summary/unshiftArticle.js +1 -1
- package/lib/output/Generator.js +2 -0
- package/lib/output/__tests__/ebook.js +1 -1
- package/lib/output/__tests__/json.js +3 -3
- package/lib/output/__tests__/plugin-hooks.js +3 -3
- package/lib/output/__tests__/website.js +8 -8
- package/lib/output/callHook.js +1 -1
- package/lib/output/callPageHook.js +1 -1
- package/lib/output/ebook/getConvertOptions.js +4 -4
- package/lib/output/ebook/getPDFTemplate.js +3 -1
- package/lib/output/ebook/index.js +1 -1
- package/lib/output/ebook/onFinish.js +3 -3
- package/lib/output/generateAssets.js +1 -1
- package/lib/output/generateBook.js +54 -46
- package/lib/output/generatePage.js +5 -5
- package/lib/output/generatePages.js +3 -3
- package/lib/output/getModifiers.js +2 -2
- package/lib/output/helper/fileToURL.js +1 -1
- package/lib/output/helper/resolveFileToURL.js +1 -1
- package/lib/output/index.js +0 -2
- package/lib/output/json/onFinish.js +1 -1
- package/lib/output/json/onPage.js +2 -2
- package/lib/output/modifiers/__tests__/addHeadingId.js +2 -2
- package/lib/output/modifiers/__tests__/annotateText.js +3 -3
- package/lib/output/modifiers/__tests__/fetchRemoteImages.js +2 -2
- package/lib/output/modifiers/__tests__/highlightCode.js +5 -5
- package/lib/output/modifiers/__tests__/inlinePng.js +1 -1
- package/lib/output/modifiers/__tests__/inlineSvg.js +2 -2
- package/lib/output/modifiers/__tests__/resolveImages.js +3 -3
- package/lib/output/modifiers/__tests__/resolveLinks.js +7 -7
- package/lib/output/modifiers/__tests__/svgToImg.js +2 -2
- package/lib/output/modifiers/addHeadingId.js +2 -2
- package/lib/output/modifiers/annotateText.js +1 -1
- package/lib/output/modifiers/fetchRemoteImages.js +1 -1
- package/lib/output/modifiers/highlightCode.js +2 -2
- package/lib/output/modifiers/inlineAssets.js +1 -1
- package/lib/output/modifiers/inlinePng.js +1 -1
- package/lib/output/modifiers/inlineSvg.js +1 -1
- package/lib/output/modifiers/resolveImages.js +1 -1
- package/lib/output/modifiers/resolveLinks.js +1 -1
- package/lib/output/modifiers/svgToImg.js +2 -2
- package/lib/output/preparePages.js +1 -1
- package/lib/output/preparePlugins.js +1 -1
- package/lib/output/testing/createMock.js +2 -2
- package/lib/output/testing/generateMock.js +3 -3
- package/lib/output/website/__tests__/i18n.js +6 -6
- package/lib/output/website/copyPluginAssets.js +4 -4
- package/lib/output/website/createTemplateEngine.js +6 -7
- package/lib/output/website/onFinish.js +3 -3
- package/lib/output/website/onInit.js +1 -1
- package/lib/output/website/onPage.js +5 -5
- package/lib/output/website/prepareI18n.js +2 -2
- package/lib/output/website/prepareResources.js +2 -2
- package/lib/output/website/state.js +1 -1
- package/lib/parse/__tests__/listAssets.js +6 -6
- package/lib/parse/__tests__/parseBook.js +6 -6
- package/lib/parse/__tests__/parseGlossary.js +4 -4
- package/lib/parse/__tests__/parseIgnore.js +2 -2
- package/lib/parse/__tests__/parsePageFromString.js +3 -3
- package/lib/parse/__tests__/parseReadme.js +5 -5
- package/lib/parse/__tests__/parseSummary.js +4 -4
- package/lib/parse/lookupStructureFile.js +1 -1
- package/lib/parse/parseBook.js +3 -3
- package/lib/parse/parseConfig.js +2 -2
- package/lib/parse/parseGlossary.js +1 -1
- package/lib/parse/parseIgnore.js +1 -1
- package/lib/parse/parseLanguages.js +1 -1
- package/lib/parse/parsePage.js +1 -1
- package/lib/parse/parsePageFromString.js +2 -2
- package/lib/parse/parsePagesList.js +2 -2
- package/lib/parse/parseReadme.js +1 -1
- package/lib/parse/parseStructureFile.js +1 -1
- package/lib/parse/parseSummary.js +1 -1
- package/lib/parse/validateConfig.js +2 -2
- package/lib/parse/walkSummary.js +1 -1
- package/lib/plugins/PluginResolver.js +4 -4
- package/lib/plugins/__tests__/findInstalled.js +1 -1
- package/lib/plugins/__tests__/listDependencies.js +6 -6
- package/lib/plugins/__tests__/sortDependencies.js +4 -4
- package/lib/plugins/__tests__/validatePlugin.js +3 -3
- package/lib/plugins/findInstalled.js +2 -2
- package/lib/plugins/listDependencies.js +1 -1
- package/lib/plugins/listDepsForBook.js +1 -1
- package/lib/plugins/loadForBook.js +2 -2
- package/lib/plugins/loadPlugin.js +2 -2
- package/lib/plugins/validateConfig.js +2 -2
- package/lib/plugins/validatePlugin.js +1 -1
- package/lib/templating/__tests__/conrefsLoader.js +8 -8
- package/lib/templating/__tests__/postRender.js +4 -4
- package/lib/templating/__tests__/replaceShortcuts.js +2 -2
- package/lib/templating/render.js +1 -1
- package/lib/templating/renderFile.js +2 -2
- package/lib/templating/replaceShortcuts.js +2 -2
- package/lib/utils/command.js +1 -33
- package/lib/utils/error.js +10 -10
- package/lib/utils/fs.js +6 -6
- package/lib/utils/git.js +4 -4
- package/lib/utils/promise.js +6 -6
- package/package.json +4 -3
|
@@ -21,7 +21,7 @@ describe("inlineSvg", () => {
|
|
|
21
21
|
return fs_1.default.promises
|
|
22
22
|
.writeFile(svgPath, svg)
|
|
23
23
|
.then(() => {
|
|
24
|
-
return inlineSvg_1.default(dir.name, "index.html", $);
|
|
24
|
+
return (0, inlineSvg_1.default)(dir.name, "index.html", $);
|
|
25
25
|
})
|
|
26
26
|
.then(() => {
|
|
27
27
|
expect($("svg").attr("fill")).toBe("currentColor");
|
|
@@ -33,7 +33,7 @@ describe("inlineSvg", () => {
|
|
|
33
33
|
return fs_1.default.promises
|
|
34
34
|
.writeFile(svgPath, svg)
|
|
35
35
|
.then(() => {
|
|
36
|
-
return inlineSvg_1.default(dir.name, "index.html", $);
|
|
36
|
+
return (0, inlineSvg_1.default)(dir.name, "index.html", $);
|
|
37
37
|
})
|
|
38
38
|
.then(() => {
|
|
39
39
|
expect($("svg").length).toBe(0);
|
|
@@ -10,7 +10,7 @@ describe("resolveImages", () => {
|
|
|
10
10
|
const TEST = "<img src=\"http://www.github.com\">";
|
|
11
11
|
test("no error occurs and return undefined", () => {
|
|
12
12
|
const $ = cheerio_1.default.load(TEST);
|
|
13
|
-
return resolveImages_1.default("hello.md", $).then(() => {
|
|
13
|
+
return (0, resolveImages_1.default)("hello.md", $).then(() => {
|
|
14
14
|
const src = $("img").attr("src");
|
|
15
15
|
expect(src).toBe("http://www.github.com");
|
|
16
16
|
});
|
|
@@ -20,7 +20,7 @@ describe("resolveImages", () => {
|
|
|
20
20
|
const TEST = "<img \nsrc=\"http://www.github.com\">";
|
|
21
21
|
test("no error occurs and return undefined", () => {
|
|
22
22
|
const $ = cheerio_1.default.load(TEST);
|
|
23
|
-
return resolveImages_1.default("hello.md", $).then(() => {
|
|
23
|
+
return (0, resolveImages_1.default)("hello.md", $).then(() => {
|
|
24
24
|
const src = $("img").attr("src");
|
|
25
25
|
expect(src).toBe("http://www.github.com");
|
|
26
26
|
});
|
|
@@ -30,7 +30,7 @@ describe("resolveImages", () => {
|
|
|
30
30
|
const TEST = "<img +src=\"http://www.github.com\">";
|
|
31
31
|
test("no error occurs and return undefined", () => {
|
|
32
32
|
const $ = cheerio_1.default.load(TEST);
|
|
33
|
-
return resolveImages_1.default("hello.md", $).then(() => {
|
|
33
|
+
return (0, resolveImages_1.default)("hello.md", $).then(() => {
|
|
34
34
|
const src = $("img").attr("src");
|
|
35
35
|
expect(src).toBe(undefined);
|
|
36
36
|
});
|
|
@@ -20,14 +20,14 @@ describe("resolveLinks", () => {
|
|
|
20
20
|
const TEST = "<p>This is a <a href=\"/test/cool.md\"></a></p>";
|
|
21
21
|
test("should resolve path starting by \"/\" in root directory", () => {
|
|
22
22
|
const $ = cheerio_1.default.load(TEST);
|
|
23
|
-
return resolveLinks_1.default("hello.md", resolveFileBasic, $).then(() => {
|
|
23
|
+
return (0, resolveLinks_1.default)("hello.md", resolveFileBasic, $).then(() => {
|
|
24
24
|
const link = $("a");
|
|
25
25
|
expect(link.attr("href")).toBe("fakeDir/test/cool.md");
|
|
26
26
|
});
|
|
27
27
|
});
|
|
28
28
|
test("should resolve path starting by \"/\" in child directory", () => {
|
|
29
29
|
const $ = cheerio_1.default.load(TEST);
|
|
30
|
-
return resolveLinks_1.default("afolder/hello.md", resolveFileBasic, $).then(() => {
|
|
30
|
+
return (0, resolveLinks_1.default)("afolder/hello.md", resolveFileBasic, $).then(() => {
|
|
31
31
|
const link = $("a");
|
|
32
32
|
expect(link.attr("href")).toBe("../fakeDir/test/cool.md");
|
|
33
33
|
});
|
|
@@ -37,7 +37,7 @@ describe("resolveLinks", () => {
|
|
|
37
37
|
test("should prevent anchors in resolution", () => {
|
|
38
38
|
const TEST = "<p>This is a <a href=\"test/cool.md#an-anchor\"></a></p>";
|
|
39
39
|
const $ = cheerio_1.default.load(TEST);
|
|
40
|
-
return resolveLinks_1.default("hello.md", resolveFileCustom, $).then(() => {
|
|
40
|
+
return (0, resolveLinks_1.default)("hello.md", resolveFileCustom, $).then(() => {
|
|
41
41
|
const link = $("a");
|
|
42
42
|
expect(link.attr("href")).toBe("test/cool.html#an-anchor");
|
|
43
43
|
});
|
|
@@ -45,7 +45,7 @@ describe("resolveLinks", () => {
|
|
|
45
45
|
test("should ignore pure anchor links", () => {
|
|
46
46
|
const TEST = "<p>This is a <a href=\"#an-anchor\"></a></p>";
|
|
47
47
|
const $ = cheerio_1.default.load(TEST);
|
|
48
|
-
return resolveLinks_1.default("hello.md", resolveFileCustom, $).then(() => {
|
|
48
|
+
return (0, resolveLinks_1.default)("hello.md", resolveFileCustom, $).then(() => {
|
|
49
49
|
const link = $("a");
|
|
50
50
|
expect(link.attr("href")).toBe("#an-anchor");
|
|
51
51
|
});
|
|
@@ -55,14 +55,14 @@ describe("resolveLinks", () => {
|
|
|
55
55
|
const TEST = "<p>This is a <a href=\"/test/cool.md\"></a> <a href=\"afile.png\"></a></p>";
|
|
56
56
|
test("should resolve path correctly for absolute path", () => {
|
|
57
57
|
const $ = cheerio_1.default.load(TEST);
|
|
58
|
-
return resolveLinks_1.default("hello.md", resolveFileCustom, $).then(() => {
|
|
58
|
+
return (0, resolveLinks_1.default)("hello.md", resolveFileCustom, $).then(() => {
|
|
59
59
|
const link = $("a").first();
|
|
60
60
|
expect(link.attr("href")).toBe("test/cool.html");
|
|
61
61
|
});
|
|
62
62
|
});
|
|
63
63
|
test("should resolve path correctly for absolute path (2)", () => {
|
|
64
64
|
const $ = cheerio_1.default.load(TEST);
|
|
65
|
-
return resolveLinks_1.default("afodler/hello.md", resolveFileCustom, $).then(() => {
|
|
65
|
+
return (0, resolveLinks_1.default)("afodler/hello.md", resolveFileCustom, $).then(() => {
|
|
66
66
|
const link = $("a").first();
|
|
67
67
|
expect(link.attr("href")).toBe("../test/cool.html");
|
|
68
68
|
});
|
|
@@ -72,7 +72,7 @@ describe("resolveLinks", () => {
|
|
|
72
72
|
const TEST = "<p>This is a <a href=\"http://www.github.com\">external link</a></p>";
|
|
73
73
|
test("should have target=\"_blank\" attribute", () => {
|
|
74
74
|
const $ = cheerio_1.default.load(TEST);
|
|
75
|
-
return resolveLinks_1.default("hello.md", resolveFileBasic, $).then(() => {
|
|
75
|
+
return (0, resolveLinks_1.default)("hello.md", resolveFileBasic, $).then(() => {
|
|
76
76
|
const link = $("a");
|
|
77
77
|
expect(link.attr("target")).toBe("_blank");
|
|
78
78
|
});
|
|
@@ -13,7 +13,7 @@ describe("svgToImg", () => {
|
|
|
13
13
|
});
|
|
14
14
|
test("should write svg as a file", () => {
|
|
15
15
|
const $ = cheerio_1.default.load('<svg xmlns="http://www.w3.org/2000/svg" width="200" height="100" version="1.1"><rect width="200" height="100" stroke="black" stroke-width="6" fill="green"/></svg>');
|
|
16
|
-
return svgToImg_1.default(dir.name, "index.html", $).then(() => {
|
|
16
|
+
return (0, svgToImg_1.default)(dir.name, "index.html", $).then(() => {
|
|
17
17
|
const $img = $("img");
|
|
18
18
|
const src = $img.attr("src");
|
|
19
19
|
expect(dir.name).toHaveFile(src);
|
|
@@ -21,7 +21,7 @@ describe("svgToImg", () => {
|
|
|
21
21
|
});
|
|
22
22
|
it("should not write icon svg as a file", () => {
|
|
23
23
|
const $ = cheerio_1.default.load('<svg xmlns="http://www.w3.org/2000/svg" width="200" height="100" version="1.1" fill="currentColor"><rect width="200" height="100" stroke-width="6"/></svg>');
|
|
24
|
-
return svgToImg_1.default(dir.name, "index.html", $).then(() => {
|
|
24
|
+
return (0, svgToImg_1.default)(dir.name, "index.html", $).then(() => {
|
|
25
25
|
// @ts-expect-error
|
|
26
26
|
expect($.contains("img")).toBe(false);
|
|
27
27
|
});
|
|
@@ -13,7 +13,7 @@ const editHTMLElement_1 = __importDefault(require("./editHTMLElement"));
|
|
|
13
13
|
function addId(heading) {
|
|
14
14
|
if (heading.attr("id"))
|
|
15
15
|
return;
|
|
16
|
-
heading.attr("id", github_slugid_1.default(heading.text()));
|
|
16
|
+
heading.attr("id", (0, github_slugid_1.default)(heading.text()));
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
Add ID to all headings
|
|
@@ -21,6 +21,6 @@ function addId(heading) {
|
|
|
21
21
|
@param {HTMLDom} $
|
|
22
22
|
*/
|
|
23
23
|
function addHeadingId($) {
|
|
24
|
-
return editHTMLElement_1.default($, "h1,h2,h3,h4,h5,h6", addId);
|
|
24
|
+
return (0, editHTMLElement_1.default)($, "h1,h2,h3,h4,h5,h6", addId);
|
|
25
25
|
}
|
|
26
26
|
exports.default = addHeadingId;
|
|
@@ -68,7 +68,7 @@ function annotateText(entries, glossaryFilePath, $) {
|
|
|
68
68
|
// @ts-expect-error ts-migrate(2554) FIXME: Expected 5 arguments, but got 4.
|
|
69
69
|
replaceText($, this, searchRegex, (match) => {
|
|
70
70
|
return (`<a href="/${glossaryFilePath}#${entryId}" ` +
|
|
71
|
-
`class="glossary-term" title="${escape_html_1.default(description)}">${match}</a>`);
|
|
71
|
+
`class="glossary-term" title="${(0, escape_html_1.default)(description)}">${match}</a>`);
|
|
72
72
|
});
|
|
73
73
|
});
|
|
74
74
|
});
|
|
@@ -18,7 +18,7 @@ const location_1 = __importDefault(require("../../utils/location"));
|
|
|
18
18
|
*/
|
|
19
19
|
function fetchRemoteImages(rootFolder, currentFile, $) {
|
|
20
20
|
const currentDirectory = path_1.default.dirname(currentFile);
|
|
21
|
-
return editHTMLElement_1.default($, "img", ($img) => {
|
|
21
|
+
return (0, editHTMLElement_1.default)($, "img", ($img) => {
|
|
22
22
|
let src = $img.attr("src");
|
|
23
23
|
const extension = path_1.default.extname(src);
|
|
24
24
|
if (!location_1.default.isExternal(src)) {
|
|
@@ -42,11 +42,11 @@ function getLanguageForClass(classNames) {
|
|
|
42
42
|
@return {Promise}
|
|
43
43
|
*/
|
|
44
44
|
function highlightCode(highlight, $) {
|
|
45
|
-
return editHTMLElement_1.default($, "code", ($code) => {
|
|
45
|
+
return (0, editHTMLElement_1.default)($, "code", ($code) => {
|
|
46
46
|
const classNames = ($code.attr("class") || "").split(" ");
|
|
47
47
|
const lang = getLanguageForClass(classNames);
|
|
48
48
|
const source = $code.text();
|
|
49
|
-
return promise_1.default(highlight(lang, source)).then((r) => {
|
|
49
|
+
return (0, promise_1.default)(highlight(lang, source)).then((r) => {
|
|
50
50
|
if (is_1.default.string(r.html)) {
|
|
51
51
|
$code.html(r.html);
|
|
52
52
|
}
|
|
@@ -16,7 +16,7 @@ const promise_1 = __importDefault(require("../../utils/promise"));
|
|
|
16
16
|
*/
|
|
17
17
|
function inlineAssets(rootFolder, currentFile) {
|
|
18
18
|
return function ($) {
|
|
19
|
-
return (promise_1.default()
|
|
19
|
+
return ((0, promise_1.default)()
|
|
20
20
|
// Resolving images and fetching external images should be
|
|
21
21
|
// done before svg conversion
|
|
22
22
|
.then(resolveImages_1.default.bind(null, currentFile, $))
|
|
@@ -18,7 +18,7 @@ const editHTMLElement_1 = __importDefault(require("./editHTMLElement"));
|
|
|
18
18
|
*/
|
|
19
19
|
function inlinePng(rootFolder, currentFile, $) {
|
|
20
20
|
const currentDirectory = path_1.default.dirname(currentFile);
|
|
21
|
-
return editHTMLElement_1.default($, "img", ($img) => {
|
|
21
|
+
return (0, editHTMLElement_1.default)($, "img", ($img) => {
|
|
22
22
|
const src = $img.attr("src");
|
|
23
23
|
if (!location_1.default.isDataURI(src)) {
|
|
24
24
|
return;
|
|
@@ -17,7 +17,7 @@ const cheerio_1 = __importDefault(require("cheerio"));
|
|
|
17
17
|
*/
|
|
18
18
|
function inlineSvg(rootFolder, currentFile, $) {
|
|
19
19
|
const currentDirectory = path_1.default.dirname(currentFile);
|
|
20
|
-
return editHTMLElement_1.default($, "img", ($img) => {
|
|
20
|
+
return (0, editHTMLElement_1.default)($, "img", ($img) => {
|
|
21
21
|
let src = $img.attr("src");
|
|
22
22
|
if (path_1.default.extname(src) !== ".svg") {
|
|
23
23
|
return;
|
|
@@ -15,7 +15,7 @@ const editHTMLElement_1 = __importDefault(require("./editHTMLElement"));
|
|
|
15
15
|
*/
|
|
16
16
|
function resolveImages(currentFile, $) {
|
|
17
17
|
const currentDirectory = path_1.default.dirname(currentFile);
|
|
18
|
-
return editHTMLElement_1.default($, "img", ($img) => {
|
|
18
|
+
return (0, editHTMLElement_1.default)($, "img", ($img) => {
|
|
19
19
|
let src = $img.attr("src");
|
|
20
20
|
if (src === null || src === undefined || location_1.default.isExternal(src) || location_1.default.isDataURI(src)) {
|
|
21
21
|
return;
|
|
@@ -17,7 +17,7 @@ const editHTMLElement_1 = __importDefault(require("./editHTMLElement"));
|
|
|
17
17
|
*/
|
|
18
18
|
function resolveLinks(currentFile, resolveFile, $) {
|
|
19
19
|
const currentDirectory = path_1.default.dirname(currentFile);
|
|
20
|
-
return editHTMLElement_1.default($, "a", ($a) => {
|
|
20
|
+
return (0, editHTMLElement_1.default)($, "a", ($a) => {
|
|
21
21
|
let href = $a.attr("href");
|
|
22
22
|
// Don't change a tag without href
|
|
23
23
|
if (!href) {
|
|
@@ -22,7 +22,7 @@ function renderDOM($, dom, options) {
|
|
|
22
22
|
dom = $._root.children;
|
|
23
23
|
}
|
|
24
24
|
options = options || dom.options || $._options;
|
|
25
|
-
return dom_serializer_1.default(dom, options);
|
|
25
|
+
return (0, dom_serializer_1.default)(dom, options);
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
Replace SVG tag by IMG
|
|
@@ -32,7 +32,7 @@ function renderDOM($, dom, options) {
|
|
|
32
32
|
*/
|
|
33
33
|
function svgToImg(baseFolder, currentFile, $) {
|
|
34
34
|
const currentDirectory = path_1.default.dirname(currentFile);
|
|
35
|
-
return editHTMLElement_1.default($, "svg", ($svg) => {
|
|
35
|
+
return (0, editHTMLElement_1.default)($, "svg", ($svg) => {
|
|
36
36
|
if ($svg.attr("fill")) {
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
@@ -15,7 +15,7 @@ function preparePages(output) {
|
|
|
15
15
|
const book = output.getBook();
|
|
16
16
|
const logger = book.getLogger();
|
|
17
17
|
if (book.isMultilingual()) {
|
|
18
|
-
return promise_1.default(output);
|
|
18
|
+
return (0, promise_1.default)(output);
|
|
19
19
|
}
|
|
20
20
|
return parse_1.default.parsePagesList(book).then((pages) => {
|
|
21
21
|
logger.info.ln("found", pages.size, "pages");
|
|
@@ -13,7 +13,7 @@ const promise_1 = __importDefault(require("../utils/promise"));
|
|
|
13
13
|
*/
|
|
14
14
|
function preparePlugins(output) {
|
|
15
15
|
const book = output.getBook();
|
|
16
|
-
return (promise_1.default()
|
|
16
|
+
return ((0, promise_1.default)()
|
|
17
17
|
// Only load plugins for main book
|
|
18
18
|
.then(() => {
|
|
19
19
|
if (book.isLanguageBook()) {
|
|
@@ -20,12 +20,12 @@ const preparePlugins_1 = __importDefault(require("../preparePlugins"));
|
|
|
20
20
|
* @return {Promise<Output>}
|
|
21
21
|
*/
|
|
22
22
|
function createMockOutput(generator, files, options) {
|
|
23
|
-
const fs = mock_1.default(files);
|
|
23
|
+
const fs = (0, mock_1.default)(files);
|
|
24
24
|
let book = book_1.default.createForFS(fs);
|
|
25
25
|
const state = generator.State ? new generator.State({}) : immutable_1.default.Map();
|
|
26
26
|
book = book.setLogLevel("disabled");
|
|
27
27
|
options = generator.Options(options);
|
|
28
|
-
return parseBook_1.default(book)
|
|
28
|
+
return (0, parseBook_1.default)(book)
|
|
29
29
|
.then((resultBook) => {
|
|
30
30
|
return new output_1.default({
|
|
31
31
|
book: resultBook,
|
|
@@ -20,13 +20,13 @@ const generateBook_1 = require("../generateBook");
|
|
|
20
20
|
* @return {Promise<String>}
|
|
21
21
|
*/
|
|
22
22
|
function generateMockBook(Generator, files) {
|
|
23
|
-
const fs = mock_1.default(files);
|
|
23
|
+
const fs = (0, mock_1.default)(files);
|
|
24
24
|
let book = book_1.default.createForFS(fs);
|
|
25
25
|
const dir = tmp_1.default.dirSync();
|
|
26
26
|
book = book.setLogLevel("disabled");
|
|
27
|
-
return parseBook_1.default(book)
|
|
27
|
+
return (0, parseBook_1.default)(book)
|
|
28
28
|
.then((resultBook) => {
|
|
29
|
-
return generateBook_1.generateBook(Generator, resultBook, {
|
|
29
|
+
return (0, generateBook_1.generateBook)(Generator, resultBook, {
|
|
30
30
|
root: dir.name,
|
|
31
31
|
});
|
|
32
32
|
})
|
|
@@ -10,29 +10,29 @@ const __1 = __importDefault(require("../"));
|
|
|
10
10
|
describe("i18n", () => {
|
|
11
11
|
test("should correctly use english as default language", () => {
|
|
12
12
|
// @ts-expect-error
|
|
13
|
-
return createMock_1.default(__1.default, {
|
|
13
|
+
return (0, createMock_1.default)(__1.default, {
|
|
14
14
|
"README.md": "Hello World"
|
|
15
15
|
})
|
|
16
16
|
.then((output) => {
|
|
17
|
-
return prepareI18n_1.default(output);
|
|
17
|
+
return (0, prepareI18n_1.default)(output);
|
|
18
18
|
})
|
|
19
19
|
.then((output) => {
|
|
20
|
-
const engine = createTemplateEngine_1.default(output, "README.md");
|
|
20
|
+
const engine = (0, createTemplateEngine_1.default)(output, "README.md");
|
|
21
21
|
const t = engine.getFilters().get("t");
|
|
22
22
|
expect(t("SUMMARY_INTRODUCTION")).toEqual("Introduction");
|
|
23
23
|
});
|
|
24
24
|
});
|
|
25
25
|
test("should correctly use language from book.json", () => {
|
|
26
26
|
// @ts-expect-error
|
|
27
|
-
return createMock_1.default(__1.default, {
|
|
27
|
+
return (0, createMock_1.default)(__1.default, {
|
|
28
28
|
"README.md": "Hello World",
|
|
29
29
|
"book.json": JSON.stringify({ language: "fr" })
|
|
30
30
|
})
|
|
31
31
|
.then((output) => {
|
|
32
|
-
return prepareI18n_1.default(output);
|
|
32
|
+
return (0, prepareI18n_1.default)(output);
|
|
33
33
|
})
|
|
34
34
|
.then((output) => {
|
|
35
|
-
const engine = createTemplateEngine_1.default(output, "README.md");
|
|
35
|
+
const engine = (0, createTemplateEngine_1.default)(output, "README.md");
|
|
36
36
|
const t = engine.getFilters().get("t");
|
|
37
37
|
expect(t("GITBOOK_LINK")).toEqual("Publié avec HonKit");
|
|
38
38
|
});
|
|
@@ -20,7 +20,7 @@ function copyPluginAssets(output) {
|
|
|
20
20
|
// Don't copy plugins assets for language book
|
|
21
21
|
// It'll be resolved to the parent folder
|
|
22
22
|
if (book.isLanguageBook()) {
|
|
23
|
-
return promise_1.default(output);
|
|
23
|
+
return (0, promise_1.default)(output);
|
|
24
24
|
}
|
|
25
25
|
const plugins = output
|
|
26
26
|
.getPlugins()
|
|
@@ -48,7 +48,7 @@ function copyAssets(output, plugin) {
|
|
|
48
48
|
const prefix = options.get("prefix");
|
|
49
49
|
const assetFolder = path_1.default.join(pluginRoot, pluginAssetsFolder_1.default, prefix);
|
|
50
50
|
if (!fs_1.default.existsSync(assetFolder)) {
|
|
51
|
-
return promise_1.default();
|
|
51
|
+
return (0, promise_1.default)();
|
|
52
52
|
}
|
|
53
53
|
logger.debug.ln("copy assets from theme", assetFolder);
|
|
54
54
|
return fs_1.default.copyDir(assetFolder, assetOutputFolder, {
|
|
@@ -74,13 +74,13 @@ function copyResources(output, plugin) {
|
|
|
74
74
|
let assetsFolder = pluginResources.get("assets");
|
|
75
75
|
const assetOutputFolder = path_1.default.join(outputRoot, "gitbook", plugin.getNpmID());
|
|
76
76
|
if (!assetsFolder) {
|
|
77
|
-
return promise_1.default();
|
|
77
|
+
return (0, promise_1.default)();
|
|
78
78
|
}
|
|
79
79
|
// Resolve assets folder
|
|
80
80
|
assetsFolder = path_1.default.resolve(pluginRoot, assetsFolder);
|
|
81
81
|
if (!fs_1.default.existsSync(assetsFolder)) {
|
|
82
82
|
logger.warn.ln(`assets folder for plugin "${plugin.getName()}" doesn't exist`);
|
|
83
|
-
return promise_1.default();
|
|
83
|
+
return (0, promise_1.default)();
|
|
84
84
|
}
|
|
85
85
|
logger.debug.ln("copy resources from plugin", assetsFolder);
|
|
86
86
|
return fs_1.default.copyDir(assetsFolder, assetOutputFolder, {
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const path_1 = __importDefault(require("path"));
|
|
7
7
|
const nunjucks_1 = __importDefault(require("nunjucks"));
|
|
8
8
|
const nunjucks_do_1 = __importDefault(require("nunjucks-do"));
|
|
9
|
-
const DoExtension = nunjucks_do_1.default(nunjucks_1.default);
|
|
9
|
+
const DoExtension = (0, nunjucks_do_1.default)(nunjucks_1.default);
|
|
10
10
|
const memoize_one_1 = __importDefault(require("memoize-one"));
|
|
11
11
|
const api_1 = __importDefault(require("../../api"));
|
|
12
12
|
const deprecate_1 = __importDefault(require("../../api/deprecate"));
|
|
@@ -43,7 +43,7 @@ function createTemplateEngine(output, currentFile) {
|
|
|
43
43
|
const summary = book.getSummary();
|
|
44
44
|
const outputFolder = output.getRoot();
|
|
45
45
|
// Search paths for templates
|
|
46
|
-
const searchPaths = listSearchPaths_1.default(output);
|
|
46
|
+
const searchPaths = (0, listSearchPaths_1.default)(output);
|
|
47
47
|
const tplSearchPaths = searchPaths.map(templateFolder);
|
|
48
48
|
// Create loader
|
|
49
49
|
// @ts-expect-error: Expected 0 arguments, but got 1.
|
|
@@ -74,7 +74,6 @@ function createTemplateEngine(output, currentFile) {
|
|
|
74
74
|
const article = summary.getByPath(filePath);
|
|
75
75
|
if (!article)
|
|
76
76
|
return undefined;
|
|
77
|
-
// @ts-expect-error ts-migrate(2554) FIXME: Expected 2 arguments, but got 1.
|
|
78
77
|
return json_1.default.encodeSummaryArticle(article);
|
|
79
78
|
}
|
|
80
79
|
/**
|
|
@@ -92,8 +91,8 @@ function createTemplateEngine(output, currentFile) {
|
|
|
92
91
|
loader: loader,
|
|
93
92
|
context: context,
|
|
94
93
|
globals: {
|
|
95
|
-
getArticleByPath: memoize_one_1.default(getArticleByPath),
|
|
96
|
-
getPageByPath: memoize_one_1.default(getPageByPath),
|
|
94
|
+
getArticleByPath: (0, memoize_one_1.default)(getArticleByPath),
|
|
95
|
+
getPageByPath: (0, memoize_one_1.default)(getPageByPath),
|
|
97
96
|
fileExists: fileExists,
|
|
98
97
|
},
|
|
99
98
|
filters: defaultFilters_1.default.merge({
|
|
@@ -109,7 +108,7 @@ function createTemplateEngine(output, currentFile) {
|
|
|
109
108
|
* it also resolve pages
|
|
110
109
|
*/
|
|
111
110
|
resolveFile: function (filePath) {
|
|
112
|
-
filePath = resolveFileToURL_1.default(output, filePath);
|
|
111
|
+
filePath = (0, resolveFileToURL_1.default)(output, filePath);
|
|
113
112
|
return location_1.default.relativeForFile(currentFile, filePath);
|
|
114
113
|
},
|
|
115
114
|
resolveAsset: function (filePath) {
|
|
@@ -125,7 +124,7 @@ function createTemplateEngine(output, currentFile) {
|
|
|
125
124
|
fileExists: deprecate_1.default.method(book, "fileExists", fileExists, 'Filter "fileExists" is deprecated, use "fileExists(filename)" '),
|
|
126
125
|
getArticleByPath: deprecate_1.default.method(book, "getArticleByPath", fileExists, 'Filter "getArticleByPath" is deprecated, use "getArticleByPath(filename)" '),
|
|
127
126
|
contentURL: function (filePath) {
|
|
128
|
-
return fileToURL_1.default(output, filePath);
|
|
127
|
+
return (0, fileToURL_1.default)(output, filePath);
|
|
129
128
|
},
|
|
130
129
|
}),
|
|
131
130
|
extensions: {
|
|
@@ -20,16 +20,16 @@ function onFinish(output) {
|
|
|
20
20
|
const options = output.getOptions();
|
|
21
21
|
const prefix = options.get("prefix");
|
|
22
22
|
if (!book.isMultilingual()) {
|
|
23
|
-
return promise_1.default(output);
|
|
23
|
+
return (0, promise_1.default)(output);
|
|
24
24
|
}
|
|
25
25
|
const filePath = "index.html";
|
|
26
|
-
const engine = createTemplateEngine_1.default(output, filePath);
|
|
26
|
+
const engine = (0, createTemplateEngine_1.default)(output, filePath);
|
|
27
27
|
const context = json_1.default.encodeOutput(output);
|
|
28
28
|
// Render the theme
|
|
29
29
|
return (templating_1.default.renderFile(engine, `${prefix}/languages.html`, context)
|
|
30
30
|
// Write it to the disk
|
|
31
31
|
.then((tplOut) => {
|
|
32
|
-
return writeFile_1.default(output, filePath, tplOut.getContent());
|
|
32
|
+
return (0, writeFile_1.default)(output, filePath, tplOut.getContent());
|
|
33
33
|
}));
|
|
34
34
|
}
|
|
35
35
|
exports.onFinish = onFinish;
|
|
@@ -14,6 +14,6 @@ const prepareResources_1 = __importDefault(require("./prepareResources"));
|
|
|
14
14
|
@return {Output}
|
|
15
15
|
*/
|
|
16
16
|
function onInit(output) {
|
|
17
|
-
return promise_1.default(output).then(prepareI18n_1.default).then(prepareResources_1.default).then(copyPluginAssets_1.default);
|
|
17
|
+
return (0, promise_1.default)(output).then(prepareI18n_1.default).then(prepareResources_1.default).then(copyPluginAssets_1.default);
|
|
18
18
|
}
|
|
19
19
|
exports.default = onInit;
|
|
@@ -29,13 +29,13 @@ function onPage(output, page) {
|
|
|
29
29
|
const plugins = output.getPlugins();
|
|
30
30
|
const state = output.getState();
|
|
31
31
|
const resources = state.getResources();
|
|
32
|
-
const engine = createTemplateEngine_1.default(output, page.getPath());
|
|
32
|
+
const engine = (0, createTemplateEngine_1.default)(output, page.getPath());
|
|
33
33
|
// Output file path
|
|
34
|
-
const filePath = fileToOutput_1.default(output, file.getPath());
|
|
34
|
+
const filePath = (0, fileToOutput_1.default)(output, file.getPath());
|
|
35
35
|
// Calcul relative path to the root
|
|
36
36
|
const outputDirName = path_1.default.dirname(filePath);
|
|
37
37
|
const basePath = location_1.default.normalize(path_1.default.relative(outputDirName, "./"));
|
|
38
|
-
return modifiers_1.default.modifyHTML(page, getModifiers_1.default(output, page)).then((resultPage) => {
|
|
38
|
+
return modifiers_1.default.modifyHTML(page, (0, getModifiers_1.default)(output, page)).then((resultPage) => {
|
|
39
39
|
// Generate the context
|
|
40
40
|
const context = json_1.default.encodeOutputWithPage(output, resultPage);
|
|
41
41
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'plugins' does not exist on type '{ summa... Remove this comment to see the full error message
|
|
@@ -47,7 +47,7 @@ function onPage(output, page) {
|
|
|
47
47
|
getJSContext: function () {
|
|
48
48
|
return {
|
|
49
49
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'page' does not exist on type '{ summary:... Remove this comment to see the full error message
|
|
50
|
-
page: omit_keys_1.default(context.page, "content"),
|
|
50
|
+
page: (0, omit_keys_1.default)(context.page, "content"),
|
|
51
51
|
config: context.config,
|
|
52
52
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'file' does not exist on type '{ summary:... Remove this comment to see the full error message
|
|
53
53
|
file: context.file,
|
|
@@ -66,7 +66,7 @@ function onPage(output, page) {
|
|
|
66
66
|
return (templating_1.default.renderFile(engine, `${prefix}/page.html`, context)
|
|
67
67
|
// Write it to the disk
|
|
68
68
|
.then((tplOut) => {
|
|
69
|
-
return writeFile_1.default(output, filePath, tplOut.getContent());
|
|
69
|
+
return (0, writeFile_1.default)(output, filePath, tplOut.getContent());
|
|
70
70
|
}));
|
|
71
71
|
});
|
|
72
72
|
}
|
|
@@ -16,13 +16,13 @@ const listSearchPaths_1 = __importDefault(require("./listSearchPaths"));
|
|
|
16
16
|
function prepareI18n(output) {
|
|
17
17
|
const state = output.getState();
|
|
18
18
|
const i18n = state.getI18n();
|
|
19
|
-
const searchPaths = listSearchPaths_1.default(output);
|
|
19
|
+
const searchPaths = (0, listSearchPaths_1.default)(output);
|
|
20
20
|
searchPaths.reverse().forEach((searchPath) => {
|
|
21
21
|
const i18nRoot = path_1.default.resolve(searchPath, "_i18n");
|
|
22
22
|
if (!fs_1.default.existsSync(i18nRoot))
|
|
23
23
|
return;
|
|
24
24
|
i18n.load(i18nRoot);
|
|
25
25
|
});
|
|
26
|
-
return promise_1.default(output);
|
|
26
|
+
return (0, promise_1.default)(output);
|
|
27
27
|
}
|
|
28
28
|
exports.default = prepareI18n;
|
|
@@ -22,11 +22,11 @@ function prepareResources(output) {
|
|
|
22
22
|
let result = immutable_1.default.Map();
|
|
23
23
|
return promise_1.default.forEach(plugins, (plugin) => {
|
|
24
24
|
const pluginResources = plugin.getResources(type);
|
|
25
|
-
return promise_1.default()
|
|
25
|
+
return (0, promise_1.default)()
|
|
26
26
|
.then(() => {
|
|
27
27
|
// Apply resources if is a function
|
|
28
28
|
if (is_1.default.fn(pluginResources)) {
|
|
29
|
-
return promise_1.default().then(pluginResources.bind(context));
|
|
29
|
+
return (0, promise_1.default)().then(pluginResources.bind(context));
|
|
30
30
|
}
|
|
31
31
|
else {
|
|
32
32
|
return pluginResources;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const i18n_t_1 = __importDefault(require("i18n-t"));
|
|
7
7
|
const immutable_1 = __importDefault(require("immutable"));
|
|
8
8
|
class GeneratorState extends immutable_1.default.Record({
|
|
9
|
-
i18n: i18n_t_1.default(),
|
|
9
|
+
i18n: (0, i18n_t_1.default)(),
|
|
10
10
|
// List of plugins' resources
|
|
11
11
|
resources: immutable_1.default.Map(),
|
|
12
12
|
}) {
|
|
@@ -11,7 +11,7 @@ const parseGlossary_1 = __importDefault(require("../parseGlossary"));
|
|
|
11
11
|
const parseBook_1 = __importDefault(require("../parseBook"));
|
|
12
12
|
describe("listAssets", () => {
|
|
13
13
|
test("should not list glossary as asset", () => {
|
|
14
|
-
const fs = mock_1.default({
|
|
14
|
+
const fs = (0, mock_1.default)({
|
|
15
15
|
"GLOSSARY.md": "# Glossary\n\n## Hello\nDescription for hello",
|
|
16
16
|
"assetFile.js": "",
|
|
17
17
|
assets: {
|
|
@@ -19,9 +19,9 @@ describe("listAssets", () => {
|
|
|
19
19
|
},
|
|
20
20
|
});
|
|
21
21
|
const book = book_1.default.createForFS(fs);
|
|
22
|
-
return parseGlossary_1.default(book)
|
|
22
|
+
return (0, parseGlossary_1.default)(book)
|
|
23
23
|
.then((resultBook) => {
|
|
24
|
-
return listAssets_1.default(resultBook, immutable_1.default.Map());
|
|
24
|
+
return (0, listAssets_1.default)(resultBook, immutable_1.default.Map());
|
|
25
25
|
})
|
|
26
26
|
.then((assets) => {
|
|
27
27
|
expect(assets.size).toBe(2);
|
|
@@ -30,7 +30,7 @@ describe("listAssets", () => {
|
|
|
30
30
|
});
|
|
31
31
|
});
|
|
32
32
|
test("should not list README.md of pages as asset", () => {
|
|
33
|
-
const fs = mock_1.default({
|
|
33
|
+
const fs = (0, mock_1.default)({
|
|
34
34
|
"book.json": JSON.stringify({
|
|
35
35
|
root: "./test",
|
|
36
36
|
}),
|
|
@@ -52,9 +52,9 @@ describe("listAssets", () => {
|
|
|
52
52
|
.set("sub/README-sub.md", "sub")
|
|
53
53
|
.set("sub/sub/README-subsub.md", "sub/sub");
|
|
54
54
|
const book = book_1.default.createForFS(fs);
|
|
55
|
-
return parseBook_1.default(book)
|
|
55
|
+
return (0, parseBook_1.default)(book)
|
|
56
56
|
.then((resultBook) => {
|
|
57
|
-
return listAssets_1.default(resultBook, pages);
|
|
57
|
+
return (0, listAssets_1.default)(resultBook, pages);
|
|
58
58
|
})
|
|
59
59
|
.then((assets) => {
|
|
60
60
|
expect(assets.size).toBe(0);
|
|
@@ -8,7 +8,7 @@ const mock_1 = __importDefault(require("../../fs/mock"));
|
|
|
8
8
|
const parseBook_1 = __importDefault(require("../parseBook"));
|
|
9
9
|
describe("parseBook", () => {
|
|
10
10
|
test("should parse multilingual book", () => {
|
|
11
|
-
const fs = mock_1.default({
|
|
11
|
+
const fs = (0, mock_1.default)({
|
|
12
12
|
"LANGS.md": "# Languages\n\n* [en](en)\n* [fr](fr)",
|
|
13
13
|
en: {
|
|
14
14
|
"README.md": "Hello",
|
|
@@ -18,7 +18,7 @@ describe("parseBook", () => {
|
|
|
18
18
|
},
|
|
19
19
|
});
|
|
20
20
|
const book = book_1.default.createForFS(fs);
|
|
21
|
-
return parseBook_1.default(book).then((resultBook) => {
|
|
21
|
+
return (0, parseBook_1.default)(book).then((resultBook) => {
|
|
22
22
|
const languages = resultBook.getLanguages();
|
|
23
23
|
const books = resultBook.getBooks();
|
|
24
24
|
expect(resultBook.isMultilingual()).toBe(true);
|
|
@@ -27,7 +27,7 @@ describe("parseBook", () => {
|
|
|
27
27
|
});
|
|
28
28
|
});
|
|
29
29
|
test("should extend configuration for multilingual book", () => {
|
|
30
|
-
const fs = mock_1.default({
|
|
30
|
+
const fs = (0, mock_1.default)({
|
|
31
31
|
"LANGS.md": "# Languages\n\n* [en](en)\n* [fr](fr)",
|
|
32
32
|
"book.json": '{ "title": "Test", "author": "HonKit" }',
|
|
33
33
|
en: {
|
|
@@ -39,7 +39,7 @@ describe("parseBook", () => {
|
|
|
39
39
|
},
|
|
40
40
|
});
|
|
41
41
|
const book = book_1.default.createForFS(fs);
|
|
42
|
-
return parseBook_1.default(book).then((resultBook) => {
|
|
42
|
+
return (0, parseBook_1.default)(book).then((resultBook) => {
|
|
43
43
|
const books = resultBook.getBooks();
|
|
44
44
|
expect(resultBook.isMultilingual()).toBe(true);
|
|
45
45
|
expect(books.size).toBe(2);
|
|
@@ -54,7 +54,7 @@ describe("parseBook", () => {
|
|
|
54
54
|
});
|
|
55
55
|
});
|
|
56
56
|
test("should parse book in a directory", () => {
|
|
57
|
-
const fs = mock_1.default({
|
|
57
|
+
const fs = (0, mock_1.default)({
|
|
58
58
|
"book.json": JSON.stringify({
|
|
59
59
|
root: "./test",
|
|
60
60
|
}),
|
|
@@ -65,7 +65,7 @@ describe("parseBook", () => {
|
|
|
65
65
|
},
|
|
66
66
|
});
|
|
67
67
|
const book = book_1.default.createForFS(fs);
|
|
68
|
-
return parseBook_1.default(book).then((resultBook) => {
|
|
68
|
+
return (0, parseBook_1.default)(book).then((resultBook) => {
|
|
69
69
|
const readme = resultBook.getReadme();
|
|
70
70
|
const summary = resultBook.getSummary();
|
|
71
71
|
const articles = summary.getArticlesAsList();
|