wikiparser-node 1.3.3 → 1.3.4-b

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 (156) hide show
  1. package/README.en.md +1 -1
  2. package/README.md +1 -1
  3. package/bundle/bundle.min.js +36 -0
  4. package/config/llwiki.json +1 -35
  5. package/config/moegirl.json +1 -44
  6. package/config/zhwiki.json +1 -466
  7. package/extensions/dist/base.js +68 -0
  8. package/extensions/dist/editor.js +159 -0
  9. package/extensions/dist/highlight.js +30 -0
  10. package/extensions/dist/lint.js +48 -0
  11. package/extensions/editor.css +63 -0
  12. package/extensions/ui.css +114 -0
  13. package/package.json +32 -12
  14. package/config/.schema.json +0 -172
  15. package/dist/addon/table.d.ts +0 -6
  16. package/dist/addon/table.js +0 -564
  17. package/dist/base.d.ts +0 -45
  18. package/dist/bin/toc.js +0 -18
  19. package/dist/index.d.ts +0 -31
  20. package/dist/index.js +0 -209
  21. package/dist/internal.d.ts +0 -44
  22. package/dist/lib/element.d.ts +0 -155
  23. package/dist/lib/element.js +0 -634
  24. package/dist/lib/node.d.ts +0 -146
  25. package/dist/lib/node.js +0 -419
  26. package/dist/lib/range.d.ts +0 -104
  27. package/dist/lib/range.js +0 -385
  28. package/dist/lib/ranges.d.ts +0 -26
  29. package/dist/lib/ranges.js +0 -117
  30. package/dist/lib/text.d.ts +0 -62
  31. package/dist/lib/text.js +0 -248
  32. package/dist/lib/title.d.ts +0 -38
  33. package/dist/lib/title.js +0 -162
  34. package/dist/mixin/attributesParent.js +0 -94
  35. package/dist/mixin/fixed.js +0 -32
  36. package/dist/mixin/flagsParent.js +0 -70
  37. package/dist/mixin/hidden.js +0 -26
  38. package/dist/mixin/magicLinkParent.js +0 -41
  39. package/dist/mixin/singleLine.js +0 -25
  40. package/dist/mixin/sol.js +0 -43
  41. package/dist/mixin/syntax.js +0 -56
  42. package/dist/parser/braces.js +0 -121
  43. package/dist/parser/commentAndExt.js +0 -69
  44. package/dist/parser/converter.js +0 -40
  45. package/dist/parser/externalLinks.js +0 -28
  46. package/dist/parser/hrAndDoubleUnderscore.js +0 -38
  47. package/dist/parser/html.js +0 -36
  48. package/dist/parser/links.js +0 -94
  49. package/dist/parser/list.js +0 -59
  50. package/dist/parser/magicLinks.js +0 -40
  51. package/dist/parser/quotes.js +0 -67
  52. package/dist/parser/selector.js +0 -162
  53. package/dist/parser/table.js +0 -112
  54. package/dist/src/arg.d.ts +0 -58
  55. package/dist/src/arg.js +0 -189
  56. package/dist/src/atom.d.ts +0 -12
  57. package/dist/src/atom.js +0 -27
  58. package/dist/src/attribute.d.ts +0 -87
  59. package/dist/src/attribute.js +0 -392
  60. package/dist/src/attributes.d.ts +0 -107
  61. package/dist/src/attributes.js +0 -341
  62. package/dist/src/converter.d.ts +0 -52
  63. package/dist/src/converter.js +0 -79
  64. package/dist/src/converterFlags.d.ts +0 -87
  65. package/dist/src/converterFlags.js +0 -224
  66. package/dist/src/converterRule.d.ts +0 -81
  67. package/dist/src/converterRule.js +0 -212
  68. package/dist/src/extLink.d.ts +0 -54
  69. package/dist/src/extLink.js +0 -122
  70. package/dist/src/gallery.d.ts +0 -55
  71. package/dist/src/gallery.js +0 -122
  72. package/dist/src/heading.d.ts +0 -74
  73. package/dist/src/heading.js +0 -127
  74. package/dist/src/hidden.d.ts +0 -22
  75. package/dist/src/hidden.js +0 -23
  76. package/dist/src/html.d.ts +0 -101
  77. package/dist/src/html.js +0 -227
  78. package/dist/src/imageParameter.d.ts +0 -66
  79. package/dist/src/imageParameter.js +0 -247
  80. package/dist/src/imagemap.d.ts +0 -57
  81. package/dist/src/imagemap.js +0 -148
  82. package/dist/src/imagemapLink.d.ts +0 -59
  83. package/dist/src/imagemapLink.js +0 -40
  84. package/dist/src/index.d.ts +0 -146
  85. package/dist/src/index.js +0 -777
  86. package/dist/src/link/base.d.ts +0 -52
  87. package/dist/src/link/base.js +0 -209
  88. package/dist/src/link/category.d.ts +0 -13
  89. package/dist/src/link/category.js +0 -29
  90. package/dist/src/link/file.d.ts +0 -96
  91. package/dist/src/link/file.js +0 -255
  92. package/dist/src/link/galleryImage.d.ts +0 -44
  93. package/dist/src/link/galleryImage.js +0 -106
  94. package/dist/src/link/index.d.ts +0 -53
  95. package/dist/src/link/index.js +0 -123
  96. package/dist/src/magicLink.d.ts +0 -70
  97. package/dist/src/magicLink.js +0 -147
  98. package/dist/src/nested.d.ts +0 -44
  99. package/dist/src/nested.js +0 -87
  100. package/dist/src/nowiki/base.d.ts +0 -47
  101. package/dist/src/nowiki/base.js +0 -42
  102. package/dist/src/nowiki/comment.d.ts +0 -40
  103. package/dist/src/nowiki/comment.js +0 -67
  104. package/dist/src/nowiki/dd.d.ts +0 -8
  105. package/dist/src/nowiki/dd.js +0 -25
  106. package/dist/src/nowiki/doubleUnderscore.d.ts +0 -45
  107. package/dist/src/nowiki/doubleUnderscore.js +0 -50
  108. package/dist/src/nowiki/hr.d.ts +0 -31
  109. package/dist/src/nowiki/hr.js +0 -14
  110. package/dist/src/nowiki/index.d.ts +0 -16
  111. package/dist/src/nowiki/index.js +0 -21
  112. package/dist/src/nowiki/list.d.ts +0 -30
  113. package/dist/src/nowiki/list.js +0 -48
  114. package/dist/src/nowiki/listBase.d.ts +0 -19
  115. package/dist/src/nowiki/listBase.js +0 -12
  116. package/dist/src/nowiki/noinclude.d.ts +0 -26
  117. package/dist/src/nowiki/noinclude.js +0 -25
  118. package/dist/src/nowiki/quote.d.ts +0 -23
  119. package/dist/src/nowiki/quote.js +0 -45
  120. package/dist/src/onlyinclude.d.ts +0 -16
  121. package/dist/src/onlyinclude.js +0 -57
  122. package/dist/src/paramTag/index.d.ts +0 -37
  123. package/dist/src/paramTag/index.js +0 -68
  124. package/dist/src/paramTag/inputbox.d.ts +0 -8
  125. package/dist/src/paramTag/inputbox.js +0 -23
  126. package/dist/src/parameter.d.ts +0 -85
  127. package/dist/src/parameter.js +0 -205
  128. package/dist/src/pre.d.ts +0 -28
  129. package/dist/src/pre.js +0 -51
  130. package/dist/src/syntax.d.ts +0 -28
  131. package/dist/src/syntax.js +0 -34
  132. package/dist/src/table/base.d.ts +0 -53
  133. package/dist/src/table/base.js +0 -78
  134. package/dist/src/table/index.d.ts +0 -229
  135. package/dist/src/table/index.js +0 -379
  136. package/dist/src/table/td.d.ts +0 -104
  137. package/dist/src/table/td.js +0 -261
  138. package/dist/src/table/tr.d.ts +0 -32
  139. package/dist/src/table/tr.js +0 -56
  140. package/dist/src/table/trBase.d.ts +0 -54
  141. package/dist/src/table/trBase.js +0 -159
  142. package/dist/src/tagPair/ext.d.ts +0 -56
  143. package/dist/src/tagPair/ext.js +0 -142
  144. package/dist/src/tagPair/include.d.ts +0 -53
  145. package/dist/src/tagPair/include.js +0 -63
  146. package/dist/src/tagPair/index.d.ts +0 -48
  147. package/dist/src/tagPair/index.js +0 -93
  148. package/dist/src/transclude.d.ts +0 -167
  149. package/dist/src/transclude.js +0 -690
  150. package/dist/util/constants.js +0 -108
  151. package/dist/util/debug.js +0 -64
  152. package/dist/util/diff.js +0 -72
  153. package/dist/util/lint.js +0 -46
  154. package/dist/util/string.js +0 -61
  155. package/errors/README +0 -1
  156. package/printed/README +0 -1
