wikiparser-node 1.28.1 → 1.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/README.md +0 -2
- package/bundle/bundle-es8.min.js +25 -25
- package/bundle/bundle-lsp.min.js +30 -30
- package/bundle/bundle.min.js +24 -24
- package/data/ext/ThirdPartyNotices.txt +33 -0
- package/data/ext/mapframe.json +489 -2
- package/dist/addon/magicWords.js +132 -0
- package/dist/addon/table.js +4 -4
- package/dist/addon/token.js +37 -126
- package/dist/addon/transclude.js +24 -30
- 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 +27 -5
- 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 -78
- package/dist/lib/node.js +25 -25
- package/dist/lib/range.js +2 -2
- package/dist/lib/title.d.ts +3 -1
- package/dist/lib/title.js +54 -33
- 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 +7 -9
- package/dist/src/arg.js +4 -6
- package/dist/src/attribute.js +36 -8
- package/dist/src/attributes.js +1 -1
- package/dist/src/converter.js +6 -3
- package/dist/src/converterRule.js +4 -6
- package/dist/src/extLink.js +3 -4
- package/dist/src/heading.js +1 -2
- package/dist/src/imageParameter.d.ts +4 -1
- package/dist/src/imageParameter.js +30 -7
- package/dist/src/index.d.ts +8 -0
- package/dist/src/index.js +21 -29
- package/dist/src/link/base.js +6 -8
- package/dist/src/link/file.js +9 -10
- package/dist/src/link/galleryImage.js +1 -1
- package/dist/src/link/redirectTarget.js +1 -1
- package/dist/src/magicLink.js +1 -2
- 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/doubleUnderscore.js +1 -3
- package/dist/src/nowiki/index.js +58 -4
- package/dist/src/onlyinclude.js +2 -1
- package/dist/src/parameter.js +4 -6
- package/dist/src/redirect.js +2 -2
- package/dist/src/table/base.js +1 -2
- package/dist/src/table/index.js +3 -6
- package/dist/src/table/td.d.ts +2 -3
- package/dist/src/table/td.js +6 -6
- package/dist/src/table/trBase.js +1 -1
- package/dist/src/tag/html.js +3 -4
- package/dist/src/tag/tvar.js +1 -2
- package/dist/src/tagPair/ext.js +2 -2
- package/dist/src/tagPair/include.js +2 -2
- package/dist/src/tagPair/translate.js +2 -2
- package/dist/src/transclude.js +5 -5
- package/dist/util/constants.js +4 -1
- package/dist/util/debug.js +1 -1
- package/dist/util/html.js +13 -10
- package/dist/util/search.js +16 -0
- package/dist/util/sharable.js +27 -3
- package/dist/util/sharable.mjs +28 -4
- package/extensions/dist/base.js +1 -1
- package/i18n/en.json +2 -0
- package/i18n/zh-hans.json +2 -0
- package/i18n/zh-hant.json +2 -0
- package/package.json +6 -4
- 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
|
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.expandMagicWord = exports.expandedMagicWords = void 0;
|
|
4
|
+
const magicWords = [
|
|
5
|
+
'currentmonth',
|
|
6
|
+
'currentmonth1',
|
|
7
|
+
'currentmonthname',
|
|
8
|
+
'currentmonthnamegen',
|
|
9
|
+
'currentmonthabbrev',
|
|
10
|
+
'currentday',
|
|
11
|
+
'currentday2',
|
|
12
|
+
'currentdayname',
|
|
13
|
+
'currentyear',
|
|
14
|
+
'currenttime',
|
|
15
|
+
'currenthour',
|
|
16
|
+
'currentweek',
|
|
17
|
+
'currentdow',
|
|
18
|
+
'currenttimestamp',
|
|
19
|
+
'localmonth',
|
|
20
|
+
'localmonth1',
|
|
21
|
+
'localmonthname',
|
|
22
|
+
'localmonthnamegen',
|
|
23
|
+
'localmonthabbrev',
|
|
24
|
+
'localday',
|
|
25
|
+
'localday2',
|
|
26
|
+
'localdayname',
|
|
27
|
+
'localyear',
|
|
28
|
+
'localtime',
|
|
29
|
+
'localhour',
|
|
30
|
+
'localweek',
|
|
31
|
+
'localdow',
|
|
32
|
+
'localtimestamp',
|
|
33
|
+
'articlepath',
|
|
34
|
+
'revisionsize',
|
|
35
|
+
'numberofarticles',
|
|
36
|
+
'numberoffiles',
|
|
37
|
+
'numberofusers',
|
|
38
|
+
'numberofactiveusers',
|
|
39
|
+
'numberofpages',
|
|
40
|
+
'numberofadmins',
|
|
41
|
+
'numberofedits',
|
|
42
|
+
];
|
|
43
|
+
exports.expandedMagicWords = new Set(magicWords);
|
|
44
|
+
/**
|
|
45
|
+
* 展开魔术字
|
|
46
|
+
* @param name 魔术字名称
|
|
47
|
+
* @param now 当前时间
|
|
48
|
+
* @param config
|
|
49
|
+
* @param args 参数
|
|
50
|
+
* @throws `RangeError` 不支持的魔术字名称
|
|
51
|
+
*/
|
|
52
|
+
const expandMagicWord = (name, now, config, args) => {
|
|
53
|
+
switch (name) {
|
|
54
|
+
case 'currentyear':
|
|
55
|
+
return now.getUTCFullYear();
|
|
56
|
+
case 'currentmonth':
|
|
57
|
+
return String(now.getUTCMonth() + 1).padStart(2, '0');
|
|
58
|
+
case 'currentmonth1':
|
|
59
|
+
return now.getUTCMonth() + 1;
|
|
60
|
+
case 'currentmonthname':
|
|
61
|
+
case 'currentmonthnamegen':
|
|
62
|
+
return now.toLocaleString('default', { month: 'long', timeZone: 'UTC' });
|
|
63
|
+
case 'currentmonthabbrev':
|
|
64
|
+
return now.toLocaleString('default', { month: 'short', timeZone: 'UTC' });
|
|
65
|
+
case 'currentday':
|
|
66
|
+
return now.getUTCDate();
|
|
67
|
+
case 'currentday2':
|
|
68
|
+
return String(now.getUTCDate()).padStart(2, '0');
|
|
69
|
+
case 'currentdow':
|
|
70
|
+
return now.getUTCDay();
|
|
71
|
+
case 'currentdayname':
|
|
72
|
+
return now.toLocaleString('default', { weekday: 'long', timeZone: 'UTC' });
|
|
73
|
+
case 'currenttime':
|
|
74
|
+
return `${String(now.getUTCHours()).padStart(2, '0')}:${String(now.getUTCMinutes()).padStart(2, '0')}`;
|
|
75
|
+
case 'currenthour':
|
|
76
|
+
return String(now.getUTCHours()).padStart(2, '0');
|
|
77
|
+
case 'currentweek': {
|
|
78
|
+
const firstDay = new Date(Date.UTC(now.getUTCFullYear(), 0, 1));
|
|
79
|
+
return Math.ceil((now.getTime() - firstDay.getTime()) / 1e3 / 60 / 60 / 24 / 7);
|
|
80
|
+
}
|
|
81
|
+
case 'currenttimestamp':
|
|
82
|
+
return now.toISOString().slice(0, 19).replace(/[-:T]/gu, '');
|
|
83
|
+
case 'localyear':
|
|
84
|
+
return now.getFullYear();
|
|
85
|
+
case 'localmonth':
|
|
86
|
+
return String(now.getMonth() + 1).padStart(2, '0');
|
|
87
|
+
case 'localmonth1':
|
|
88
|
+
return now.getMonth() + 1;
|
|
89
|
+
case 'localmonthname':
|
|
90
|
+
case 'localmonthnamegen':
|
|
91
|
+
return now.toLocaleString('default', { month: 'long' });
|
|
92
|
+
case 'localmonthabbrev':
|
|
93
|
+
return now.toLocaleString('default', { month: 'short' });
|
|
94
|
+
case 'localday':
|
|
95
|
+
return now.getDate();
|
|
96
|
+
case 'localday2':
|
|
97
|
+
return String(now.getDate()).padStart(2, '0');
|
|
98
|
+
case 'localdow':
|
|
99
|
+
return now.getDay();
|
|
100
|
+
case 'localdayname':
|
|
101
|
+
return now.toLocaleString('default', { weekday: 'long' });
|
|
102
|
+
case 'localtime':
|
|
103
|
+
return `${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}`;
|
|
104
|
+
case 'localhour':
|
|
105
|
+
return String(now.getHours()).padStart(2, '0');
|
|
106
|
+
case 'localweek': {
|
|
107
|
+
const firstDay = new Date(now.getFullYear(), 0, 1);
|
|
108
|
+
return Math.ceil((now.getTime() - firstDay.getTime()) / 1e3 / 60 / 60 / 24 / 7);
|
|
109
|
+
}
|
|
110
|
+
case 'localtimestamp':
|
|
111
|
+
return String(now.getFullYear())
|
|
112
|
+
+ String(now.getMonth() + 1).padStart(2, '0')
|
|
113
|
+
+ String(now.getDate()).padStart(2, '0')
|
|
114
|
+
+ String(now.getHours()).padStart(2, '0')
|
|
115
|
+
+ String(now.getMinutes()).padStart(2, '0')
|
|
116
|
+
+ String(now.getSeconds()).padStart(2, '0');
|
|
117
|
+
case 'articlepath':
|
|
118
|
+
return config.articlePath ?? '';
|
|
119
|
+
case 'revisionsize':
|
|
120
|
+
case 'numberofarticles':
|
|
121
|
+
case 'numberoffiles':
|
|
122
|
+
case 'numberofusers':
|
|
123
|
+
case 'numberofactiveusers':
|
|
124
|
+
case 'numberofpages':
|
|
125
|
+
case 'numberofadmins':
|
|
126
|
+
case 'numberofedits':
|
|
127
|
+
return 0;
|
|
128
|
+
default:
|
|
129
|
+
throw new RangeError(`Unsupported magic word: ${name}`);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
exports.expandMagicWord = expandMagicWord;
|
package/dist/addon/table.js
CHANGED
|
@@ -159,13 +159,13 @@ index_2.TableToken.prototype.formatTableCol =
|
|
|
159
159
|
index_2.TableToken.prototype.fillTableRow =
|
|
160
160
|
/** @implements */
|
|
161
161
|
function (y, inner, subtype, attr) {
|
|
162
|
-
const
|
|
163
|
-
fill(y,
|
|
162
|
+
const layout = this.getLayout({ y });
|
|
163
|
+
fill(y, this.getNthRow(y), layout, getMaxCol(layout), (0, td_1.createTd)(inner, this, subtype, attr));
|
|
164
164
|
};
|
|
165
165
|
index_2.TableToken.prototype.fillTable =
|
|
166
166
|
/** @implements */
|
|
167
167
|
function (inner, subtype, attr) {
|
|
168
|
-
const rowTokens = this.getAllRows(), layout = this.getLayout(), maxCol = getMaxCol(layout), token = (0, td_1.createTd)(inner, subtype, attr
|
|
168
|
+
const rowTokens = this.getAllRows(), layout = this.getLayout(), maxCol = getMaxCol(layout), token = (0, td_1.createTd)(inner, this, subtype, attr);
|
|
169
169
|
for (let y = 0; y < rowTokens.length; y++) {
|
|
170
170
|
fill(y, rowTokens[y], layout, maxCol, token);
|
|
171
171
|
}
|
|
@@ -247,7 +247,7 @@ index_2.TableToken.prototype.insertTableCol =
|
|
|
247
247
|
if (x > minCol) {
|
|
248
248
|
throw new RangeError(`Row ${rowLength.indexOf(minCol)} has only ${minCol} column(s)!`);
|
|
249
249
|
}
|
|
250
|
-
const token = (0, td_1.createTd)(inner, subtype, attr
|
|
250
|
+
const token = (0, td_1.createTd)(inner, this, subtype, attr);
|
|
251
251
|
for (let i = 0; i < layout.length; i++) {
|
|
252
252
|
const rowLayout = layout[i], coords = rowLayout[x], prevCoords = x === 0 ? true : rowLayout[x - 1];
|
|
253
253
|
if (!prevCoords) {
|