wikiparser-node 1.39.0 → 1.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.
- package/README.md +1 -1
- package/bundle/bundle-es8.min.js +30 -29
- package/bundle/bundle-lsp.min.js +30 -30
- package/bundle/bundle.min.js +19 -19
- package/config/.schema.json +1 -1
- package/config/default.json +10 -1
- package/config/enwiki.json +88 -87
- package/config/jawiki.json +162 -153
- package/config/minimum.json +5 -81
- package/config/zhwiki.json +125 -124
- package/data/signatures.json +1 -1
- package/dist/addon/attribute.js +1 -1
- package/dist/addon/table.js +1 -1
- package/dist/addon/transclude.js +3 -1
- package/dist/base.d.mts +6 -6
- package/dist/base.d.ts +6 -6
- package/dist/base.js +1 -0
- package/dist/base.mjs +1 -0
- package/dist/bin/config.js +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -1
- package/dist/lib/lintConfig.js +12 -0
- package/dist/lib/lsp.js +6 -12
- package/dist/lib/node.js +5 -2
- package/dist/lib/text.js +4 -1
- package/dist/lib/title.js +8 -4
- package/dist/mixin/elementLike.js +2 -2
- package/dist/parser/commentAndExt.js +2 -1
- package/dist/render/expand.js +3 -3
- package/dist/render/extension.js +15 -3
- package/dist/render/magicWords.js +7 -7
- package/dist/src/attribute.d.ts +4 -1
- package/dist/src/attribute.js +4 -3
- package/dist/src/attributes.js +27 -5
- package/dist/src/heading.js +8 -3
- package/dist/src/link/base.d.ts +1 -1
- package/dist/src/link/base.js +10 -6
- package/dist/src/link/file.js +2 -2
- package/dist/src/magicLink.js +20 -16
- package/dist/src/multiLine/gallery.d.ts +5 -3
- package/dist/src/multiLine/gallery.js +6 -4
- package/dist/src/nowiki/base.d.ts +1 -1
- package/dist/src/parameter.js +5 -2
- package/dist/src/table/tr.js +1 -1
- package/dist/src/tagPair/ext.js +12 -18
- package/dist/src/tagPair/index.d.ts +1 -1
- package/dist/src/transclude.d.ts +6 -1
- package/dist/src/transclude.js +27 -19
- package/dist/util/constants.js +2 -1
- package/extensions/dist/base.js +3 -2
- package/i18n/en.json +1 -0
- package/i18n/zh-hans.json +1 -0
- package/i18n/zh-hant.json +1 -0
- package/package.json +11 -23
package/config/zhwiki.json
CHANGED
|
@@ -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
|
-
"
|
|
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
|
-
"
|
|
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
|
-
"
|
|
477
|
+
"numberoffiles",
|
|
478
|
+
"numberofpages",
|
|
479
|
+
"numberofusers",
|
|
454
480
|
"pageid",
|
|
455
|
-
"
|
|
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
|
-
"
|
|
489
|
+
"revisionsize",
|
|
477
490
|
"revisiontimestamp",
|
|
491
|
+
"revisionyear",
|
|
478
492
|
"revisionuser",
|
|
479
|
-
"
|
|
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
|
-
"
|
|
836
|
-
"
|
|
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
|
-
"
|
|
860
|
-
"
|
|
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
|
-
"
|
|
871
|
-
"
|
|
881
|
+
"LOCALYEAR": "localyear",
|
|
882
|
+
"本地年": "localyear",
|
|
883
|
+
"PAGELANGUAGE": "pagelanguage",
|
|
872
884
|
"REVISIONSIZE": "revisionsize",
|
|
873
885
|
"修订大小": "revisionsize",
|
|
874
|
-
"
|
|
875
|
-
"
|
|
876
|
-
"
|
|
877
|
-
"
|
|
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
|
-
"
|
|
920
|
-
"
|
|
921
|
-
"
|
|
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
|
-
"
|
|
931
|
-
"
|
|
932
|
-
"
|
|
933
|
-
"
|
|
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
|
-
"
|
|
941
|
-
"
|
|
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",
|
package/data/signatures.json
CHANGED
|
@@ -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/addon/attribute.js
CHANGED
|
@@ -90,7 +90,7 @@ attribute_1.AttributeToken.prototype.css =
|
|
|
90
90
|
start = offset + length;
|
|
91
91
|
}
|
|
92
92
|
output += style.slice(start);
|
|
93
|
-
this.setValue(output.
|
|
93
|
+
this.setValue(output.replaceAll(/^\s*;\s*|;\s*(?=;)/gu, ''));
|
|
94
94
|
}
|
|
95
95
|
return undefined;
|
|
96
96
|
}
|
package/dist/addon/table.js
CHANGED
|
@@ -436,7 +436,7 @@ index_2.TableToken.prototype.removeTableCol =
|
|
|
436
436
|
index_2.TableToken.prototype.mergeCells =
|
|
437
437
|
/** @implements */
|
|
438
438
|
function (xlim, ylim) {
|
|
439
|
-
const layout = this.getLayout(), maxCol = getMaxCol(layout), [xmin, xmax] = xlim.map(x => x < 0 ? x + maxCol : x).
|
|
439
|
+
const layout = this.getLayout(), maxCol = getMaxCol(layout), [xmin, xmax] = xlim.map(x => x < 0 ? x + maxCol : x).toSorted(compare), [ymin, ymax] = ylim.map(y => y < 0 ? y + layout.length : y).toSorted(compare), set = new Set(layout.slice(ymin, ymax).flatMap(rowLayout => rowLayout.slice(xmin, xmax)));
|
|
440
440
|
if ([...layout[ymin - 1] ?? [], ...layout[ymax] ?? []].some(coords => set.has(coords))
|
|
441
441
|
|| layout.some(rowLayout => set.has(rowLayout[xmin - 1]) || set.has(rowLayout[xmax]))) {
|
|
442
442
|
throw new RangeError('The area to be merged overlaps with the outer area!');
|
package/dist/addon/transclude.js
CHANGED
|
@@ -18,7 +18,9 @@ const atom_1 = require("../src/atom");
|
|
|
18
18
|
*/
|
|
19
19
|
const format = (token) => {
|
|
20
20
|
const { lastChild, type } = token, isParameter = lastChild.is('parameter');
|
|
21
|
-
if (!(type === 'template'
|
|
21
|
+
if (!(type === 'template'
|
|
22
|
+
? isParameter && lastChild.anon
|
|
23
|
+
: lastChild.is('magic-word-name'))
|
|
22
24
|
&& !lastChild.toString().endsWith('\n')) {
|
|
23
25
|
(isParameter ? lastChild.lastChild : lastChild).insertAt('\n');
|
|
24
26
|
}
|
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
|
-
|
|
16
|
+
articlePath?: string;
|
|
17
17
|
readonly conversionTable?: [string, string][];
|
|
18
18
|
readonly redirects?: [string, string][];
|
|
19
19
|
}
|
|
@@ -47,7 +47,7 @@ export declare const stages: {
|
|
|
47
47
|
'list-range': number;
|
|
48
48
|
};
|
|
49
49
|
export type Stage = keyof typeof stages;
|
|
50
|
-
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"];
|
|
50
|
+
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"];
|
|
51
51
|
export declare namespace LintError {
|
|
52
52
|
type Severity = 'error' | 'warning';
|
|
53
53
|
type Rule = typeof rules[number];
|
|
@@ -315,9 +315,9 @@ export interface LintConfiguration extends FullLintConfig {
|
|
|
315
315
|
rules: LintRuleConfiguration;
|
|
316
316
|
getSeverity(rule: LintError.Rule, key?: string): LintError.Severity | false;
|
|
317
317
|
}
|
|
318
|
+
export type MaxStage = number | Stage | Stage[];
|
|
318
319
|
export interface Parser {
|
|
319
|
-
config: string |
|
|
320
|
-
ConfigData;
|
|
320
|
+
config: string | ConfigData;
|
|
321
321
|
i18n: Record<string, string> | string | undefined;
|
|
322
322
|
/** @since v1.22.0 */
|
|
323
323
|
lintConfig: LintConfig;
|
|
@@ -338,8 +338,8 @@ export interface Parser {
|
|
|
338
338
|
* @param maxStage max stage for parsing / 最大解析层级
|
|
339
339
|
* @param page page name / 页面名称
|
|
340
340
|
*/
|
|
341
|
-
parse(wikitext: string, include?: boolean, maxStage?:
|
|
342
|
-
parse(wikitext: string, page: string, include?: boolean, maxStage?:
|
|
341
|
+
parse(wikitext: string, include?: boolean, maxStage?: MaxStage, config?: Config, page?: string): Token;
|
|
342
|
+
parse(wikitext: string, page: string, include?: boolean, maxStage?: MaxStage, config?: Config): Token;
|
|
343
343
|
/**
|
|
344
344
|
* Create a language server
|
|
345
345
|
*
|
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
|
-
|
|
16
|
+
articlePath?: string;
|
|
17
17
|
readonly conversionTable?: [string, string][];
|
|
18
18
|
readonly redirects?: [string, string][];
|
|
19
19
|
}
|
|
@@ -47,7 +47,7 @@ export declare const stages: {
|
|
|
47
47
|
'list-range': number;
|
|
48
48
|
};
|
|
49
49
|
export type Stage = keyof typeof stages;
|
|
50
|
-
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"];
|
|
50
|
+
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"];
|
|
51
51
|
export declare namespace LintError {
|
|
52
52
|
type Severity = 'error' | 'warning';
|
|
53
53
|
type Rule = typeof rules[number];
|
|
@@ -315,9 +315,9 @@ export interface LintConfiguration extends FullLintConfig {
|
|
|
315
315
|
rules: LintRuleConfiguration;
|
|
316
316
|
getSeverity(rule: LintError.Rule, key?: string): LintError.Severity | false;
|
|
317
317
|
}
|
|
318
|
+
export type MaxStage = number | Stage | Stage[];
|
|
318
319
|
export interface Parser {
|
|
319
|
-
config: string |
|
|
320
|
-
ConfigData;
|
|
320
|
+
config: string | ConfigData;
|
|
321
321
|
i18n: Record<string, string> | string | undefined;
|
|
322
322
|
/** @since v1.22.0 */
|
|
323
323
|
lintConfig: LintConfig;
|
|
@@ -338,8 +338,8 @@ export interface Parser {
|
|
|
338
338
|
* @param maxStage max stage for parsing / 最大解析层级
|
|
339
339
|
* @param page page name / 页面名称
|
|
340
340
|
*/
|
|
341
|
-
parse(wikitext: string, include?: boolean, maxStage?:
|
|
342
|
-
parse(wikitext: string, page: string, include?: boolean, maxStage?:
|
|
341
|
+
parse(wikitext: string, include?: boolean, maxStage?: MaxStage, config?: Config, page?: string): Token;
|
|
342
|
+
parse(wikitext: string, page: string, include?: boolean, maxStage?: MaxStage, config?: Config): Token;
|
|
343
343
|
/**
|
|
344
344
|
* Create a language server
|
|
345
345
|
*
|
package/dist/base.js
CHANGED
package/dist/base.mjs
CHANGED
package/dist/bin/config.js
CHANGED
|
@@ -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 = "wikiparser-node", version = "1.
|
|
43
|
+
const pkg = "wikiparser-node", version = "1.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,10 +1,9 @@
|
|
|
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,
|
|
3
|
+
import type { MaxStage, Config, ConfigData, LintError, LintConfig, TokenTypes, Parser as ParserBase, AST } from './base';
|
|
4
4
|
import type { TitleOptions } from './lib/title';
|
|
5
5
|
import type { LanguageService, QuickFixData } from './lib/lsp';
|
|
6
6
|
import type { Token, FunctionHook, TagHook } from './internal';
|
|
7
|
-
import type { AstRange } from './lib/range';
|
|
8
7
|
declare interface Parser extends ParserBase {
|
|
9
8
|
default: Parser;
|
|
10
9
|
/** @since v1.5.1 */
|
|
@@ -34,8 +33,8 @@ declare interface Parser extends ParserBase {
|
|
|
34
33
|
* @param include whether to be transcluded / 是否嵌入
|
|
35
34
|
*/
|
|
36
35
|
normalizeTitle(title: string, defaultNs?: number, include?: boolean, config?: Config): Title;
|
|
37
|
-
parse(wikitext: string, include?: boolean, maxStage?:
|
|
38
|
-
parse(wikitext: string, page: string, include?: boolean, maxStage?:
|
|
36
|
+
parse(wikitext: string, include?: boolean, maxStage?: MaxStage, config?: Config, page?: string): Token;
|
|
37
|
+
parse(wikitext: string, page: string, include?: boolean, maxStage?: MaxStage, config?: Config): Token;
|
|
39
38
|
/**
|
|
40
39
|
* Create a language server
|
|
41
40
|
*
|
|
@@ -122,6 +121,7 @@ declare const Parser: Parser;
|
|
|
122
121
|
// @ts-expect-error mixed export styles
|
|
123
122
|
export = Parser;
|
|
124
123
|
export default Parser;
|
|
125
|
-
export type { Config, ConfigData, LintConfig, LintError, TokenTypes, LanguageService, QuickFixData, Title, AST,
|
|
124
|
+
export type { Config, ConfigData, LintConfig, LintError, TokenTypes, LanguageService, QuickFixData, Title, AST, };
|
|
126
125
|
export type * from './internal';
|
|
126
|
+
export type { AstRange } from './lib/range';
|
|
127
127
|
declare global { type WikiParserAcceptable = Record<string, any>; }
|
package/dist/index.js
CHANGED
|
@@ -190,7 +190,11 @@ const Parser = {
|
|
|
190
190
|
root.parseOnce(0, include).parseOnce();
|
|
191
191
|
const t = new title_1.Title(root.firstChild.toString(), defaultNs, config, opt);
|
|
192
192
|
root.build();
|
|
193
|
-
|
|
193
|
+
const keys = [
|
|
194
|
+
'main',
|
|
195
|
+
'fragment',
|
|
196
|
+
];
|
|
197
|
+
for (const key of keys) {
|
|
194
198
|
const str = t[key];
|
|
195
199
|
if (str?.includes('\0')) {
|
|
196
200
|
const s = root.buildFromStr(str, constants_1.BuildMethod.Text);
|
package/dist/lib/lintConfig.js
CHANGED
|
@@ -166,6 +166,18 @@ const defaultLintRuleConfig = {
|
|
|
166
166
|
// td: 1,
|
|
167
167
|
},
|
|
168
168
|
],
|
|
169
|
+
'required-attr': [
|
|
170
|
+
2,
|
|
171
|
+
{
|
|
172
|
+
// indicator: 2,
|
|
173
|
+
// langconvert: 2,
|
|
174
|
+
// mapframe: 2,
|
|
175
|
+
// maplink: 2,
|
|
176
|
+
// phonos: 2,
|
|
177
|
+
// section: 2,
|
|
178
|
+
// templatestyles: 2,
|
|
179
|
+
},
|
|
180
|
+
],
|
|
169
181
|
'syntax-like': [
|
|
170
182
|
2,
|
|
171
183
|
{
|
package/dist/lib/lsp.js
CHANGED
|
@@ -856,21 +856,16 @@ class LanguageService {
|
|
|
856
856
|
end: { line: endLine, character: endCol },
|
|
857
857
|
},
|
|
858
858
|
severity: severity === 'error' ? 1 : 2,
|
|
859
|
-
source:
|
|
860
|
-
/* eslint-disable @stylistic/operator-linebreak */
|
|
861
|
-
sources[rule] ??
|
|
859
|
+
source: sources[rule] ??
|
|
862
860
|
'WikiLint',
|
|
863
861
|
code: code ??
|
|
864
|
-
/* eslint-enable @stylistic/operator-linebreak */
|
|
865
862
|
rule,
|
|
866
863
|
message,
|
|
867
864
|
data: [
|
|
868
865
|
...fix ? [getQuickFix(root, fix, true)] : [],
|
|
869
866
|
...suggestions ? suggestions.map(suggestion => getQuickFix(root, suggestion)) : [],
|
|
870
867
|
],
|
|
871
|
-
})),
|
|
872
|
-
/* eslint-disable @stylistic/operator-linebreak */
|
|
873
|
-
cssDiagnostics = stylelint ?
|
|
868
|
+
})), cssDiagnostics = stylelint ?
|
|
874
869
|
await (async () => {
|
|
875
870
|
NPM: {
|
|
876
871
|
const tokens = this.findStyleTokens();
|
|
@@ -929,7 +924,6 @@ class LanguageService {
|
|
|
929
924
|
return warning ? e : e.filter(({ severity }) => severity === 1);
|
|
930
925
|
})) :
|
|
931
926
|
[];
|
|
932
|
-
/* eslint-enable @stylistic/operator-linebreak */
|
|
933
927
|
/* NOT FOR BROWSER ONLY */
|
|
934
928
|
let lilypondDiagnostics = [];
|
|
935
929
|
if (this.lilypond) {
|
|
@@ -1013,7 +1007,7 @@ class LanguageService {
|
|
|
1013
1007
|
* @param text source Wikitext / 源代码
|
|
1014
1008
|
*/
|
|
1015
1009
|
async provideFoldingRanges(text) {
|
|
1016
|
-
const root = await this.#queue(text), { length } = root.getLines(), ranges = [], levels =
|
|
1010
|
+
const root = await this.#queue(text), { length } = root.getLines(), ranges = [], levels = Array.from({ length: 6 }), tokens = root.querySelectorAll('heading-title,table,template,magic-word');
|
|
1017
1011
|
for (const token of [...tokens].reverse()) { // 提高 getBoundingClientRect 的性能
|
|
1018
1012
|
token.getRelativeIndex();
|
|
1019
1013
|
}
|
|
@@ -1397,7 +1391,7 @@ class LanguageService {
|
|
|
1397
1391
|
if (!this.data) {
|
|
1398
1392
|
return undefined;
|
|
1399
1393
|
}
|
|
1400
|
-
const { line, character } = position, curLine = text.split(/\r?\n/u, line + 1)[line], { lastChild } = await this.#queueSignature(`${curLine.slice(0, character +
|
|
1394
|
+
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))}}}`);
|
|
1401
1395
|
if (!lastChild.is('magic-word') || lastChild.length === 1) {
|
|
1402
1396
|
return undefined;
|
|
1403
1397
|
}
|
|
@@ -1561,7 +1555,7 @@ class LanguageService {
|
|
|
1561
1555
|
* @param text source Wikitext / 源代码
|
|
1562
1556
|
*/
|
|
1563
1557
|
async provideDocumentSymbols(text) {
|
|
1564
|
-
const root = await this.#queue(text), lines = root.getLines(), { length } = lines, symbols = [], names = new Set(), sections =
|
|
1558
|
+
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');
|
|
1565
1559
|
for (const token of tokens) {
|
|
1566
1560
|
const { top, height, left, width } = token.getBoundingClientRect(), { level } = token.parentNode;
|
|
1567
1561
|
for (let i = level - 1; i < 6; i++) {
|
|
@@ -1612,7 +1606,7 @@ class LanguageService {
|
|
|
1612
1606
|
catch {
|
|
1613
1607
|
this.config = await index_1.default.fetchConfig(site, `${host}/w`, user);
|
|
1614
1608
|
}
|
|
1615
|
-
|
|
1609
|
+
this.config.articlePath = `${host}/wiki/`;
|
|
1616
1610
|
}
|
|
1617
1611
|
/** @implements */
|
|
1618
1612
|
[Symbol.dispose]() {
|