wikiparser-node 0.10.0 → 0.11.0-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 (93) hide show
  1. package/README.md +44 -32
  2. package/bundle/bundle.min.js +38 -0
  3. package/config/.schema.json +1 -19
  4. package/config/default.json +1 -2
  5. package/config/llwiki.json +1 -36
  6. package/config/minimum.json +135 -0
  7. package/config/moegirl.json +1 -45
  8. package/config/zhwiki.json +1 -467
  9. package/extensions/base.js +154 -0
  10. package/extensions/editor.css +63 -0
  11. package/extensions/editor.js +183 -0
  12. package/extensions/highlight.js +40 -0
  13. package/extensions/ui.css +119 -0
  14. package/i18n/zh-hans.json +1 -1
  15. package/i18n/zh-hant.json +1 -1
  16. package/package.json +16 -11
  17. package/index.js +0 -333
  18. package/lib/element.js +0 -611
  19. package/lib/node.js +0 -770
  20. package/lib/ranges.js +0 -130
  21. package/lib/text.js +0 -263
  22. package/lib/title.js +0 -83
  23. package/mixin/attributeParent.js +0 -117
  24. package/mixin/fixedToken.js +0 -40
  25. package/mixin/hidden.js +0 -21
  26. package/mixin/singleLine.js +0 -31
  27. package/mixin/sol.js +0 -54
  28. package/parser/brackets.js +0 -126
  29. package/parser/commentAndExt.js +0 -59
  30. package/parser/converter.js +0 -46
  31. package/parser/externalLinks.js +0 -33
  32. package/parser/hrAndDoubleUnderscore.js +0 -49
  33. package/parser/html.js +0 -42
  34. package/parser/links.js +0 -94
  35. package/parser/list.js +0 -59
  36. package/parser/magicLinks.js +0 -41
  37. package/parser/quotes.js +0 -64
  38. package/parser/selector.js +0 -177
  39. package/parser/table.js +0 -114
  40. package/src/arg.js +0 -207
  41. package/src/atom/hidden.js +0 -13
  42. package/src/atom/index.js +0 -43
  43. package/src/attribute.js +0 -470
  44. package/src/attributes.js +0 -453
  45. package/src/charinsert.js +0 -97
  46. package/src/converter.js +0 -176
  47. package/src/converterFlags.js +0 -284
  48. package/src/converterRule.js +0 -256
  49. package/src/extLink.js +0 -180
  50. package/src/gallery.js +0 -149
  51. package/src/hasNowiki/index.js +0 -44
  52. package/src/hasNowiki/pre.js +0 -40
  53. package/src/heading.js +0 -134
  54. package/src/html.js +0 -254
  55. package/src/imageParameter.js +0 -303
  56. package/src/imagemap.js +0 -199
  57. package/src/imagemapLink.js +0 -41
  58. package/src/index.js +0 -932
  59. package/src/link/category.js +0 -44
  60. package/src/link/file.js +0 -287
  61. package/src/link/galleryImage.js +0 -120
  62. package/src/link/index.js +0 -388
  63. package/src/magicLink.js +0 -149
  64. package/src/nested/choose.js +0 -24
  65. package/src/nested/combobox.js +0 -23
  66. package/src/nested/index.js +0 -93
  67. package/src/nested/references.js +0 -23
  68. package/src/nowiki/comment.js +0 -71
  69. package/src/nowiki/dd.js +0 -59
  70. package/src/nowiki/doubleUnderscore.js +0 -56
  71. package/src/nowiki/hr.js +0 -41
  72. package/src/nowiki/index.js +0 -56
  73. package/src/nowiki/list.js +0 -16
  74. package/src/nowiki/noinclude.js +0 -28
  75. package/src/nowiki/quote.js +0 -69
  76. package/src/onlyinclude.js +0 -64
  77. package/src/paramTag/index.js +0 -89
  78. package/src/paramTag/inputbox.js +0 -35
  79. package/src/parameter.js +0 -239
  80. package/src/syntax.js +0 -91
  81. package/src/table/index.js +0 -983
  82. package/src/table/td.js +0 -338
  83. package/src/table/tr.js +0 -319
  84. package/src/tagPair/ext.js +0 -145
  85. package/src/tagPair/include.js +0 -50
  86. package/src/tagPair/index.js +0 -126
  87. package/src/transclude.js +0 -843
  88. package/tool/index.js +0 -1202
  89. package/util/base.js +0 -17
  90. package/util/debug.js +0 -73
  91. package/util/diff.js +0 -76
  92. package/util/lint.js +0 -55
  93. package/util/string.js +0 -126
