This commit is contained in:
2025-05-12 05:38:44 +09:00
parent dced21c3f8
commit 6d78bfa46e
8120 changed files with 1161564 additions and 0 deletions

202
book/node_modules/@honkit/html/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2020-present azu.
Copyright 2014 FriendCode Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

6
book/node_modules/@honkit/html/README.md generated vendored Normal file
View File

@@ -0,0 +1,6 @@
# HonKit HTML Parser
This node module parse HTML for gitbook (SUMMARY.html, README.html).
It is a dependency of **gitbook-asciidoc** and **gitbook-markdown**.

36
book/node_modules/@honkit/html/lib/dom.d.ts generated vendored Normal file
View File

@@ -0,0 +1,36 @@
import * as cheerio from "cheerio";
/**
* Load an HTML string and return a cheerio instance
* @param html
*/
export declare function loadHtml(html: string): cheerio.CheerioAPI;
/**
Parse an HTML string and return its content
@param html
@return {cheerio.Root}
*/
export declare function parse(html: string): cheerio.CheerioAPI;
/**
Return main element for a DOM
@param {cheerio.DOM}
@return {cheerio.Node}
*/
export declare function root($: any): any;
/**
Return text node of an element
@param {cheerio.Node}
@return {string}
*/
export declare function textNode($el: any): any;
/**
Cleanup a DOM by removing all useless divs
@param {cheerio.Node}
@param {cheerio.DOM}
@return {cheerio.Node}
*/
export declare function cleanup($el: any, $: any): any;
//# sourceMappingURL=dom.d.ts.map

1
book/node_modules/@honkit/html/lib/dom.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../src/dom.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAOnC;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAEzD;AACD;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAKtD;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,CAAC,KAAA,OAGrB;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,KAAA,OAS3B;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,GAAG,KAAA,EAAE,CAAC,KAAA,OAS7B"}

91
book/node_modules/@honkit/html/lib/dom.js generated vendored Normal file
View File

@@ -0,0 +1,91 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadHtml = loadHtml;
exports.parse = parse;
exports.root = root;
exports.textNode = textNode;
exports.cleanup = cleanup;
const lodash_1 = __importDefault(require("lodash"));
const cheerio = __importStar(require("cheerio"));
/**
* Load an HTML string and return a cheerio instance
* @param html
*/
function loadHtml(html) {
return cheerio.load(html, { _useHtmlParser2: true });
}
/**
Parse an HTML string and return its content
@param html
@return {cheerio.Root}
*/
function parse(html) {
const $ = cheerio.load(html, { _useHtmlParser2: true });
const $el = $("html, body").first();
return ($el.length > 0 ? $el : $);
}
/**
Return main element for a DOM
@param {cheerio.DOM}
@return {cheerio.Node}
*/
function root($) {
const $el = $("html, body, > div").first();
return $el.length > 0 ? $el : $.root();
}
/**
Return text node of an element
@param {cheerio.Node}
@return {string}
*/
function textNode($el) {
return lodash_1.default.reduce($el.children, (text, e) => {
if (e.type == "text")
text += e.data;
return text;
}, "");
}
/**
Cleanup a DOM by removing all useless divs
@param {cheerio.Node}
@param {cheerio.DOM}
@return {cheerio.Node}
*/
function cleanup($el, $) {
$el.find("div").each(function () {
const $div = $(this);
cleanup($div, $);
$div.replaceWith($div.html());
});
return $el;
}

12
book/node_modules/@honkit/html/lib/glossary.d.ts generated vendored Normal file
View File

@@ -0,0 +1,12 @@
/**
Parse an HTML content into a list of glossary entry
@param {string} html
@return {Array}
*/
declare function parseGlossary(html: string): {
name: string;
description: any;
}[];
export default parseGlossary;
//# sourceMappingURL=glossary.d.ts.map

1
book/node_modules/@honkit/html/lib/glossary.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"glossary.d.ts","sourceRoot":"","sources":["../src/glossary.ts"],"names":[],"mappings":"AAGA;;;;;EAKE;AACF,iBAAS,aAAa,CAAC,IAAI,EAAE,MAAM;UAGF,MAAM;iBAAe,GAAG;IAgBxD;AACD,eAAe,aAAa,CAAC"}

