@kenjura/ursa 0.48.0 → 0.49.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/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/src/helper/linkValidator.js +14 -1
- package/src/helper/wikitextHelper.js +4 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
# 0.49.0
|
|
2
|
+
2025-12-20
|
|
3
|
+
|
|
4
|
+
- Fixed more instances of false inactive links, this time in wikitext files (.txt)
|
|
1
5
|
|
|
2
6
|
|
|
3
7
|
# 0.48.0
|
|
@@ -10,6 +14,8 @@
|
|
|
10
14
|
- **Menu Collapse Fix**: Fixed issue where clicking the caret on a folder containing the current page wouldn't collapse it
|
|
11
15
|
- **URL Encoding Fix**: Fixed menu not highlighting current page when URLs contain spaces or special characters
|
|
12
16
|
- **Link Validation Fix**: Links to folders are no longer incorrectly marked as inactive (folders now included in valid paths since auto-index generates index.html for all)
|
|
17
|
+
- **WikiText Link Fix**: Fixed wikitext links (in .txt files) being incorrectly marked as inactive. Link validation is now handled centrally by the link validator after HTML generation.
|
|
18
|
+
- **Folder/Index Link Fix**: Links to folders containing a `(foldername).md` file (instead of `index.md`) are now correctly recognized as valid
|
|
13
19
|
|
|
14
20
|
# 0.47.0
|
|
15
21
|
2025-12-20
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { extname, dirname, join, normalize, posix } from "path";
|
|
1
|
+
import { extname, dirname, join, normalize, posix, basename } from "path";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Build a set of valid internal paths from the list of source files and directories
|
|
@@ -38,6 +38,19 @@ export function buildValidPaths(sourceFiles, source, directories = []) {
|
|
|
38
38
|
validPaths.add((dirPath + "/").toLowerCase());
|
|
39
39
|
validPaths.add((dirPath + "/index.html").toLowerCase());
|
|
40
40
|
}
|
|
41
|
+
|
|
42
|
+
// Handle (foldername).md files - they get promoted to index.html by auto-index
|
|
43
|
+
// e.g., /foo/bar/bar.md becomes /foo/bar/index.html (bar.html promoted to index.html)
|
|
44
|
+
const fileName = basename(relativePath); // e.g., "bar" from "/foo/bar/bar"
|
|
45
|
+
const parentDir = dirname(relativePath); // e.g., "/foo/bar" from "/foo/bar/bar"
|
|
46
|
+
const parentDirName = basename(parentDir); // e.g., "bar" from "/foo/bar"
|
|
47
|
+
|
|
48
|
+
if (fileName === parentDirName) {
|
|
49
|
+
// This file has same name as its parent folder - it will be promoted to index.html
|
|
50
|
+
validPaths.add(parentDir.toLowerCase());
|
|
51
|
+
validPaths.add((parentDir + "/").toLowerCase());
|
|
52
|
+
validPaths.add((parentDir + "/index.html").toLowerCase());
|
|
53
|
+
}
|
|
41
54
|
}
|
|
42
55
|
|
|
43
56
|
// Add all directories as valid paths (they get auto-generated index.html)
|
|
@@ -10,8 +10,6 @@ export function wikiToHtml({ wikitext, articleName, args } = {}) {
|
|
|
10
10
|
const linkbase = ("/" + db + "/").replace(/\/\//g, "/");
|
|
11
11
|
const imageroot = ("/" + db + "/img/").replace(/\/\//g, "/");
|
|
12
12
|
|
|
13
|
-
const allArticles = args.allArticles || [];
|
|
14
|
-
|
|
15
13
|
// console.log('wikitext=',wikitext);
|
|
16
14
|
var html = String(wikitext);
|
|
17
15
|
// instance.article = article;
|
|
@@ -226,31 +224,19 @@ export function wikiToHtml({ wikitext, articleName, args } = {}) {
|
|
|
226
224
|
if (!anchor) anchor = "";
|
|
227
225
|
else anchor = "#" + anchor;
|
|
228
226
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
active = !!allArticles.find((article) => article.match(articleName));
|
|
227
|
+
// Note: Link validation (active/inactive status) is now handled by linkValidator.js
|
|
228
|
+
// after HTML generation, so we don't set active/inactive class here.
|
|
232
229
|
|
|
233
230
|
if (articleName.indexOf("/") >= 0) {
|
|
234
231
|
// assume the link is fully formed
|
|
235
|
-
return `<a class="wikiLink${
|
|
236
|
-
active ? " active" : ""
|
|
237
|
-
} data-articleName="${articleName}" href="${articleName}">${
|
|
232
|
+
return `<a class="wikiLink" data-articleName="${articleName}" href="${articleName}">${
|
|
238
233
|
displayName || articleName
|
|
239
234
|
}</a>`;
|
|
240
235
|
} else {
|
|
241
236
|
var link = linkbase + articleName + anchor;
|
|
242
237
|
|
|
243
|
-
// not sure what this did, but I need a new handler for this case
|
|
244
|
-
// if (articleName.indexOf('/')>-1) {
|
|
245
|
-
// link = '/'+articleName+anchor;
|
|
246
|
-
// displayName = articleName.substr(articleName.indexOf('/')+1);
|
|
247
|
-
// console.log('link=',link);
|
|
248
|
-
// }
|
|
249
|
-
|
|
250
238
|
return (
|
|
251
|
-
'<a class="wikiLink ' +
|
|
252
|
-
(active ? "active" : "inactive") +
|
|
253
|
-
'" data-articleName="' +
|
|
239
|
+
'<a class="wikiLink" data-articleName="' +
|
|
254
240
|
articleName +
|
|
255
241
|
'" href="' +
|
|
256
242
|
link +
|