@@ -1,177 +0,0 @@
1
- 'use strict';
2
-
3
- const Parser = require('..');
4
-
5
- const /** @type {Set<pseudo>} */ simplePseudos = new Set([
6
- 'root',
7
- 'first-child',
8
- 'first-of-type',
9
- 'last-child',
10
- 'last-of-type',
11
- 'only-child',
12
- 'only-of-type',
13
- 'empty',
14
- 'parent',
15
- 'header',
16
- 'hidden',
17
- 'visible',
18
- 'only-whitespace',
19
- 'local-link',
20
- 'read-only',
21
- 'read-write',
22
- 'invalid',
23
- 'required',
24
- 'optional',
25
- ]),
26
- /** @type {pseudo[]} */ complexPseudos = [
27
- 'is',
28
- 'not',
29
- 'nth-child',
30
- 'nth-of-type',
31
- 'nth-last-child',
32
- 'nth-last-of-type',
33
- 'contains',
34
- 'has',
35
- 'lang',
36
- ],
37
- specialChars = [
38
- ['[', '&lbrack;'],
39
- [']', '&rbrack;'],
40
- ['(', '&lpar;'],
41
- [')', '&rpar;'],
42
- ['"', '&quot;'],
43
- [`'`, '&apos;'],
44
- [':', '&colon;'],
45
- ['\\', '&bsol;'],
46
- ['&', '&amp;'],
47
- ],
48
- pseudoRegex = new RegExp(`:(${complexPseudos.join('|')})$`, 'u'),
49
- regularRegex = /[[(,>+~]|\s+/u,
50
- attributeRegex = /^\s*(\w+)\s*(?:([~|^$*!]?=)\s*("[^"]*"|'[^']*'|[^\s[\]]+)(?:\s+(i))?\s*)?\]/u,
51
- functionRegex = /^(\s*"[^"]*"\s*|\s*'[^']*'\s*|[^()]*)\)/u,
52
- grouping = new Set([',', '>', '+', '~']),
53
- combinator = new Set(['>', '+', '~', '']);
54
-
55
- /**
56
- * 清理转义符号
57
- * @param {string} selector
58
- */
59
- const sanitize = selector => {
60
- for (const [c, escaped] of specialChars) {
61
- selector = selector.replaceAll(`\\${c}`, escaped);
62
- }
63
- return selector;
64
- };
65
-
66
- /**
67
- * 还原转义符号
68
- * @param {string|undefined} selector
69
- */
70
- const desanitize = selector => {
71
- if (selector === undefined) {
72
- return undefined;
73
- }
74
- for (const [c, escaped] of specialChars) {
75
- selector = selector.replaceAll(escaped, c);
76
- }
77
- return selector.trim();
78
- };
79
-
80
- /**
81
- * 去除首尾的引号
82
- * @param {string|undefined} val 属性值或伪选择器函数的参数
83
- */
84
- const deQuote = val => {
85
- if (val === undefined) {
86
- return undefined;
87
- }
88
- const quotes = /^(["']).*\1$/u.exec(val)?.[1];
89
- return quotes ? val.slice(1, -1) : val;
90
- };
91
-
92
- /**
93
- * 解析简单伪选择器
94
- * @param {SelectorArray} step 当前顶部
95
- * @param {string} str 不含属性和复杂伪选择器的语句
96
- * @throws `SyntaxError` 非法的选择器
97
- */
98
- const pushSimple = (step, str) => {
99
- const pieces = str.trim().split(':'),
100
- // eslint-disable-next-line unicorn/explicit-length-check
101
- i = pieces.slice(1).findIndex(pseudo => simplePseudos.has(pseudo)) + 1 || pieces.length;
102
- if (pieces.slice(i).some(pseudo => !simplePseudos.has(pseudo))) {
103
- throw new SyntaxError(`非法的选择器!\n${str}\n可能需要将':'转义为'\\:'。`);
104
- }
105
- step.push(desanitize(pieces.slice(0, i).join(':')), ...pieces.slice(i).map(piece => `:${piece}`));
106
- };
107
-
108
- /**
109
- * 解析选择器
110
- * @param {string} selector
111
- * @throws `SyntaxError` 非法的选择器
112
- */
113
- const parseSelector = selector => {
114
- selector = selector.trim();
115
- const /** @type {SelectorArray[][]} */ stack = [[[]]];
116
- let sanitized = sanitize(selector),
117
- regex = regularRegex,
118
- mt = regex.exec(sanitized),
119
- [condition] = stack,
120
- [step] = condition;
121
- while (mt) {
122
- let {0: syntax, index} = mt;
123
- if (syntax.trim() === '') {
124
- index += syntax.length;
125
- const char = sanitized[index];
126
- syntax = grouping.has(char) ? char : '';
127
- }
128
- if (syntax === ',') { // 情形1:并列
129
- pushSimple(step, sanitized.slice(0, index));
130
- condition = [[]];
131
- [step] = condition;
132
- stack.push(condition);
133
- } else if (combinator.has(syntax)) { // 情形2:关系
134
- pushSimple(step, sanitized.slice(0, index));
135
- if (!step.some(Boolean)) {
136
- throw new SyntaxError(`非法的选择器!\n${selector}\n可能需要通用选择器'*'。`);
137
- }
138
- step.relation = syntax;
139
- step = [];
140
- condition.push(step);
141
- } else if (syntax === '[') { // 情形3:属性开启
142
- pushSimple(step, sanitized.slice(0, index));
143
- regex = attributeRegex;
144
- } else if (syntax.endsWith(']')) { // 情形4:属性闭合
145
- mt[3] = desanitize(deQuote(mt[3]));
146
- step.push(mt.slice(1));
147
- regex = regularRegex;
148
- } else if (syntax === '(') { // 情形5:伪选择器开启
149
- const pseudoExec = pseudoRegex.exec(sanitized.slice(0, index));
150
- if (!pseudoExec) {
151
- throw new SyntaxError(`非法的选择器!\n${desanitize(sanitized)}\n请检查伪选择器是否存在。`);
152
- }
153
- pushSimple(step, sanitized.slice(0, pseudoExec.index));
154
- step.push(pseudoExec[1]); // 临时存放复杂伪选择器
155
- regex = functionRegex;
156
- } else { // 情形6:伪选择器闭合
157
- const /** @type {pseudo} */ pseudo = step.pop();
158
- mt.push(pseudo);
159
- mt[1] = deQuote(mt[1]);
160
- step.push(mt.slice(1));
161
- regex = regularRegex;
162
- }
163
- sanitized = sanitized.slice(index + syntax.length);
164
- if (grouping.has(syntax)) {
165
- sanitized = sanitized.trim();
166
- }
167
- mt = regex.exec(sanitized);
168
- }
169
- if (regex === regularRegex) {
170
- pushSimple(step, sanitized);
171
- return stack;
172
- }
173
- throw new SyntaxError(`非法的选择器!\n${selector}\n检测到未闭合的'${regex === attributeRegex ? '[' : '('}'`);
174
- };
175
-
176
- Parser.parsers.parseSelector = __filename;
177
- module.exports = parseSelector;
package/parser/table.js DELETED
@@ -1,114 +0,0 @@
1
- 'use strict';
2
-
3
- const Parser = require('..'),
4
- AstText = require('../lib/text'),
5
- Token = require('../src'),
6
- TableToken = require('../src/table'),
7
- TrToken = require('../src/table/tr'),
8
- TdToken = require('../src/table/td'),
9
- DdToken = require('../src/nowiki/dd');
10
-
11
- /**
12
- * 解析表格,注意`tr`和`td`包含开头的换行
13
- * @param {Token & {firstChild: AstText}} root 根节点
14
- * @param {accum} accum
15
- */
16
- const parseTable = ({firstChild: {data}, type, name}, config = Parser.getConfig(), accum = []) => {
17
- const /** @type {TrToken[]} */ stack = [],
18
- lines = data.split('\n');
19
- let out = type === 'root' || type === 'parameter-value' || type === 'ext-inner' && name === 'poem'
20
- ? ''
21
- : `\n${lines.shift()}`;
22
-
23
- /**
24
- * 向表格中插入纯文本
25
- * @param {string} str 待插入的文本
26
- * @param {TrToken} top 当前解析的表格或表格行
27
- */
28
- const push = (str, top) => {
29
- if (!top) {
30
- out += str;
31
- return;
32
- }
33
- const /** @type {Token}} */ {lastChild} = top;
34
- if (lastChild.constructor === Token) {
35
- lastChild.setText(String(lastChild) + str);
36
- } else {
37
- const token = new Token(str, config, true, accum);
38
- token.type = 'table-inter';
39
- top.insertAt(token.setAttribute('stage', 3));
40
- }
41
- };
42
- for (const outLine of lines) {
43
- let top = stack.pop();
44
- const [spaces] = /^(?:\s|\0\d+c\x7F)*/u.exec(outLine),
45
- line = outLine.slice(spaces.length),
46
- matchesStart = /^(:*)((?:\s|\0\d+c\x7F)*)(\{\||\{(?:\0\d+c\x7F)*\0\d+!\x7F|\0\d+\{\x7F)(.*)$/u.exec(line);
47
- if (matchesStart) {
48
- while (top && top.type !== 'td') {
49
- top = stack.pop();
50
- }
51
- const [, indent, moreSpaces, tableSyntax, attr] = matchesStart;
52
- if (indent) {
53
- new DdToken(indent, config, accum);
54
- }
55
- push(`\n${spaces}${indent && `\0${accum.length - 1}d\x7F`}${moreSpaces}\0${accum.length}b\x7F`, top);
56
- const table = new TableToken(tableSyntax, attr, config, accum);
57
- stack.push(...top ? [top] : [], table);
58
- continue;
59
- } else if (!top) {
60
- out += `\n${outLine}`;
61
- continue;
62
- }
63
- const matches = // eslint-disable-line operator-linebreak
64
- /^(?:(\|\}|\0\d+!\x7F\}|\0\d+\}\x7F)|(\|-+|\0\d+!\x7F-+|\0\d+-\x7F-*)(?!-)|(!|(?:\||\0\d+!\x7F)\+?))(.*)$/u
65
- .exec(line);
66
- if (!matches) {
67
- push(`\n${outLine}`, top);
68
- stack.push(...top ? [top] : []);
69
- continue;
70
- }
71
- const [, closing, row, cell, attr] = matches;
72
- if (closing) {
73
- while (!(top instanceof TableToken)) {
74
- top = stack.pop();
75
- }
76
- top.close(`\n${spaces}${closing}`, true);
77
- push(attr, stack.at(-1));
78
- } else if (row) {
79
- if (top.type === 'td') {
80
- top = stack.pop();
81
- }
82
- if (top.type === 'tr') {
83
- top = stack.pop();
84
- }
85
- const tr = new TrToken(`\n${spaces}${row}`, attr, config, accum);
86
- stack.push(top, tr);
87
- top.insertAt(tr);
88
- } else {
89
- if (top.type === 'td') {
90
- top = stack.pop();
91
- }
92
- const regex = cell === '!'
93
- ? /!!|(?:\||\0\d+!\x7F){2}|\0\d+\+\x7F/gu
94
- : /(?:\||\0\d+!\x7F){2}|\0\d+\+\x7F/gu;
95
- let mt = regex.exec(attr),
96
- lastIndex = 0,
97
- lastSyntax = `\n${spaces}${cell}`;
98
- while (mt) {
99
- const td = new TdToken(lastSyntax, attr.slice(lastIndex, mt.index), config, accum);
100
- top.insertAt(td);
101
- ({lastIndex} = regex);
102
- [lastSyntax] = mt;
103
- mt = regex.exec(attr);
104
- }
105
- const td = new TdToken(lastSyntax, attr.slice(lastIndex), config, accum);
106
- stack.push(top, td);
107
- top.insertAt(td);
108
- }
109
- }
110
- return out.slice(1);
111
- };
112
-
113
- Parser.parsers.parseTable = __filename;
114
- module.exports = parseTable;
package/src/arg.js DELETED
@@ -1,207 +0,0 @@
1
- 'use strict';
2
-
3
- const {text, noWrap} = require('../util/string'),
4
- {generateForSelf, generateForChild} = require('../util/lint'),
5
- Parser = require('..'),
6
- Token = require('.');
7
-
8
- /**
9
- * `{{{}}}`包裹的参数
10
- * @classdesc `{childNodes: [AtomToken, ?Token, ...HiddenToken]}`
11
- */
12
- class ArgToken extends Token {
13
- type = 'arg';
14
-
15
- /** default */
16
- get default() {
17
- return this.childNodes[1]?.text() ?? false;
18
- }
19
-
20
- /**
21
- * @param {string[]} parts 以'|'分隔的各部分
22
- * @param {accum} accum
23
- * @complexity `n`
24
- */
25
- constructor(parts, config = Parser.getConfig(), accum = []) {
26
- super(undefined, config, true, accum, {
27
- AtomToken: 0, Token: 1, HiddenToken: '2:',
28
- });
29
- for (let i = 0; i < parts.length; i++) {
30
- if (i === 0 || i > 1) {
31
- const AtomToken = i === 0 ? require('./atom') : require('./atom/hidden');
32
- const token = new AtomToken(parts[i], i === 0 ? 'arg-name' : undefined, config, accum, {
33
- 'Stage-2': ':', '!HeadingToken': '',
34
- });
35
- super.insertAt(token);
36
- } else {
37
- const token = new Token(parts[i], config, true, accum);
38
- token.type = 'arg-default';
39
- super.insertAt(token.setAttribute('stage', 2));
40
- }
41
- }
42
- this.getAttribute('protectChildren')(0);
43
- }
44
-
45
- /**
46
- * @override
47
- * @param {string} selector
48
- */
49
- toString(selector) {
50
- return selector && this.matches(selector) ? '' : `{{{${super.toString(selector, '|')}}}}`;
51
- }
52
-
53
- /**
54
- * @override
55
- * @returns {string}
56
- */
57
- text() {
58
- return `{{{${text(this.childNodes.slice(0, 2), '|')}}}}`;
59
- }
60
-
61
- /** @override */
62
- getPadding() {
63
- return 3;
64
- }
65
-
66
- /** @override */
67
- getGaps() {
68
- return 1;
69
- }
70
-
71
- /** @override */
72
- print() {
73
- return super.print({pre: '{{{', post: '}}}', sep: '|'});
74
- }
75
-
76
- /**
77
- * @override
78
- * @param {number} start 起始位置
79
- * @returns {LintError[]}
80
- */
81
- lint(start = this.getAbsoluteIndex()) {
82
- if (!this.getAttribute('include')) {
83
- return [generateForSelf(this, {start}, 'unexpected template argument')];
84
- }
85
- const {childNodes: [argName, argDefault, ...rest]} = this,
86
- errors = argName.lint(start + 3);
87
- if (argDefault) {
88
- errors.push(...argDefault.lint(start + 4 + String(argName).length));
89
- }
90
- if (rest.length > 0) {
91
- const rect = {start, ...this.getRootNode().posFromIndex(start)};
92
- errors.push(...rest.map(child => {
93
- const error = generateForChild(child, rect, 'invisible content inside triple brackets'),
94
- {startIndex, startCol, excerpt} = error;
95
- return {...error, startIndex: startIndex - 1, startCol: startCol - 1, excerpt: `|${excerpt}`};
96
- }));
97
- }
98
- return errors;
99
- }
100
-
101
- /** @override */
102
- cloneNode() {
103
- const [name, ...cloned] = this.cloneChildNodes();
104
- return Parser.run(() => {
105
- const token = new ArgToken([''], this.getAttribute('config'));
106
- token.firstChild.safeReplaceWith(name);
107
- token.append(...cloned);
108
- token.afterBuild();
109
- return token;
110
- });
111
- }
112
-
113
- /** @override */
114
- afterBuild() {
115
- this.setAttribute('name', this.firstChild.text().trim());
116
- const /** @type {AstListener} */ argListener = ({prevTarget}) => {
117
- if (prevTarget === this.firstChild) {
118
- this.setAttribute('name', prevTarget.text().trim());
119
- }
120
- };
121
- this.addEventListener(['remove', 'insert', 'replace', 'text'], argListener);
122
- }
123
-
124
- /**
125
- * 移除无效部分
126
- * @complexity `n`
127
- */
128
- removeRedundant() {
129
- Parser.run(() => {
130
- for (let i = this.length - 1; i > 1; i--) {
131
- super.removeAt(i);
132
- }
133
- });
134
- }
135
-
136
- /**
137
- * 移除子节点,且在移除`arg-default`子节点时自动移除全部多余子节点
138
- * @param {number} i 移除位置
139
- * @returns {Token}
140
- */
141
- removeAt(i) {
142
- if (i === 1) {
143
- this.removeRedundant();
144
- }
145
- return super.removeAt(i);
146
- }
147
-
148
- /**
149
- * @override
150
- * @param {Token} token 待插入的子节点
151
- * @param {number} i 插入位置
152
- * @throws `RangeError` 不可插入多余子节点
153
- */
154
- insertAt(token, i = this.length) {
155
- const j = i < 0 ? i + this.length : i;
156
- if (j > 1) {
157
- throw new RangeError(`${this.constructor.name} 不可插入多余的子节点!`);
158
- }
159
- super.insertAt(token, i);
160
- if (j === 1) {
161
- token.type = 'arg-default';
162
- }
163
- return token;
164
- }
165
-
166
- /**
167
- * 设置参数名
168
- * @param {string} name 新参数名
169
- * @throws `SyntaxError` 非法的参数名
170
- */
171
- setName(name) {
172
- name = String(name);
173
- const root = Parser.parse(`{{{${name}}}}`, this.getAttribute('include'), 2, this.getAttribute('config')),
174
- {length, firstChild: arg} = root;
175
- if (length !== 1 || arg.type !== 'arg' || arg.length !== 1) {
176
- throw new SyntaxError(`非法的参数名称:${noWrap(name)}`);
177
- }
178
- const {firstChild} = arg;
179
- arg.destroy(true);
180
- this.firstChild.safeReplaceWith(firstChild);
181
- }
182
-
183
- /**
184
- * 设置预设值
185
- * @param {string} value 预设值
186
- * @throws `SyntaxError` 非法的参数预设值
187
- */
188
- setDefault(value) {
189
- value = String(value);
190
- const root = Parser.parse(`{{{|${value}}}}`, this.getAttribute('include'), 2, this.getAttribute('config')),
191
- {length, firstChild: arg} = root;
192
- if (length !== 1 || arg.type !== 'arg' || arg.length !== 2) {
193
- throw new SyntaxError(`非法的参数预设值:${noWrap(value)}`);
194
- }
195
- const {childNodes: [, oldDefault]} = this,
196
- {lastChild} = arg;
197
- arg.destroy(true);
198
- if (oldDefault) {
199
- oldDefault.safeReplaceWith(lastChild);
200
- } else {
201
- this.insertAt(lastChild);
202
- }
203
- }
204
- }
205
-
206
- Parser.classes.ArgToken = __filename;
207
- module.exports = ArgToken;
@@ -1,13 +0,0 @@
1
- 'use strict';
2
-
3
- const hidden = require('../../mixin/hidden'),
4
- Parser = require('../..'),
5
- AtomToken = require('.');
6
-
7
- /** 不可见的节点 */
8
- class HiddenToken extends hidden(AtomToken) {
9
- type = 'hidden';
10
- }
11
-
12
- Parser.classes.HiddenToken = __filename;
13
- module.exports = HiddenToken;
package/src/atom/index.js DELETED
@@ -1,43 +0,0 @@
1
- 'use strict';
2
-
3
- const Parser = require('../..'),
4
- Token = require('..');
5
-
6
- /**
7
- * 不会被继续解析的plain Token
8
- * @classdesc `{childNodes: ...AstText|Token}`
9
- */
10
- class AtomToken extends Token {
11
- type = 'plain';
12
-
13
- /**
14
- * @param {string} wikitext wikitext
15
- * @param {string|undefined} type Token.type
16
- * @param {accum} accum
17
- * @param {acceptable} acceptable 可接受的子节点设置
18
- */
19
- constructor(wikitext, type, config = Parser.getConfig(), accum = [], acceptable = undefined) {
20
- super(wikitext, config, true, accum, acceptable);
21
- if (type) {
22
- this.type = type;
23
- }
24
- }
25
-
26
- /**
27
- * @override
28
- * @this {AtomToken & {constructor: typeof AtomToken}}
29
- */
30
- cloneNode() {
31
- const cloned = this.cloneChildNodes(),
32
- config = this.getAttribute('config'),
33
- acceptable = this.getAttribute('acceptable');
34
- return Parser.run(() => {
35
- const token = new this.constructor(undefined, this.type, config, [], acceptable);
36
- token.append(...cloned);
37
- return token;
38
- });
39
- }
40
- }
41
-
42
- Parser.classes.AtomToken = __filename;
43
- module.exports = AtomToken;