48
book/node_modules/@honkit/html/lib/glossary.js generated vendored Normal file
View File

@@ -0,0 +1,48 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
// const dom = require("./dom");
const dom = __importStar(require("./dom"));
/**
Parse an HTML content into a list of glossary entry
@param {string} html
@return {Array}
*/
function parseGlossary(html) {
const $ = dom.parse(html);
const entries = [];
$("h2").each(function () {
const $heading = $(this);
const $next = $heading.next();
const $p = $next.is("p") ? $next.first() : $next.find("p").first();
const entry = {};
entry.name = $heading.text();
entry.description = $p.text();
entries.push(entry);
});
return entries;
}
exports.default = parseGlossary;

46
book/node_modules/@honkit/html/lib/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,46 @@
import { SummaryPart } from "./summary";
/**
* Utility for loading HTML content
*/
export { loadHtml } from "./dom";
export type ToHTMLOptions = {
baseDirectory: string;
};
export type ToHTMLFunction = (content: string, options?: ToHTMLOptions) => string;
export type ToTextFunction = (content: any) => string;
export type { SummaryPart };
export type ParserSummary = ((content: string, options?: ToHTMLOptions) => {
parts: SummaryPart[];
}) & {
toText: ToTextFunction;
};
export type ParserGlossary = ((content: string, options?: ToHTMLOptions) => string[]) & {
toText: ToTextFunction;
};
export type ParserLangs = ((content: string, options?: ToHTMLOptions) => string[]) & {
toText: ToTextFunction;
};
export type ParserREADME = (content: string, options?: ToHTMLOptions) => {
title: string;
description: string;
};
export type ParserPage = ((content: string, options?: ToHTMLOptions) => {
content: string;
}) & {
prepare?: (content: string, options?: ToHTMLOptions) => string;
};
export type ParserInline = (content: string, options?: ToHTMLOptions) => {
content: string;
};
export type Parsers = {
summary: ParserSummary;
glossary: ParserGlossary;
langs: ParserLangs;
readme: ParserREADME;
page: ParserPage;
inline: ParserInline;
};
declare function createParser(toHTML: any, toText?: any): Parsers;
declare const defaultParser: Parsers;
export { defaultParser as default, createParser };
//# sourceMappingURL=index.d.ts.map

1
book/node_modules/@honkit/html/lib/index.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAgB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAcjD;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,MAAM,MAAM,aAAa,GAAG;IACxB,aAAa,EAAE,MAAM,CAAC;CACzB,CAAC;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,KAAK,MAAM,CAAC;AAElF,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,GAAG,KAAK,MAAM,CAAC;AACtD,YAAY,EAAE,WAAW,EAAE,CAAC;AAC5B,MAAM,MAAM,aAAa,GAAG,CAAC,CACzB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,aAAa,KACtB;IACD,KAAK,EAAE,WAAW,EAAE,CAAC;CACxB,CAAC,GAAG;IACD,MAAM,EAAE,cAAc,CAAC;CAC1B,CAAC;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,KAAK,MAAM,EAAE,CAAC,GAAG;IACpF,MAAM,EAAE,cAAc,CAAC;CAC1B,CAAC;AACF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,KAAK,MAAM,EAAE,CAAC,GAAG;IACjF,MAAM,EAAE,cAAc,CAAC;CAC1B,CAAC;AACF,MAAM,MAAM,YAAY,GAAG,CACvB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,aAAa,KACtB;IACD,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACvB,CAAC;AACF,MAAM,MAAM,UAAU,GAAG,CAAC,CACtB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,aAAa,KACtB;IACD,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC,GAAG;IAGD,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,KAAK,MAAM,CAAC;CAClE,CAAC;AACF,MAAM,MAAM,YAAY,GAAG,CACvB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,aAAa,KACtB;IACD,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC;AACF,MAAM,MAAM,OAAO,GAAG;IAClB,OAAO,EAAE,aAAa,CAAC;IACvB,QAAQ,EAAE,cAAc,CAAC;IACzB,KAAK,EAAE,WAAW,CAAC;IACnB,MAAM,EAAE,YAAY,CAAC;IACrB,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,YAAY,CAAC;CACxB,CAAC;AAYF,iBAAS,YAAY,CAAC,MAAM,KAAA,EAAE,MAAM,MAAY,GAAG,OAAO,CAwBzD;AAED,QAAA,MAAM,aAAa,SAA2B,CAAC;AAC/C,OAAO,EAAE,aAAa,IAAI,OAAO,EAAE,YAAY,EAAE,CAAC"}

