wikiparser-node 1.9.2-b → 1.9.2
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 +18 -18
- package/config/.schema.json +181 -0
- package/config/enwiki.json +814 -1
- package/config/llwiki.json +35 -1
- package/config/moegirl.json +44 -1
- package/config/zhwiki.json +466 -1
- package/dist/addon/table.js +486 -0
- package/dist/addon/token.js +240 -0
- package/dist/addon/transclude.js +185 -0
- package/dist/base.d.ts +73 -0
- package/dist/base.js +39 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +232 -0
- package/dist/internal.d.ts +46 -0
- package/dist/lib/element.d.ts +124 -0
- package/dist/lib/element.js +600 -0
- package/dist/lib/node.d.ts +166 -0
- package/dist/lib/node.js +472 -0
- package/dist/lib/range.d.ts +105 -0
- package/dist/lib/range.js +406 -0
- package/dist/lib/ranges.d.ts +28 -0
- package/dist/lib/ranges.js +126 -0
- package/dist/lib/rect.d.ts +18 -0
- package/dist/lib/rect.js +34 -0
- package/dist/lib/text.d.ts +54 -0
- package/dist/lib/text.js +345 -0
- package/dist/lib/title.d.ts +40 -0
- package/dist/lib/title.js +197 -0
- package/dist/mixin/attributesParent.d.ts +49 -0
- package/dist/mixin/attributesParent.js +82 -0
- package/dist/mixin/fixed.d.ts +5 -0
- package/dist/mixin/fixed.js +32 -0
- package/dist/mixin/flagsParent.d.ts +41 -0
- package/dist/mixin/flagsParent.js +60 -0
- package/dist/mixin/hidden.d.ts +6 -0
- package/dist/mixin/hidden.js +29 -0
- package/dist/mixin/magicLinkParent.d.ts +19 -0
- package/dist/mixin/magicLinkParent.js +43 -0
- package/dist/mixin/singleLine.d.ts +5 -0
- package/dist/mixin/singleLine.js +27 -0
- package/dist/mixin/sol.d.ts +5 -0
- package/dist/mixin/sol.js +44 -0
- package/dist/mixin/syntax.d.ts +8 -0
- package/dist/mixin/syntax.js +47 -0
- package/dist/parser/braces.js +150 -0
- package/dist/parser/commentAndExt.js +79 -0
- package/dist/parser/converter.js +39 -0
- package/dist/parser/externalLinks.js +37 -0
- package/dist/parser/hrAndDoubleUnderscore.js +42 -0
- package/dist/parser/html.js +38 -0
- package/dist/parser/links.js +101 -0
- package/dist/parser/list.js +97 -0
- package/dist/parser/magicLinks.js +53 -0
- package/dist/parser/quotes.js +67 -0
- package/dist/parser/redirect.js +26 -0
- package/dist/parser/selector.js +190 -0
- package/dist/parser/table.js +123 -0
- package/dist/src/arg.d.ts +52 -0
- package/dist/src/arg.js +213 -0
- package/dist/src/atom.d.ts +12 -0
- package/dist/src/atom.js +26 -0
- package/dist/src/attribute.d.ts +65 -0
- package/dist/src/attribute.js +483 -0
- package/dist/src/attributes.d.ts +103 -0
- package/dist/src/attributes.js +350 -0
- package/dist/src/converter.d.ts +29 -0
- package/dist/src/converter.js +134 -0
- package/dist/src/converterFlags.d.ts +81 -0
- package/dist/src/converterFlags.js +239 -0
- package/dist/src/converterRule.d.ts +73 -0
- package/dist/src/converterRule.js +210 -0
- package/dist/src/extLink.d.ts +37 -0
- package/dist/src/extLink.js +191 -0
- package/dist/src/gallery.d.ts +48 -0
- package/dist/src/gallery.js +139 -0
- package/dist/src/heading.d.ts +41 -0
- package/dist/src/heading.js +185 -0
- package/dist/src/hidden.d.ts +10 -0
- package/dist/src/hidden.js +79 -0
- package/dist/src/html.d.ts +58 -0
- package/dist/src/html.js +334 -0
- package/dist/src/imageParameter.d.ts +59 -0
- package/dist/src/imageParameter.js +246 -0
- package/dist/src/imagemap.d.ts +48 -0
- package/dist/src/imagemap.js +145 -0
- package/dist/src/imagemapLink.d.ts +31 -0
- package/dist/src/imagemapLink.js +93 -0
- package/dist/src/index.d.ts +130 -0
- package/dist/src/index.js +721 -0
- package/dist/src/link/base.d.ts +46 -0
- package/dist/src/link/base.js +224 -0
- package/dist/src/link/category.d.ts +22 -0
- package/dist/src/link/category.js +30 -0
- package/dist/src/link/file.d.ts +96 -0
- package/dist/src/link/file.js +274 -0
- package/dist/src/link/galleryImage.d.ts +30 -0
- package/dist/src/link/galleryImage.js +158 -0
- package/dist/src/link/index.d.ts +52 -0
- package/dist/src/link/index.js +133 -0
- package/dist/src/link/redirectTarget.d.ts +37 -0
- package/dist/src/link/redirectTarget.js +95 -0
- package/dist/src/magicLink.d.ts +60 -0
- package/dist/src/magicLink.js +270 -0
- package/dist/src/nested.d.ts +41 -0
- package/dist/src/nested.js +105 -0
- package/dist/src/nowiki/base.d.ts +31 -0
- package/dist/src/nowiki/base.js +91 -0
- package/dist/src/nowiki/comment.d.ts +15 -0
- package/dist/src/nowiki/comment.js +123 -0
- package/dist/src/nowiki/dd.d.ts +8 -0
- package/dist/src/nowiki/dd.js +24 -0
- package/dist/src/nowiki/doubleUnderscore.d.ts +16 -0
- package/dist/src/nowiki/doubleUnderscore.js +96 -0
- package/dist/src/nowiki/hr.d.ts +5 -0
- package/dist/src/nowiki/hr.js +63 -0
- package/dist/src/nowiki/index.d.ts +14 -0
- package/dist/src/nowiki/index.js +29 -0
- package/dist/src/nowiki/list.d.ts +16 -0
- package/dist/src/nowiki/list.js +109 -0
- package/dist/src/nowiki/listBase.d.ts +5 -0
- package/dist/src/nowiki/listBase.js +61 -0
- package/dist/src/nowiki/noinclude.d.ts +10 -0
- package/dist/src/nowiki/noinclude.js +73 -0
- package/dist/src/nowiki/quote.d.ts +17 -0
- package/dist/src/nowiki/quote.js +131 -0
- package/dist/src/onlyinclude.d.ts +14 -0
- package/dist/src/onlyinclude.js +57 -0
- package/dist/src/paramTag/index.d.ts +31 -0
- package/dist/src/paramTag/index.js +77 -0
- package/dist/src/paramTag/inputbox.d.ts +8 -0
- package/dist/src/paramTag/inputbox.js +22 -0
- package/dist/src/parameter.d.ts +66 -0
- package/dist/src/parameter.js +265 -0
- package/dist/src/pre.d.ts +29 -0
- package/dist/src/pre.js +59 -0
- package/dist/src/redirect.d.ts +31 -0
- package/dist/src/redirect.js +121 -0
- package/dist/src/syntax.d.ts +17 -0
- package/dist/src/syntax.js +84 -0
- package/dist/src/table/base.d.ts +29 -0
- package/dist/src/table/base.js +82 -0
- package/dist/src/table/index.d.ts +239 -0
- package/dist/src/table/index.js +502 -0
- package/dist/src/table/td.d.ts +78 -0
- package/dist/src/table/td.js +368 -0
- package/dist/src/table/tr.d.ts +30 -0
- package/dist/src/table/tr.js +57 -0
- package/dist/src/table/trBase.d.ts +49 -0
- package/dist/src/table/trBase.js +156 -0
- package/dist/src/tagPair/ext.d.ts +30 -0
- package/dist/src/tagPair/ext.js +201 -0
- package/dist/src/tagPair/include.d.ts +35 -0
- package/dist/src/tagPair/include.js +124 -0
- package/dist/src/tagPair/index.d.ts +23 -0
- package/dist/src/tagPair/index.js +128 -0
- package/dist/src/transclude.d.ts +160 -0
- package/dist/src/transclude.js +579 -0
- package/dist/util/constants.js +25 -0
- package/dist/util/debug.js +97 -0
- package/dist/util/diff.js +83 -0
- package/dist/util/lint.js +32 -0
- package/dist/util/string.js +60 -0
- package/errors/README +1 -0
- package/package.json +20 -30
- package/printed/README +1 -0
- package/README.en.md +0 -57
- package/bundle/bundle.min.js +0 -38
- package/extensions/dist/base.js +0 -64
- package/extensions/dist/editor.js +0 -159
- package/extensions/dist/highlight.js +0 -58
- package/extensions/dist/lint.js +0 -72
- package/extensions/editor.css +0 -64
- package/extensions/ui.css +0 -144
package/README.md
CHANGED
|
@@ -4,54 +4,54 @@
|
|
|
4
4
|
|
|
5
5
|
# Other Languages
|
|
6
6
|
|
|
7
|
-
- [
|
|
7
|
+
- [简体中文](./README-%28ZH%29.md)
|
|
8
8
|
|
|
9
|
-
#
|
|
9
|
+
# Introduction
|
|
10
10
|
|
|
11
|
-
WikiParser-Node
|
|
11
|
+
WikiParser-Node is an offline [Wikitext](https://www.mediawiki.org/wiki/Wikitext) parser developed by Bhsd for the [Node.js](https://nodejs.org/) environment. It can parse almost all wiki syntax and generate an [Abstract Syntax Tree (AST)](https://en.wikipedia.org/wiki/Abstract_syntax_tree) ([Try it online](https://bhsd-harry.github.io/wikiparser-node/#editor)). It also allows for easy querying and modification of the AST, and returns the modified wikitext.
|
|
12
12
|
|
|
13
|
-
#
|
|
13
|
+
# Other Versions
|
|
14
14
|
|
|
15
|
-
## Mini (
|
|
15
|
+
## Mini (also known as [WikiLint](https://www.npmjs.com/package/wikilint))
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
This version provides a [CLI](https://en.wikipedia.org/wiki/Command-line_interface), but only retains the parsing functionality and linting functionality. The parsed AST cannot be modified. It is used in the [eslint-plugin-wikitext](https://www.npmjs.com/package/eslint-plugin-wikitext) plugin.
|
|
18
18
|
|
|
19
19
|
## Browser-compatible
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
A browser-compatible version, which can be used for code highlighting or as a linting plugin in conjunction with editors such as [CodeMirror](https://codemirror.net/) and [Monaco](https://microsoft.github.io/monaco-editor/). ([Usage example](https://bhsd-harry.github.io/wikiparser-node))
|
|
22
22
|
|
|
23
|
-
#
|
|
23
|
+
# Installation
|
|
24
24
|
|
|
25
25
|
## Node.js
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
Please install the corresponding version as needed (`WikiParser-Node` or `WikiLint`), for example:
|
|
28
28
|
|
|
29
29
|
```sh
|
|
30
30
|
npm i wikiparser-node
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
or
|
|
34
34
|
|
|
35
35
|
```sh
|
|
36
36
|
npm i wikilint
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
##
|
|
39
|
+
## Browser
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
You can download the code via CDN, for example:
|
|
42
42
|
|
|
43
43
|
```html
|
|
44
|
-
<script src="//cdn.jsdelivr.net/npm/wikiparser-node@browser"></script>
|
|
44
|
+
<script src="//cdn.jsdelivr.net/npm/wikiparser-node@browser/bundle/bundle.min.js"></script>
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
or
|
|
48
48
|
|
|
49
49
|
```html
|
|
50
|
-
<script src="//unpkg.com/wikiparser-node@browser"></script>
|
|
50
|
+
<script src="//unpkg.com/wikiparser-node@browser/bundle/bundle.min.js"></script>
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
For more browser extensions, please refer to the corresponding [documentation](https://github.com/bhsd-harry/wikiparser-node/wiki/Browser-%28EN%29).
|
|
54
54
|
|
|
55
|
-
#
|
|
55
|
+
# Usage
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
Please refer to the [Wiki](https://github.com/bhsd-harry/wikiparser-node/wiki/Home-%28EN%29).
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"properties": {
|
|
4
|
+
"ext": {
|
|
5
|
+
"description": "extension tags",
|
|
6
|
+
"type": "array",
|
|
7
|
+
"items": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"pattern": "^[a-z\\d_]+$"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"html": {
|
|
13
|
+
"description": "valid HTML tags",
|
|
14
|
+
"type": "array",
|
|
15
|
+
"items": {
|
|
16
|
+
"type": "array",
|
|
17
|
+
"items": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"pattern": "^[a-z\\d]+$"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"minItems": 3,
|
|
23
|
+
"maxItems": 3
|
|
24
|
+
},
|
|
25
|
+
"namespaces": {
|
|
26
|
+
"description": "formatted namespaces",
|
|
27
|
+
"type": "object",
|
|
28
|
+
"patternProperties": {
|
|
29
|
+
"^-?\\d+$": {
|
|
30
|
+
"type": "string"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"additionalProperties": false
|
|
34
|
+
},
|
|
35
|
+
"nsid": {
|
|
36
|
+
"description": "namespace IDs",
|
|
37
|
+
"type": "object",
|
|
38
|
+
"required": [
|
|
39
|
+
"file",
|
|
40
|
+
"category"
|
|
41
|
+
],
|
|
42
|
+
"additionalProperties": {
|
|
43
|
+
"type": "integer"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"parserFunction": {
|
|
47
|
+
"type": "array",
|
|
48
|
+
"items": [
|
|
49
|
+
{
|
|
50
|
+
"description": "case-insensitive parser functions",
|
|
51
|
+
"type": "object",
|
|
52
|
+
"additionalProperties": {
|
|
53
|
+
"type": "string"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"description": "case-sensitive parser functions",
|
|
58
|
+
"type": "array",
|
|
59
|
+
"allOf": [
|
|
60
|
+
{
|
|
61
|
+
"contains": {
|
|
62
|
+
"const": "!"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"contains": {
|
|
67
|
+
"const": "="
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
"items": {
|
|
72
|
+
"type": "string"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"description": "msg and raw",
|
|
77
|
+
"type": "array",
|
|
78
|
+
"items": {
|
|
79
|
+
"type": "string"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"description": "subst and safesubst",
|
|
84
|
+
"type": "array",
|
|
85
|
+
"items": {
|
|
86
|
+
"type": "string"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
"minItems": 4,
|
|
91
|
+
"maxItems": 4
|
|
92
|
+
},
|
|
93
|
+
"doubleUnderscore": {
|
|
94
|
+
"description": "behavior switches",
|
|
95
|
+
"type": "array",
|
|
96
|
+
"items": {
|
|
97
|
+
"type": "array",
|
|
98
|
+
"items": {
|
|
99
|
+
"type": "string"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"minItems": 2,
|
|
103
|
+
"maxItems": 2
|
|
104
|
+
},
|
|
105
|
+
"protocol": {
|
|
106
|
+
"description": "external link protocols",
|
|
107
|
+
"type": "string",
|
|
108
|
+
"pattern": "^[a-z:/]+(?:\\|[a-z:/]+)*$"
|
|
109
|
+
},
|
|
110
|
+
"interwiki": {
|
|
111
|
+
"type": "array",
|
|
112
|
+
"items": {
|
|
113
|
+
"type": "string"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"img": {
|
|
117
|
+
"description": "image-related magic words",
|
|
118
|
+
"type": "object",
|
|
119
|
+
"additionalProperties": {
|
|
120
|
+
"type": "string",
|
|
121
|
+
"pattern": "^[-a-z]+$"
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"redirection": {
|
|
125
|
+
"description": "magic words for redirection",
|
|
126
|
+
"type": "array",
|
|
127
|
+
"items": {
|
|
128
|
+
"type": "string",
|
|
129
|
+
"pattern": "^#.+$"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"variants": {
|
|
133
|
+
"description": "variants for language conversion",
|
|
134
|
+
"type": "array",
|
|
135
|
+
"items": {
|
|
136
|
+
"type": "string",
|
|
137
|
+
"pattern": "^[-a-z]+$"
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
"conversionTable": {
|
|
141
|
+
"description": "table of unidirectional conversions",
|
|
142
|
+
"type": "array",
|
|
143
|
+
"items": {
|
|
144
|
+
"type": "array",
|
|
145
|
+
"items": {
|
|
146
|
+
"type": "string",
|
|
147
|
+
"pattern": "^[^ <>[\\]{}|]+$"
|
|
148
|
+
},
|
|
149
|
+
"minItems": 2,
|
|
150
|
+
"maxItems": 2
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"redirects": {
|
|
154
|
+
"description": "table of redirects",
|
|
155
|
+
"type": "array",
|
|
156
|
+
"items": {
|
|
157
|
+
"type": "array",
|
|
158
|
+
"items": {
|
|
159
|
+
"type": "string",
|
|
160
|
+
"pattern": "^[^ <>[\\]{}|]+$"
|
|
161
|
+
},
|
|
162
|
+
"minItems": 2,
|
|
163
|
+
"maxItems": 2
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
"required": [
|
|
168
|
+
"ext",
|
|
169
|
+
"html",
|
|
170
|
+
"namespaces",
|
|
171
|
+
"nsid",
|
|
172
|
+
"parserFunction",
|
|
173
|
+
"doubleUnderscore",
|
|
174
|
+
"protocol",
|
|
175
|
+
"interwiki",
|
|
176
|
+
"img",
|
|
177
|
+
"redirection",
|
|
178
|
+
"variants"
|
|
179
|
+
],
|
|
180
|
+
"additionalProperties": false
|
|
181
|
+
}
|