wikilint 2.3.2 → 2.3.3
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/dist/parser/links.js +1 -1
- package/dist/src/html.js +5 -2
- package/dist/src/transclude.js +4 -3
- package/package.json +1 -1
package/dist/parser/links.js
CHANGED
|
@@ -13,7 +13,7 @@ const category_1 = require("../src/link/category");
|
|
|
13
13
|
*/
|
|
14
14
|
const parseLinks = (wikitext, config = Parser.getConfig(), accum = []) => {
|
|
15
15
|
const { parseQuotes } = require('./quotes');
|
|
16
|
-
const regex = /^((?:(?!\0\d+!\x7F)[^\n[\]{}|])+)(?:(\||\0\d+!\x7F)(.*?[^\]]))?\]\](.*)$/su, regexImg = /^((?:(?!\0\d+!\x7F)[^\n[\]{}|])+)(\||\0\d+!\x7F)(.*)$/su, regexExt = new RegExp(`^\\s*(?:${config.protocol})`, 'iu'), bits = wikitext.split('[[');
|
|
16
|
+
const regex = /^((?:(?!\0\d+!\x7F)[^\n[\]{}|])+)(?:(\||\0\d+!\x7F)(.*?[^\]]))?\]\](.*)$/su, regexImg = /^((?:(?!\0\d+!\x7F)[^\n[\]{}|])+)(\||\0\d+!\x7F)(.*)$/su, regexExt = new RegExp(`^\\s*(?:${config.protocol}|//)`, 'iu'), bits = wikitext.split('[[');
|
|
17
17
|
let s = bits.shift();
|
|
18
18
|
for (let i = 0; i < bits.length; i++) {
|
|
19
19
|
let mightBeImg = false, link, delimiter, text, after;
|
package/dist/src/html.js
CHANGED
|
@@ -39,8 +39,11 @@ class HtmlToken extends index_1.Token {
|
|
|
39
39
|
}
|
|
40
40
|
/** @override */
|
|
41
41
|
text() {
|
|
42
|
-
const { closing } = this;
|
|
43
|
-
|
|
42
|
+
const { closing, name } = this, tag = `${this.#tag}${closing ? '' : super.text()}`, { html } = this.getAttribute('config');
|
|
43
|
+
if (html[2].includes(name)) {
|
|
44
|
+
return closing && name !== 'br' ? '' : `<${tag}>`;
|
|
45
|
+
}
|
|
46
|
+
return `<${closing ? '/' : ''}${tag}${this.#selfClosing && html[1].includes(name) ? '/' : ''}>`;
|
|
44
47
|
}
|
|
45
48
|
/** @private */
|
|
46
49
|
getAttribute(key) {
|
package/dist/src/transclude.js
CHANGED
|
@@ -35,10 +35,11 @@ class TranscludeToken extends index_1.Token {
|
|
|
35
35
|
title = arg.join(':').slice(mt.length);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
const isFunction = title.includes(':');
|
|
39
|
+
if (isFunction || parts.length === 0 && !this.#raw) {
|
|
40
|
+
const [magicWord, ...arg] = title.split(':'), cleaned = (0, string_1.removeComment)(magicWord), name = cleaned[arg.length > 0 ? 'trimStart' : 'trim'](), isSensitive = sensitive.includes(name), canonicalCame = isFunction && insensitive[name.toLowerCase()];
|
|
40
41
|
if (isSensitive || canonicalCame) {
|
|
41
|
-
this.setAttribute('name', canonicalCame
|
|
42
|
+
this.setAttribute('name', canonicalCame || name.toLowerCase());
|
|
42
43
|
this.type = 'magic-word';
|
|
43
44
|
const pattern = new RegExp(`^\\s*${name}\\s*$`, isSensitive ? 'u' : 'iu'), token = new syntax_1.SyntaxToken(magicWord, pattern, 'magic-word-name', config, accum, {});
|
|
44
45
|
super.insertAt(token);
|