60
book/node_modules/@honkit/html/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,60 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = exports.loadHtml = void 0;
exports.createParser = createParser;
const lodash_1 = __importDefault(require("lodash"));
const totext_1 = __importDefault(require("./totext"));
// import
const summary_1 = __importDefault(require("./summary"));
const glossary_1 = __importDefault(require("./glossary"));
const langs_1 = __importDefault(require("./langs"));
const readme_1 = __importDefault(require("./readme"));
const page_1 = __importDefault(require("./page"));
const htmlParser = {
summary: summary_1.default,
glossary: glossary_1.default,
langs: langs_1.default,
readme: readme_1.default,
page: page_1.default
};
/**
* Utility for loading HTML content
*/
var dom_1 = require("./dom");
Object.defineProperty(exports, "loadHtml", { enumerable: true, get: function () { return dom_1.loadHtml; } });
// Compose a function with a transform function for the first argument only
function compose(toHTML, fn) {
return function (content, options) {
// e.g. convert asciidoc to html
const html = toHTML(content, options);
return fn.call(this, html);
};
}
// Create a HonKit parser from an HTML converter
function createParser(toHTML, toText = undefined) {
if (typeof toHTML === "function") {
toHTML = {
inline: toHTML,
block: toHTML
};
}
const parser = {
summary: compose(toHTML.block, htmlParser.summary),
glossary: compose(toHTML.block, htmlParser.glossary),
langs: compose(toHTML.block, htmlParser.langs),
readme: compose(toHTML.block, htmlParser.readme),
page: compose(toHTML.block, htmlParser.page),
inline: compose(toHTML.inline, htmlParser.page)
};
// @ts-expect-error
const _toText = new totext_1.default(toText);
parser.summary.toText = _toText.summary;
parser.langs.toText = _toText.langs;
parser.glossary.toText = _toText.glossary;
return parser;
}
const defaultParser = createParser(lodash_1.default.identity);
exports.default = defaultParser;

9
book/node_modules/@honkit/html/lib/langs.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
/**
Parse an HTML content into a list of language
@param {string} html
@return {Array}
*/
declare function parseLangs(content: string): any[];
export default parseLangs;
//# sourceMappingURL=langs.d.ts.map

1
book/node_modules/@honkit/html/lib/langs.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"langs.d.ts","sourceRoot":"","sources":["../src/langs.ts"],"names":[],"mappings":"AAEA;;;;;EAKE;AACF,iBAAS,UAAU,CAAC,OAAO,EAAE,MAAM,SAOlC;AAED,eAAe,UAAU,CAAC"}

20
book/node_modules/@honkit/html/lib/langs.js generated vendored Normal file
View File

@@ -0,0 +1,20 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const summary_1 = __importDefault(require("./summary"));
/**
Parse an HTML content into a list of language
@param {string} html
@return {Array}
*/
function parseLangs(content) {
const parts = (0, summary_1.default)(content).parts;
if (parts.length > 0) {
return parts[0].articles;
}
return [];
}
exports.default = parseLangs;

11
book/node_modules/@honkit/html/lib/page.d.ts generated vendored Normal file
View File

@@ -0,0 +1,11 @@
/**
Parse content of a page
@param {string} html
@return {Object}
*/
declare function parsePage(html: any): {
content: any;
};
export default parsePage;
//# sourceMappingURL=page.d.ts.map

