wikilint 2.5.2 → 2.5.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/lib/text.js CHANGED
@@ -83,8 +83,18 @@ class AstText extends node_1.AstNode {
83
83
  if (!parentNode) {
84
84
  return [];
85
85
  }
86
+ const { type, name, parentNode: grandparent } = parentNode, nowiki = name === 'nowiki' || name === 'pre';
87
+ let isHtmlAttrVal = false;
88
+ if (type === 'attr-value') {
89
+ const { type: grandType, name: grandName, tag } = grandparent;
90
+ if (grandType !== 'ext-attr') {
91
+ isHtmlAttrVal = true;
92
+ }
93
+ else if (tag === 'choose' && (grandName === 'before' || grandName === 'after')) {
94
+ return [];
95
+ }
96
+ }
86
97
  const { NowikiToken } = require('../src/nowiki');
87
- const { type, name } = parentNode, nowiki = name === 'nowiki' || name === 'pre', isHtmlAttrVal = type === 'attr-value' && parentNode.parentNode.type !== 'ext-attr';
88
98
  let errorRegex;
89
99
  if (type === 'ext-inner' && (name === 'pre' || parentNode instanceof NowikiToken)) {
90
100
  errorRegex = new RegExp(`<\\s*(?:\\/\\s*)${nowiki ? '' : '?'}(${name})\\b`, 'giu');
@@ -18,6 +18,8 @@ export declare abstract class AttributeToken extends Token {
18
18
  abstract get parentNode(): AttributesToken | undefined;
19
19
  abstract get nextSibling(): AtomToken | this | undefined;
20
20
  abstract get previousSibling(): AtomToken | this | undefined;
21
+ /** 标签名 */
22
+ get tag(): string;
21
23
  /** 引号是否匹配 */
22
24
  get balanced(): boolean;
23
25
  /**
@@ -178,7 +178,7 @@ class AttributeToken extends index_2.Token {
178
178
  #tag;
179
179
  #equal;
180
180
  #quotes;
181
- /** @private */
181
+ /** 标签名 */
182
182
  get tag() {
183
183
  return this.#tag;
184
184
  }
@@ -114,8 +114,8 @@ class LinkBaseToken extends index_2.Token {
114
114
  return errors;
115
115
  }
116
116
  /** @private */
117
- getTitle() {
118
- return this.normalizeTitle(this.firstChild.text(), 0, false, true, true);
117
+ getTitle(halfParsed = false) {
118
+ return this.normalizeTitle(this.firstChild.text(), 0, halfParsed, true, true);
119
119
  }
120
120
  }
121
121
  exports.LinkBaseToken = LinkBaseToken;
@@ -51,7 +51,7 @@ class FileToken extends base_1.LinkBaseToken {
51
51
  */
52
52
  constructor(link, text, config = index_1.default.getConfig(), accum = [], delimiter = '|') {
53
53
  super(link, undefined, config, accum, delimiter);
54
- const { extension } = this;
54
+ const { extension } = this.getTitle(true);
55
55
  this.append(...explode('-{', '}-', '|', text).map(
56
56
  // @ts-expect-error abstract class
57
57
  part => new imageParameter_1.ImageParameterToken(part, extension, config, accum)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wikilint",
3
- "version": "2.5.2",
3
+ "version": "2.5.3",
4
4
  "description": "A Node.js linter for MediaWiki markup",
5
5
  "keywords": [
6
6
  "mediawiki",
@@ -43,15 +43,17 @@
43
43
  "test:end": "pkill -x http-server",
44
44
  "test:real": "node dist/test/real.js"
45
45
  },
46
+ "dependencies": {
47
+ "chalk": "^4.1.2"
48
+ },
46
49
  "devDependencies": {
47
50
  "@cypress/request": "^3.0.1",
48
51
  "@stylistic/eslint-plugin": "^1.5.4",
49
52
  "@types/node": "^20.11.6",
50
53
  "@types/request": "^2.48.12",
51
- "@typescript-eslint/eslint-plugin": "^6.19.1",
52
- "@typescript-eslint/parser": "^6.19.1",
54
+ "@typescript-eslint/eslint-plugin": "^7.1.0",
55
+ "@typescript-eslint/parser": "^7.1.0",
53
56
  "ajv-cli": "^5.0.0",
54
- "chalk": "^4.1.2",
55
57
  "eslint": "^8.56.0",
56
58
  "eslint-plugin-es-x": "^7.5.0",
57
59
  "eslint-plugin-eslint-comments": "^3.2.0",
@@ -60,7 +62,7 @@
60
62
  "eslint-plugin-n": "^16.6.2",
61
63
  "eslint-plugin-promise": "^6.1.1",
62
64
  "eslint-plugin-regexp": "^2.2.0",
63
- "eslint-plugin-unicorn": "^50.0.1",
65
+ "eslint-plugin-unicorn": "^51.0.1",
64
66
  "typescript": "^5.3.3"
65
67
  },
66
68
  "engines": {