wikiparser-node 1.4.4-b → 1.4.5
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.en.md +3 -3
- package/README.md +5 -5
- package/config/.schema.json +172 -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.d.ts +6 -0
- package/dist/addon/table.js +564 -0
- package/dist/base.d.ts +60 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +211 -0
- package/dist/internal.d.ts +44 -0
- package/dist/lib/element.d.ts +155 -0
- package/dist/lib/element.js +655 -0
- package/dist/lib/node.d.ts +146 -0
- package/dist/lib/node.js +428 -0
- package/dist/lib/range.d.ts +104 -0
- package/dist/lib/range.js +385 -0
- package/dist/lib/ranges.d.ts +26 -0
- package/dist/lib/ranges.js +118 -0
- package/dist/lib/text.d.ts +62 -0
- package/dist/lib/text.js +314 -0
- package/dist/lib/title.d.ts +38 -0
- package/dist/lib/title.js +164 -0
- package/dist/mixin/attributesParent.d.ts +50 -0
- package/dist/mixin/attributesParent.js +78 -0
- package/dist/mixin/fixed.d.ts +6 -0
- package/dist/mixin/fixed.js +30 -0
- package/dist/mixin/flagsParent.d.ts +72 -0
- package/dist/mixin/flagsParent.js +59 -0
- package/dist/mixin/hidden.d.ts +5 -0
- package/dist/mixin/hidden.js +24 -0
- package/dist/mixin/magicLinkParent.d.ts +40 -0
- package/dist/mixin/magicLinkParent.js +42 -0
- package/dist/mixin/singleLine.d.ts +6 -0
- package/dist/mixin/singleLine.js +26 -0
- package/dist/mixin/sol.d.ts +6 -0
- package/dist/mixin/sol.js +43 -0
- package/dist/mixin/syntax.d.ts +9 -0
- package/dist/mixin/syntax.js +50 -0
- package/dist/parser/braces.js +131 -0
- package/dist/parser/commentAndExt.js +90 -0
- package/dist/parser/converter.js +41 -0
- package/dist/parser/externalLinks.js +32 -0
- package/dist/parser/hrAndDoubleUnderscore.js +41 -0
- package/dist/parser/html.js +39 -0
- package/dist/parser/links.js +95 -0
- package/dist/parser/list.js +68 -0
- package/dist/parser/magicLinks.js +43 -0
- package/dist/parser/quotes.js +68 -0
- package/dist/parser/selector.js +162 -0
- package/dist/parser/table.js +124 -0
- package/dist/src/arg.d.ts +58 -0
- package/dist/src/arg.js +196 -0
- package/dist/src/atom.d.ts +12 -0
- package/dist/src/atom.js +27 -0
- package/dist/src/attribute.d.ts +69 -0
- package/dist/src/attribute.js +475 -0
- package/dist/src/attributes.d.ts +109 -0
- package/dist/src/attributes.js +346 -0
- package/dist/src/converter.d.ts +33 -0
- package/dist/src/converter.js +134 -0
- package/dist/src/converterFlags.d.ts +87 -0
- package/dist/src/converterFlags.js +226 -0
- package/dist/src/converterRule.d.ts +77 -0
- package/dist/src/converterRule.js +209 -0
- package/dist/src/extLink.d.ts +43 -0
- package/dist/src/extLink.js +186 -0
- package/dist/src/gallery.d.ts +54 -0
- package/dist/src/gallery.js +127 -0
- package/dist/src/heading.d.ts +47 -0
- package/dist/src/heading.js +190 -0
- package/dist/src/hidden.d.ts +7 -0
- package/dist/src/hidden.js +23 -0
- package/dist/src/html.d.ts +65 -0
- package/dist/src/html.js +340 -0
- package/dist/src/imageParameter.d.ts +65 -0
- package/dist/src/imageParameter.js +246 -0
- package/dist/src/imagemap.d.ts +56 -0
- package/dist/src/imagemap.js +150 -0
- package/dist/src/imagemapLink.d.ts +31 -0
- package/dist/src/imagemapLink.js +93 -0
- package/dist/src/index.d.ts +143 -0
- package/dist/src/index.js +803 -0
- package/dist/src/link/base.d.ts +52 -0
- package/dist/src/link/base.js +209 -0
- package/dist/src/link/category.d.ts +13 -0
- package/dist/src/link/category.js +28 -0
- package/dist/src/link/file.d.ts +96 -0
- package/dist/src/link/file.js +265 -0
- package/dist/src/link/galleryImage.d.ts +32 -0
- package/dist/src/link/galleryImage.js +157 -0
- package/dist/src/link/index.d.ts +56 -0
- package/dist/src/link/index.js +133 -0
- package/dist/src/magicLink.d.ts +59 -0
- package/dist/src/magicLink.js +199 -0
- package/dist/src/nested.d.ts +43 -0
- package/dist/src/nested.js +92 -0
- package/dist/src/nowiki/base.d.ts +31 -0
- package/dist/src/nowiki/base.js +93 -0
- package/dist/src/nowiki/comment.d.ts +25 -0
- package/dist/src/nowiki/comment.js +70 -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 +18 -0
- package/dist/src/nowiki/doubleUnderscore.js +101 -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 +16 -0
- package/dist/src/nowiki/index.js +21 -0
- package/dist/src/nowiki/list.d.ts +16 -0
- package/dist/src/nowiki/list.js +97 -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 +23 -0
- package/dist/src/nowiki/quote.d.ts +14 -0
- package/dist/src/nowiki/quote.js +117 -0
- package/dist/src/onlyinclude.d.ts +16 -0
- package/dist/src/onlyinclude.js +57 -0
- package/dist/src/paramTag/index.d.ts +37 -0
- package/dist/src/paramTag/index.js +69 -0
- package/dist/src/paramTag/inputbox.d.ts +8 -0
- package/dist/src/paramTag/inputbox.js +22 -0
- package/dist/src/parameter.d.ts +70 -0
- package/dist/src/parameter.js +262 -0
- package/dist/src/pre.d.ts +28 -0
- package/dist/src/pre.js +55 -0
- package/dist/src/syntax.d.ts +20 -0
- package/dist/src/syntax.js +86 -0
- package/dist/src/table/base.d.ts +30 -0
- package/dist/src/table/base.js +132 -0
- package/dist/src/table/index.d.ts +233 -0
- package/dist/src/table/index.js +396 -0
- package/dist/src/table/td.d.ts +92 -0
- package/dist/src/table/td.js +337 -0
- package/dist/src/table/tr.d.ts +32 -0
- package/dist/src/table/tr.js +58 -0
- package/dist/src/table/trBase.d.ts +53 -0
- package/dist/src/table/trBase.js +154 -0
- package/dist/src/tagPair/ext.d.ts +32 -0
- package/dist/src/tagPair/ext.js +203 -0
- package/dist/src/tagPair/include.d.ts +35 -0
- package/dist/src/tagPair/include.js +65 -0
- package/dist/src/tagPair/index.d.ts +27 -0
- package/dist/src/tagPair/index.js +128 -0
- package/dist/src/transclude.d.ts +167 -0
- package/dist/src/transclude.js +710 -0
- package/dist/util/constants.js +113 -0
- package/dist/util/debug.js +88 -0
- package/dist/util/diff.js +82 -0
- package/dist/util/lint.js +31 -0
- package/dist/util/string.js +53 -0
- package/errors/README +1 -0
- package/package.json +14 -27
- package/printed/README +1 -0
- package/bundle/bundle.min.js +0 -36
- package/extensions/dist/base.js +0 -64
- package/extensions/dist/editor.js +0 -159
- package/extensions/dist/highlight.js +0 -59
- package/extensions/dist/lint.js +0 -48
- package/extensions/editor.css +0 -63
- package/extensions/ui.css +0 -141
package/README.en.md
CHANGED
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
# Introduction
|
|
10
10
|
|
|
11
|
-
|
|
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 (also known as [
|
|
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
|
|
|
@@ -24,7 +24,7 @@ A browser-compatible version, which can be used for code highlighting or as a li
|
|
|
24
24
|
|
|
25
25
|
## Node.js
|
|
26
26
|
|
|
27
|
-
Please install the corresponding version as needed (`
|
|
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
|
package/README.md
CHANGED
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
# 简介
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
WikiParser-Node 是一款由 Bhsd 开发的基于 [Node.js](https://nodejs.org/) 环境的离线[维基文本](https://www.mediawiki.org/wiki/Wikitext)语法解析器,可以解析几乎全部的维基语法并生成[语法树](https://en.wikipedia.org/wiki/Abstract_syntax_tree)([在线解析](https://bhsd-harry.github.io/wikiparser-node/#editor)),还可以很方便地对语法树进行查询和修改,最后返回修改后的维基文本。
|
|
12
12
|
|
|
13
13
|
# 其他版本
|
|
14
14
|
|
|
15
|
-
## Mini (又名 [
|
|
15
|
+
## Mini (又名 [WikiLint](https://www.npmjs.com/package/wikilint))
|
|
16
16
|
|
|
17
17
|
提供了 [CLI](https://en.wikipedia.org/wiki/Command-line_interface),但仅保留了解析功能和语法错误分析功能,解析生成的语法树不能修改。这个版本被应用于 [eslint-plugin-wikitext](https://www.npmjs.com/package/eslint-plugin-wikitext) 插件。
|
|
18
18
|
|
|
@@ -24,7 +24,7 @@ wikiparser-node 是一款由 Bhsd 开发的基于 [Node.js](https://nodejs.org/)
|
|
|
24
24
|
|
|
25
25
|
## Node.js
|
|
26
26
|
|
|
27
|
-
请根据需要需要安装对应的版本(`
|
|
27
|
+
请根据需要需要安装对应的版本(`WikiParser-Node` 或 `WikiLint`),如:
|
|
28
28
|
|
|
29
29
|
```sh
|
|
30
30
|
npm i wikiparser-node
|
|
@@ -41,13 +41,13 @@ npm i wikilint
|
|
|
41
41
|
可以通过 CDN 下载代码,如:
|
|
42
42
|
|
|
43
43
|
```html
|
|
44
|
-
<script src="//cdn.jsdelivr.net/npm/wikiparser-node@browser
|
|
44
|
+
<script src="//cdn.jsdelivr.net/npm/wikiparser-node@browser"></script>
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
或
|
|
48
48
|
|
|
49
49
|
```html
|
|
50
|
-
<script src="//unpkg.com/wikiparser-node@browser
|
|
50
|
+
<script src="//unpkg.com/wikiparser-node@browser"></script>
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
更多浏览器端可用的插件请查阅对应[文档](https://github.com/bhsd-harry/wikiparser-node/wiki/Browser)。
|
|
@@ -0,0 +1,172 @@
|
|
|
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
|
+
"variants": {
|
|
125
|
+
"description": "variants for language conversion",
|
|
126
|
+
"type": "array",
|
|
127
|
+
"items": {
|
|
128
|
+
"type": "string",
|
|
129
|
+
"pattern": "^[-a-z]+$"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"conversionTable": {
|
|
133
|
+
"description": "table of unidirectional conversions",
|
|
134
|
+
"type": "array",
|
|
135
|
+
"items": {
|
|
136
|
+
"type": "array",
|
|
137
|
+
"items": {
|
|
138
|
+
"type": "string",
|
|
139
|
+
"pattern": "^[^ <>[\\]{}|]+$"
|
|
140
|
+
},
|
|
141
|
+
"minItems": 2,
|
|
142
|
+
"maxItems": 2
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"redirects": {
|
|
146
|
+
"description": "table of redirects",
|
|
147
|
+
"type": "array",
|
|
148
|
+
"items": {
|
|
149
|
+
"type": "array",
|
|
150
|
+
"items": {
|
|
151
|
+
"type": "string",
|
|
152
|
+
"pattern": "^[^ <>[\\]{}|]+$"
|
|
153
|
+
},
|
|
154
|
+
"minItems": 2,
|
|
155
|
+
"maxItems": 2
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
"required": [
|
|
160
|
+
"ext",
|
|
161
|
+
"html",
|
|
162
|
+
"namespaces",
|
|
163
|
+
"nsid",
|
|
164
|
+
"parserFunction",
|
|
165
|
+
"doubleUnderscore",
|
|
166
|
+
"protocol",
|
|
167
|
+
"interwiki",
|
|
168
|
+
"img",
|
|
169
|
+
"variants"
|
|
170
|
+
],
|
|
171
|
+
"additionalProperties": false
|
|
172
|
+
}
|