wikilint 0.10.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/LICENSE +674 -0
- package/README.md +17 -0
- package/config/.schema.json +127 -0
- package/config/default.json +831 -0
- package/config/llwiki.json +595 -0
- package/config/moegirl.json +685 -0
- package/config/zhwiki.json +803 -0
- package/index.js +76 -0
- package/lib/element.js +115 -0
- package/lib/node.js +226 -0
- package/lib/text.js +166 -0
- package/lib/title.js +56 -0
- package/mixin/hidden.js +18 -0
- package/package.json +51 -0
- package/parser/brackets.js +125 -0
- package/parser/commentAndExt.js +61 -0
- package/parser/converter.js +45 -0
- package/parser/externalLinks.js +32 -0
- package/parser/hrAndDoubleUnderscore.js +48 -0
- package/parser/html.js +41 -0
- package/parser/links.js +98 -0
- package/parser/list.js +58 -0
- package/parser/magicLinks.js +40 -0
- package/parser/quotes.js +63 -0
- package/parser/table.js +113 -0
- package/src/arg.js +93 -0
- package/src/atom/hidden.js +11 -0
- package/src/atom/index.js +26 -0
- package/src/attribute.js +284 -0
- package/src/attributes.js +147 -0
- package/src/converter.js +70 -0
- package/src/converterFlags.js +97 -0
- package/src/converterRule.js +74 -0
- package/src/extLink.js +60 -0
- package/src/gallery.js +94 -0
- package/src/hasNowiki/index.js +32 -0
- package/src/hasNowiki/pre.js +28 -0
- package/src/heading.js +83 -0
- package/src/html.js +130 -0
- package/src/imageParameter.js +141 -0
- package/src/imagemap.js +140 -0
- package/src/imagemapLink.js +29 -0
- package/src/index.js +406 -0
- package/src/link/category.js +13 -0
- package/src/link/file.js +132 -0
- package/src/link/galleryImage.js +62 -0
- package/src/link/index.js +119 -0
- package/src/magicLink.js +67 -0
- package/src/nested/choose.js +23 -0
- package/src/nested/combobox.js +22 -0
- package/src/nested/index.js +69 -0
- package/src/nested/references.js +22 -0
- package/src/nowiki/comment.js +47 -0
- package/src/nowiki/dd.js +13 -0
- package/src/nowiki/doubleUnderscore.js +26 -0
- package/src/nowiki/hr.js +22 -0
- package/src/nowiki/index.js +34 -0
- package/src/nowiki/list.js +13 -0
- package/src/nowiki/noinclude.js +14 -0
- package/src/nowiki/quote.js +51 -0
- package/src/onlyinclude.js +39 -0
- package/src/paramTag/index.js +66 -0
- package/src/paramTag/inputbox.js +32 -0
- package/src/parameter.js +96 -0
- package/src/syntax.js +23 -0
- package/src/table/index.js +45 -0
- package/src/table/td.js +118 -0
- package/src/table/tr.js +73 -0
- package/src/tagPair/ext.js +125 -0
- package/src/tagPair/include.js +26 -0
- package/src/tagPair/index.js +77 -0
- package/src/transclude.js +336 -0
- package/util/base.js +17 -0
- package/util/diff.js +76 -0
- package/util/lint.js +53 -0
- package/util/string.js +75 -0
package/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
[](https://www.npmjs.com/package/wikilint)
|
|
2
|
+
[](https://github.com/bhsd-harry/wikiparser-node/actions/workflows/github-code-scanning/codeql)
|
|
3
|
+
|
|
4
|
+
# wikilint
|
|
5
|
+
This is a minimal version of [wikiparser-node](https://www.npmjs.com/package/wikiparser-node) specifically designed for [eslint-plugin-wikitext](https://www.npmjs.com/package/eslint-plugin-wikitext).
|
|
6
|
+
|
|
7
|
+
However, you can also directly lint Wikitext articles using this package. Here is an example:
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
const Parser = require('wikilint');
|
|
11
|
+
// path to the configuration file, using Chinese Wikipedia as an example
|
|
12
|
+
Parser.config = './config/zhwiki';
|
|
13
|
+
|
|
14
|
+
const wikitext = 'some text',
|
|
15
|
+
include = false; // whether this text will be transcluded on another page
|
|
16
|
+
console.log(Parser.parse(wikitext, include).lint());
|
|
17
|
+
```
|
|
@@ -0,0 +1,127 @@
|
|
|
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
|
+
"required": [
|
|
34
|
+
"6",
|
|
35
|
+
"10"
|
|
36
|
+
],
|
|
37
|
+
"additionalProperties": false
|
|
38
|
+
},
|
|
39
|
+
"nsid": {
|
|
40
|
+
"description": "namespace IDs",
|
|
41
|
+
"type": "object",
|
|
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
|
+
"items": {
|
|
60
|
+
"type": "string"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"description": "msg and raw",
|
|
65
|
+
"type": "array",
|
|
66
|
+
"items": {
|
|
67
|
+
"type": "string"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"description": "subst and safesubst",
|
|
72
|
+
"type": "array",
|
|
73
|
+
"items": {
|
|
74
|
+
"type": "string"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
],
|
|
78
|
+
"minItems": 4,
|
|
79
|
+
"maxItems": 4
|
|
80
|
+
},
|
|
81
|
+
"doubleUnderscore": {
|
|
82
|
+
"description": "behavior switches",
|
|
83
|
+
"type": "array",
|
|
84
|
+
"items": {
|
|
85
|
+
"type": "array",
|
|
86
|
+
"items": {
|
|
87
|
+
"type": "string"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"minItems": 2,
|
|
91
|
+
"maxItems": 2
|
|
92
|
+
},
|
|
93
|
+
"protocol": {
|
|
94
|
+
"description": "external link protocols",
|
|
95
|
+
"type": "string",
|
|
96
|
+
"pattern": "^[a-z:/]+(?:\\|[a-z:/]+)*$"
|
|
97
|
+
},
|
|
98
|
+
"img": {
|
|
99
|
+
"description": "image-related magic words",
|
|
100
|
+
"type": "object",
|
|
101
|
+
"additionalProperties": {
|
|
102
|
+
"type": "string",
|
|
103
|
+
"pattern": "^[-a-z]+$"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"variants": {
|
|
107
|
+
"description": "variants for language conversion",
|
|
108
|
+
"type": "array",
|
|
109
|
+
"items": {
|
|
110
|
+
"type": "string",
|
|
111
|
+
"pattern": "^[-a-z]+$"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"required": [
|
|
116
|
+
"ext",
|
|
117
|
+
"html",
|
|
118
|
+
"namespaces",
|
|
119
|
+
"nsid",
|
|
120
|
+
"parserFunction",
|
|
121
|
+
"doubleUnderscore",
|
|
122
|
+
"protocol",
|
|
123
|
+
"img",
|
|
124
|
+
"variants"
|
|
125
|
+
],
|
|
126
|
+
"additionalProperties": false
|
|
127
|
+
}
|