honkit 6.0.0 → 6.0.2
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotateText.d.ts","sourceRoot":"","sources":["../../../src/output/modifiers/annotateText.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"annotateText.d.ts","sourceRoot":"","sources":["../../../src/output/modifiers/annotateText.ts"],"names":[],"mappings":"AAyDA;;;;;;GAMG;AACH,iBAAS,YAAY,CAAC,OAAO,KAAA,EAAE,gBAAgB,KAAA,EAAE,CAAC,KAAA,QA4BjD;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -20,14 +20,15 @@ function replaceText($, el, search, replace, text_only) {
|
|
|
20
20
|
// Loop over all childNodes.
|
|
21
21
|
while (node) {
|
|
22
22
|
// Only process text nodes.
|
|
23
|
-
if (node.nodeType === 3) {
|
|
23
|
+
if (node.nodeType === 3 && node.nodeValue) {
|
|
24
24
|
// The original node value.
|
|
25
25
|
val = node.nodeValue;
|
|
26
26
|
new_val = val.replace(search, replace);
|
|
27
27
|
// Only replace text if the new value is actually different!
|
|
28
28
|
if (new_val !== val) {
|
|
29
29
|
if (!text_only && /</.test(new_val)) {
|
|
30
|
-
// The new value contains HTML, set it in a slower but far more
|
|
30
|
+
// The new value contains HTML, set it in a slower but far more
|
|
31
|
+
// robust way.
|
|
31
32
|
// Don't remove the node yet, or the loop will lose its place.
|
|
32
33
|
const currentTextNode = $(node);
|
|
33
34
|
const newHTML = val.replace(val, new_val);
|
|
@@ -64,16 +65,21 @@ function annotateText(entries, glossaryFilePath, $) {
|
|
|
64
65
|
entries.forEach((entry) => {
|
|
65
66
|
const entryId = entry.getID();
|
|
66
67
|
const name = entry.getName();
|
|
68
|
+
const nameLowerCase = `${name}`.toLowerCase();
|
|
69
|
+
const quotedName = pregQuote(nameLowerCase);
|
|
70
|
+
const nameCleaned = nameLowerCase.replace(/[^\w\s]/, "");
|
|
71
|
+
const searchRegex = nameLowerCase === nameCleaned
|
|
72
|
+
? new RegExp(`\\b(${quotedName})\\b`, "gi")
|
|
73
|
+
: new RegExp(`(?:\\s*)(${quotedName})(?:\\s*)`, "gi");
|
|
67
74
|
const description = entry.getDescription();
|
|
68
|
-
const searchRegex = new RegExp(`\\b(${pregQuote(name.toLowerCase())})\\b`, "gi");
|
|
69
75
|
$("*").each(function () {
|
|
70
76
|
const $this = $(this);
|
|
71
77
|
if ($this.is(ANNOTATION_IGNORE) || $this.parents(ANNOTATION_IGNORE).length > 0)
|
|
72
78
|
return;
|
|
73
79
|
// @ts-expect-error ts-migrate(2554) FIXME: Expected 5 arguments, but got 4.
|
|
74
|
-
replaceText($, this, searchRegex, (match) => {
|
|
80
|
+
replaceText($, this, searchRegex, (match, matchedTerm) => {
|
|
75
81
|
return (`<a href="/${glossaryFilePath}#${entryId}" ` +
|
|
76
|
-
`class="glossary-term" title="${(0, escape_html_1.default)(description)}">${
|
|
82
|
+
`class="glossary-term" title="${(0, escape_html_1.default)(description)}">${matchedTerm}</a>`);
|
|
77
83
|
});
|
|
78
84
|
});
|
|
79
85
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginResolver.d.ts","sourceRoot":"","sources":["../../src/plugins/PluginResolver.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PluginResolver.d.ts","sourceRoot":"","sources":["../../src/plugins/PluginResolver.ts"],"names":[],"mappings":"AAaA;;;;;;;;;;;;GAYG;AAEH,qBAAa,cAAc;IACvB,aAAa,EAAE,MAAM,CAAC;gBAEV,MAAM,GAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAO;IAOnD;;;;OAIG;IACH,wBAAwB,CAAC,WAAW,KAAA;CAyBvC"}
|
|
@@ -32,6 +32,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
32
32
|
const util = __importStar(require("./package-name-util"));
|
|
33
33
|
const try_resolve_1 = __importDefault(require("try-resolve"));
|
|
34
34
|
const SPECIAL_PACKAGE_NAME = [
|
|
35
|
+
"fontsettings", // → @honkit/honkit-plugin-fontsettings
|
|
35
36
|
"highlight", // → @honkit/honkit-plugin-highlight
|
|
36
37
|
"theme-default" // → @honkit/honkit-plugin-theme-default
|
|
37
38
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "honkit",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.2",
|
|
4
4
|
"description": "HonKit is building beautiful books using Markdown.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"git",
|
|
@@ -37,11 +37,12 @@
|
|
|
37
37
|
"updateSnapshot": "jest src -u"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@honkit/asciidoc": "6.0.
|
|
41
|
-
"@honkit/honkit-plugin-
|
|
42
|
-
"@honkit/honkit-plugin-
|
|
43
|
-
"@honkit/
|
|
44
|
-
"@honkit/
|
|
40
|
+
"@honkit/asciidoc": "6.0.2",
|
|
41
|
+
"@honkit/honkit-plugin-fontsettings": "6.0.2",
|
|
42
|
+
"@honkit/honkit-plugin-highlight": "6.0.2",
|
|
43
|
+
"@honkit/honkit-plugin-theme-default": "6.0.2",
|
|
44
|
+
"@honkit/html": "6.0.2",
|
|
45
|
+
"@honkit/markdown-legacy": "6.0.2",
|
|
45
46
|
"bash-color": "^0.0.4",
|
|
46
47
|
"cheerio": "^1.0.0",
|
|
47
48
|
"chokidar": "^3.6.0",
|
|
@@ -58,7 +59,6 @@
|
|
|
58
59
|
"extend": "^3.0.2",
|
|
59
60
|
"flat-cache": "^2.0.1",
|
|
60
61
|
"front-matter": "^2.3.0",
|
|
61
|
-
"gitbook-plugin-fontsettings": "^2.0.0",
|
|
62
62
|
"gitbook-plugin-livereload": "^0.0.1",
|
|
63
63
|
"gitbook-plugin-lunr": "^1.2.0",
|
|
64
64
|
"gitbook-plugin-search": "^2.2.1",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"urijs": "^1.19.11"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
93
|
-
"@honkit/internal-test-utils": "6.0.
|
|
93
|
+
"@honkit/internal-test-utils": "6.0.2",
|
|
94
94
|
"@relmify/jest-serializer-strip-ansi": "^1.0.2",
|
|
95
95
|
"@types/jest": "^29.5.13",
|
|
96
96
|
"@types/node": "^22.7.4",
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"rimraf": "^3.0.2",
|
|
102
102
|
"typescript": "^5.6.2"
|
|
103
103
|
},
|
|
104
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "9dcd51c588177ee3a684788c633a67b82dea82a5"
|
|
105
105
|
}
|