wikilint 2.39.1 → 2.40.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.
@@ -425,89 +425,89 @@
425
425
  "variable": [
426
426
  "!",
427
427
  "=",
428
+ "articlepath",
429
+ "basepagename",
430
+ "basepagenamee",
431
+ "bcp47",
432
+ "cascadingsources",
433
+ "contentlanguage",
434
+ "contentmodel",
435
+ "currentday",
436
+ "currentday2",
437
+ "currentdayname",
438
+ "currentdow",
439
+ "currenthour",
428
440
  "currentmonth",
429
441
  "currentmonth1",
430
442
  "currentmonthname",
431
443
  "currentmonthnamegen",
432
444
  "currentmonthabbrev",
433
- "currentday",
434
- "currentday2",
435
- "currentdayname",
436
- "currentyear",
437
445
  "currenttime",
438
- "currenthour",
446
+ "currenttimestamp",
447
+ "currentversion",
448
+ "currentweek",
449
+ "currentyear",
450
+ "dir",
451
+ "directionmark",
452
+ "fullpagename",
453
+ "fullpagenamee",
454
+ "isbn",
455
+ "language",
456
+ "localday",
457
+ "localday2",
458
+ "localdayname",
459
+ "localdow",
460
+ "localhour",
439
461
  "localmonth",
440
462
  "localmonth1",
463
+ "localmonthabbrev",
441
464
  "localmonthname",
442
465
  "localmonthnamegen",
443
- "localmonthabbrev",
444
- "localday",
445
- "localday2",
446
- "localdayname",
447
- "localyear",
448
466
  "localtime",
449
- "localhour",
467
+ "localtimestamp",
468
+ "localweek",
469
+ "localyear",
470
+ "namespace",
471
+ "namespacee",
472
+ "namespacenumber",
473
+ "numberofactiveusers",
474
+ "numberofadmins",
450
475
  "numberofarticles",
451
- "numberoffiles",
452
476
  "numberofedits",
453
- "articlepath",
477
+ "numberoffiles",
478
+ "numberofpages",
479
+ "numberofusers",
454
480
  "pageid",
455
- "sitename",
456
- "server",
457
- "servername",
458
- "scriptpath",
459
- "stylepath",
481
+ "pagelanguage",
460
482
  "pagename",
461
483
  "pagenamee",
462
- "fullpagename",
463
- "fullpagenamee",
464
- "namespace",
465
- "namespacee",
466
- "namespacenumber",
467
- "currentweek",
468
- "currentdow",
469
- "localweek",
470
- "localdow",
471
- "revisionid",
472
484
  "revisionday",
473
485
  "revisionday2",
486
+ "revisionid",
474
487
  "revisionmonth",
475
488
  "revisionmonth1",
476
- "revisionyear",
489
+ "revisionsize",
477
490
  "revisiontimestamp",
491
+ "revisionyear",
478
492
  "revisionuser",
479
- "revisionsize",
493
+ "rootpagename",
494
+ "rootpagenamee",
495
+ "scriptpath",
496
+ "server",
497
+ "servername",
498
+ "sitename",
499
+ "stylepath",
500
+ "subjectpagename",
501
+ "subjectpagenamee",
502
+ "subjectspace",
503
+ "subjectspacee",
480
504
  "subpagename",
481
505
  "subpagenamee",
482
506
  "talkspace",
483
507
  "talkspacee",
484
- "subjectspace",
485
- "subjectspacee",
486
508
  "talkpagename",
487
509
  "talkpagenamee",
488
- "subjectpagename",
489
- "subjectpagenamee",
490
- "numberofusers",
491
- "numberofactiveusers",
492
- "numberofpages",
493
- "currentversion",
494
- "rootpagename",
495
- "rootpagenamee",
496
- "basepagename",
497
- "basepagenamee",
498
- "currenttimestamp",
499
- "localtimestamp",
500
- "directionmark",
501
- "contentlanguage",
502
510
  "userlanguage",
503
- "pagelanguage",
504
- "numberofadmins",
505
- "cascadingsources",
506
- "bcp47",
507
- "contentmodel",
508
- "dir",
509
- "language",
510
- "isbn",
511
511
  "numberofwikis",
512
512
  "noexternallanglinks",
513
513
  "wbreponame"
@@ -652,14 +652,14 @@
652
652
  "#mentor": "mentor",
653
653
  "articlepath": "articlepath",
654
654
  "条目路径": "articlepath",
655
+ "scriptpath": "scriptpath",
656
+ "脚本路径": "scriptpath",
655
657
  "server": "server",
656
658
  "服务器": "server",
657
659
  "伺服器": "server",
658
660
  "servername": "servername",
659
661
  "服务器名": "servername",
660
662
  "伺服器名稱": "servername",
661
- "scriptpath": "scriptpath",
662
- "脚本路径": "scriptpath",
663
663
  "stylepath": "stylepath",
664
664
  "样式路径": "stylepath",
665
665
  "numberofwikis": "numberofwikis",
@@ -803,6 +803,22 @@
803
803
  "#timefl": "timefl",
804
804
  "!": "!",
805
805
  "=": "=",
806
+ "CONTENTLANGUAGE": "contentlanguage",
807
+ "CONTENTLANG": "contentlanguage",
808
+ "内容语言": "contentlanguage",
809
+ "內容語言": "contentlanguage",
810
+ "CURRENTDAY": "currentday",
811
+ "今天": "currentday",
812
+ "CURRENTDAY2": "currentday2",
813
+ "今天2": "currentday2",
814
+ "CURRENTDAYNAME": "currentdayname",
815
+ "星期": "currentdayname",
816
+ "今天名": "currentdayname",
817
+ "今天名称": "currentdayname",
818
+ "CURRENTDOW": "currentdow",
819
+ "当前DOW": "currentdow",
820
+ "CURRENTHOUR": "currenthour",
821
+ "当前小时": "currenthour",
806
822
  "CURRENTMONTH": "currentmonth",
807
823
  "CURRENTMONTH2": "currentmonth",
808
824
  "本月": "currentmonth",
@@ -818,75 +834,59 @@
818
834
  "CURRENTMONTHABBREV": "currentmonthabbrev",
819
835
  "本月简称": "currentmonthabbrev",
820
836
  "本月縮寫": "currentmonthabbrev",
821
- "CURRENTDAY": "currentday",
822
- "今天": "currentday",
823
- "CURRENTDAY2": "currentday2",
824
- "今天2": "currentday2",
825
- "CURRENTDAYNAME": "currentdayname",
826
- "星期": "currentdayname",
827
- "今天名": "currentdayname",
828
- "今天名称": "currentdayname",
829
- "CURRENTYEAR": "currentyear",
830
- "今年": "currentyear",
831
837
  "CURRENTTIME": "currenttime",
832
838
  "当前时间": "currenttime",
833
839
  "此时": "currenttime",
834
840
  "目前時間": "currenttime",
835
- "CURRENTHOUR": "currenthour",
836
- "当前小时": "currenthour",
841
+ "CURRENTTIMESTAMP": "currenttimestamp",
842
+ "当前时间戳": "currenttimestamp",
843
+ "CURRENTVERSION": "currentversion",
844
+ "当前版本": "currentversion",
845
+ "目前版本": "currentversion",
846
+ "CURRENTWEEK": "currentweek",
847
+ "本周": "currentweek",
848
+ "CURRENTYEAR": "currentyear",
849
+ "今年": "currentyear",
850
+ "DIRECTIONMARK": "directionmark",
851
+ "DIRMARK": "directionmark",
852
+ "方向标记": "directionmark",
853
+ "LOCALDAY": "localday",
854
+ "本地日": "localday",
855
+ "LOCALDAY2": "localday2",
856
+ "本地日2": "localday2",
857
+ "LOCALDAYNAME": "localdayname",
858
+ "本地日名": "localdayname",
859
+ "LOCALDOW": "localdow",
860
+ "本地DOW": "localdow",
861
+ "LOCALHOUR": "localhour",
862
+ "本地小时": "localhour",
837
863
  "LOCALMONTH": "localmonth",
838
864
  "LOCALMONTH2": "localmonth",
839
865
  "本地月": "localmonth",
840
866
  "本地月2": "localmonth",
841
867
  "LOCALMONTH1": "localmonth1",
842
868
  "本地月1": "localmonth1",
869
+ "LOCALMONTHABBREV": "localmonthabbrev",
870
+ "本地月缩写": "localmonthabbrev",
843
871
  "LOCALMONTHNAME": "localmonthname",
844
872
  "本地月份名": "localmonthname",
845
873
  "LOCALMONTHNAMEGEN": "localmonthnamegen",
846
874
  "本地月历": "localmonthnamegen",
847
- "LOCALMONTHABBREV": "localmonthabbrev",
848
- "本地月缩写": "localmonthabbrev",
849
- "LOCALDAY": "localday",
850
- "本地日": "localday",
851
- "LOCALDAY2": "localday2",
852
- "本地日2": "localday2",
853
- "LOCALDAYNAME": "localdayname",
854
- "本地日名": "localdayname",
855
- "LOCALYEAR": "localyear",
856
- "本地年": "localyear",
857
875
  "LOCALTIME": "localtime",
858
876
  "本地时间": "localtime",
859
- "LOCALHOUR": "localhour",
860
- "本地小时": "localhour",
861
- "SITENAME": "sitename",
862
- "站点名称": "sitename",
863
- "網站名稱": "sitename",
864
- "CURRENTWEEK": "currentweek",
865
- "本周": "currentweek",
866
- "CURRENTDOW": "currentdow",
867
- "当前DOW": "currentdow",
877
+ "LOCALTIMESTAMP": "localtimestamp",
878
+ "本地时间戳": "localtimestamp",
868
879
  "LOCALWEEK": "localweek",
869
880
  "本地周": "localweek",
870
- "LOCALDOW": "localdow",
871
- "本地DOW": "localdow",
881
+ "LOCALYEAR": "localyear",
882
+ "本地年": "localyear",
883
+ "PAGELANGUAGE": "pagelanguage",
872
884
  "REVISIONSIZE": "revisionsize",
873
885
  "修订大小": "revisionsize",
874
- "CURRENTVERSION": "currentversion",
875
- "当前版本": "currentversion",
876
- "目前版本": "currentversion",
877
- "CURRENTTIMESTAMP": "currenttimestamp",
878
- "当前时间戳": "currenttimestamp",
879
- "LOCALTIMESTAMP": "localtimestamp",
880
- "本地时间戳": "localtimestamp",
881
- "DIRECTIONMARK": "directionmark",
882
- "DIRMARK": "directionmark",
883
- "方向标记": "directionmark",
884
- "CONTENTLANGUAGE": "contentlanguage",
885
- "CONTENTLANG": "contentlanguage",
886
- "内容语言": "contentlanguage",
887
- "內容語言": "contentlanguage",
888
- "USERLANGUAGE": "userlanguage",
889
- "PAGELANGUAGE": "pagelanguage"
886
+ "SITENAME": "sitename",
887
+ "站点名称": "sitename",
888
+ "網站名稱": "sitename",
889
+ "USERLANGUAGE": "userlanguage"
890
890
  },
