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.
Files changed (76) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +17 -0
  3. package/config/.schema.json +127 -0
  4. package/config/default.json +831 -0
  5. package/config/llwiki.json +595 -0
  6. package/config/moegirl.json +685 -0
  7. package/config/zhwiki.json +803 -0
  8. package/index.js +76 -0
  9. package/lib/element.js +115 -0
  10. package/lib/node.js +226 -0
  11. package/lib/text.js +166 -0
  12. package/lib/title.js +56 -0
  13. package/mixin/hidden.js +18 -0
  14. package/package.json +51 -0
  15. package/parser/brackets.js +125 -0
  16. package/parser/commentAndExt.js +61 -0
  17. package/parser/converter.js +45 -0
  18. package/parser/externalLinks.js +32 -0
  19. package/parser/hrAndDoubleUnderscore.js +48 -0
  20. package/parser/html.js +41 -0
  21. package/parser/links.js +98 -0
  22. package/parser/list.js +58 -0
  23. package/parser/magicLinks.js +40 -0
  24. package/parser/quotes.js +63 -0
  25. package/parser/table.js +113 -0
  26. package/src/arg.js +93 -0
  27. package/src/atom/hidden.js +11 -0
  28. package/src/atom/index.js +26 -0
  29. package/src/attribute.js +284 -0
  30. package/src/attributes.js +147 -0
  31. package/src/converter.js +70 -0
  32. package/src/converterFlags.js +97 -0
  33. package/src/converterRule.js +74 -0
  34. package/src/extLink.js +60 -0
  35. package/src/gallery.js +94 -0
  36. package/src/hasNowiki/index.js +32 -0
  37. package/src/hasNowiki/pre.js +28 -0
  38. package/src/heading.js +83 -0
  39. package/src/html.js +130 -0
  40. package/src/imageParameter.js +141 -0
  41. package/src/imagemap.js +140 -0
  42. package/src/imagemapLink.js +29 -0
  43. package/src/index.js +406 -0
  44. package/src/link/category.js +13 -0
  45. package/src/link/file.js +132 -0
  46. package/src/link/galleryImage.js +62 -0
  47. package/src/link/index.js +119 -0
  48. package/src/magicLink.js +67 -0
  49. package/src/nested/choose.js +23 -0
  50. package/src/nested/combobox.js +22 -0
  51. package/src/nested/index.js +69 -0
  52. package/src/nested/references.js +22 -0
  53. package/src/nowiki/comment.js +47 -0
  54. package/src/nowiki/dd.js +13 -0
  55. package/src/nowiki/doubleUnderscore.js +26 -0
  56. package/src/nowiki/hr.js +22 -0
  57. package/src/nowiki/index.js +34 -0
  58. package/src/nowiki/list.js +13 -0
  59. package/src/nowiki/noinclude.js +14 -0
  60. package/src/nowiki/quote.js +51 -0
  61. package/src/onlyinclude.js +39 -0
  62. package/src/paramTag/index.js +66 -0
  63. package/src/paramTag/inputbox.js +32 -0
  64. package/src/parameter.js +96 -0
  65. package/src/syntax.js +23 -0
  66. package/src/table/index.js +45 -0
  67. package/src/table/td.js +118 -0
  68. package/src/table/tr.js +73 -0
  69. package/src/tagPair/ext.js +125 -0
  70. package/src/tagPair/include.js +26 -0
  71. package/src/tagPair/index.js +77 -0
  72. package/src/transclude.js +336 -0
  73. package/util/base.js +17 -0
  74. package/util/diff.js +76 -0
  75. package/util/lint.js +53 -0
  76. package/util/string.js +75 -0
package/README.md ADDED
@@ -0,0 +1,17 @@
1
+ [![npm version](https://badge.fury.io/js/wikiparser-node.svg)](https://www.npmjs.com/package/wikilint)
2
+ [![CodeQL](https://github.com/bhsd-harry/wikiparser-node/actions/workflows/github-code-scanning/codeql/badge.svg)](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
+ }