wikiparser-node 0.5.0 → 0.6.1
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/config/default.json +129 -66
- package/config/zhwiki.json +4 -4
- package/index.js +74 -65
- package/lib/element.js +125 -152
- package/lib/node.js +251 -223
- package/lib/ranges.js +2 -2
- package/lib/text.js +64 -64
- package/lib/title.js +8 -7
- package/mixin/hidden.js +2 -0
- package/mixin/sol.js +1 -2
- package/package.json +4 -3
- package/parser/brackets.js +8 -2
- package/parser/externalLinks.js +1 -1
- package/parser/hrAndDoubleUnderscore.js +4 -4
- package/parser/links.js +7 -7
- package/parser/table.js +12 -10
- package/src/arg.js +53 -48
- package/src/atom/index.js +7 -5
- package/src/attribute.js +91 -80
- package/src/charinsert.js +91 -0
- package/src/converter.js +22 -11
- package/src/converterFlags.js +72 -62
- package/src/converterRule.js +49 -49
- package/src/extLink.js +30 -28
- package/src/gallery.js +56 -32
- package/src/hasNowiki/index.js +42 -0
- package/src/hasNowiki/pre.js +40 -0
- package/src/heading.js +15 -11
- package/src/html.js +38 -38
- package/src/imageParameter.js +64 -48
- package/src/imagemap.js +205 -0
- package/src/imagemapLink.js +43 -0
- package/src/index.js +222 -124
- package/src/link/category.js +4 -8
- package/src/link/file.js +95 -59
- package/src/link/galleryImage.js +74 -10
- package/src/link/index.js +61 -39
- package/src/magicLink.js +21 -22
- package/src/nested/choose.js +24 -0
- package/src/nested/combobox.js +23 -0
- package/src/nested/index.js +88 -0
- package/src/nested/references.js +23 -0
- package/src/nowiki/comment.js +17 -17
- package/src/nowiki/dd.js +2 -2
- package/src/nowiki/doubleUnderscore.js +14 -14
- package/src/nowiki/index.js +12 -0
- package/src/onlyinclude.js +10 -8
- package/src/paramTag/index.js +83 -0
- package/src/paramTag/inputbox.js +42 -0
- package/src/parameter.js +32 -18
- package/src/syntax.js +9 -1
- package/src/table/index.js +33 -32
- package/src/table/td.js +51 -57
- package/src/table/tr.js +6 -6
- package/src/tagPair/ext.js +58 -40
- package/src/tagPair/include.js +1 -1
- package/src/tagPair/index.js +21 -20
- package/src/transclude.js +158 -143
- package/tool/index.js +720 -439
- package/util/base.js +17 -0
- package/util/debug.js +1 -1
- package/util/diff.js +1 -1
- package/util/string.js +20 -20
package/config/default.json
CHANGED
|
@@ -22,7 +22,21 @@
|
|
|
22
22
|
"seo",
|
|
23
23
|
"tab",
|
|
24
24
|
"tabs",
|
|
25
|
-
"combobox"
|
|
25
|
+
"combobox",
|
|
26
|
+
"ce",
|
|
27
|
+
"chem",
|
|
28
|
+
"graph",
|
|
29
|
+
"hiero",
|
|
30
|
+
"langconvert",
|
|
31
|
+
"mapframe",
|
|
32
|
+
"maplink",
|
|
33
|
+
"math",
|
|
34
|
+
"quiz",
|
|
35
|
+
"section",
|
|
36
|
+
"source",
|
|
37
|
+
"syntaxhighlight",
|
|
38
|
+
"templatedata",
|
|
39
|
+
"timeline"
|
|
26
40
|
],
|
|
27
41
|
"html": [
|
|
28
42
|
[
|
|
@@ -113,10 +127,19 @@
|
|
|
113
127
|
"13": "Help talk",
|
|
114
128
|
"14": "Category",
|
|
115
129
|
"15": "Category talk",
|
|
130
|
+
"100": "Portal",
|
|
131
|
+
"101": "Portal talk",
|
|
132
|
+
"102": "WikiProject",
|
|
133
|
+
"103": "WikiProject talk",
|
|
134
|
+
"118": "Draft",
|
|
135
|
+
"119": "Draft talk",
|
|
116
136
|
"274": "Widget",
|
|
117
137
|
"275": "Widget talk",
|
|
138
|
+
"710": "TimedText",
|
|
139
|
+
"711": "TimedText talk",
|
|
118
140
|
"828": "Module",
|
|
119
|
-
"829": "Module talk"
|
|
141
|
+
"829": "Module talk",
|
|
142
|
+
"2600": "Topic"
|
|
120
143
|
},
|
|
121
144
|
"nsid": {
|
|
122
145
|
"": 0,
|
|
@@ -141,6 +164,7 @@
|
|
|
141
164
|
"用戶": 2,
|
|
142
165
|
"用户": 2,
|
|
143
166
|
"利用者": 2,
|
|
167
|
+
"ut": 3,
|
|
144
168
|
"user talk": 3,
|
|
145
169
|
"使用者討論": 3,
|
|
146
170
|
"用戶對話": 3,
|
|
@@ -154,7 +178,11 @@
|
|
|
154
178
|
"moegirlpedia": 4,
|
|
155
179
|
"萌娘百科": 4,
|
|
156
180
|
"萌えっ娘百科事典": 4,
|
|
181
|
+
"wp": 4,
|
|
182
|
+
"wikipedia": 4,
|
|
157
183
|
"project": 4,
|
|
184
|
+
"维基百科": 4,
|
|
185
|
+
"維基百科": 4,
|
|
158
186
|
"llwiki talk": 5,
|
|
159
187
|
"llwiki讨论": 5,
|
|
160
188
|
"llwiki討論": 5,
|
|
@@ -164,22 +192,32 @@
|
|
|
164
192
|
"moegirlpedia talk": 5,
|
|
165
193
|
"萌えっ娘百科事典‐ノート": 5,
|
|
166
194
|
"萌えっ娘百科事典・トーク": 5,
|
|
195
|
+
"wt": 5,
|
|
196
|
+
"wikipedia talk": 5,
|
|
167
197
|
"project talk": 5,
|
|
198
|
+
"维基百科对话": 5,
|
|
199
|
+
"维基百科讨论": 5,
|
|
200
|
+
"維基百科對話": 5,
|
|
201
|
+
"維基百科討論": 5,
|
|
202
|
+
"f": 6,
|
|
168
203
|
"file": 6,
|
|
169
204
|
"image": 6,
|
|
170
205
|
"图像": 6,
|
|
171
206
|
"圖像": 6,
|
|
207
|
+
"圖片": 6,
|
|
172
208
|
"文件": 6,
|
|
173
209
|
"档案": 6,
|
|
174
210
|
"檔案": 6,
|
|
175
211
|
"ファイル": 6,
|
|
176
212
|
"画像": 6,
|
|
213
|
+
"ft": 7,
|
|
177
214
|
"file talk": 7,
|
|
178
215
|
"image talk": 7,
|
|
179
216
|
"图像对话": 7,
|
|
180
217
|
"图像讨论": 7,
|
|
181
218
|
"圖像對話": 7,
|
|
182
219
|
"圖像討論": 7,
|
|
220
|
+
"圖片討論": 7,
|
|
183
221
|
"文件对话": 7,
|
|
184
222
|
"文件讨论": 7,
|
|
185
223
|
"文件對話": 7,
|
|
@@ -244,18 +282,30 @@
|
|
|
244
282
|
"widget talk": 275,
|
|
245
283
|
"module": 828,
|
|
246
284
|
"模块": 828,
|
|
285
|
+
"模塊": 828,
|
|
247
286
|
"模組": 828,
|
|
287
|
+
"模组": 828,
|
|
248
288
|
"モジュール": 828,
|
|
249
289
|
"module talk": 829,
|
|
250
290
|
"模块讨论": 829,
|
|
291
|
+
"模块对话": 829,
|
|
292
|
+
"模塊對話": 829,
|
|
293
|
+
"模塊討論": 829,
|
|
294
|
+
"模組對話": 829,
|
|
251
295
|
"模組討論": 829,
|
|
296
|
+
"模组对话": 829,
|
|
297
|
+
"模组讨论": 829,
|
|
252
298
|
"モジュール・トーク": 829
|
|
253
299
|
},
|
|
254
300
|
"parserFunction": [
|
|
255
301
|
[
|
|
256
302
|
"名称空间",
|
|
303
|
+
"名字空间",
|
|
304
|
+
"命名空間",
|
|
257
305
|
"ns",
|
|
258
306
|
"名称空间e",
|
|
307
|
+
"名字空间e",
|
|
308
|
+
"命名空間e",
|
|
259
309
|
"nse",
|
|
260
310
|
"url编码",
|
|
261
311
|
"urlencode",
|
|
@@ -284,11 +334,14 @@
|
|
|
284
334
|
"语法",
|
|
285
335
|
"grammar",
|
|
286
336
|
"性别",
|
|
337
|
+
"性別",
|
|
338
|
+
"性",
|
|
287
339
|
"gender",
|
|
288
340
|
"复数",
|
|
289
341
|
"plural",
|
|
290
342
|
"bidi",
|
|
291
343
|
"#语言",
|
|
344
|
+
"#語言",
|
|
292
345
|
"#language",
|
|
293
346
|
"左填充",
|
|
294
347
|
"padleft",
|
|
@@ -299,6 +352,7 @@
|
|
|
299
352
|
"文件路径",
|
|
300
353
|
"filepath",
|
|
301
354
|
"页面id",
|
|
355
|
+
"頁面id",
|
|
302
356
|
"pageid",
|
|
303
357
|
"界面",
|
|
304
358
|
"int",
|
|
@@ -313,6 +367,7 @@
|
|
|
313
367
|
"#formatdate",
|
|
314
368
|
"#dateformat",
|
|
315
369
|
"#invoke",
|
|
370
|
+
"#調動",
|
|
316
371
|
"#while",
|
|
317
372
|
"#dowhile",
|
|
318
373
|
"#loop",
|
|
@@ -326,12 +381,14 @@
|
|
|
326
381
|
"#匹配式",
|
|
327
382
|
"#若相等",
|
|
328
383
|
"#如果相等",
|
|
384
|
+
"#若表達式",
|
|
329
385
|
"#ifeq",
|
|
330
386
|
"#多选式",
|
|
331
387
|
"#多条件式",
|
|
332
388
|
"#双射式",
|
|
333
389
|
"#开关",
|
|
334
390
|
"#转换",
|
|
391
|
+
"#轉換",
|
|
335
392
|
"#switch",
|
|
336
393
|
"#存在式",
|
|
337
394
|
"#若有",
|
|
@@ -341,18 +398,24 @@
|
|
|
341
398
|
"#ifexpr",
|
|
342
399
|
"#错误式",
|
|
343
400
|
"#如果错误",
|
|
401
|
+
"#如果錯誤",
|
|
344
402
|
"#iferror",
|
|
345
403
|
"#时间",
|
|
404
|
+
"#時間",
|
|
346
405
|
"#time",
|
|
347
406
|
"#时间l",
|
|
407
|
+
"#時間l",
|
|
348
408
|
"#timel",
|
|
349
409
|
"#计算式",
|
|
350
410
|
"#表达式",
|
|
411
|
+
"#表達式",
|
|
351
412
|
"#expr",
|
|
352
413
|
"#rel2abs",
|
|
353
414
|
"#标题组成部分",
|
|
354
415
|
"#titleparts",
|
|
355
416
|
"#categorytree",
|
|
417
|
+
"#分類樹",
|
|
418
|
+
"#分类树",
|
|
356
419
|
"#url解码",
|
|
357
420
|
"#urldecode",
|
|
358
421
|
"#choose",
|
|
@@ -367,8 +430,10 @@
|
|
|
367
430
|
"条目路径",
|
|
368
431
|
"articlepath",
|
|
369
432
|
"服务器",
|
|
433
|
+
"伺服器",
|
|
370
434
|
"server",
|
|
371
435
|
"服务器名",
|
|
436
|
+
"伺服器名稱",
|
|
372
437
|
"servername",
|
|
373
438
|
"脚本路径",
|
|
374
439
|
"scriptpath",
|
|
@@ -389,20 +454,52 @@
|
|
|
389
454
|
"#replace",
|
|
390
455
|
"#explode",
|
|
391
456
|
"#tab",
|
|
392
|
-
"#seo"
|
|
457
|
+
"#seo",
|
|
458
|
+
"#babel",
|
|
459
|
+
"#巴别",
|
|
460
|
+
"#巴別",
|
|
461
|
+
"#commaseparatedlist",
|
|
462
|
+
"#coordinates",
|
|
463
|
+
"#lst",
|
|
464
|
+
"#lsth",
|
|
465
|
+
"#lstx",
|
|
466
|
+
"#mentor",
|
|
467
|
+
"#property",
|
|
468
|
+
"#target",
|
|
469
|
+
"#目標",
|
|
470
|
+
"#目标",
|
|
471
|
+
"#section",
|
|
472
|
+
"#section-x",
|
|
473
|
+
"#section-h",
|
|
474
|
+
"无外部语言连接",
|
|
475
|
+
"隱藏跨語言連結",
|
|
476
|
+
"noexternallanglinks",
|
|
477
|
+
"#屬性",
|
|
478
|
+
"#属性",
|
|
479
|
+
"#statements",
|
|
480
|
+
"numberofwikis",
|
|
481
|
+
"wb報表名稱",
|
|
482
|
+
"wb报告名",
|
|
483
|
+
"wbreponame"
|
|
393
484
|
],
|
|
394
485
|
[
|
|
395
486
|
"页面数",
|
|
487
|
+
"頁面數",
|
|
396
488
|
"NUMBEROFPAGES",
|
|
397
489
|
"用户数",
|
|
490
|
+
"使用者人數量",
|
|
398
491
|
"NUMBEROFUSERS",
|
|
399
492
|
"活跃用户数",
|
|
493
|
+
"活躍使用者人數",
|
|
400
494
|
"NUMBEROFACTIVEUSERS",
|
|
401
495
|
"条目数",
|
|
496
|
+
"文章數",
|
|
402
497
|
"NUMBEROFARTICLES",
|
|
403
498
|
"文件数",
|
|
499
|
+
"檔案數",
|
|
404
500
|
"NUMBEROFFILES",
|
|
405
501
|
"管理员数",
|
|
502
|
+
"管理員數",
|
|
406
503
|
"NUMBEROFADMINS",
|
|
407
504
|
"组中用户数",
|
|
408
505
|
"NUMBERINGROUP",
|
|
@@ -429,6 +526,7 @@
|
|
|
429
526
|
"NAMESPACENUMBER",
|
|
430
527
|
"讨论空间",
|
|
431
528
|
"讨论名字空间",
|
|
529
|
+
"對話空間",
|
|
432
530
|
"TALKSPACE",
|
|
433
531
|
"讨论空间等同",
|
|
434
532
|
"讨论名字空间等同",
|
|
@@ -444,6 +542,7 @@
|
|
|
444
542
|
"页名",
|
|
445
543
|
"页面名",
|
|
446
544
|
"页面名称",
|
|
545
|
+
"頁面名稱",
|
|
447
546
|
"PAGENAME",
|
|
448
547
|
"页面名等同",
|
|
449
548
|
"页面名称等同",
|
|
@@ -454,8 +553,10 @@
|
|
|
454
553
|
"完整页面名称等同",
|
|
455
554
|
"FULLPAGENAMEE",
|
|
456
555
|
"根页面名称",
|
|
556
|
+
"根頁面名稱",
|
|
457
557
|
"ROOTPAGENAME",
|
|
458
558
|
"根页面名称等同",
|
|
559
|
+
"根頁面名稱E",
|
|
459
560
|
"ROOTPAGENAMEE",
|
|
460
561
|
"基础页面名称",
|
|
461
562
|
"BASEPAGENAME",
|
|
@@ -494,12 +595,16 @@
|
|
|
494
595
|
"修订时间戳",
|
|
495
596
|
"REVISIONTIMESTAMP",
|
|
496
597
|
"修订用户",
|
|
598
|
+
"修訂使用者",
|
|
497
599
|
"REVISIONUSER",
|
|
498
600
|
"级联来源",
|
|
499
601
|
"CASCADINGSOURCES",
|
|
500
602
|
"名字空间",
|
|
603
|
+
"命名空間",
|
|
604
|
+
"命名空間數",
|
|
501
605
|
"NAMESPACE",
|
|
502
606
|
"显示标题",
|
|
607
|
+
"顯示標題",
|
|
503
608
|
"DISPLAYTITLE",
|
|
504
609
|
"!",
|
|
505
610
|
"本月",
|
|
@@ -527,6 +632,7 @@
|
|
|
527
632
|
"今年",
|
|
528
633
|
"CURRENTYEAR",
|
|
529
634
|
"当前时间",
|
|
635
|
+
"目前時間",
|
|
530
636
|
"此时",
|
|
531
637
|
"CURRENTTIME",
|
|
532
638
|
"当前小时",
|
|
@@ -542,6 +648,7 @@
|
|
|
542
648
|
"本地月历",
|
|
543
649
|
"LOCALMONTHNAMEGEN",
|
|
544
650
|
"本地月缩写",
|
|
651
|
+
"本月縮寫",
|
|
545
652
|
"LOCALMONTHABBREV",
|
|
546
653
|
"本地日",
|
|
547
654
|
"LOCALDAY",
|
|
@@ -556,6 +663,7 @@
|
|
|
556
663
|
"本地小时",
|
|
557
664
|
"LOCALHOUR",
|
|
558
665
|
"站点名称",
|
|
666
|
+
"網站名稱",
|
|
559
667
|
"SITENAME",
|
|
560
668
|
"本周",
|
|
561
669
|
"CURRENTWEEK",
|
|
@@ -568,6 +676,7 @@
|
|
|
568
676
|
"修订大小",
|
|
569
677
|
"REVISIONSIZE",
|
|
570
678
|
"当前版本",
|
|
679
|
+
"目前版本",
|
|
571
680
|
"CURRENTVERSION",
|
|
572
681
|
"当前时间戳",
|
|
573
682
|
"CURRENTTIMESTAMP",
|
|
@@ -577,9 +686,11 @@
|
|
|
577
686
|
"DIRECTIONMARK",
|
|
578
687
|
"DIRMARK",
|
|
579
688
|
"内容语言",
|
|
689
|
+
"內容語言",
|
|
580
690
|
"CONTENTLANGUAGE",
|
|
581
691
|
"CONTENTLANG",
|
|
582
|
-
"PAGELANGUAGE"
|
|
692
|
+
"PAGELANGUAGE",
|
|
693
|
+
"="
|
|
583
694
|
],
|
|
584
695
|
[
|
|
585
696
|
"msg",
|
|
@@ -597,21 +708,28 @@
|
|
|
597
708
|
[
|
|
598
709
|
"forcetoc",
|
|
599
710
|
"强显目录",
|
|
711
|
+
"強制目錄",
|
|
600
712
|
"nocc",
|
|
601
713
|
"nocontentconvert",
|
|
602
714
|
"不转换内容",
|
|
715
|
+
"不轉換內容",
|
|
603
716
|
"noeditsection",
|
|
604
717
|
"无段落编辑",
|
|
605
718
|
"无编辑段落",
|
|
719
|
+
"無段落編輯",
|
|
606
720
|
"nogallery",
|
|
607
721
|
"无图库",
|
|
722
|
+
"無圖庫",
|
|
608
723
|
"notc",
|
|
609
724
|
"notitleconvert",
|
|
610
725
|
"不转换标题",
|
|
726
|
+
"不轉換標題",
|
|
611
727
|
"notoc",
|
|
612
728
|
"无目录",
|
|
729
|
+
"無目錄",
|
|
613
730
|
"toc",
|
|
614
|
-
"目录"
|
|
731
|
+
"目录",
|
|
732
|
+
"目錄"
|
|
615
733
|
],
|
|
616
734
|
[
|
|
617
735
|
"EXPECTUNUSEDCATEGORY",
|
|
@@ -619,6 +737,7 @@
|
|
|
619
737
|
"消除歧义",
|
|
620
738
|
"HIDDENCAT",
|
|
621
739
|
"隐藏分类",
|
|
740
|
+
"隱藏分類",
|
|
622
741
|
"INDEX",
|
|
623
742
|
"索引",
|
|
624
743
|
"NEWSECTIONLINK",
|
|
@@ -628,70 +747,14 @@
|
|
|
628
747
|
"NONEWSECTIONLINK",
|
|
629
748
|
"无新段落链接",
|
|
630
749
|
"STATICREDIRECT",
|
|
631
|
-
"静态重定向"
|
|
750
|
+
"静态重定向",
|
|
751
|
+
"靜態重新導向",
|
|
752
|
+
"NOGLOBAL",
|
|
753
|
+
"EXPECTED_UNCONNECTED_PAGE"
|
|
632
754
|
]
|
|
633
755
|
],
|
|
634
756
|
"protocol": "bitcoin:|ftp://|ftps://|geo:|git://|gopher://|http://|https://|irc://|ircs://|magnet:|mailto:|mms://|news:|nntp://|redis://|sftp://|sip:|sips:|sms:|ssh://|svn://|tel:|telnet://|urn:|worldwind://|xmpp:",
|
|
635
|
-
"interwiki": [
|
|
636
|
-
"arxiv",
|
|
637
|
-
"aswiki",
|
|
638
|
-
"cache",
|
|
639
|
-
"cmoegirl",
|
|
640
|
-
"commons",
|
|
641
|
-
"doi",
|
|
642
|
-
"google",
|
|
643
|
-
"googlegroups",
|
|
644
|
-
"gsnews",
|
|
645
|
-
"imdb",
|
|
646
|
-
"jawiki",
|
|
647
|
-
"komica",
|
|
648
|
-
"mediawikiwiki",
|
|
649
|
-
"metawikimedia",
|
|
650
|
-
"moegirl",
|
|
651
|
-
"mw",
|
|
652
|
-
"sifaswiki",
|
|
653
|
-
"sifwiki",
|
|
654
|
-
"wikia",
|
|
655
|
-
"wikibooks",
|
|
656
|
-
"wikidata",
|
|
657
|
-
"wikimedia",
|
|
658
|
-
"wikinews",
|
|
659
|
-
"wikiinfo",
|
|
660
|
-
"wikipedia",
|
|
661
|
-
"wikiquote",
|
|
662
|
-
"wikisource",
|
|
663
|
-
"wikispecies",
|
|
664
|
-
"wikiversity",
|
|
665
|
-
"wikivoyage",
|
|
666
|
-
"wikt",
|
|
667
|
-
"wiktionary",
|
|
668
|
-
"zhwiki",
|
|
669
|
-
"cc",
|
|
670
|
-
"cm",
|
|
671
|
-
"en",
|
|
672
|
-
"enmoe",
|
|
673
|
-
"enwp",
|
|
674
|
-
"fandom",
|
|
675
|
-
"ghia",
|
|
676
|
-
"huiji",
|
|
677
|
-
"ja",
|
|
678
|
-
"jamoe",
|
|
679
|
-
"jawp",
|
|
680
|
-
"library",
|
|
681
|
-
"meta",
|
|
682
|
-
"phab",
|
|
683
|
-
"pmid",
|
|
684
|
-
"shoutwiki",
|
|
685
|
-
"translatewiki",
|
|
686
|
-
"zhmoe",
|
|
687
|
-
"zhmoegirl",
|
|
688
|
-
"zhtest",
|
|
689
|
-
"zhwp",
|
|
690
|
-
"文库",
|
|
691
|
-
"萌娘共享",
|
|
692
|
-
"萌娘文库",
|
|
693
|
-
"萌百"
|
|
694
|
-
],
|
|
757
|
+
"interwiki": [],
|
|
695
758
|
"img": {
|
|
696
759
|
"thumbnail": "thumbnail",
|
|
697
760
|
"thumb": "thumbnail",
|
package/config/zhwiki.json
CHANGED
|
@@ -141,8 +141,8 @@
|
|
|
141
141
|
"對話": 1,
|
|
142
142
|
"讨论": 1,
|
|
143
143
|
"討論": 1,
|
|
144
|
-
"u": 2,
|
|
145
144
|
"user": 2,
|
|
145
|
+
"u": 2,
|
|
146
146
|
"使用者": 2,
|
|
147
147
|
"用戶": 2,
|
|
148
148
|
"用户": 2,
|
|
@@ -194,8 +194,8 @@
|
|
|
194
194
|
"mediawiki talk": 9,
|
|
195
195
|
"mediawiki讨论": 9,
|
|
196
196
|
"mediawiki討論": 9,
|
|
197
|
-
"t": 10,
|
|
198
197
|
"template": 10,
|
|
198
|
+
"t": 10,
|
|
199
199
|
"样板": 10,
|
|
200
200
|
"模板": 10,
|
|
201
201
|
"樣板": 10,
|
|
@@ -219,8 +219,8 @@
|
|
|
219
219
|
"帮助讨论": 13,
|
|
220
220
|
"幫助對話": 13,
|
|
221
221
|
"幫助討論": 13,
|
|
222
|
-
"cat": 14,
|
|
223
222
|
"category": 14,
|
|
223
|
+
"cat": 14,
|
|
224
224
|
"分类": 14,
|
|
225
225
|
"分類": 14,
|
|
226
226
|
"category talk": 15,
|
|
@@ -686,9 +686,9 @@
|
|
|
686
686
|
"目錄"
|
|
687
687
|
],
|
|
688
688
|
[
|
|
689
|
+
"EXPECTUNUSEDCATEGORY",
|
|
689
690
|
"DISAMBIG",
|
|
690
691
|
"消除歧义",
|
|
691
|
-
"EXPECTUNUSEDCATEGORY",
|
|
692
692
|
"HIDDENCAT",
|
|
693
693
|
"隐藏分类",
|
|
694
694
|
"隱藏分類",
|
package/index.js
CHANGED
|
@@ -5,17 +5,18 @@ const fs = require('fs'),
|
|
|
5
5
|
{text} = require('./util/string');
|
|
6
6
|
|
|
7
7
|
const /** @type {Parser} */ Parser = {
|
|
8
|
-
warning: true,
|
|
9
|
-
debugging: false,
|
|
10
|
-
running: false,
|
|
11
|
-
|
|
12
8
|
config: './config/default',
|
|
13
9
|
|
|
14
10
|
MAX_STAGE: 11,
|
|
15
11
|
|
|
12
|
+
warning: true,
|
|
13
|
+
debugging: false,
|
|
14
|
+
running: false,
|
|
15
|
+
|
|
16
16
|
classes: {},
|
|
17
17
|
mixins: {},
|
|
18
18
|
parsers: {},
|
|
19
|
+
tool: {},
|
|
19
20
|
|
|
20
21
|
aliases: [
|
|
21
22
|
['AstText'],
|
|
@@ -32,6 +33,8 @@ const /** @type {Parser} */ Parser = {
|
|
|
32
33
|
['ConverterToken'],
|
|
33
34
|
],
|
|
34
35
|
typeAliases: {
|
|
36
|
+
text: ['string', 'str'],
|
|
37
|
+
plain: ['regular', 'normal'],
|
|
35
38
|
include: ['includeonly'],
|
|
36
39
|
ext: ['extension'],
|
|
37
40
|
'ext-attr': ['extension-attr'],
|
|
@@ -54,9 +57,12 @@ const /** @type {Parser} */ Parser = {
|
|
|
54
57
|
'td-inner': ['table-cell-inner', 'table-data-inner'],
|
|
55
58
|
'double-underscore': ['underscore', 'behavior-switch', 'behaviour-switch'],
|
|
56
59
|
hr: ['horizontal'],
|
|
60
|
+
link: ['wikilink'],
|
|
57
61
|
category: ['category-link', 'cat', 'cat-link'],
|
|
58
62
|
file: ['file-link', 'image', 'image-link', 'img', 'img-link'],
|
|
63
|
+
'link-text': ['wikilink-text'],
|
|
59
64
|
'gallery-image': ['gallery-file', 'gallery-img'],
|
|
65
|
+
'imagemap-image': ['imagemap-file', 'imagemap-img', 'image-map-image', 'image-map-file', 'image-map-img'],
|
|
60
66
|
'image-parameter': ['img-parameter', 'image-param', 'img-param'],
|
|
61
67
|
quote: ['quotes', 'quot', 'apostrophe', 'apostrophes', 'apos'],
|
|
62
68
|
'ext-link': ['external-link'],
|
|
@@ -73,72 +79,16 @@ const /** @type {Parser} */ Parser = {
|
|
|
73
79
|
'converter-rule-variant': ['convert-rule-variant', 'conversion-rule-variant'],
|
|
74
80
|
'converter-rule-to': ['convert-rule-to', 'conversion-rule-to'],
|
|
75
81
|
'converter-rule-from': ['convert-rule-from', 'conversion-rule-from'],
|
|
82
|
+
'imagemap-link': ['image-map-link'],
|
|
83
|
+
'param-line': ['parameter-line'],
|
|
76
84
|
},
|
|
77
85
|
|
|
78
86
|
promises: [Promise.resolve()],
|
|
79
87
|
|
|
80
|
-
warn(msg, ...args) {
|
|
81
|
-
if (this.warning) {
|
|
82
|
-
console.warn('\x1B[33m%s\x1B[0m', msg, ...args);
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
debug(msg, ...args) {
|
|
86
|
-
if (this.debugging) {
|
|
87
|
-
console.debug('\x1B[34m%s\x1B[0m', msg, ...args);
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
error(msg, ...args) {
|
|
91
|
-
console.error('\x1B[31m%s\x1B[0m', msg, ...args);
|
|
92
|
-
},
|
|
93
|
-
info(msg, ...args) {
|
|
94
|
-
console.info('\x1B[32m%s\x1B[0m', msg, ...args);
|
|
95
|
-
},
|
|
96
|
-
|
|
97
|
-
log(f) {
|
|
98
|
-
if (typeof f === 'function') {
|
|
99
|
-
console.log(String(f));
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
|
|
103
88
|
getConfig() {
|
|
104
89
|
return require(this.config);
|
|
105
90
|
},
|
|
106
91
|
|
|
107
|
-
run(callback) {
|
|
108
|
-
const {running} = this;
|
|
109
|
-
this.running = true;
|
|
110
|
-
try {
|
|
111
|
-
const result = callback();
|
|
112
|
-
this.running = running;
|
|
113
|
-
return result;
|
|
114
|
-
} catch (e) {
|
|
115
|
-
this.running = running;
|
|
116
|
-
throw e;
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
|
|
120
|
-
clearCache() {
|
|
121
|
-
const entries = [
|
|
122
|
-
...Object.entries(this.classes),
|
|
123
|
-
...Object.entries(this.mixins),
|
|
124
|
-
...Object.entries(this.parsers),
|
|
125
|
-
];
|
|
126
|
-
for (const [, filePath] of entries) {
|
|
127
|
-
delete require.cache[require.resolve(filePath)];
|
|
128
|
-
}
|
|
129
|
-
for (const [name, filePath] of entries) {
|
|
130
|
-
if (name in global) {
|
|
131
|
-
global[name] = require(filePath);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
|
|
136
|
-
isInterwiki(title, {interwiki} = Parser.getConfig()) {
|
|
137
|
-
title = String(title);
|
|
138
|
-
return new RegExp(`^(${interwiki.join('|')})\\s*:`, 'iu')
|
|
139
|
-
.exec(title.replaceAll('_', ' ').replace(/^\s*:?\s*/u, ''));
|
|
140
|
-
},
|
|
141
|
-
|
|
142
92
|
normalizeTitle(title, defaultNs = 0, include = false, config = Parser.getConfig(), halfParsed = false) {
|
|
143
93
|
let /** @type {Token} */ token;
|
|
144
94
|
if (!halfParsed) {
|
|
@@ -166,7 +116,7 @@ const /** @type {Parser} */ Parser = {
|
|
|
166
116
|
}
|
|
167
117
|
};
|
|
168
118
|
this.run(() => {
|
|
169
|
-
build(['title', 'fragment']);
|
|
119
|
+
build(['title', 'main', 'fragment']);
|
|
170
120
|
});
|
|
171
121
|
}
|
|
172
122
|
return titleObj;
|
|
@@ -223,6 +173,65 @@ const /** @type {Parser} */ Parser = {
|
|
|
223
173
|
return token;
|
|
224
174
|
},
|
|
225
175
|
|
|
176
|
+
run(callback) {
|
|
177
|
+
const {running} = this;
|
|
178
|
+
this.running = true;
|
|
179
|
+
try {
|
|
180
|
+
const result = callback();
|
|
181
|
+
this.running = running;
|
|
182
|
+
return result;
|
|
183
|
+
} catch (e) {
|
|
184
|
+
this.running = running;
|
|
185
|
+
throw e;
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
|
|
189
|
+
warn(msg, ...args) {
|
|
190
|
+
if (this.warning) {
|
|
191
|
+
console.warn('\x1B[33m%s\x1B[0m', msg, ...args);
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
debug(msg, ...args) {
|
|
195
|
+
if (this.debugging) {
|
|
196
|
+
console.debug('\x1B[34m%s\x1B[0m', msg, ...args);
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
error(msg, ...args) {
|
|
200
|
+
console.error('\x1B[31m%s\x1B[0m', msg, ...args);
|
|
201
|
+
},
|
|
202
|
+
info(msg, ...args) {
|
|
203
|
+
console.info('\x1B[32m%s\x1B[0m', msg, ...args);
|
|
204
|
+
},
|
|
205
|
+
|
|
206
|
+
log(f) {
|
|
207
|
+
if (typeof f === 'function') {
|
|
208
|
+
console.log(String(f));
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
clearCache() {
|
|
213
|
+
const entries = [
|
|
214
|
+
...Object.entries(this.classes),
|
|
215
|
+
...Object.entries(this.mixins),
|
|
216
|
+
...Object.entries(this.parsers),
|
|
217
|
+
...Object.entries(this.tool),
|
|
218
|
+
];
|
|
219
|
+
for (const [, filePath] of entries) {
|
|
220
|
+
delete require.cache[require.resolve(filePath)];
|
|
221
|
+
}
|
|
222
|
+
for (const [name, filePath] of entries) {
|
|
223
|
+
if (name in global) {
|
|
224
|
+
global[name] = require(filePath);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
|
|
229
|
+
isInterwiki(title, {interwiki} = Parser.getConfig()) {
|
|
230
|
+
title = String(title);
|
|
231
|
+
return new RegExp(`^(${interwiki.join('|')})\\s*:`, 'iu')
|
|
232
|
+
.exec(title.replaceAll('_', ' ').replace(/^\s*:?\s*/u, ''));
|
|
233
|
+
},
|
|
234
|
+
|
|
226
235
|
reparse(date) {
|
|
227
236
|
const main = fs.readdirSync(path.join(__dirname, 'errors'))
|
|
228
237
|
.find(name => name.startsWith(date) && name.at(-1) === 'Z');
|
|
@@ -257,9 +266,9 @@ const /** @type {Parser} */ Parser = {
|
|
|
257
266
|
|
|
258
267
|
const /** @type {PropertyDescriptorMap} */ def = {};
|
|
259
268
|
for (const key in Parser) {
|
|
260
|
-
if (['
|
|
269
|
+
if (['MAX_STAGE', 'aliases', 'typeAliases', 'promises'].includes(key)) {
|
|
261
270
|
def[key] = {enumerable: false, writable: false};
|
|
262
|
-
} else if (!['config', '
|
|
271
|
+
} else if (!['config', 'normalizeTitle', 'parse', 'isInterwiki', 'getTool'].includes(key)) {
|
|
263
272
|
def[key] = {enumerable: false};
|
|
264
273
|
}
|
|
265
274
|
}
|