891
891
  [
892
892
  "msg",
@@ -907,49 +907,50 @@
907
907
  [],
908
908
  [],
909
909
  {
910
- "notoc": "notoc",
911
- "无目录": "notoc",
912
- "無目錄": "notoc",
913
- "nogallery": "nogallery",
914
- "无图库": "nogallery",
915
- "無圖庫": "nogallery",
916
910
  "forcetoc": "forcetoc",
917
911
  "强显目录": "forcetoc",
918
912
  "強制目錄": "forcetoc",
919
- "toc": "toc",
920
- "目录": "toc",
921
- "目錄": "toc",
913
+ "nocontentconvert": "nocontentconvert",
914
+ "nocc": "nocontentconvert",
915
+ "不转换内容": "nocontentconvert",
916
+ "不轉換內容": "nocontentconvert",
922
917
  "noeditsection": "noeditsection",
923
918
  "无编辑段落": "noeditsection",
924
919
  "无段落编辑": "noeditsection",
925
920
  "無段落編輯": "noeditsection",
921
+ "nogallery": "nogallery",
922
+ "无图库": "nogallery",
923
+ "無圖庫": "nogallery",
926
924
  "notitleconvert": "notitleconvert",
927
925
  "notc": "notitleconvert",
928
926
  "不转换标题": "notitleconvert",
929
927
  "不轉換標題": "notitleconvert",
930
- "nocontentconvert": "nocontentconvert",
931
- "nocc": "nocontentconvert",
932
- "不转换内容": "nocontentconvert",
933
- "不轉換內容": "nocontentconvert",
928
+ "notoc": "notoc",
929
+ "无目录": "notoc",
930
+ "無目錄": "notoc",
931
+ "toc": "toc",
932
+ "目录": "toc",
933
+ "目錄": "toc",
934
+ "nomediaviewercarousel": "nomediaviewercarousel",
934
935
  "已存档讨论": "archivedtalk",
935
936
  "archivedtalk": "archivedtalk",
936
937
  "禁用讨论": "notalk",
937
938
  "notalk": "notalk"
938
939
  },
939
940
  {
940
- "NEWSECTIONLINK": "NEWSECTIONLINK",
941
- "新段落链接": "NEWSECTIONLINK",
942
- "NONEWSECTIONLINK": "NONEWSECTIONLINK",
943
- "无新段落链接": "NONEWSECTIONLINK",
941
+ "EXPECTUNUSEDCATEGORY": "EXPECTUNUSEDCATEGORY",
942
+ "EXPECTUNUSEDTEMPLATE": "EXPECTUNUSEDTEMPLATE",
944
943
  "HIDDENCAT": "HIDDENCAT",
945
944
  "隐藏分类": "HIDDENCAT",
946
945
  "隱藏分類": "HIDDENCAT",
947
- "EXPECTUNUSEDCATEGORY": "EXPECTUNUSEDCATEGORY",
948
- "EXPECTUNUSEDTEMPLATE": "EXPECTUNUSEDTEMPLATE",
949
946
  "INDEX": "INDEX",
950
947
  "索引": "INDEX",
948
+ "NEWSECTIONLINK": "NEWSECTIONLINK",
949
+ "新段落链接": "NEWSECTIONLINK",
951
950
  "NOINDEX": "NOINDEX",
952
951
  "无索引": "NOINDEX",
952
+ "NONEWSECTIONLINK": "NONEWSECTIONLINK",
953
+ "无新段落链接": "NONEWSECTIONLINK",
953
954
  "STATICREDIRECT": "STATICREDIRECT",
954
955
  "静态重定向": "STATICREDIRECT",
955
956
  "靜態重新導向": "STATICREDIRECT",
@@ -1962,7 +1962,7 @@
1962
1962
  }
1963
1963
  ]
