wikilint 2.28.1 → 2.29.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/data/ext/ThirdPartyNotices.txt +33 -0
- package/data/ext/mapframe.json +489 -2
- package/dist/base.d.mts +4 -2
- package/dist/base.d.ts +4 -2
- package/dist/base.js +1 -0
- package/dist/base.mjs +2 -1
- package/dist/bin/config.js +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +23 -2
- package/dist/lib/document.d.ts +23 -7
- package/dist/lib/document.js +7 -27
- package/dist/lib/element.js +1 -1
- package/dist/lib/lintConfig.js +2 -0
- package/dist/lib/lsp.d.ts +1 -12
- package/dist/lib/lsp.js +41 -75
- package/dist/lib/node.js +23 -20
- package/dist/lib/title.d.ts +3 -1
- package/dist/lib/title.js +37 -9
- package/dist/mixin/elementLike.js +14 -9
- package/dist/parser/commentAndExt.js +30 -26
- package/dist/parser/links.js +4 -3
- package/dist/parser/redirect.js +1 -1
- package/dist/parser/selector.js +6 -8
- package/dist/src/arg.js +2 -2
- package/dist/src/attribute.js +27 -0
- package/dist/src/attributes.js +1 -1
- package/dist/src/converter.js +6 -3
- package/dist/src/imageParameter.d.ts +3 -1
- package/dist/src/imageParameter.js +18 -3
- package/dist/src/index.d.ts +8 -0
- package/dist/src/index.js +21 -28
- package/dist/src/link/file.js +7 -7
- package/dist/src/link/galleryImage.js +1 -1
- package/dist/src/link/redirectTarget.js +1 -1
- package/dist/src/multiLine/gallery.js +2 -2
- package/dist/src/multiLine/imagemap.js +3 -4
- package/dist/src/multiLine/paramTag.js +2 -2
- package/dist/src/nowiki/index.js +59 -2
- package/dist/src/table/base.js +1 -2
- package/dist/src/table/index.js +1 -2
- package/dist/src/transclude.js +3 -3
- package/dist/util/constants.js +3 -1
- package/dist/util/debug.js +1 -1
- package/dist/util/search.js +16 -0
- package/dist/util/sharable.js +27 -3
- package/dist/util/sharable.mjs +28 -4
- package/i18n/en.json +2 -0
- package/i18n/zh-hans.json +2 -0
- package/i18n/zh-hant.json +2 -0
- package/package.json +5 -3
- package/data/ext/maplink.json +0 -4
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
THIRD-PARTY SOFTWARE NOTICES AND INFORMATION
|
|
2
|
+
Do Not Translate or Localize
|
|
3
|
+
|
|
4
|
+
This project incorporates components from the projects listed below. The original copyright notices and the licenses
|
|
5
|
+
under which such components were received are set forth below.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
%% mediawiki-extensions-Kartographer (https://gerrit.wikimedia.org/g/mediawiki/extensions/Kartographer)
|
|
10
|
+
=========================================
|
|
11
|
+
The MIT License (MIT)
|
|
12
|
+
|
|
13
|
+
Copyright (c) 2015 Yuri Astrakhan and others, see AUTHORS.txt
|
|
14
|
+
|
|
15
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
16
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
17
|
+
in the Software without restriction, including without limitation the rights
|
|
18
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
19
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
20
|
+
furnished to do so, subject to the following conditions:
|
|
21
|
+
|
|
22
|
+
The above copyright notice and this permission notice shall be included in all
|
|
23
|
+
copies or substantial portions of the Software.
|
|
24
|
+
|
|
25
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
26
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
27
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
28
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
29
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
30
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
|
+
SOFTWARE.
|
|
32
|
+
=========================================
|
|
33
|
+
END OF mediawiki-extensions-Kartographer NOTICES AND INFORMATION
|
package/data/ext/mapframe.json
CHANGED
|
@@ -1,4 +1,491 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "http://json-schema.org/draft-
|
|
3
|
-
"
|
|
2
|
+
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
3
|
+
"id": "http://json-schema.org/geojson/geojson.json#",
|
|
4
|
+
"oneOf": [
|
|
5
|
+
{
|
|
6
|
+
"$ref": "#/definitions/root"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"type": "array",
|
|
10
|
+
"items": {
|
|
11
|
+
"$ref": "#/definitions/root"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"definitions": {
|
|
16
|
+
"root": {
|
|
17
|
+
"title": "Geo JSON object",
|
|
18
|
+
"description": "Schema for a Geo JSON object",
|
|
19
|
+
"type": "object",
|
|
20
|
+
"required": [
|
|
21
|
+
"type"
|
|
22
|
+
],
|
|
23
|
+
"properties": {
|
|
24
|
+
"crs": {
|
|
25
|
+
"$ref": "#/definitions/crs"
|
|
26
|
+
},
|
|
27
|
+
"bbox": {
|
|
28
|
+
"$ref": "#/definitions/bbox"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"oneOf": [
|
|
32
|
+
{
|
|
33
|
+
"$ref": "#/definitions/geometry"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"$ref": "#/definitions/feature"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"$ref": "#/definitions/featureCollection"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"$ref": "#/definitions/externalData"
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
"crs": {
|
|
47
|
+
"title": "crs",
|
|
48
|
+
"description": "a Coordinate Reference System object",
|
|
49
|
+
"type": [
|
|
50
|
+
"object",
|
|
51
|
+
"null"
|
|
52
|
+
],
|
|
53
|
+
"required": [
|
|
54
|
+
"type",
|
|
55
|
+
"properties"
|
|
56
|
+
],
|
|
57
|
+
"properties": {
|
|
58
|
+
"type": {
|
|
59
|
+
"type": "string"
|
|
60
|
+
},
|
|
61
|
+
"properties": {
|
|
62
|
+
"type": "object"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"additionalProperties": false,
|
|
66
|
+
"oneOf": [
|
|
67
|
+
{
|
|
68
|
+
"$ref": "#/definitions/namedCrs"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"$ref": "#/definitions/linkedCrs"
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
"bbox": {
|
|
76
|
+
"description": "A bounding box as defined by GeoJSON",
|
|
77
|
+
"FIXME": "unenforceable constraint: even number of elements in array",
|
|
78
|
+
"type": "array",
|
|
79
|
+
"items": {
|
|
80
|
+
"type": "number"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"geometry": {
|
|
84
|
+
"title": "geometry",
|
|
85
|
+
"description": "One geometry as defined by GeoJSON",
|
|
86
|
+
"type": "object",
|
|
87
|
+
"required": [
|
|
88
|
+
"type"
|
|
89
|
+
],
|
|
90
|
+
"oneOf": [
|
|
91
|
+
{
|
|
92
|
+
"$ref": "#/definitions/primitiveGeometry"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"$ref": "#/definitions/geometryCollection"
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
"primitiveGeometry": {
|
|
100
|
+
"title": "primitiveGeometry",
|
|
101
|
+
"description": "All the non-collection Geometry types",
|
|
102
|
+
"type": "object",
|
|
103
|
+
"required": [
|
|
104
|
+
"coordinates"
|
|
105
|
+
],
|
|
106
|
+
"oneOf": [
|
|
107
|
+
{
|
|
108
|
+
"title": "Point",
|
|
109
|
+
"properties": {
|
|
110
|
+
"type": {
|
|
111
|
+
"enum": [
|
|
112
|
+
"Point"
|
|
113
|
+
]
|
|
114
|
+
},
|
|
115
|
+
"coordinates": {
|
|
116
|
+
"$ref": "#/definitions/position"
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"title": "MultiPoint",
|
|
122
|
+
"properties": {
|
|
123
|
+
"type": {
|
|
124
|
+
"enum": [
|
|
125
|
+
"MultiPoint"
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
"coordinates": {
|
|
129
|
+
"$ref": "#/definitions/positionArray"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"title": "LineString",
|
|
135
|
+
"properties": {
|
|
136
|
+
"type": {
|
|
137
|
+
"enum": [
|
|
138
|
+
"LineString"
|
|
139
|
+
]
|
|
140
|
+
},
|
|
141
|
+
"coordinates": {
|
|
142
|
+
"$ref": "#/definitions/lineString"
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"title": "MultiLineString",
|
|
148
|
+
"properties": {
|
|
149
|
+
"type": {
|
|
150
|
+
"enum": [
|
|
151
|
+
"MultiLineString"
|
|
152
|
+
]
|
|
153
|
+
},
|
|
154
|
+
"coordinates": {
|
|
155
|
+
"type": "array",
|
|
156
|
+
"items": {
|
|
157
|
+
"$ref": "#/definitions/lineString"
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"title": "Polygon",
|
|
164
|
+
"properties": {
|
|
165
|
+
"type": {
|
|
166
|
+
"enum": [
|
|
167
|
+
"Polygon"
|
|
168
|
+
]
|
|
169
|
+
},
|
|
170
|
+
"coordinates": {
|
|
171
|
+
"$ref": "#/definitions/polygon"
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"title": "MultiPolygon",
|
|
177
|
+
"properties": {
|
|
178
|
+
"type": {
|
|
179
|
+
"enum": [
|
|
180
|
+
"MultiPolygon"
|
|
181
|
+
]
|
|
182
|
+
},
|
|
183
|
+
"coordinates": {
|
|
184
|
+
"type": "array",
|
|
185
|
+
"items": {
|
|
186
|
+
"$ref": "#/definitions/polygon"
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
]
|
|
192
|
+
},
|
|
193
|
+
"geometryCollection": {
|
|
194
|
+
"title": "GeometryCollection",
|
|
195
|
+
"description": "A collection of geometry objects",
|
|
196
|
+
"required": [
|
|
197
|
+
"geometries"
|
|
198
|
+
],
|
|
199
|
+
"properties": {
|
|
200
|
+
"type": {
|
|
201
|
+
"enum": [
|
|
202
|
+
"GeometryCollection"
|
|
203
|
+
]
|
|
204
|
+
},
|
|
205
|
+
"geometries": {
|
|
206
|
+
"type": "array",
|
|
207
|
+
"items": {
|
|
208
|
+
"$ref": "#/definitions/geometry"
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
"feature": {
|
|
214
|
+
"title": "Feature",
|
|
215
|
+
"description": "A Geo JSON feature object",
|
|
216
|
+
"required": [
|
|
217
|
+
"geometry"
|
|
218
|
+
],
|
|
219
|
+
"properties": {
|
|
220
|
+
"type": {
|
|
221
|
+
"enum": [
|
|
222
|
+
"Feature"
|
|
223
|
+
]
|
|
224
|
+
},
|
|
225
|
+
"geometry": {
|
|
226
|
+
"oneOf": [
|
|
227
|
+
{
|
|
228
|
+
"type": "null"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"$ref": "#/definitions/geometry"
|
|
232
|
+
}
|
|
233
|
+
]
|
|
234
|
+
},
|
|
235
|
+
"properties": {
|
|
236
|
+
"$ref": "#/definitions/simplestyle"
|
|
237
|
+
},
|
|
238
|
+
"id": {
|
|
239
|
+
"type": [
|
|
240
|
+
"string",
|
|
241
|
+
"number"
|
|
242
|
+
]
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
"featureCollection": {
|
|
247
|
+
"title": "FeatureCollection",
|
|
248
|
+
"description": "A Geo JSON feature collection",
|
|
249
|
+
"required": [
|
|
250
|
+
"features"
|
|
251
|
+
],
|
|
252
|
+
"properties": {
|
|
253
|
+
"type": {
|
|
254
|
+
"enum": [
|
|
255
|
+
"FeatureCollection"
|
|
256
|
+
]
|
|
257
|
+
},
|
|
258
|
+
"features": {
|
|
259
|
+
"type": "array",
|
|
260
|
+
"items": {
|
|
261
|
+
"$ref": "#/definitions/feature"
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
"externalData": {
|
|
267
|
+
"title": "ExternalData",
|
|
268
|
+
"description": "WMF extension - reference to external geometries",
|
|
269
|
+
"required": [
|
|
270
|
+
"type",
|
|
271
|
+
"service"
|
|
272
|
+
],
|
|
273
|
+
"oneOf": [
|
|
274
|
+
{
|
|
275
|
+
"required": [
|
|
276
|
+
"title"
|
|
277
|
+
],
|
|
278
|
+
"properties": {
|
|
279
|
+
"service": {
|
|
280
|
+
"enum": [
|
|
281
|
+
"page"
|
|
282
|
+
]
|
|
283
|
+
},
|
|
284
|
+
"title": {
|
|
285
|
+
"type": "string"
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
"anyOf": [
|
|
291
|
+
{
|
|
292
|
+
"required": [
|
|
293
|
+
"query"
|
|
294
|
+
]
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
"required": [
|
|
298
|
+
"ids"
|
|
299
|
+
]
|
|
300
|
+
}
|
|
301
|
+
],
|
|
302
|
+
"properties": {
|
|
303
|
+
"service": {
|
|
304
|
+
"enum": [
|
|
305
|
+
"geoshape",
|
|
306
|
+
"geoline",
|
|
307
|
+
"geopoint",
|
|
308
|
+
"geomask"
|
|
309
|
+
]
|
|
310
|
+
},
|
|
311
|
+
"query": {
|
|
312
|
+
"type": "string"
|
|
313
|
+
},
|
|
314
|
+
"ids": {
|
|
315
|
+
"oneOf": [
|
|
316
|
+
{
|
|
317
|
+
"type": "array",
|
|
318
|
+
"items": {
|
|
319
|
+
"type": "string",
|
|
320
|
+
"pattern": "^Q[1-9]\\d{0,19}$"
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
"type": "string",
|
|
325
|
+
"pattern": "^Q[1-9]\\d{0,19}(\\s*,\\s*Q[1-9]\\d{0,19})*$"
|
|
326
|
+
}
|
|
327
|
+
]
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
],
|
|
332
|
+
"properties": {
|
|
333
|
+
"type": {
|
|
334
|
+
"enum": [
|
|
335
|
+
"ExternalData"
|
|
336
|
+
]
|
|
337
|
+
},
|
|
338
|
+
"service": {
|
|
339
|
+
"type": "string"
|
|
340
|
+
},
|
|
341
|
+
"properties": {
|
|
342
|
+
"$ref": "#/definitions/simplestyle"
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
"position": {
|
|
347
|
+
"description": "A single position",
|
|
348
|
+
"type": "array",
|
|
349
|
+
"minItems": 2,
|
|
350
|
+
"items": {
|
|
351
|
+
"type": "number"
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
"positionArray": {
|
|
355
|
+
"description": "An array of positions",
|
|
356
|
+
"type": "array",
|
|
357
|
+
"items": {
|
|
358
|
+
"$ref": "#/definitions/position"
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
"lineString": {
|
|
362
|
+
"description": "An array of two or more positions",
|
|
363
|
+
"allOf": [
|
|
364
|
+
{
|
|
365
|
+
"$ref": "#/definitions/positionArray"
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
"minItems": 2
|
|
369
|
+
}
|
|
370
|
+
]
|
|
371
|
+
},
|
|
372
|
+
"linearRing": {
|
|
373
|
+
"description": "An array of four positions where the first equals the last",
|
|
374
|
+
"allOf": [
|
|
375
|
+
{
|
|
376
|
+
"$ref": "#/definitions/positionArray"
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
"minItems": 4
|
|
380
|
+
}
|
|
381
|
+
]
|
|
382
|
+
},
|
|
383
|
+
"polygon": {
|
|
384
|
+
"description": "An array of linear rings",
|
|
385
|
+
"type": "array",
|
|
386
|
+
"items": {
|
|
387
|
+
"$ref": "#/definitions/linearRing"
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
"namedCrs": {
|
|
391
|
+
"properties": {
|
|
392
|
+
"type": {
|
|
393
|
+
"enum": [
|
|
394
|
+
"name"
|
|
395
|
+
]
|
|
396
|
+
},
|
|
397
|
+
"properties": {
|
|
398
|
+
"required": [
|
|
399
|
+
"name"
|
|
400
|
+
],
|
|
401
|
+
"additionalProperties": false,
|
|
402
|
+
"properties": {
|
|
403
|
+
"name": {
|
|
404
|
+
"type": "string",
|
|
405
|
+
"FIXME": "semantic validation necessary"
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
},
|
|
411
|
+
"linkedObject": {
|
|
412
|
+
"type": "object",
|
|
413
|
+
"required": [
|
|
414
|
+
"href"
|
|
415
|
+
],
|
|
416
|
+
"properties": {
|
|
417
|
+
"href": {
|
|
418
|
+
"type": "string",
|
|
419
|
+
"format": "uri",
|
|
420
|
+
"FIXME": "spec says \"dereferenceable\", cannot enforce that"
|
|
421
|
+
},
|
|
422
|
+
"type": {
|
|
423
|
+
"type": "string",
|
|
424
|
+
"description": "Suggested values: proj4, ogjwkt, esriwkt"
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
},
|
|
428
|
+
"linkedCrs": {
|
|
429
|
+
"properties": {
|
|
430
|
+
"type": {
|
|
431
|
+
"enum": [
|
|
432
|
+
"link"
|
|
433
|
+
]
|
|
434
|
+
},
|
|
435
|
+
"properties": {
|
|
436
|
+
"$ref": "#/definitions/linkedObject"
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
|
+
"simplestyle": {
|
|
441
|
+
"type": "object",
|
|
442
|
+
"properties": {
|
|
443
|
+
"title": {
|
|
444
|
+
"type": "string"
|
|
445
|
+
},
|
|
446
|
+
"description": {
|
|
447
|
+
"type": "string"
|
|
448
|
+
},
|
|
449
|
+
"marker-size": {
|
|
450
|
+
"enum": [
|
|
451
|
+
"small",
|
|
452
|
+
"medium",
|
|
453
|
+
"large"
|
|
454
|
+
]
|
|
455
|
+
},
|
|
456
|
+
"marker-symbol": {
|
|
457
|
+
"type": "string",
|
|
458
|
+
"pattern": "^(|[a-zA-Z0-9-]+)$"
|
|
459
|
+
},
|
|
460
|
+
"marker-color": {
|
|
461
|
+
"$ref": "#/definitions/color"
|
|
462
|
+
},
|
|
463
|
+
"stroke": {
|
|
464
|
+
"$ref": "#/definitions/color"
|
|
465
|
+
},
|
|
466
|
+
"stroke-opacity": {
|
|
467
|
+
"$ref": "#/definitions/opacity"
|
|
468
|
+
},
|
|
469
|
+
"stroke-width": {
|
|
470
|
+
"type": "number",
|
|
471
|
+
"minimum": 0
|
|
472
|
+
},
|
|
473
|
+
"fill": {
|
|
474
|
+
"$ref": "#/definitions/color"
|
|
475
|
+
},
|
|
476
|
+
"fill-opacity": {
|
|
477
|
+
"$ref": "#/definitions/opacity"
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
},
|
|
481
|
+
"color": {
|
|
482
|
+
"type": "string",
|
|
483
|
+
"pattern": "^#?([0-9a-fA-F]{3}){1,2}$"
|
|
484
|
+
},
|
|
485
|
+
"opacity": {
|
|
486
|
+
"type": "number",
|
|
487
|
+
"minimum": 0,
|
|
488
|
+
"maximum": 1
|
|
489
|
+
}
|
|
490
|
+
}
|
|
4
491
|
}
|
package/dist/base.d.mts
CHANGED
|
@@ -45,7 +45,7 @@ export declare const stages: {
|
|
|
45
45
|
'list-range': number;
|
|
46
46
|
};
|
|
47
47
|
export type Stage = keyof typeof stages;
|
|
48
|
-
export declare const rules: readonly ["bold-header", "format-leakage", "fostered-content", "h1", "illegal-attr", "insecure-style", "invalid-gallery", "invalid-imagemap", "invalid-invoke", "invalid-isbn", "invalid-url", "lonely-apos", "lonely-bracket", "lonely-http", "nested-link", "no-arg", "no-duplicate", "no-ignored", "obsolete-attr", "obsolete-tag", "parsing-order", "pipe-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"];
|
|
48
|
+
export declare const rules: readonly ["bold-header", "format-leakage", "fostered-content", "h1", "illegal-attr", "insecure-style", "invalid-gallery", "invalid-imagemap", "invalid-invoke", "invalid-isbn", "invalid-url", "lonely-apos", "lonely-bracket", "lonely-http", "nested-link", "no-arg", "no-duplicate", "no-ignored", "obsolete-attr", "obsolete-tag", "parsing-order", "pipe-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"];
|
|
49
49
|
export declare namespace LintError {
|
|
50
50
|
type Severity = 'error' | 'warning';
|
|
51
51
|
type Rule = typeof rules[number];
|
|
@@ -304,8 +304,10 @@ export interface Parser {
|
|
|
304
304
|
* 解析wikitext
|
|
305
305
|
* @param include whether to be transcluded / 是否嵌入
|
|
306
306
|
* @param maxStage max stage for parsing / 最大解析层级
|
|
307
|
+
* @param page page name / 页面名称
|
|
307
308
|
*/
|
|
308
|
-
parse(wikitext: string, include?: boolean, maxStage?: number | Stage | Stage[], config?: Config): Token;
|
|
309
|
+
parse(wikitext: string, include?: boolean, maxStage?: number | Stage | Stage[], config?: Config, page?: string): Token;
|
|
310
|
+
parse(wikitext: string, page: string, include?: boolean, maxStage?: number | Stage | Stage[], config?: Config): Token;
|
|
309
311
|
/**
|
|
310
312
|
* Create a language server
|
|
311
313
|
*
|
package/dist/base.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export declare const stages: {
|
|
|
45
45
|
'list-range': number;
|
|
46
46
|
};
|
|
47
47
|
export type Stage = keyof typeof stages;
|
|
48
|
-
export declare const rules: readonly ["bold-header", "format-leakage", "fostered-content", "h1", "illegal-attr", "insecure-style", "invalid-gallery", "invalid-imagemap", "invalid-invoke", "invalid-isbn", "invalid-url", "lonely-apos", "lonely-bracket", "lonely-http", "nested-link", "no-arg", "no-duplicate", "no-ignored", "obsolete-attr", "obsolete-tag", "parsing-order", "pipe-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"];
|
|
48
|
+
export declare const rules: readonly ["bold-header", "format-leakage", "fostered-content", "h1", "illegal-attr", "insecure-style", "invalid-gallery", "invalid-imagemap", "invalid-invoke", "invalid-isbn", "invalid-url", "lonely-apos", "lonely-bracket", "lonely-http", "nested-link", "no-arg", "no-duplicate", "no-ignored", "obsolete-attr", "obsolete-tag", "parsing-order", "pipe-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"];
|
|
49
49
|
export declare namespace LintError {
|
|
50
50
|
type Severity = 'error' | 'warning';
|
|
51
51
|
type Rule = typeof rules[number];
|
|
@@ -304,8 +304,10 @@ export interface Parser {
|
|
|
304
304
|
* 解析wikitext
|
|
305
305
|
* @param include whether to be transcluded / 是否嵌入
|
|
306
306
|
* @param maxStage max stage for parsing / 最大解析层级
|
|
307
|
+
* @param page page name / 页面名称
|
|
307
308
|
*/
|
|
308
|
-
parse(wikitext: string, include?: boolean, maxStage?: number | Stage | Stage[], config?: Config): Token;
|
|
309
|
+
parse(wikitext: string, include?: boolean, maxStage?: number | Stage | Stage[], config?: Config, page?: string): Token;
|
|
310
|
+
parse(wikitext: string, page: string, include?: boolean, maxStage?: number | Stage | Stage[], config?: Config): Token;
|
|
309
311
|
/**
|
|
310
312
|
* Create a language server
|
|
311
313
|
*
|
package/dist/base.js
CHANGED
package/dist/base.mjs
CHANGED
package/dist/bin/config.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -17,7 +17,8 @@ declare interface Parser extends ParserBase {
|
|
|
17
17
|
* @param include whether to be transcluded / 是否嵌入
|
|
18
18
|
*/
|
|
19
19
|
normalizeTitle(title: string, defaultNs?: number, include?: boolean, config?: Config): Title;
|
|
20
|
-
parse(wikitext: string, include?: boolean, maxStage?: number | Stage | Stage[], config?: Config): Token;
|
|
20
|
+
parse(wikitext: string, include?: boolean, maxStage?: number | Stage | Stage[], config?: Config, page?: string): Token;
|
|
21
|
+
parse(wikitext: string, page: string, include?: boolean, maxStage?: number | Stage | Stage[], config?: Config): Token;
|
|
21
22
|
/**
|
|
22
23
|
* Create a language server
|
|
23
24
|
*
|
package/dist/index.js
CHANGED
|
@@ -132,6 +132,7 @@ const Parser = {
|
|
|
132
132
|
titleObj = debug_1.Shadow.run(() => {
|
|
133
133
|
const root = new Token(title, config);
|
|
134
134
|
root.type = 'root';
|
|
135
|
+
root.pageName = opt?.page;
|
|
135
136
|
root.parseOnce(0, include).parseOnce();
|
|
136
137
|
const t = new Title(root.toString(), defaultNs, config, opt);
|
|
137
138
|
root.build();
|
|
@@ -153,8 +154,23 @@ const Parser = {
|
|
|
153
154
|
return titleObj;
|
|
154
155
|
},
|
|
155
156
|
/** @implements */
|
|
156
|
-
parse(wikitext,
|
|
157
|
+
parse(wikitext, includeOrPage, maxStageOrInclude, configOrStage, pageOrConfig) {
|
|
157
158
|
wikitext = (0, string_1.tidy)(wikitext);
|
|
159
|
+
let include, maxStage, config, page;
|
|
160
|
+
if (typeof includeOrPage === 'string') {
|
|
161
|
+
include = Boolean(maxStageOrInclude);
|
|
162
|
+
maxStage = configOrStage;
|
|
163
|
+
config = pageOrConfig;
|
|
164
|
+
page = includeOrPage;
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
include = Boolean(includeOrPage);
|
|
168
|
+
maxStage = maxStageOrInclude;
|
|
169
|
+
config = configOrStage;
|
|
170
|
+
page = pageOrConfig;
|
|
171
|
+
}
|
|
172
|
+
maxStage ??= constants_1.MAX_STAGE;
|
|
173
|
+
config ??= this.getConfig();
|
|
158
174
|
let types;
|
|
159
175
|
LINT: { // eslint-disable-line no-unused-labels
|
|
160
176
|
if (typeof maxStage !== 'number') {
|
|
@@ -166,6 +182,7 @@ const Parser = {
|
|
|
166
182
|
const root = debug_1.Shadow.run(() => {
|
|
167
183
|
const token = new Token(wikitext, config);
|
|
168
184
|
token.type = 'root';
|
|
185
|
+
token.pageName = page;
|
|
169
186
|
try {
|
|
170
187
|
return token.parse(maxStage, include);
|
|
171
188
|
/* NOT FOR BROWSER ONLY */
|
|
@@ -180,7 +197,7 @@ const Parser = {
|
|
|
180
197
|
}
|
|
181
198
|
fs_1.default.writeFileSync(file, stage === constants_1.MAX_STAGE ? wikitext : token.toString());
|
|
182
199
|
fs_1.default.writeFileSync(`${file}.err`, e.stack);
|
|
183
|
-
fs_1.default.writeFileSync(`${file}.json`, JSON.stringify({ stage, include, config }, null, '\t'));
|
|
200
|
+
fs_1.default.writeFileSync(`${file}.json`, JSON.stringify({ stage, include, config, page }, null, '\t'));
|
|
184
201
|
}
|
|
185
202
|
throw e;
|
|
186
203
|
}
|
|
@@ -189,6 +206,10 @@ const Parser = {
|
|
|
189
206
|
return root;
|
|
190
207
|
},
|
|
191
208
|
/** @implements */
|
|
209
|
+
parseWithRef(wikitext, ref, maxStage, include = ref.getAttribute('include')) {
|
|
210
|
+
return this.parse(wikitext, include, maxStage, ref.getAttribute('config'), ref.pageName);
|
|
211
|
+
},
|
|
212
|
+
/** @implements */
|
|
192
213
|
async partialParse(wikitext, watch, include, config = Parser.getConfig()) {
|
|
193
214
|
LSP: { // eslint-disable-line no-unused-labels
|
|
194
215
|
const { Token } = require('./src/index');
|