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.
Files changed (173) hide show
  1. package/README.md +18 -18
  2. package/config/.schema.json +181 -0
  3. package/config/enwiki.json +814 -1
  4. package/config/llwiki.json +35 -1
  5. package/config/moegirl.json +44 -1
  6. package/config/zhwiki.json +466 -1
  7. package/dist/addon/table.js +486 -0
  8. package/dist/addon/token.js +240 -0
  9. package/dist/addon/transclude.js +185 -0
  10. package/dist/base.d.ts +73 -0
  11. package/dist/base.js +39 -0
  12. package/dist/index.d.ts +31 -0
  13. package/dist/index.js +232 -0
  14. package/dist/internal.d.ts +46 -0
  15. package/dist/lib/element.d.ts +124 -0
  16. package/dist/lib/element.js +600 -0
  17. package/dist/lib/node.d.ts +166 -0
  18. package/dist/lib/node.js +472 -0
  19. package/dist/lib/range.d.ts +105 -0
  20. package/dist/lib/range.js +406 -0
  21. package/dist/lib/ranges.d.ts +28 -0
  22. package/dist/lib/ranges.js +126 -0
  23. package/dist/lib/rect.d.ts +18 -0
  24. package/dist/lib/rect.js +34 -0
  25. package/dist/lib/text.d.ts +54 -0
  26. package/dist/lib/text.js +345 -0
  27. package/dist/lib/title.d.ts +40 -0
  28. package/dist/lib/title.js +197 -0
  29. package/dist/mixin/attributesParent.d.ts +49 -0
  30. package/dist/mixin/attributesParent.js +82 -0
  31. package/dist/mixin/fixed.d.ts +5 -0
  32. package/dist/mixin/fixed.js +32 -0
  33. package/dist/mixin/flagsParent.d.ts +41 -0
  34. package/dist/mixin/flagsParent.js +60 -0
  35. package/dist/mixin/hidden.d.ts +6 -0
  36. package/dist/mixin/hidden.js +29 -0
  37. package/dist/mixin/magicLinkParent.d.ts +19 -0
  38. package/dist/mixin/magicLinkParent.js +43 -0
  39. package/dist/mixin/singleLine.d.ts +5 -0
  40. package/dist/mixin/singleLine.js +27 -0
  41. package/dist/mixin/sol.d.ts +5 -0
  42. package/dist/mixin/sol.js +44 -0
  43. package/dist/mixin/syntax.d.ts +8 -0
  44. package/dist/mixin/syntax.js +47 -0
  45. package/dist/parser/braces.js +150 -0
  46. package/dist/parser/commentAndExt.js +79 -0
  47. package/dist/parser/converter.js +39 -0
  48. package/dist/parser/externalLinks.js +37 -0
  49. package/dist/parser/hrAndDoubleUnderscore.js +42 -0
  50. package/dist/parser/html.js +38 -0
  51. package/dist/parser/links.js +101 -0
  52. package/dist/parser/list.js +97 -0
  53. package/dist/parser/magicLinks.js +53 -0
  54. package/dist/parser/quotes.js +67 -0
  55. package/dist/parser/redirect.js +26 -0
  56. package/dist/parser/selector.js +190 -0
  57. package/dist/parser/table.js +123 -0
  58. package/dist/src/arg.d.ts +52 -0
  59. package/dist/src/arg.js +213 -0
  60. package/dist/src/atom.d.ts +12 -0
  61. package/dist/src/atom.js +26 -0
  62. package/dist/src/attribute.d.ts +65 -0
  63. package/dist/src/attribute.js +483 -0
  64. package/dist/src/attributes.d.ts +103 -0
  65. package/dist/src/attributes.js +350 -0
  66. package/dist/src/converter.d.ts +29 -0
  67. package/dist/src/converter.js +134 -0
  68. package/dist/src/converterFlags.d.ts +81 -0
  69. package/dist/src/converterFlags.js +239 -0
  70. package/dist/src/converterRule.d.ts +73 -0
  71. package/dist/src/converterRule.js +210 -0
  72. package/dist/src/extLink.d.ts +37 -0
  73. package/dist/src/extLink.js +191 -0
  74. package/dist/src/gallery.d.ts +48 -0
  75. package/dist/src/gallery.js +139 -0
  76. package/dist/src/heading.d.ts +41 -0
  77. package/dist/src/heading.js +185 -0
  78. package/dist/src/hidden.d.ts +10 -0
  79. package/dist/src/hidden.js +79 -0
  80. package/dist/src/html.d.ts +58 -0
  81. package/dist/src/html.js +334 -0
  82. package/dist/src/imageParameter.d.ts +59 -0
  83. package/dist/src/imageParameter.js +246 -0
  84. package/dist/src/imagemap.d.ts +48 -0
  85. package/dist/src/imagemap.js +145 -0
  86. package/dist/src/imagemapLink.d.ts +31 -0
  87. package/dist/src/imagemapLink.js +93 -0
  88. package/dist/src/index.d.ts +130 -0
  89. package/dist/src/index.js +721 -0
  90. package/dist/src/link/base.d.ts +46 -0
  91. package/dist/src/link/base.js +224 -0
  92. package/dist/src/link/category.d.ts +22 -0
  93. package/dist/src/link/category.js +30 -0
  94. package/dist/src/link/file.d.ts +96 -0
  95. package/dist/src/link/file.js +274 -0
  96. package/dist/src/link/galleryImage.d.ts +30 -0
  97. package/dist/src/link/galleryImage.js +158 -0
  98. package/dist/src/link/index.d.ts +52 -0
  99. package/dist/src/link/index.js +133 -0
  100. package/dist/src/link/redirectTarget.d.ts +37 -0
  101. package/dist/src/link/redirectTarget.js +95 -0
  102. package/dist/src/magicLink.d.ts +60 -0
  103. package/dist/src/magicLink.js +270 -0
  104. package/dist/src/nested.d.ts +41 -0
  105. package/dist/src/nested.js +105 -0
  106. package/dist/src/nowiki/base.d.ts +31 -0
  107. package/dist/src/nowiki/base.js +91 -0
  108. package/dist/src/nowiki/comment.d.ts +15 -0
  109. package/dist/src/nowiki/comment.js +123 -0
  110. package/dist/src/nowiki/dd.d.ts +8 -0
  111. package/dist/src/nowiki/dd.js +24 -0
  112. package/dist/src/nowiki/doubleUnderscore.d.ts +16 -0
  113. package/dist/src/nowiki/doubleUnderscore.js +96 -0
  114. package/dist/src/nowiki/hr.d.ts +5 -0
  115. package/dist/src/nowiki/hr.js +63 -0
  116. package/dist/src/nowiki/index.d.ts +14 -0
  117. package/dist/src/nowiki/index.js +29 -0
  118. package/dist/src/nowiki/list.d.ts +16 -0
  119. package/dist/src/nowiki/list.js +109 -0
  120. package/dist/src/nowiki/listBase.d.ts +5 -0
  121. package/dist/src/nowiki/listBase.js +61 -0
  122. package/dist/src/nowiki/noinclude.d.ts +10 -0
  123. package/dist/src/nowiki/noinclude.js +73 -0
  124. package/dist/src/nowiki/quote.d.ts +17 -0
  125. package/dist/src/nowiki/quote.js +131 -0
  126. package/dist/src/onlyinclude.d.ts +14 -0
  127. package/dist/src/onlyinclude.js +57 -0
  128. package/dist/src/paramTag/index.d.ts +31 -0
  129. package/dist/src/paramTag/index.js +77 -0
  130. package/dist/src/paramTag/inputbox.d.ts +8 -0
  131. package/dist/src/paramTag/inputbox.js +22 -0
  132. package/dist/src/parameter.d.ts +66 -0
  133. package/dist/src/parameter.js +265 -0
  134. package/dist/src/pre.d.ts +29 -0
  135. package/dist/src/pre.js +59 -0
  136. package/dist/src/redirect.d.ts +31 -0
  137. package/dist/src/redirect.js +121 -0
  138. package/dist/src/syntax.d.ts +17 -0
  139. package/dist/src/syntax.js +84 -0
  140. package/dist/src/table/base.d.ts +29 -0
  141. package/dist/src/table/base.js +82 -0
  142. package/dist/src/table/index.d.ts +239 -0
  143. package/dist/src/table/index.js +502 -0
  144. package/dist/src/table/td.d.ts +78 -0
  145. package/dist/src/table/td.js +368 -0
  146. package/dist/src/table/tr.d.ts +30 -0
  147. package/dist/src/table/tr.js +57 -0
  148. package/dist/src/table/trBase.d.ts +49 -0
  149. package/dist/src/table/trBase.js +156 -0
  150. package/dist/src/tagPair/ext.d.ts +30 -0
  151. package/dist/src/tagPair/ext.js +201 -0
  152. package/dist/src/tagPair/include.d.ts +35 -0
  153. package/dist/src/tagPair/include.js +124 -0
  154. package/dist/src/tagPair/index.d.ts +23 -0
  155. package/dist/src/tagPair/index.js +128 -0
  156. package/dist/src/transclude.d.ts +160 -0
  157. package/dist/src/transclude.js +579 -0
  158. package/dist/util/constants.js +25 -0
  159. package/dist/util/debug.js +97 -0
  160. package/dist/util/diff.js +83 -0
  161. package/dist/util/lint.js +32 -0
  162. package/dist/util/string.js +60 -0
  163. package/errors/README +1 -0
  164. package/package.json +20 -30
  165. package/printed/README +1 -0
  166. package/README.en.md +0 -57
  167. package/bundle/bundle.min.js +0 -38
  168. package/extensions/dist/base.js +0 -64
  169. package/extensions/dist/editor.js +0 -159
  170. package/extensions/dist/highlight.js +0 -58
  171. package/extensions/dist/lint.js +0 -72
  172. package/extensions/editor.css +0 -64
  173. package/extensions/ui.css +0 -144