@@ -1,53 +0,0 @@
1
- import * as Parser from '../../index';
2
- import { Token } from '../index';
3
- import { SyntaxToken } from '../syntax';
4
- import { AttributesToken } from '../attributes';
5
- declare const TableBaseToken_base: (abstract new (...args: any[]) => {
6
- readonly childNodes: Parser.AstNodes[];
7
- readonly "__#7@#attributesChild": Parser.AttributesToken;
8
- attributes: Record<string, string | true>;
9
- className: string;
10
- classList: Set<string>;
11
- id: string;
12
- hasAttr(key: string): boolean;
13
- getAttr(key: string): string | true | undefined;
14
- getAttrNames(): Set<string>;
15
- getAttrs(): Record<string, string | true>;
16
- setAttr(key: string, value: string | boolean): void;
17
- removeAttr(key: string): void;
18
- toggleAttr(key: string, force?: boolean | undefined): void;
19
- readonly length: number;
20
- toString(omit?: Set<string> | undefined, separator?: string | undefined): string;
21
- text(separator?: string | undefined): string;
22
- lint(start?: number | undefined): Parser.LintError[];
23
- insertAt(token: unknown, i?: number | undefined): unknown;
24
- afterBuild(): void;
25
- getAttribute<T extends string>(key: T): TokenAttributeGetter<T>;
26
- setAttribute<T_1 extends string>(key: T_1, value: TokenAttributeSetter<T_1>): void;
27
- addEventListener(events: string | string[], listener: AstListener): void;
28
- replaceChildren(...elements: (string | Parser.AstNodes)[]): void;
29
- }) & typeof Parser.Token;
30
- /**
31
- * 表格行,含开头的换行,不含结尾的换行
32
- * @classdesc `{childNodes: [SyntaxToken, AttributesToken, ...Token]}`
33
- */
34
- export declare abstract class TableBaseToken extends TableBaseToken_base {
35
- type: 'table' | 'tr' | 'td';
36
- readonly childNodes: [SyntaxToken, AttributesToken, ...Token[]];
37
- abstract get children(): [SyntaxToken, AttributesToken, ...Token[]];
38
- abstract get firstChild(): SyntaxToken;
39
- abstract get firstElementChild(): SyntaxToken;
40
- abstract get lastChild(): Token;
41
- abstract get lastElementChild(): Token;
42
- /**
43
- * @param pattern 表格语法正则
44
- * @param syntax 表格语法
45
- * @param attr 表格属性
46
- */
47
- constructor(pattern: RegExp, syntax?: string, attr?: string, config?: Parser.Config, accum?: Token[], acceptable?: Acceptable);
48
- /** @override */
49
- cloneNode(): this;
50
- /** 转义表格语法 */
51
- escape(): void;
52
- }
53
- export {};
@@ -1,78 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TableBaseToken = void 0;
4
- const debug_1 = require("../../util/debug");
5
- const constants_1 = require("../../util/constants");
6
- const attributesParent_1 = require("../../mixin/attributesParent");
7
- const Parser = require("../../index");
8
- const index_1 = require("../index");
9
- const syntax_1 = require("../syntax");
10
- const attributes_1 = require("../attributes");
11
- /* NOT FOR BROWSER */
12
- /**
13
- * 转义表格语法
14
- * @param syntax 表格语法节点
15
- */
16
- const escapeTable = (syntax) => {
17
- const wikitext = syntax.childNodes.map(child => child.type === 'text'
18
- ? child.data.replaceAll('|', '{{!}}')
19
- : String(child)).join(''), { childNodes } = Parser.parse(wikitext, syntax.getAttribute('include'), 2, syntax.getAttribute('config'));
20
- syntax.replaceChildren(...childNodes);
21
- };
22
- /* NOT FOR BROWSER END */
23
- /**
24
- * 表格行,含开头的换行,不含结尾的换行
25
- * @classdesc `{childNodes: [SyntaxToken, AttributesToken, ...Token]}`
26
- */
27
- class TableBaseToken extends (0, attributesParent_1.attributesParent)(index_1.Token, 1) {
28
- /**
29
- * @param pattern 表格语法正则
30
- * @param syntax 表格语法
31
- * @param attr 表格属性
32
- */
33
- constructor(pattern, syntax, attr, config = Parser.getConfig(), accum = [], acceptable = {}) {
34
- super(undefined, config, accum, acceptable);
35
- this.append(new syntax_1.SyntaxToken(syntax, pattern, 'table-syntax', config, accum, {
36
- 'Stage-1': ':', '!ExtToken': '', TranscludeToken: ':',
37
- }), new attributes_1.AttributesToken(attr, 'table-attrs', this.type, config, accum));
38
- this.protectChildren(0, 1);
39
- }
40
- /* NOT FOR BROWSER */
41
- /** @override */
42
- cloneNode() {
43
- const [syntax, attr, ...cloned] = this.cloneChildNodes();
44
- return debug_1.Shadow.run(() => {
45
- const { constructor } = this, token = new constructor(undefined, undefined, this.getAttribute('config'));
46
- token.firstChild.safeReplaceWith(syntax);
47
- token.childNodes[1].safeReplaceWith(attr);
48
- if (token.type === 'td') { // TdToken
49
- token.childNodes[2].safeReplaceWith(cloned[0]);
50
- }
51
- else {
52
- token.append(...cloned);
53
- }
54
- return token;
55
- });
56
- }
57
- /** 转义表格语法 */
58
- escape() {
59
- for (const child of this.childNodes) {
60
- if (child instanceof syntax_1.SyntaxToken) {
61
- escapeTable(child);
62
- }
63
- else if (child instanceof TableBaseToken) {
64
- child.escape();
65
- }
66
- }
67
- }
68
- /** @private */
69
- setSyntax(syntax, esc = false) {
70
- const { firstChild } = this;
71
- firstChild.replaceChildren(syntax);
72
- if (esc) {
73
- escapeTable(firstChild);
74
- }
75
- }
76
- }
77
- exports.TableBaseToken = TableBaseToken;
78
- constants_1.classes['TableBaseToken'] = __filename;
@@ -1,229 +0,0 @@
1
- import * as Parser from '../../index';
2
- import { TrBaseToken } from './trBase';
3
- import { SyntaxToken } from '../syntax';
4
- import type { LintError } from '../../base';
5
- import type { AttributesToken, TdToken, TrToken, Token } from '../../internal';
6
- import type { TableCoords } from './trBase';
7
- import type { TdAttrs, TdSubtypes, TdSpanAttrs } from './td';
8
- import type { Layout } from '../../addon/table';
9
- export interface TableRenderedCoords {
10
- readonly row?: undefined;
11
- readonly column?: undefined;
12
- readonly x: number;
13
- readonly y: number;
14
- }
15
- /**
16
- * 表格
17
- * @classdesc `{childNodes: [SyntaxToken, AttributesToken, ?Token, ...TdToken, ...TrToken, ?SyntaxToken]}`
18
- */
19
- export declare class TableToken extends TrBaseToken {
20
- readonly type = "table";
21
- readonly childNodes: [SyntaxToken, AttributesToken, ...(TdToken | TrToken)[], SyntaxToken] | [SyntaxToken, AttributesToken, ...(TdToken | TrToken)[]];
22
- abstract get children(): [SyntaxToken, AttributesToken, ...(TdToken | TrToken)[], SyntaxToken] | [SyntaxToken, AttributesToken, ...(TdToken | TrToken)[]];
23
- abstract get lastChild(): AttributesToken | TdToken | TrToken | SyntaxToken;
24
- abstract get lastElementChild(): AttributesToken | TdToken | TrToken | SyntaxToken;
25
- /** 表格是否闭合 */
26
- get closed(): boolean;
27
- set closed(closed: boolean);
28
- /**
29
- * @param syntax 表格语法
30
- * @param attr 表格属性
31
- */
32
- constructor(syntax: string, attr?: string, config?: Parser.Config, accum?: Token[]);
33
- /** @override */
34
- lint(start?: number): LintError[];
35
- /**
36
- * 闭合表格语法
37
- * @param syntax 表格结尾语法
38
- * @param halfParsed
39
- */
40
- close(syntax?: string, halfParsed?: boolean): void;
41
- /**
42
- * @override
43
- * @param token 待插入的子节点
44
- * @param i 插入位置
45
- * @throws `SyntaxError` 表格的闭合部分非法
46
- */
47
- insertAt<T extends Token>(token: T, i?: number): T;
48
- /** @override */
49
- getRowCount(): number;
50
- /** 获取下一行 */
51
- getNextRow(): TrToken | undefined;
52
- /**
53
- * 获取第n行
54
- * @param n 行号
55
- * @param force 是否将表格自身视为第一行
56
- * @param insert 是否用于判断插入新行的位置
57
- * @throws `RangeError` 不存在该行
58
- */
59
- getNthRow(n: number, force?: boolean, insert?: false): TrToken | this | undefined;
60
- /** @ignore */
61
- getNthRow(n: number, force: boolean, insert: true): TrToken | this | SyntaxToken | undefined;
62
- /** 获取所有行 */
63
- getAllRows(): readonly (TrToken | this)[];
64
- /**
65
- * 获取指定坐标的单元格
66
- * @param coords 表格坐标
67
- */
68
- getNthCell(coords: TableCoords | TableRenderedCoords): TdToken | undefined;
69
- /**
70
- * 获取表格布局
71
- * @param stop 中止条件
72
- * @param stop.row 中止行
73
- * @param stop.column 中止列
74
- * @param stop.x 中止行
75
- * @param stop.y 中止列
76
- */
77
- getLayout(stop?: {
78
- row?: number;
79
- column?: number;
80
- x?: number;
81
- y?: number;
82
- }): Layout;
83
- /** 打印表格布局 */
84
- printLayout(): void;
85
- /**
86
- * 转换为渲染后的表格坐标
87
- * @param {TableCoords} coord wikitext中的表格坐标
88
- */
89
- toRenderedCoords(coord: TableCoords): TableRenderedCoords | undefined;
90
- /**
91
- * 转换为wikitext中的表格坐标
92
- * @param {TableRenderedCoords} coord 渲染后的表格坐标
93
- */
94
- toRawCoords(coord: TableRenderedCoords): TableCoords | undefined;
95
- /**
96
- * 获取完整行
97
- * @param y 行号
98
- */
99
- getFullRow(y: number): Map<TdToken, boolean>;
100
- /**
101
- * 获取完整列
102
- * @param x 列号
103
- */
104
- getFullCol(x: number): Map<TdToken, boolean>;
105
- /**
106
- * 设置行格式
107
- * @param y 行号
108
- * @param attr 表格属性
109
- * @param multiRow 是否对所有单元格设置,或是仅对行首单元格设置
110
- */
111
- formatTableRow(y: number, attr?: TdAttrs | string, multiRow?: boolean): void;
112
- /**
113
- * 设置列格式
114
- * @param x 列号
115
- * @param attr 表格属性
116
- * @param multiCol 是否对所有单元格设置,或是仅对行首单元格设置
117
- */
118
- formatTableCol(x: number, attr?: TdAttrs | string, multiCol?: boolean): void;
119
- /**
120
- * 填补表格行
121
- * @param y 行号
122
- * @param inner 填充内容
123
- * @param subtype 单元格类型
124
- * @param attr 表格属性
125
- */
126
- fillTableRow(y: number, inner: string | Token, subtype?: TdSubtypes, attr?: TdAttrs): void;
127
- /**
128
- * 填补表格
129
- * @param inner 填充内容
130
- * @param subtype 单元格类型
131
- * @param attr 表格属性
132
- */
133
- fillTable(inner: string | Token, subtype?: TdSubtypes, attr?: TdAttrs): void;
134
- /**
135
- * @override
136
- * @param inner 单元格内部wikitext
137
- * @param coords 单元格坐标
138
- * @param subtype 单元格类型
139
- * @param attr 单元格属性
140
- * @throws `RangeError` 指定的坐标不是单元格起始点
141
- */
142
- insertTableCell(inner: string | Token, coords: TableCoords | TableRenderedCoords, subtype?: TdSubtypes, attr?: TdAttrs): TdToken;
143
- /**
144
- * 插入表格行
145
- * @param y 行号
146
- * @param attr 表格行属性
147
- * @param inner 内部wikitext
148
- * @param subtype 单元格类型
149
- * @param innerAttr 单元格属性
150
- */
151
- insertTableRow(y: number, attr?: Record<string, string | true>, inner?: string | Token, subtype?: TdSubtypes, innerAttr?: TdAttrs): TrToken;
152
- /**
153
- * 插入表格列
154
- * @param x 列号
155
- * @param inner 内部wikitext
156
- * @param subtype 单元格类型
157
- * @param attr 单元格属性
158
- * @throws `RangeError` 列号过大
159
- */
160
- insertTableCol(x: number, inner: string | Token, subtype?: TdSubtypes, attr?: TdAttrs): void;
161
- /**
162
- * 移除表格行
163
- * @param y 行号
164
- */
165
- removeTableRow(y: number): TrToken;
166
- /**
167
- * 移除表格列
168
- * @param x 列号
169
- */
170
- removeTableCol(x: number): void;
171
- /**
172
- * 合并单元格
173
- * @param xlim 列范围
174
- * @param ylim 行范围
175
- * @throws `RangeError` 待合并区域与外侧区域有重叠
176
- */
177
- mergeCells(xlim: readonly [number, number], ylim: readonly [number, number]): TdToken;
178
- /**
179
- * 分裂成多行
180
- * @param coords 单元格坐标
181
- */
182
- splitIntoRows(coords: TableCoords | TableRenderedCoords): void;
183
- /**
184
- * 分裂成多列
185
- * @param coords 单元格坐标
186
- */
187
- splitIntoCols(coords: TableCoords | TableRenderedCoords): void;
188
- /**
189
- * 分裂成单元格
190
- * @param coords 单元格坐标
191
- */
192
- splitIntoCells(coords: TableCoords | TableRenderedCoords): void;
193
- /**
194
- * 复制一行并插入该行之前
195
- * @param row 行号
196
- */
197
- replicateTableRow(row: number): TrToken;
198
- /**
199
- * 复制一列并插入该列之前
200
- * @param x 列号
201
- */
202
- replicateTableCol(x: number): readonly TdToken[];
203
- /**
204
- * 移动表格行
205
- * @param y 行号
206
- * @param before 新位置
207
- * @throws `RangeError` 无法移动
208
- */
209
- moveTableRowBefore(y: number, before: number): TrToken;
210
- /**
211
- * 移动表格行
212
- * @param y 行号
213
- * @param after 新位置
214
- * @throws `RangeError` 无法移动
215
- */
216
- moveTableRowAfter(y: number, after: number): TrToken;
217
- /**
218
- * 移动表格列
219
- * @param x 列号
220
- * @param before 新位置
221
- */
222
- moveTableColBefore(x: number, before: number): void;
223
- /**
224
- * 移动表格列
225
- * @param x 列号
226
- * @param after 新位置
227
- */
228
- moveTableColAfter(x: number, after: number): void;
229
- }