1
book/node_modules/@honkit/html/lib/page.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../src/page.ts"],"names":[],"mappings":"AAAA;;;;;EAKE;AACF,iBAAS,SAAS,CAAC,IAAI,KAAA;;EAItB;AACD,eAAe,SAAS,CAAC"}

14
book/node_modules/@honkit/html/lib/page.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
Parse content of a page
@param {string} html
@return {Object}
*/
function parsePage(html) {
return {
content: html
};
}
exports.default = parsePage;

12
book/node_modules/@honkit/html/lib/readme.d.ts generated vendored Normal file
View File

@@ -0,0 +1,12 @@
/**
Parse an HTML content into metadata about a readme
@param {string} html
@return {Object}
*/
declare function parseReadme(html: any): {
title: string;
description: string;
};
export default parseReadme;
//# sourceMappingURL=readme.d.ts.map

1
book/node_modules/@honkit/html/lib/readme.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"readme.d.ts","sourceRoot":"","sources":["../src/readme.ts"],"names":[],"mappings":"AAEA;;;;;EAKE;AACF,iBAAS,WAAW,CAAC,IAAI,KAAA;;;EAOxB;AAED,eAAe,WAAW,CAAC"}

40
book/node_modules/@honkit/html/lib/readme.js generated vendored Normal file
View File

@@ -0,0 +1,40 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const dom = __importStar(require("./dom"));
/**
Parse an HTML content into metadata about a readme
@param {string} html
@return {Object}
*/
function parseReadme(html) {
const $ = dom.parse(html);
return {
title: $("h1:first-child").text().trim(),
description: $("div.paragraph,p").first().text().trim()
};
}
exports.default = parseReadme;

15
book/node_modules/@honkit/html/lib/summary.d.ts generated vendored Normal file
View File

@@ -0,0 +1,15 @@
export type SummaryPart = {
title: string;
articles: any[];
};
/**
Parse an HTML content into a tree of articles/parts
@param {string} html
@return {Object}
*/
declare function parseSummary(html: string): {
parts: SummaryPart[];
};
export default parseSummary;
//# sourceMappingURL=summary.d.ts.map

1
book/node_modules/@honkit/html/lib/summary.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"summary.d.ts","sourceRoot":"","sources":["../src/summary.ts"],"names":[],"mappings":"AA6HA,MAAM,MAAM,WAAW,GAAG;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,GAAG,EAAE,CAAC;CACnB,CAAC;AAEF;;;;;GAKG;AACH,iBAAS,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,WAAW,EAAE,CAAA;CAAE,CAoB5D;AAED,eAAe,YAAY,CAAC"}

161
book/node_modules/@honkit/html/lib/summary.js generated vendored Normal file
View File