1964
1964
  ],
1965
- "description": "The canonical or localized name of the content model of the specified page."
1965
+ "description": "**[Expensive]** The canonical or localized name of the content model of the specified page."
1966
1966
  },
1967
1967
  {
1968
1968
  "aliases": [
package/dist/base.d.mts CHANGED
@@ -13,7 +13,7 @@ export interface Config {
13
13
  readonly img: Record<string, string>;
14
14
  readonly redirection: string[];
15
15
  readonly variants: string[];
16
- readonly articlePath?: string;
16
+ articlePath?: string;
17
17
  }
18
18
  export type ConfigData = Omit<Config, 'excludes'>;
19
19
  export type TokenTypes = 'root' | 'plain' | 'redirect' | 'redirect-syntax' | 'redirect-target' | 'translate' | 'translate-attr' | 'translate-inner' | 'tvar' | 'tvar-name' | 'onlyinclude' | 'noinclude' | 'include' | 'comment' | 'ext' | 'ext-attrs' | 'ext-attr-dirty' | 'ext-attr' | 'attr-key' | 'attr-value' | 'ext-inner' | 'arg' | 'arg-name' | 'arg-default' | 'hidden' | 'magic-word' | 'magic-word-name' | 'invoke-function' | 'invoke-module' | 'template' | 'template-name' | 'parameter' | 'parameter-key' | 'parameter-value' | 'heading' | 'heading-title' | 'heading-trail' | 'html' | 'html-attrs' | 'html-attr-dirty' | 'html-attr' | 'table' | 'tr' | 'td' | 'table-syntax' | 'table-attrs' | 'table-attr-dirty' | 'table-attr' | 'table-inter' | 'td-inner' | 'hr' | 'double-underscore' | 'link' | 'link-target' | 'link-text' | 'category' | 'file' | 'gallery-image' | 'imagemap-image' | 'image-parameter' | 'quote' | 'ext-link' | 'ext-link-text' | 'ext-link-url' | 'free-ext-link' | 'magic-link' | 'list' | 'dd' | 'converter' | 'converter-flags' | 'converter-flag' | 'converter-rule' | 'converter-rule-variant' | 'converter-rule-to' | 'converter-rule-from' | 'param-line' | 'imagemap-link';
@@ -44,7 +44,7 @@ export declare const stages: {
44
44
  converter: number;
45
45
  };
46
46
  export type Stage = keyof typeof stages;
47
- export declare const rules: readonly ["arg-in-ext", "blank-alt", "bold-header", "format-leakage", "fostered-content", "h1", "illegal-attr", "insecure-style", "invalid-gallery", "invalid-imagemap", "invalid-invoke", "invalid-isbn", "invalid-json", "invalid-url", "lonely-apos", "lonely-bracket", "lonely-http", "nested-link", "no-arg", "no-duplicate", "no-ignored", "obsolete-attr", "obsolete-tag", "parsing-order", "pipe-like", "syntax-like", "table-layout", "tag-like", "unbalanced-header", "unclosed-comment", "unclosed-quote", "unclosed-table", "unescaped", "unknown-page", "unmatched-tag", "unterminated-url", "url-encoding", "var-anchor", "void-ext", "invalid-css", "invalid-math"];
47
+ export declare const rules: readonly ["arg-in-ext", "blank-alt", "bold-header", "format-leakage", "fostered-content", "h1", "illegal-attr", "insecure-style", "invalid-gallery", "invalid-imagemap", "invalid-invoke", "invalid-isbn", "invalid-json", "invalid-url", "lonely-apos", "lonely-bracket", "lonely-http", "nested-link", "no-arg", "no-duplicate", "no-ignored", "obsolete-attr", "obsolete-tag", "parsing-order", "pipe-like", "required-attr", "syntax-like", "table-layout", "tag-like", "unbalanced-header", "unclosed-comment", "unclosed-quote", "unclosed-table", "unescaped", "unknown-page", "unmatched-tag", "unterminated-url", "url-encoding", "var-anchor", "void-ext", "invalid-css", "invalid-math"];
48
48
  export declare namespace LintError {
49
49
  type Severity = 'error' | 'warning';
50
50
  type Rule = typeof rules[number];
@@ -284,9 +284,9 @@ export interface LintConfiguration extends FullLintConfig {
284
284
  rules: LintRuleConfiguration;
285
285
  getSeverity(rule: LintError.Rule, key?: string): LintError.Severity | false;
286
286
  }
287
+ export type MaxStage = number | Stage | Stage[];
287
288
  export interface Parser {
288
- config: string | // eslint-disable-line @stylistic/operator-linebreak
289
- ConfigData;
289
+ config: string | ConfigData;
290
290
  i18n: Record<string, string> | string | undefined;
291
291
  /** @since v1.22.0 */
292
292
  lintConfig: LintConfig;
@@ -305,8 +305,8 @@ export interface Parser {
305
305
  * @param maxStage max stage for parsing / 最大解析层级
306
306
  * @param page page name / 页面名称
307
307
  */
308
- parse(wikitext: string, include?: boolean, maxStage?: number | Stage | Stage[], config?: Config, page?: string): Token;
309
- parse(wikitext: string, page: string, include?: boolean, maxStage?: number | Stage | Stage[], config?: Config): Token;
308
+ parse(wikitext: string, include?: boolean, maxStage?: MaxStage, config?: Config, page?: string): Token;
309
+ parse(wikitext: string, page: string, include?: boolean, maxStage?: MaxStage, config?: Config): Token;
310
310
  /**
311
311
  * Create a language server
312
312
  *
package/dist/base.d.ts CHANGED
@@ -13,7 +13,7 @@ export interface Config {
13
13
  readonly img: Record<string, string>;
14
14
  readonly redirection: string[];
15
15
  readonly variants: string[];
16
- readonly articlePath?: string;
16
+ articlePath?: string;
17
17
  }
18
18
  export type ConfigData = Omit<Config, 'excludes'>;
19
19
  export type TokenTypes = 'root' | 'plain' | 'redirect' | 'redirect-syntax' | 'redirect-target' | 'translate' | 'translate-attr' | 'translate-inner' | 'tvar' | 'tvar-name' | 'onlyinclude' | 'noinclude' | 'include' | 'comment' | 'ext' | 'ext-attrs' | 'ext-attr-dirty' | 'ext-attr' | 'attr-key' | 'attr-value' | 'ext-inner' | 'arg' | 'arg-name' | 'arg-default' | 'hidden' | 'magic-word' | 'magic-word-name' | 'invoke-function' | 'invoke-module' | 'template' | 'template-name' | 'parameter' | 'parameter-key' | 'parameter-value' | 'heading' | 'heading-title' | 'heading-trail' | 'html' | 'html-attrs' | 'html-attr-dirty' | 'html-attr' | 'table' | 'tr' | 'td' | 'table-syntax' | 'table-attrs' | 'table-attr-dirty' | 'table-attr' | 'table-inter' | 'td-inner' | 'hr' | 'double-underscore' | 'link' | 'link-target' | 'link-text' | 'category' | 'file' | 'gallery-image' | 'imagemap-image' | 'image-parameter' | 'quote' | 'ext-link' | 'ext-link-text' | 'ext-link-url' | 'free-ext-link' | 'magic-link' | 'list' | 'dd' | 'converter' | 'converter-flags' | 'converter-flag' | 'converter-rule' | 'converter-rule-variant' | 'converter-rule-to' | 'converter-rule-from' | 'param-line' | 'imagemap-link';
@@ -44,7 +44,7 @@ export declare const stages: {
44
44
  converter: number;
45
45
  };
46
46
  export type Stage = keyof typeof stages;
47
- export declare const rules: readonly ["arg-in-ext", "blank-alt", "bold-header", "format-leakage", "fostered-content", "h1", "illegal-attr", "insecure-style", "invalid-gallery", "invalid-imagemap", "invalid-invoke", "invalid-isbn", "invalid-json", "invalid-url", "lonely-apos", "lonely-bracket", "lonely-http", "nested-link", "no-arg", "no-duplicate", "no-ignored", "obsolete-attr", "obsolete-tag", "parsing-order", "pipe-like", "syntax-like", "table-layout", "tag-like", "unbalanced-header", "unclosed-comment", "unclosed-quote", "unclosed-table", "unescaped", "unknown-page", "unmatched-tag", "unterminated-url", "url-encoding", "var-anchor", "void-ext", "invalid-css", "invalid-math"];
47
+ export declare const rules: readonly ["arg-in-ext", "blank-alt", "bold-header", "format-leakage", "fostered-content", "h1", "illegal-attr", "insecure-style", "invalid-gallery", "invalid-imagemap", "invalid-invoke", "invalid-isbn", "invalid-json", "invalid-url", "lonely-apos", "lonely-bracket", "lonely-http", "nested-link", "no-arg", "no-duplicate", "no-ignored", "obsolete-attr", "obsolete-tag", "parsing-order", "pipe-like", "required-attr", "syntax-like", "table-layout", "tag-like", "unbalanced-header", "unclosed-comment", "unclosed-quote", "unclosed-table", "unescaped", "unknown-page", "unmatched-tag", "unterminated-url", "url-encoding", "var-anchor", "void-ext", "invalid-css", "invalid-math"];
48
48
  export declare namespace LintError {
49
49
  type Severity = 'error' | 'warning';
50
50
  type Rule = typeof rules[number];
@@ -284,9 +284,9 @@ export interface LintConfiguration extends FullLintConfig {
284
284
  rules: LintRuleConfiguration;
285
285
  getSeverity(rule: LintError.Rule, key?: string): LintError.Severity | false;
286
286
  }
287
+ export type MaxStage = number | Stage | Stage[];
287
288
  export interface Parser {
288
- config: string | // eslint-disable-line @stylistic/operator-linebreak
289
- ConfigData;
289
+ config: string | ConfigData;
290
290
  i18n: Record<string, string> | string | undefined;
291
291
  /** @since v1.22.0 */
292
292
  lintConfig: LintConfig;
@@ -305,8 +305,8 @@ export interface Parser {
305
305
  * @param maxStage max stage for parsing / 最大解析层级
306
306
  * @param page page name / 页面名称
307
307
  */
308
- parse(wikitext: string, include?: boolean, maxStage?: number | Stage | Stage[], config?: Config, page?: string): Token;
309
- parse(wikitext: string, page: string, include?: boolean, maxStage?: number | Stage | Stage[], config?: Config): Token;
308
+ parse(wikitext: string, include?: boolean, maxStage?: MaxStage, config?: Config, page?: string): Token;
309
+ parse(wikitext: string, page: string, include?: boolean, maxStage?: MaxStage, config?: Config): Token;
310
310
  /**
311
311
  * Create a language server
312
312
  *
package/dist/base.js CHANGED
@@ -58,6 +58,7 @@ exports.rules = (() => {
58
58
  'obsolete-tag',
59
59
  'parsing-order',
60
60
  'pipe-like',
61
+ 'required-attr',
61
62
  'syntax-like',
62
63
  'table-layout',
63
64
  'tag-like',
package/dist/base.mjs CHANGED
@@ -55,6 +55,7 @@ const rules = /* @__PURE__ */ (() => {
55
55
  "obsolete-tag",
56
56
  "parsing-order",
57
57
  "pipe-like",
58
+ "required-attr",
58
59
  "syntax-like",
59
60
  "table-layout",
60
61
  "tag-like",
@@ -40,7 +40,7 @@ const filterGadget = (id) => {
40
40
  const n = Number(id);
41
41
  return n < 2300 || n > 2303; // Gadget, Gadget talk, Gadget definition, Gadget definition talk
42
42
  };
43
- const pkg = "wikilint", version = "2.39.1";
43
+ const pkg = "wikilint", version = "2.40.0";
44
44
  /**
45
45
  * Get the parser configuration for a Wikimedia Foundation project.
46
46
  * @param site site nickname
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { LintConfiguration } from './lib/lintConfig';
2
2
  import { Title } from './lib/title';
3
- import type { Config, ConfigData, LintError, LintConfig, TokenTypes, Parser as ParserBase, Stage } from './base';
3
+ import type { MaxStage, Config, ConfigData, LintError, LintConfig, TokenTypes, Parser as ParserBase } from './base';
4
4
  import type { TitleOptions } from './lib/title';
5
5
  import type { LanguageService, QuickFixData } from './lib/lsp';
6
6
  import type { Token } from './internal';
@@ -18,8 +18,8 @@ declare interface Parser extends ParserBase {
18
18
  * @param include whether to be transcluded / 是否嵌入
19
19
  */
20
20
  normalizeTitle(title: string, defaultNs?: number, include?: boolean, config?: Config): Title;
21
- parse(wikitext: string, include?: boolean, maxStage?: number | Stage | Stage[], config?: Config, page?: string): Token;
22
- parse(wikitext: string, page: string, include?: boolean, maxStage?: number | Stage | Stage[], config?: Config): Token;
21
+ parse(wikitext: string, include?: boolean, maxStage?: MaxStage, config?: Config, page?: string): Token;
22
+ parse(wikitext: string, page: string, include?: boolean, maxStage?: MaxStage, config?: Config): Token;
23
23
  /**
24
24
  * Create a language server
25
25
  *
package/dist/index.js CHANGED
@@ -149,7 +149,11 @@ const Parser = {
149
149
  root.parseOnce(0, include).parseOnce();
150
150
  const t = new title_1.Title(root.firstChild.toString(), defaultNs, config, opt);
151
151
  root.build();
152
- for (const key of ['main', 'fragment']) {
152
+ const keys = [
153
+ 'main',
154
+ 'fragment',
155
+ ];
156
+ for (const key of keys) {
153
157
  const str = t[key];
154
158
  if (str?.includes('\0')) {
155
159
  const s = root.buildFromStr(str, constants_1.BuildMethod.Text);
@@ -163,6 +163,18 @@ const defaultLintRuleConfig = {
163
163
  // td: 1,
164
164
  },
165
165
  ],
166
+ 'required-attr': [
167
+ 2,
168
+ {
169
+ // indicator: 2,
170
+ // langconvert: 2,
171
+ // mapframe: 2,
172
+ // maplink: 2,
173
+ // phonos: 2,
174
+ // section: 2,
175
+ // templatestyles: 2,
176
+ },
177
+ ],
166
178
  'syntax-like': [
167
179
  2,
168
180
  {
package/dist/lib/lsp.js CHANGED
@@ -847,21 +847,16 @@ class LanguageService {
847
847
  end: { line: endLine, character: endCol },
848
848
  },
849
849
  severity: severity === 'error' ? 1 : 2,
850
- source:
851
- /* eslint-disable @stylistic/operator-linebreak */
852
- sources[rule] ??
850
+ source: sources[rule] ??
853
851
  'WikiLint',
854
852
  code: code ??
855
- /* eslint-enable @stylistic/operator-linebreak */
856
853
  rule,
857
854
  message,
858
855
  data: [
859
856
  ...fix ? [getQuickFix(root, fix, true)] : [],
860
857
  ...suggestions ? suggestions.map(suggestion => getQuickFix(root, suggestion)) : [],
861
858
  ],
862
- })),
863
- /* eslint-disable @stylistic/operator-linebreak */
864
- cssDiagnostics = stylelint ?
859
+ })), cssDiagnostics = stylelint ?
865
860
  await (async () => {
866
861
  NPM: {
867
862
  const tokens = this.findStyleTokens();
@@ -920,7 +915,6 @@ class LanguageService {
920
915
  return warning ? e : e.filter(({ severity }) => severity === 1);
921
916
  })) :
922
917
  [];
923
- /* eslint-enable @stylistic/operator-linebreak */
924
918
  /* NOT FOR BROWSER ONLY */
925
919
  let lilypondDiagnostics = [];
926
920
  if (this.lilypond) {
@@ -1004,7 +998,7 @@ class LanguageService {
1004
998
  * @param text source Wikitext / 源代码
1005
999
  */
1006
1000
  async provideFoldingRanges(text) {
1007
- const root = await this.#queue(text), { length } = root.getLines(), ranges = [], levels = new Array(6), tokens = root.querySelectorAll('heading-title,table,template,magic-word');
1001
+ const root = await this.#queue(text), { length } = root.getLines(), ranges = [], levels = Array.from({ length: 6 }), tokens = root.querySelectorAll('heading-title,table,template,magic-word');
1008
1002
  for (const token of [...tokens].reverse()) { // 提高 getBoundingClientRect 的性能
1009
1003
  token.getRelativeIndex();
1010
1004
  }
@@ -1388,7 +1382,7 @@ class LanguageService {
1388
1382
  if (!this.data) {
1389
1383
  return undefined;
1390
1384
  }
1391
- const { line, character } = position, curLine = text.split(/\r?\n/u, line + 1)[line], { lastChild } = await this.#queueSignature(`${curLine.slice(0, character + /^[^{}<]*/u.exec(curLine.slice(character))[0].length)}}}`);
1385
+ const { line, character } = position, curLine = text.split(/\r?\n/u, line + 1)[line], { lastChild } = await this.#queueSignature(`${curLine.slice(0, character + (0, common_1.numLeadingSpaces)(curLine.slice(character), /[{}<]|$/u))}}}`);
1392
1386
  if (!lastChild.is('magic-word') || lastChild.length === 1) {
1393
1387
  return undefined;
1394
1388
  }
@@ -1552,7 +1546,7 @@ class LanguageService {
1552
1546
  * @param text source Wikitext / 源代码
1553
1547
  */
1554
1548
  async provideDocumentSymbols(text) {
1555
- const root = await this.#queue(text), lines = root.getLines(), { length } = lines, symbols = [], names = new Set(), sections = new Array(6), tokens = root.querySelectorAll('heading-title');
1549
+ const root = await this.#queue(text), lines = root.getLines(), { length } = lines, symbols = [], names = new Set(), sections = Array.from({ length: 6 }), tokens = root.querySelectorAll('heading-title');
1556
1550
  for (const token of tokens) {
1557
1551
  const { top, height, left, width } = token.getBoundingClientRect(), { level } = token.parentNode;
1558
1552
  for (let i = level - 1; i < 6; i++) {
@@ -1603,7 +1597,7 @@ class LanguageService {
1603
1597
  catch {
1604
1598
  this.config = await index_1.default.fetchConfig(site, `${host}/w`, user);
1605
1599
  }
1606
- Object.assign(this.config, { articlePath: `${host}/wiki/` });
1600
+ this.config.articlePath = `${host}/wiki/`;
1607
1601
  }
1608
1602
  /** @implements */
1609
1603
  [Symbol.dispose]() {
package/dist/lib/node.js CHANGED
@@ -90,7 +90,10 @@ let AstNode = (() => {
90
90
  /** @private */
91
91
  getChildNodes() {
92
92
  const { childNodes } = this;
93
- return Object.isFrozen(childNodes) ? [...childNodes] : childNodes;
93
+ if (Object.isFrozen(childNodes)) {
94
+ return [...childNodes];
95
+ }
96
+ return childNodes;
94
97
  }
95
98
  /** @private */
96
99
  getAttribute(key) {
package/dist/lib/text.js CHANGED
@@ -70,7 +70,10 @@ class AstText extends node_1.AstNode {
70
70
  }
71
71
  /** @private */
72
72
  toString(skip) {
73
- return skip && !this.parentNode?.getAttribute('built') ? (0, string_1.removeComment)(this.data) : this.data;
73
+ if (skip && !this.parentNode?.getAttribute('built')) {
74
+ return (0, string_1.removeComment)(this.data);
75
+ }
76
+ return this.data;
74
77
  }
75
78
  /** @private */
76
79
  text() {