package/README.md CHANGED
@@ -4,54 +4,54 @@
4
4
 
5
5
  # Other Languages
6
6
 
7
- - [English](./README.en.md)
7
+ - [简体中文](./README-%28ZH%29.md)
8
8
 
9
- # 简介
9
+ # Introduction
10
10
 
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)),还可以很方便地对语法树进行查询和修改,最后返回修改后的维基文本。
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 (又名 [WikiLint](https://www.npmjs.com/package/wikilint))
15
+ ## Mini (also known as [WikiLint](https://www.npmjs.com/package/wikilint))
16
16
 
17
- 提供了 [CLI](https://en.wikipedia.org/wiki/Command-line_interface),但仅保留了解析功能和语法错误分析功能,解析生成的语法树不能修改。这个版本被应用于 [eslint-plugin-wikitext](https://www.npmjs.com/package/eslint-plugin-wikitext) 插件。
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
- 兼容浏览器的版本,可用于代码高亮或是搭配 [CodeMirror](https://codemirror.net/) [Monaco](https://microsoft.github.io/monaco-editor/) 等编辑器作为语法分析插件。([使用实例展示](https://bhsd-harry.github.io/wikiparser-node)
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
- 请根据需要需要安装对应的版本(`WikiParser-Node` `WikiLint`),如:
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
- 可以通过 CDN 下载代码,如:
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
- 更多浏览器端可用的插件请查阅对应[文档](https://github.com/bhsd-harry/wikiparser-node/wiki/Browser)
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
- 请查阅 [Wiki](https://github.com/bhsd-harry/wikiparser-node/wiki)
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
+ }