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,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const cheerio = __importStar(require("cheerio"));
|
|
30
|
-
const resolveImages_1 = __importDefault(require("../resolveImages"));
|
|
31
|
-
describe("resolveImages", () => {
|
|
32
|
-
describe("img tag", () => {
|
|
33
|
-
const TEST = "<img src=\"http://www.github.com\">";
|
|
34
|
-
test("no error occurs and return undefined", () => {
|
|
35
|
-
const $ = cheerio.load(TEST, { _useHtmlParser2: true });
|
|
36
|
-
return (0, resolveImages_1.default)("hello.md", $).then(() => {
|
|
37
|
-
const src = $("img").attr("src");
|
|
38
|
-
expect(src).toBe("http://www.github.com");
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
describe("img tag with break line", () => {
|
|
43
|
-
const TEST = "<img \nsrc=\"http://www.github.com\">";
|
|
44
|
-
test("no error occurs and return undefined", () => {
|
|
45
|
-
const $ = cheerio.load(TEST, { _useHtmlParser2: true });
|
|
46
|
-
return (0, resolveImages_1.default)("hello.md", $).then(() => {
|
|
47
|
-
const src = $("img").attr("src");
|
|
48
|
-
expect(src).toBe("http://www.github.com");
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
describe("img tag with src with plus sign", () => {
|
|
53
|
-
const TEST = "<img +src=\"http://www.github.com\">";
|
|
54
|
-
test("no error occurs and return undefined", () => {
|
|
55
|
-
const $ = cheerio.load(TEST, { _useHtmlParser2: true });
|
|
56
|
-
return (0, resolveImages_1.default)("hello.md", $).then(() => {
|
|
57
|
-
const src = $("img").attr("src");
|
|
58
|
-
expect(src).toBe(undefined);
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolveLinks.d.ts","sourceRoot":"","sources":["../../../../src/output/modifiers/__tests__/resolveLinks.ts"],"names":[],"mappings":""}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const path_1 = __importDefault(require("path"));
|
|
30
|
-
const cheerio = __importStar(require("cheerio"));
|
|
31
|
-
const resolveLinks_1 = __importDefault(require("../resolveLinks"));
|
|
32
|
-
describe("resolveLinks", () => {
|
|
33
|
-
function resolveFileBasic(href) {
|
|
34
|
-
return `fakeDir/${href}`;
|
|
35
|
-
}
|
|
36
|
-
function resolveFileCustom(href) {
|
|
37
|
-
if (path_1.default.extname(href) == ".md") {
|
|
38
|
-
return `${href.slice(0, -3)}.html`;
|
|
39
|
-
}
|
|
40
|
-
return href;
|
|
41
|
-
}
|
|
42
|
-
describe("Absolute path", () => {
|
|
43
|
-
const TEST = "<p>This is a <a href=\"/test/cool.md\"></a></p>";
|
|
44
|
-
test("should resolve path starting by \"/\" in root directory", () => {
|
|
45
|
-
const $ = cheerio.load(TEST, { _useHtmlParser2: true });
|
|
46
|
-
return (0, resolveLinks_1.default)("hello.md", resolveFileBasic, $).then(() => {
|
|
47
|
-
const link = $("a");
|
|
48
|
-
expect(link.attr("href")).toBe("fakeDir/test/cool.md");
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
test("should resolve path starting by \"/\" in child directory", () => {
|
|
52
|
-
const $ = cheerio.load(TEST, { _useHtmlParser2: true });
|
|
53
|
-
return (0, resolveLinks_1.default)("afolder/hello.md", resolveFileBasic, $).then(() => {
|
|
54
|
-
const link = $("a");
|
|
55
|
-
expect(link.attr("href")).toBe("../fakeDir/test/cool.md");
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
describe("Anchor", () => {
|
|
60
|
-
test("should prevent anchors in resolution", () => {
|
|
61
|
-
const TEST = "<p>This is a <a href=\"test/cool.md#an-anchor\"></a></p>";
|
|
62
|
-
const $ = cheerio.load(TEST, { _useHtmlParser2: true });
|
|
63
|
-
return (0, resolveLinks_1.default)("hello.md", resolveFileCustom, $).then(() => {
|
|
64
|
-
const link = $("a");
|
|
65
|
-
expect(link.attr("href")).toBe("test/cool.html#an-anchor");
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
test("should ignore pure anchor links", () => {
|
|
69
|
-
const TEST = "<p>This is a <a href=\"#an-anchor\"></a></p>";
|
|
70
|
-
const $ = cheerio.load(TEST, { _useHtmlParser2: true });
|
|
71
|
-
return (0, resolveLinks_1.default)("hello.md", resolveFileCustom, $).then(() => {
|
|
72
|
-
const link = $("a");
|
|
73
|
-
expect(link.attr("href")).toBe("#an-anchor");
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
describe("Custom Resolver", () => {
|
|
78
|
-
const TEST = "<p>This is a <a href=\"/test/cool.md\"></a> <a href=\"afile.png\"></a></p>";
|
|
79
|
-
test("should resolve path correctly for absolute path", () => {
|
|
80
|
-
const $ = cheerio.load(TEST, { _useHtmlParser2: true });
|
|
81
|
-
return (0, resolveLinks_1.default)("hello.md", resolveFileCustom, $).then(() => {
|
|
82
|
-
const link = $("a").first();
|
|
83
|
-
expect(link.attr("href")).toBe("test/cool.html");
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
test("should resolve path correctly for absolute path (2)", () => {
|
|
87
|
-
const $ = cheerio.load(TEST, { _useHtmlParser2: true });
|
|
88
|
-
return (0, resolveLinks_1.default)("afodler/hello.md", resolveFileCustom, $).then(() => {
|
|
89
|
-
const link = $("a").first();
|
|
90
|
-
expect(link.attr("href")).toBe("../test/cool.html");
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
describe("External link", () => {
|
|
95
|
-
const TEST = "<p>This is a <a href=\"http://www.github.com\">external link</a></p>";
|
|
96
|
-
test("should have target=\"_blank\" attribute", () => {
|
|
97
|
-
const $ = cheerio.load(TEST, { _useHtmlParser2: true });
|
|
98
|
-
return (0, resolveLinks_1.default)("hello.md", resolveFileBasic, $).then(() => {
|
|
99
|
-
const link = $("a");
|
|
100
|
-
expect(link.attr("target")).toBe("_blank");
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"svgToImg.d.ts","sourceRoot":"","sources":["../../../../src/output/modifiers/__tests__/svgToImg.ts"],"names":[],"mappings":""}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const cheerio = __importStar(require("cheerio"));
|
|
30
|
-
const tmp_1 = __importDefault(require("tmp"));
|
|
31
|
-
const svgToImg_1 = __importDefault(require("../svgToImg"));
|
|
32
|
-
describe("svgToImg", () => {
|
|
33
|
-
let dir;
|
|
34
|
-
beforeEach(() => {
|
|
35
|
-
dir = tmp_1.default.dirSync();
|
|
36
|
-
});
|
|
37
|
-
test("should write svg as a file", () => {
|
|
38
|
-
const $ = cheerio.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>', { _useHtmlParser2: true });
|
|
39
|
-
return (0, svgToImg_1.default)(dir.name, "index.html", $).then(() => {
|
|
40
|
-
const $img = $("img");
|
|
41
|
-
const src = $img.attr("src");
|
|
42
|
-
expect(dir.name).toHaveFile(src);
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
it("should not write icon svg as a file", () => {
|
|
46
|
-
const $ = cheerio.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>', { _useHtmlParser2: true });
|
|
47
|
-
return (0, svgToImg_1.default)(dir.name, "index.html", $).then(() => {
|
|
48
|
-
// @ts-expect-error
|
|
49
|
-
expect($.contains("img")).toBe(false);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../../../src/output/website/__tests__/i18n.ts"],"names":[],"mappings":""}
|
|
@@ -1,40 +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 createTemplateEngine_1 = __importDefault(require("../createTemplateEngine"));
|
|
7
|
-
const createMock_1 = __importDefault(require("../../testing/createMock"));
|
|
8
|
-
const prepareI18n_1 = __importDefault(require("../prepareI18n"));
|
|
9
|
-
const __1 = __importDefault(require("../"));
|
|
10
|
-
describe("i18n", () => {
|
|
11
|
-
test("should correctly use english as default language", () => {
|
|
12
|
-
// @ts-expect-error
|
|
13
|
-
return (0, createMock_1.default)(__1.default, {
|
|
14
|
-
"README.md": "Hello World"
|
|
15
|
-
})
|
|
16
|
-
.then((output) => {
|
|
17
|
-
return (0, prepareI18n_1.default)(output);
|
|
18
|
-
})
|
|
19
|
-
.then((output) => {
|
|
20
|
-
const engine = (0, createTemplateEngine_1.default)(output, "README.md");
|
|
21
|
-
const t = engine.getFilters().get("t");
|
|
22
|
-
expect(t("SUMMARY_INTRODUCTION")).toEqual("Introduction");
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
test("should correctly use language from book.json", () => {
|
|
26
|
-
// @ts-expect-error
|
|
27
|
-
return (0, createMock_1.default)(__1.default, {
|
|
28
|
-
"README.md": "Hello World",
|
|
29
|
-
"book.json": JSON.stringify({ language: "fr" })
|
|
30
|
-
})
|
|
31
|
-
.then((output) => {
|
|
32
|
-
return (0, prepareI18n_1.default)(output);
|
|
33
|
-
})
|
|
34
|
-
.then((output) => {
|
|
35
|
-
const engine = (0, createTemplateEngine_1.default)(output, "README.md");
|
|
36
|
-
const t = engine.getFilters().get("t");
|
|
37
|
-
expect(t("GITBOOK_LINK")).toEqual("Publié avec HonKit");
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"listAssets.d.ts","sourceRoot":"","sources":["../../../src/parse/__tests__/listAssets.ts"],"names":[],"mappings":""}
|
|
@@ -1,63 +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 mock_1 = __importDefault(require("../../fs/mock"));
|
|
8
|
-
const book_1 = __importDefault(require("../../models/book"));
|
|
9
|
-
const listAssets_1 = __importDefault(require("../listAssets"));
|
|
10
|
-
const parseGlossary_1 = __importDefault(require("../parseGlossary"));
|
|
11
|
-
const parseBook_1 = __importDefault(require("../parseBook"));
|
|
12
|
-
describe("listAssets", () => {
|
|
13
|
-
test("should not list glossary as asset", () => {
|
|
14
|
-
const fs = (0, mock_1.default)({
|
|
15
|
-
"GLOSSARY.md": "# Glossary\n\n## Hello\nDescription for hello",
|
|
16
|
-
"assetFile.js": "",
|
|
17
|
-
assets: {
|
|
18
|
-
"file.js": "",
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
const book = book_1.default.createForFS(fs);
|
|
22
|
-
return (0, parseGlossary_1.default)(book)
|
|
23
|
-
.then((resultBook) => {
|
|
24
|
-
return (0, listAssets_1.default)(resultBook, immutable_1.default.Map());
|
|
25
|
-
})
|
|
26
|
-
.then((assets) => {
|
|
27
|
-
expect(assets.size).toBe(2);
|
|
28
|
-
expect(assets.includes("assetFile.js"));
|
|
29
|
-
expect(assets.includes("assets/file.js"));
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
test("should not list README.md of pages as asset", () => {
|
|
33
|
-
const fs = (0, mock_1.default)({
|
|
34
|
-
"book.json": JSON.stringify({
|
|
35
|
-
root: "./test",
|
|
36
|
-
}),
|
|
37
|
-
test: {
|
|
38
|
-
"SUMMARY.md": `# Summary
|
|
39
|
-
|
|
40
|
-
* [top](README.md)
|
|
41
|
-
* [sub](sub/README-sub.md)
|
|
42
|
-
* [subsub](sub/sub/README-subsub.md)
|
|
43
|
-
|
|
44
|
-
`,
|
|
45
|
-
"README.md": "top",
|
|
46
|
-
"sub/README-sub.md": "in sub",
|
|
47
|
-
"sub/sub/README-subsub.md": "in sub/sub",
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
const pages = new Map()
|
|
51
|
-
.set("README.md", "top")
|
|
52
|
-
.set("sub/README-sub.md", "sub")
|
|
53
|
-
.set("sub/sub/README-subsub.md", "sub/sub");
|
|
54
|
-
const book = book_1.default.createForFS(fs);
|
|
55
|
-
return (0, parseBook_1.default)(book)
|
|
56
|
-
.then((resultBook) => {
|
|
57
|
-
return (0, listAssets_1.default)(resultBook, pages);
|
|
58
|
-
})
|
|
59
|
-
.then((assets) => {
|
|
60
|
-
expect(assets.size).toBe(0);
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseBook.d.ts","sourceRoot":"","sources":["../../../src/parse/__tests__/parseBook.ts"],"names":[],"mappings":""}
|
|
@@ -1,77 +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 book_1 = __importDefault(require("../../models/book"));
|
|
7
|
-
const mock_1 = __importDefault(require("../../fs/mock"));
|
|
8
|
-
const parseBook_1 = __importDefault(require("../parseBook"));
|
|
9
|
-
describe("parseBook", () => {
|
|
10
|
-
test("should parse multilingual book", () => {
|
|
11
|
-
const fs = (0, mock_1.default)({
|
|
12
|
-
"LANGS.md": "# Languages\n\n* [en](en)\n* [fr](fr)",
|
|
13
|
-
en: {
|
|
14
|
-
"README.md": "Hello",
|
|
15
|
-
},
|
|
16
|
-
fr: {
|
|
17
|
-
"README.md": "Bonjour",
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
const book = book_1.default.createForFS(fs);
|
|
21
|
-
return (0, parseBook_1.default)(book).then((resultBook) => {
|
|
22
|
-
const languages = resultBook.getLanguages();
|
|
23
|
-
const books = resultBook.getBooks();
|
|
24
|
-
expect(resultBook.isMultilingual()).toBe(true);
|
|
25
|
-
expect(languages.getList().size).toBe(2);
|
|
26
|
-
expect(books.size).toBe(2);
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
test("should extend configuration for multilingual book", () => {
|
|
30
|
-
const fs = (0, mock_1.default)({
|
|
31
|
-
"LANGS.md": "# Languages\n\n* [en](en)\n* [fr](fr)",
|
|
32
|
-
"book.json": '{ "title": "Test", "author": "HonKit" }',
|
|
33
|
-
en: {
|
|
34
|
-
"README.md": "Hello",
|
|
35
|
-
"book.json": '{ "title": "Test EN" }',
|
|
36
|
-
},
|
|
37
|
-
fr: {
|
|
38
|
-
"README.md": "Bonjour",
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
const book = book_1.default.createForFS(fs);
|
|
42
|
-
return (0, parseBook_1.default)(book).then((resultBook) => {
|
|
43
|
-
const books = resultBook.getBooks();
|
|
44
|
-
expect(resultBook.isMultilingual()).toBe(true);
|
|
45
|
-
expect(books.size).toBe(2);
|
|
46
|
-
const en = books.get("en");
|
|
47
|
-
const fr = books.get("fr");
|
|
48
|
-
const enConfig = en.getConfig();
|
|
49
|
-
const frConfig = fr.getConfig();
|
|
50
|
-
expect(enConfig.getValue("title")).toBe("Test EN");
|
|
51
|
-
expect(enConfig.getValue("author")).toBe("HonKit");
|
|
52
|
-
expect(frConfig.getValue("title")).toBe("Test");
|
|
53
|
-
expect(frConfig.getValue("author")).toBe("HonKit");
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
test("should parse book in a directory", () => {
|
|
57
|
-
const fs = (0, mock_1.default)({
|
|
58
|
-
"book.json": JSON.stringify({
|
|
59
|
-
root: "./test",
|
|
60
|
-
}),
|
|
61
|
-
test: {
|
|
62
|
-
"README.md": "Hello World",
|
|
63
|
-
"SUMMARY.md": "# Summary\n\n* [Page](page.md)\n",
|
|
64
|
-
"page.md": "Page",
|
|
65
|
-
},
|
|
66
|
-
});
|
|
67
|
-
const book = book_1.default.createForFS(fs);
|
|
68
|
-
return (0, parseBook_1.default)(book).then((resultBook) => {
|
|
69
|
-
const readme = resultBook.getReadme();
|
|
70
|
-
const summary = resultBook.getSummary();
|
|
71
|
-
const articles = summary.getArticlesAsList();
|
|
72
|
-
expect(summary.getFile().exists()).toBe(true);
|
|
73
|
-
expect(readme.getFile().exists()).toBe(true);
|
|
74
|
-
expect(articles.size).toBe(2);
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseGlossary.d.ts","sourceRoot":"","sources":["../../../src/parse/__tests__/parseGlossary.ts"],"names":[],"mappings":""}
|
|
@@ -1,32 +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 book_1 = __importDefault(require("../../models/book"));
|
|
7
|
-
const mock_1 = __importDefault(require("../../fs/mock"));
|
|
8
|
-
const parseGlossary_1 = __importDefault(require("../parseGlossary"));
|
|
9
|
-
describe("parseGlossary", () => {
|
|
10
|
-
test("should parse glossary if exists", () => {
|
|
11
|
-
const fs = (0, mock_1.default)({
|
|
12
|
-
"GLOSSARY.md": "# Glossary\n\n## Hello\nDescription for hello",
|
|
13
|
-
});
|
|
14
|
-
const book = book_1.default.createForFS(fs);
|
|
15
|
-
return (0, parseGlossary_1.default)(book).then((resultBook) => {
|
|
16
|
-
const glossary = resultBook.getGlossary();
|
|
17
|
-
const file = glossary.getFile();
|
|
18
|
-
const entries = glossary.getEntries();
|
|
19
|
-
expect(file.exists()).toBeTruthy();
|
|
20
|
-
expect(entries.size).toBe(1);
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
test("should not fail if doesn't exist", () => {
|
|
24
|
-
const fs = (0, mock_1.default)({});
|
|
25
|
-
const book = book_1.default.createForFS(fs);
|
|
26
|
-
return (0, parseGlossary_1.default)(book).then((resultBook) => {
|
|
27
|
-
const glossary = resultBook.getGlossary();
|
|
28
|
-
const file = glossary.getFile();
|
|
29
|
-
expect(file.exists()).toBeFalsy();
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseIgnore.d.ts","sourceRoot":"","sources":["../../../src/parse/__tests__/parseIgnore.ts"],"names":[],"mappings":""}
|
|
@@ -1,37 +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 book_1 = __importDefault(require("../../models/book"));
|
|
7
|
-
const mock_1 = __importDefault(require("../../fs/mock"));
|
|
8
|
-
const parseIgnore_1 = __importDefault(require("../parseIgnore"));
|
|
9
|
-
describe("parseIgnore", () => {
|
|
10
|
-
const fs = (0, mock_1.default)({
|
|
11
|
-
".ignore": "test-1.js",
|
|
12
|
-
".gitignore": "test-2.js\ntest-3.js",
|
|
13
|
-
".bookignore": "!test-3.js",
|
|
14
|
-
"test-1.js": "1",
|
|
15
|
-
"test-2.js": "2",
|
|
16
|
-
"test-3.js": "3",
|
|
17
|
-
});
|
|
18
|
-
function getBook() {
|
|
19
|
-
const book = book_1.default.createForFS(fs);
|
|
20
|
-
return (0, parseIgnore_1.default)(book);
|
|
21
|
-
}
|
|
22
|
-
test("should load rules from .ignore", () => {
|
|
23
|
-
return getBook().then((book) => {
|
|
24
|
-
expect(book.isFileIgnored("test-1.js")).toBeTruthy();
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
test("should load rules from .gitignore", () => {
|
|
28
|
-
return getBook().then((book) => {
|
|
29
|
-
expect(book.isFileIgnored("test-2.js")).toBeTruthy();
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
test("should load rules from .bookignore", () => {
|
|
33
|
-
return getBook().then((book) => {
|
|
34
|
-
expect(book.isFileIgnored("test-3.js")).toBeFalsy();
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parsePageFromString.d.ts","sourceRoot":"","sources":["../../../src/parse/__tests__/parsePageFromString.ts"],"names":[],"mappings":""}
|
|
@@ -1,34 +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 parsePageFromString_1 = __importDefault(require("../parsePageFromString"));
|
|
7
|
-
const page_1 = __importDefault(require("../../models/page"));
|
|
8
|
-
describe("parsePageFromString", () => {
|
|
9
|
-
const page = new page_1.default();
|
|
10
|
-
test("should parse YAML frontmatter", () => {
|
|
11
|
-
const CONTENT = "---\nhello: true\nworld: \"cool\"\n---\n# Hello World\n";
|
|
12
|
-
const newPage = (0, parsePageFromString_1.default)(page, CONTENT);
|
|
13
|
-
expect(newPage.getDir()).toBe("ltr");
|
|
14
|
-
expect(newPage.getContent()).toBe("# Hello World\n");
|
|
15
|
-
const attrs = newPage.getAttributes();
|
|
16
|
-
expect(attrs.size).toBe(2);
|
|
17
|
-
expect(attrs.get("hello")).toBe(true);
|
|
18
|
-
expect(attrs.get("world")).toBe("cool");
|
|
19
|
-
});
|
|
20
|
-
test("should parse text direction (english)", () => {
|
|
21
|
-
const CONTENT = "Hello World";
|
|
22
|
-
const newPage = (0, parsePageFromString_1.default)(page, CONTENT);
|
|
23
|
-
expect(newPage.getDir()).toBe("ltr");
|
|
24
|
-
expect(newPage.getContent()).toBe("Hello World");
|
|
25
|
-
expect(newPage.getAttributes().size).toBe(0);
|
|
26
|
-
});
|
|
27
|
-
test("should parse text direction (arab)", () => {
|
|
28
|
-
const CONTENT = "مرحبا بالعالم";
|
|
29
|
-
const newPage = (0, parsePageFromString_1.default)(page, CONTENT);
|
|
30
|
-
expect(newPage.getDir()).toBe("rtl");
|
|
31
|
-
expect(newPage.getContent()).toBe("مرحبا بالعالم");
|
|
32
|
-
expect(newPage.getAttributes().size).toBe(0);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseReadme.d.ts","sourceRoot":"","sources":["../../../src/parse/__tests__/parseReadme.ts"],"names":[],"mappings":""}
|
|
@@ -1,33 +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 promise_1 = __importDefault(require("../../utils/promise"));
|
|
7
|
-
const mock_1 = __importDefault(require("../../fs/mock"));
|
|
8
|
-
const book_1 = __importDefault(require("../../models/book"));
|
|
9
|
-
const parseReadme_1 = __importDefault(require("../parseReadme"));
|
|
10
|
-
describe("parseReadme", () => {
|
|
11
|
-
test("should parse summary if exists", () => {
|
|
12
|
-
const fs = (0, mock_1.default)({
|
|
13
|
-
"README.md": "# Hello\n\nAnd here is the description.",
|
|
14
|
-
});
|
|
15
|
-
const book = book_1.default.createForFS(fs);
|
|
16
|
-
return (0, parseReadme_1.default)(book).then((resultBook) => {
|
|
17
|
-
const readme = resultBook.getReadme();
|
|
18
|
-
const file = readme.getFile();
|
|
19
|
-
expect(file.exists()).toBeTruthy();
|
|
20
|
-
expect(readme.getTitle()).toBe("Hello");
|
|
21
|
-
expect(readme.getDescription()).toBe("And here is the description.");
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
test("should fail if doesn't exist", () => {
|
|
25
|
-
const fs = (0, mock_1.default)({});
|
|
26
|
-
const book = book_1.default.createForFS(fs);
|
|
27
|
-
return (0, parseReadme_1.default)(book).then((resultBook) => {
|
|
28
|
-
throw new Error("It should have fail");
|
|
29
|
-
}, () => {
|
|
30
|
-
return (0, promise_1.default)();
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseSummary.d.ts","sourceRoot":"","sources":["../../../src/parse/__tests__/parseSummary.ts"],"names":[],"mappings":""}
|