@@ -0,0 +1,161 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const dom = __importStar(require("./dom"));
const SELECTOR_LIST = "ol, ul";
const SELECTOR_LINK = "> a, p > a";
const SELECTOR_PART = "h2, h3, h4";
/**
Find a list
@param {cheerio.Node}
@return {cheerio.Node}
*/
function findList($parent) {
const $container = $parent.children(".olist");
if ($container.length > 0)
$parent = $container.first();
return $parent.children(SELECTOR_LIST);
}
/**
Parse a ul list and return list of chapters recursvely
@param {cheerio.Node}
@param {cheerio.DOM}
@return {Array}
*/
function parseList($ul, $) {
const articles = [];
$ul.children("li").each(function () {
const article = {};
const $li = $(this);
// Get text for the entry
const $p = $li.children("p");
article.title = ($p.text() || dom.textNode($li.get(0))).trim();
// Parse link
const $a = $li.find(SELECTOR_LINK);
if ($a.length > 0) {
article.title = $a.first().text();
article.ref = $a.attr("href").replace(/\\/g, "/").replace(/^\/+/, "");
}
// Sub articles
const $sub = findList($li);
article.articles = parseList($sub, $);
if (!article.title)
return;
articles.push(article);
});
return articles;
}
/**
Find all parts and their corresponding lists
@param {cheerio.Node}
@param {cheerio.DOM}
@return {Array<{title: String, list: cheerio.Node}>}
*/
function findParts($parent, $) {
// Find parts and lists
// TODO asciidoc compatibility
const partsAndLists = $parent.children(`${SELECTOR_LIST}, ${SELECTOR_PART}`);
// Group each part with the list after
const parts = [];
let previousPart = null;
partsAndLists.each((i, el) => {
if (isPartNode(el)) {
if (previousPart !== null) {
// The previous part was empty
parts.push(previousPart);
}
previousPart = {
title: getPartTitle(el, $),
list: null
};
}
else {
// It is a list
if (previousPart !== null) {
previousPart.list = el;
}
else {
previousPart = {
title: "",
list: el
};
}
parts.push(previousPart);
previousPart = null;
}
});
// Last part might be empty
if (previousPart !== null) {
parts.push(previousPart);
}
return parts;
}
/**
True if the element is a part
@param el
@return {boolean}
*/
function isPartNode(el) {
return SELECTOR_PART.indexOf(el.name) !== -1;
}
/**
Parse the title of a part element
@param el
@param {cheerio.DOM} $
@return {string}
*/
function getPartTitle(el, $) {
return $(el).text().trim();
}
/**
Parse an HTML content into a tree of articles/parts
@param {string} html
@return {Object}
*/
function parseSummary(html) {
const $ = dom.parse(html);
const $root = dom.cleanup(dom.root($), $);
const parts = findParts($root, $);
// Parse each list
const parsedParts = [];
let part;
for (let i = 0; i < parts.length; ++i) {
part = parts[i];
parsedParts.push({
title: part.title,
articles: parseList($(part.list), $)
});
}
return {
parts: parsedParts
};
}
exports.default = parseSummary;

3
book/node_modules/@honkit/html/lib/totext.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
declare function ToText(markup: any): any;
export default ToText;
//# sourceMappingURL=totext.d.ts.map

1
book/node_modules/@honkit/html/lib/totext.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"totext.d.ts","sourceRoot":"","sources":["../src/totext.ts"],"names":[],"mappings":"AAOA,iBAAS,MAAM,CAAC,MAAM,KAAA,OAQrB;AAkKD,eAAe,MAAM,CAAC"}

144
book/node_modules/@honkit/html/lib/totext.js generated vendored Normal file
View File

@@ -0,0 +1,144 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const lodash_1 = __importDefault(require("lodash"));
/*
This class is extended by gitbook-markdown and gitbook-asciidoc
to generate back markdown/asciidoc from HonKit metadata.
*/
function ToText(markup) {
if (!(this instanceof ToText)) {
// @ts-expect-error
return new ToText(markup);
}
lodash_1.default.extend(this, markup || {});
lodash_1.default.bindAll(this, lodash_1.default.functionsIn(this));
}
// Break line
ToText.prototype.onBL = function () {
return "\n";
};
ToText.prototype.onText = function (text) {
return text;
};
ToText.prototype.onHR = function () {
return "<hr />";
};
// ---- TITLES
ToText.prototype.onTitleStart = function (level) {
return `<h${level}>`;
};
ToText.prototype.onTitleEnd = function (level) {
return `</h${level}>`;
};
// ---- PARAGRAPHS / SECTIONS
ToText.prototype.onParagraphStart = function () {
return "<p>";
};
ToText.prototype.onParagraphEnd = function () {
return "</p>";
};
ToText.prototype.onSection = function () {
return this.onBL();
};
// ---- LINKS
ToText.prototype.onLinkStart = function (href) {
return `<a href="${href}">`;
};
ToText.prototype.onLinkEnd = function (href) {
return "</a>";
};
// ---- LISTS
ToText.prototype.onListItemStart = function (level) {
return `${this._spaces((level + 1) * 4)}<li>`;
};
ToText.prototype.onListItemEnd = function (level) {
return `${this._spaces((level + 1) * 4)}</li>${this.onBL()}`;
};
ToText.prototype.onListStart = function (level) {
return `${this._spaces(level * 4)}<ul>${this.onBL()}`;
};
ToText.prototype.onListEnd = function (level) {
return `${this._spaces(level * 4)}</ul>${this.onBL()}`;
};
// ------ LANGS
ToText.prototype.langs = function (languages) {
let content = "";
content += this.onTitleStart(1) + this.onText("Languages") + this.onTitleEnd(1);
content += this.onSection();
content += this._summaryArticles(languages);
return content;
};
// ------ GLOSSARY
ToText.prototype.glossary = function (glossary) {
const that = this;
let content = "";
content += that.onTitleStart(1) + that.onText("Glossary") + that.onTitleEnd(1);
content += that.onSection();
lodash_1.default.each(glossary, (entry) => {
content += that.onTitleStart(2) + that.onText(entry.name) + that.onTitleEnd(2);
content += that.onParagraphStart();
content += that.onText(entry.description);
content += that.onParagraphEnd();
content += that.onSection();
});
return content;
};
// ------ SUMMARY
ToText.prototype._summaryArticle = function (article, level) {
let content = "";
content += this.onListItemStart(level);
if (article.ref)
content += this.onLinkStart(article.ref);
content += this.onText(article.title);
if (article.ref)
content += this.onLinkEnd(article.ref);
content += this.onBL();
if (article.articles && article.articles.length > 0) {
content += this._summaryArticles(article.articles, level + 1);
}
content += this.onListItemEnd(level);
return content;
};
ToText.prototype._summaryArticles = function (articles, level) {
const that = this;
let content = "";
level = level || 0;
content += that.onListStart(level);
lodash_1.default.each(articles, (article) => {
content += that._summaryArticle(article, level);
});
content += that.onListEnd(level);
return content;
};
ToText.prototype._summaryPart = function (part) {
let content = "";
if (part.title)
content += this.onTitleStart(2) + this.onText(part.title) + this.onTitleEnd(2);
content += this._summaryArticles(part.articles);
return content;
};
ToText.prototype.summary = function (summary) {
const that = this;
let content = "";
content += that.onTitleStart(1) + that.onText("Summary") + that.onTitleEnd(1);
content += that.onSection();
lodash_1.default.each(summary.parts, (part, i) => {
const next = summary.parts[i + 1];
content += that._summaryPart(part);
if (next && !next.title) {
content += that.onBL() + that.onHR() + that.onBL();
}
else {
content += that.onSection();
}
});
return content;
};
// ---- Utilities
ToText.prototype._spaces = function (n, s) {
return Array(n + 1).join(s || " ");
};
exports.default = ToText;

55
book/node_modules/@honkit/html/package.json generated vendored Normal file
View File

@@ -0,0 +1,55 @@
{
"name": "@honkit/html",
"version": "6.0.2",
"description": "Parse HTML content for gitbook",
"homepage": "https://github.com/honkit/honkit",
"bugs": {
"url": "https://github.com/honkit/honkit/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/honkit/honkit.git"
},
"license": "Apache-2.0",
"author": "azu <azuciao@gmail.com>",
"contributors": [
{
"name": "FriendCode Inc.",
"email": "contact@gitbook.com"
},
{
"name": "Aaron O'Mullan",
"email": "aaron@gitbook.com"
},
{
"name": "Samy Pessé",
"email": "samy@gitbook.com"
}
],
"main": "lib/index.js",
"files": [
"lib",
"!__tests__"
],
"scripts": {
"build": "tsc -p .",
"clean": "rimraf lib/",
"test": "mocha",
"prepublish": "npm run --if-present build"
},
"dependencies": {
"cheerio": "^1.0.0",
"lodash": "^4.17.21",
"q": "^1.5.1"
},
"devDependencies": {
"mocha": "^10.7.3",
"rimraf": "^3.0.2",
"ts-node": "^10.9.2",
"typescript": "^5.6.2"
},
"publishConfig": {
"access": "public"
},
"gitHead": "9dcd51c588177ee3a684788c633a67b82dea82a5"
}