securemark 0.298.2 → 0.298.4
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/CHANGELOG.md +8 -0
- package/design.md +1 -5
- package/dist/index.js +153 -153
- package/package.json +1 -1
- package/src/combinator/control/constraint/line.ts +1 -1
- package/src/combinator/control/manipulation/match.ts +1 -1
- package/src/combinator/data/delimiter.ts +42 -37
- package/src/combinator/data/parser/context.ts +4 -2
- package/src/combinator/data/parser/inits.ts +1 -1
- package/src/combinator/data/parser/sequence.ts +1 -1
- package/src/combinator/data/parser/some.ts +4 -3
- package/src/parser/api/bind.ts +17 -22
- package/src/parser/api/header.ts +1 -1
- package/src/parser/api/parse.test.ts +7 -10
- package/src/parser/api/parse.ts +27 -31
- package/src/parser/block/codeblock.ts +1 -1
- package/src/parser/block/extension/fig.ts +1 -1
- package/src/parser/block/extension/figure.ts +1 -1
- package/src/parser/block/extension/message.ts +1 -1
- package/src/parser/block/extension/placeholder.ts +1 -1
- package/src/parser/block/extension/table.ts +1 -1
- package/src/parser/block/heading.test.ts +2 -2
- package/src/parser/block/heading.ts +1 -1
- package/src/parser/block/mathblock.ts +1 -1
- package/src/parser/block/table.test.ts +1 -1
- package/src/parser/block.ts +64 -82
- package/src/parser/context.ts +20 -0
- package/src/parser/header.test.ts +1 -0
- package/src/parser/header.ts +3 -3
- package/src/parser/inline/annotation.test.ts +19 -19
- package/src/parser/inline/annotation.ts +10 -7
- package/src/parser/inline/autolink.ts +3 -3
- package/src/parser/inline/bracket.test.ts +11 -11
- package/src/parser/inline/bracket.ts +7 -17
- package/src/parser/inline/emphasis.test.ts +2 -2
- package/src/parser/inline/emstrong.test.ts +3 -3
- package/src/parser/inline/extension/index.test.ts +1 -1
- package/src/parser/inline/html.test.ts +5 -1
- package/src/parser/inline/html.ts +61 -53
- package/src/parser/inline/italic.test.ts +1 -1
- package/src/parser/inline/link.test.ts +1 -1
- package/src/parser/inline/reference.test.ts +1 -1
- package/src/parser/inline/strong.test.ts +2 -2
- package/src/parser/inline.test.ts +14 -14
- package/src/parser/inline.ts +7 -1
- package/src/parser/processor/note.ts +1 -1
- package/src/parser/segment.ts +13 -15
- package/src/parser/source/escapable.ts +0 -1
- package/src/parser/source/line.ts +6 -4
- package/src/parser/source/text.ts +4 -5
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.298.
|
|
1
|
+
/*! securemark v0.298.4 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
|
|
2
2
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
3
3
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
4
4
|
module.exports = factory(require("Prism"), require("DOMPurify"));
|
|
@@ -2664,7 +2664,7 @@ function firstline(source, position) {
|
|
|
2664
2664
|
return i === -1 ? source.slice(position) : source.slice(position, i + 1);
|
|
2665
2665
|
}
|
|
2666
2666
|
exports.firstline = firstline;
|
|
2667
|
-
const emptyline = /[^\S\n]*(?:$|\n)/y;
|
|
2667
|
+
const emptyline = /[^\S\r\n]*(?:$|\r?\n)/y;
|
|
2668
2668
|
function isEmptyline(source, position) {
|
|
2669
2669
|
emptyline.lastIndex = position;
|
|
2670
2670
|
return source.length === position || source[position] === '\n' || emptyline.test(source);
|
|
@@ -2903,7 +2903,7 @@ exports.match = void 0;
|
|
|
2903
2903
|
const parser_1 = __webpack_require__(605);
|
|
2904
2904
|
const combinator_1 = __webpack_require__(3484);
|
|
2905
2905
|
function match(pattern, f) {
|
|
2906
|
-
const count = typeof pattern === 'object' ? /[^^\\*+][*+]/.test(pattern.source) : false;
|
|
2906
|
+
const count = typeof pattern === 'object' ? /[^^\\*+][*+]|{\d+,}/.test(pattern.source) : false;
|
|
2907
2907
|
return (0, parser_1.failsafe)(input => {
|
|
2908
2908
|
const context = input;
|
|
2909
2909
|
const {
|
|
@@ -3229,10 +3229,24 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
3229
3229
|
exports.tester = exports.matcher = exports.Delimiters = void 0;
|
|
3230
3230
|
const parser_1 = __webpack_require__(605);
|
|
3231
3231
|
const context_1 = __webpack_require__(5745);
|
|
3232
|
+
const indexes = new Map();
|
|
3233
|
+
function index(source) {
|
|
3234
|
+
let x = 0;
|
|
3235
|
+
for (let i = 0; i < source.length; ++i) {
|
|
3236
|
+
const c = source.charCodeAt(i);
|
|
3237
|
+
x = x ^ c << 1 || ~x ^ c << 1; // 16+1bit
|
|
3238
|
+
|
|
3239
|
+
x ^= x << 13; // shift <= 32-17bit
|
|
3240
|
+
x ^= x >>> 17;
|
|
3241
|
+
x ^= x << 15;
|
|
3242
|
+
}
|
|
3243
|
+
x >>>= 3;
|
|
3244
|
+
x &= ~0 >>> 32 - 4;
|
|
3245
|
+
return x;
|
|
3246
|
+
}
|
|
3232
3247
|
class Delimiters {
|
|
3233
3248
|
constructor() {
|
|
3234
|
-
this.
|
|
3235
|
-
this.map = new Map();
|
|
3249
|
+
this.memories = [];
|
|
3236
3250
|
this.delimiters = [];
|
|
3237
3251
|
this.stack = [];
|
|
3238
3252
|
this.states = [];
|
|
@@ -3241,18 +3255,14 @@ class Delimiters {
|
|
|
3241
3255
|
static signature(pattern) {
|
|
3242
3256
|
switch (typeof pattern) {
|
|
3243
3257
|
case 'undefined':
|
|
3244
|
-
return
|
|
3258
|
+
return 0;
|
|
3245
3259
|
case 'string':
|
|
3246
|
-
|
|
3247
|
-
const code = pattern.charCodeAt(0);
|
|
3248
|
-
return code;
|
|
3249
|
-
}
|
|
3250
|
-
return `s:${pattern}`;
|
|
3260
|
+
return index(`'${pattern}`);
|
|
3251
3261
|
case 'object':
|
|
3252
|
-
return
|
|
3262
|
+
return index(`/${pattern.source}`);
|
|
3253
3263
|
}
|
|
3254
3264
|
}
|
|
3255
|
-
static
|
|
3265
|
+
static tester(pattern, after) {
|
|
3256
3266
|
switch (typeof pattern) {
|
|
3257
3267
|
case 'undefined':
|
|
3258
3268
|
return () => undefined;
|
|
@@ -3264,15 +3274,7 @@ class Delimiters {
|
|
|
3264
3274
|
}
|
|
3265
3275
|
}
|
|
3266
3276
|
registry(signature) {
|
|
3267
|
-
|
|
3268
|
-
return this.tree[signature] ??= [];
|
|
3269
|
-
} else {
|
|
3270
|
-
const ds = this.map.get(signature);
|
|
3271
|
-
if (ds) return ds;
|
|
3272
|
-
const blank = [];
|
|
3273
|
-
this.map.set(signature, blank);
|
|
3274
|
-
return blank;
|
|
3275
|
-
}
|
|
3277
|
+
return this.memories[signature] ??= [];
|
|
3276
3278
|
}
|
|
3277
3279
|
push(delims) {
|
|
3278
3280
|
const {
|
|
@@ -3284,7 +3286,7 @@ class Delimiters {
|
|
|
3284
3286
|
for (let i = 0; i < delims.length; ++i) {
|
|
3285
3287
|
const {
|
|
3286
3288
|
signature,
|
|
3287
|
-
|
|
3289
|
+
tester,
|
|
3288
3290
|
precedence
|
|
3289
3291
|
} = delims[i];
|
|
3290
3292
|
const memory = this.registry(signature);
|
|
@@ -3293,8 +3295,7 @@ class Delimiters {
|
|
|
3293
3295
|
const delimiter = {
|
|
3294
3296
|
memory,
|
|
3295
3297
|
index,
|
|
3296
|
-
|
|
3297
|
-
matcher,
|
|
3298
|
+
tester,
|
|
3298
3299
|
precedence,
|
|
3299
3300
|
state: true
|
|
3300
3301
|
};
|
|
@@ -3302,9 +3303,10 @@ class Delimiters {
|
|
|
3302
3303
|
memory.push(delimiter);
|
|
3303
3304
|
stack.push(index);
|
|
3304
3305
|
} else {
|
|
3306
|
+
// 現状各優先順位は固定
|
|
3307
|
+
|
|
3305
3308
|
stack.push(-1);
|
|
3306
3309
|
}
|
|
3307
|
-
// 現状各優先順位は固定
|
|
3308
3310
|
}
|
|
3309
3311
|
}
|
|
3310
3312
|
pop(count) {
|
|
@@ -3349,7 +3351,7 @@ class Delimiters {
|
|
|
3349
3351
|
delimiters[indexes[i]].state = true;
|
|
3350
3352
|
}
|
|
3351
3353
|
}
|
|
3352
|
-
|
|
3354
|
+
test(input) {
|
|
3353
3355
|
const {
|
|
3354
3356
|
precedence
|
|
3355
3357
|
} = input;
|
|
@@ -3359,7 +3361,7 @@ class Delimiters {
|
|
|
3359
3361
|
for (let i = delimiters.length; i--;) {
|
|
3360
3362
|
const delimiter = delimiters[i];
|
|
3361
3363
|
if (delimiter.precedence <= precedence || !delimiter.state) continue;
|
|
3362
|
-
switch (delimiter.
|
|
3364
|
+
switch (delimiter.tester(input)) {
|
|
3363
3365
|
case true:
|
|
3364
3366
|
return true;
|
|
3365
3367
|
case false:
|
|
@@ -3373,7 +3375,7 @@ class Delimiters {
|
|
|
3373
3375
|
}
|
|
3374
3376
|
exports.Delimiters = Delimiters;
|
|
3375
3377
|
function matcher(pattern, advance, after) {
|
|
3376
|
-
const count = typeof pattern === 'object' ? /[^^\\*+][*+]/.test(pattern.source) : false;
|
|
3378
|
+
const count = typeof pattern === 'object' ? /[^^\\*+][*+]|{\d+,}/.test(pattern.source) : false;
|
|
3377
3379
|
switch (typeof pattern) {
|
|
3378
3380
|
case 'string':
|
|
3379
3381
|
if (pattern === '') return () => new parser_1.List([new parser_1.Node(pattern)]);
|
|
@@ -3411,7 +3413,7 @@ function matcher(pattern, advance, after) {
|
|
|
3411
3413
|
}
|
|
3412
3414
|
exports.matcher = matcher;
|
|
3413
3415
|
function tester(pattern, advance, after) {
|
|
3414
|
-
const count = typeof pattern === 'object' ? /[^^\\*+][*+]/.test(pattern.source) : false;
|
|
3416
|
+
const count = typeof pattern === 'object' ? /[^^\\*+][*+]|{\d+,}/.test(pattern.source) : false;
|
|
3415
3417
|
switch (typeof pattern) {
|
|
3416
3418
|
case 'string':
|
|
3417
3419
|
if (pattern === '') return () => new parser_1.List();
|
|
@@ -3690,12 +3692,14 @@ exports.constraint = exports.state = exports.precedence = exports.recursions = e
|
|
|
3690
3692
|
const alias_1 = __webpack_require__(5413);
|
|
3691
3693
|
const assign_1 = __webpack_require__(9888);
|
|
3692
3694
|
function reset(base, parser) {
|
|
3695
|
+
const clock = base.resources?.clock;
|
|
3696
|
+
const recursions = base.resources?.recursions;
|
|
3693
3697
|
return input => {
|
|
3694
3698
|
const context = input;
|
|
3695
3699
|
// @ts-expect-error
|
|
3696
3700
|
context.resources ??= {
|
|
3697
|
-
clock
|
|
3698
|
-
recursions:
|
|
3701
|
+
clock,
|
|
3702
|
+
recursions: recursions?.slice()
|
|
3699
3703
|
};
|
|
3700
3704
|
context.backtracks = {};
|
|
3701
3705
|
return parser(input);
|
|
@@ -3885,7 +3889,7 @@ function inits(parsers) {
|
|
|
3885
3889
|
let nodes;
|
|
3886
3890
|
for (let len = parsers.length, i = 0; i < len; ++i) {
|
|
3887
3891
|
if (context.position === source.length) break;
|
|
3888
|
-
if (context.delimiters.
|
|
3892
|
+
if (context.delimiters.test(input)) break;
|
|
3889
3893
|
const result = parsers[i](input);
|
|
3890
3894
|
if (result === undefined) break;
|
|
3891
3895
|
nodes = nodes?.import(result) ?? result;
|
|
@@ -3918,7 +3922,7 @@ function sequence(parsers) {
|
|
|
3918
3922
|
let nodes;
|
|
3919
3923
|
for (let len = parsers.length, i = 0; i < len; ++i) {
|
|
3920
3924
|
if (context.position === source.length) return;
|
|
3921
|
-
if (context.delimiters.
|
|
3925
|
+
if (context.delimiters.test(input)) return;
|
|
3922
3926
|
const result = parsers[i](input);
|
|
3923
3927
|
if (result === undefined) return;
|
|
3924
3928
|
nodes = nodes?.import(result) ?? result;
|
|
@@ -3952,10 +3956,10 @@ function some(parser, delimiter, after, delimiters, limit = -1) {
|
|
|
3952
3956
|
delimiters = after;
|
|
3953
3957
|
after = undefined;
|
|
3954
3958
|
}
|
|
3955
|
-
const match = delimiter_1.Delimiters.
|
|
3959
|
+
const match = delimiter_1.Delimiters.tester(delimiter, after);
|
|
3956
3960
|
const delims = delimiters?.map(([delimiter, precedence]) => ({
|
|
3957
3961
|
signature: delimiter_1.Delimiters.signature(delimiter),
|
|
3958
|
-
|
|
3962
|
+
tester: delimiter_1.Delimiters.tester(delimiter),
|
|
3959
3963
|
precedence
|
|
3960
3964
|
}));
|
|
3961
3965
|
return input => {
|
|
@@ -3970,7 +3974,7 @@ function some(parser, delimiter, after, delimiters, limit = -1) {
|
|
|
3970
3974
|
// whileは数倍遅い
|
|
3971
3975
|
for (const len = source.length; context.position < len;) {
|
|
3972
3976
|
if (match(input)) break;
|
|
3973
|
-
if (context.delimiters.
|
|
3977
|
+
if (context.delimiters.test(input)) break;
|
|
3974
3978
|
const result = parser(input);
|
|
3975
3979
|
if (result === undefined) break;
|
|
3976
3980
|
nodes = nodes?.import(result) ?? result;
|
|
@@ -4153,19 +4157,18 @@ const context_1 = __webpack_require__(8669);
|
|
|
4153
4157
|
const parser_1 = __webpack_require__(605);
|
|
4154
4158
|
const segment_1 = __webpack_require__(3967);
|
|
4155
4159
|
const block_1 = __webpack_require__(7099);
|
|
4156
|
-
const normalize_1 = __webpack_require__(4490);
|
|
4157
4160
|
const header_1 = __webpack_require__(3652);
|
|
4158
4161
|
const figure_1 = __webpack_require__(1657);
|
|
4159
4162
|
const note_1 = __webpack_require__(165);
|
|
4160
4163
|
const url_1 = __webpack_require__(1904);
|
|
4161
4164
|
const array_1 = __webpack_require__(6876);
|
|
4162
4165
|
function bind(target, settings) {
|
|
4163
|
-
const
|
|
4166
|
+
const options = {
|
|
4164
4167
|
...settings,
|
|
4165
4168
|
host: settings.host ?? new url_1.ReadonlyURL(location.pathname, location.origin)
|
|
4166
|
-
}
|
|
4167
|
-
if (
|
|
4168
|
-
if (
|
|
4169
|
+
};
|
|
4170
|
+
if (options.id?.match(/[^0-9a-z/-]/i)) throw new Error('Invalid ID: ID must be alphanumeric');
|
|
4171
|
+
if (options.host?.origin === 'null') throw new Error(`Invalid host: ${options.host.href}`);
|
|
4169
4172
|
const blocks = [];
|
|
4170
4173
|
const adds = [];
|
|
4171
4174
|
const dels = [];
|
|
@@ -4179,13 +4182,12 @@ function bind(target, settings) {
|
|
|
4179
4182
|
function* parse(source) {
|
|
4180
4183
|
if (settings.chunk && revision) throw new Error('Chunks cannot be updated');
|
|
4181
4184
|
const url = (0, header_1.headers)(source).find(field => field.toLowerCase().startsWith('url:'))?.slice(4).trim() ?? '';
|
|
4182
|
-
source = (0, normalize_1.normalize)(source);
|
|
4183
4185
|
// @ts-expect-error
|
|
4184
|
-
|
|
4186
|
+
options.url = url ? new url_1.ReadonlyURL(url) : undefined;
|
|
4185
4187
|
const rev = revision = Symbol();
|
|
4186
4188
|
const sourceSegments = [];
|
|
4187
4189
|
const sourceSegmentAttrs = [];
|
|
4188
|
-
for (const [seg, attr] of (0, segment_1.segment)(source)) {
|
|
4190
|
+
for (const [seg, attr] of (0, segment_1.segment)(source, true)) {
|
|
4189
4191
|
sourceSegments.push(seg);
|
|
4190
4192
|
sourceSegmentAttrs.push(attr);
|
|
4191
4193
|
yield {
|
|
@@ -4208,16 +4210,16 @@ function bind(target, settings) {
|
|
|
4208
4210
|
const base = next(head);
|
|
4209
4211
|
let index = head;
|
|
4210
4212
|
// @ts-expect-error
|
|
4211
|
-
|
|
4213
|
+
options.header = true;
|
|
4212
4214
|
for (; index < sourceSegments.length - last; ++index) {
|
|
4213
|
-
const
|
|
4214
|
-
|
|
4215
|
-
const es = (0, block_1.block)((0, parser_1.input)(
|
|
4215
|
+
const seg = sourceSegments[index];
|
|
4216
|
+
options.segment = sourceSegmentAttrs[index] | 1 /* Segment.write */;
|
|
4217
|
+
const es = (0, block_1.block)((0, parser_1.input)(seg, new context_1.Context(options))).foldl((acc, {
|
|
4216
4218
|
value
|
|
4217
|
-
}) => void acc.push(value) || acc, [])
|
|
4219
|
+
}) => void acc.push(value) || acc, []);
|
|
4218
4220
|
// @ts-expect-error
|
|
4219
|
-
|
|
4220
|
-
blocks.length === index ? blocks.push([
|
|
4221
|
+
options.header = false;
|
|
4222
|
+
blocks.length === index ? blocks.push([seg, es, url]) : blocks.splice(index, 0, [seg, es, url]);
|
|
4221
4223
|
if (es.length === 0) continue;
|
|
4222
4224
|
// All deletion processes always run after all addition processes have done.
|
|
4223
4225
|
// Therefore any `base` node will never be unavailable by deletions until all the dependent `el` nodes are added.
|
|
@@ -4270,7 +4272,7 @@ function bind(target, settings) {
|
|
|
4270
4272
|
if (rev !== revision) return yield {
|
|
4271
4273
|
type: 'cancel'
|
|
4272
4274
|
};
|
|
4273
|
-
for (const el of (0, figure_1.figure)(next(0)?.parentNode ?? target, settings.notes,
|
|
4275
|
+
for (const el of (0, figure_1.figure)(next(0)?.parentNode ?? target, settings.notes, options)) {
|
|
4274
4276
|
el ? yield {
|
|
4275
4277
|
type: 'figure',
|
|
4276
4278
|
value: el
|
|
@@ -4281,7 +4283,7 @@ function bind(target, settings) {
|
|
|
4281
4283
|
type: 'cancel'
|
|
4282
4284
|
};
|
|
4283
4285
|
}
|
|
4284
|
-
for (const el of (0, note_1.note)(next(0)?.parentNode ?? target, settings.notes,
|
|
4286
|
+
for (const el of (0, note_1.note)(next(0)?.parentNode ?? target, settings.notes, options, bottom)) {
|
|
4285
4287
|
el ? yield {
|
|
4286
4288
|
type: 'note',
|
|
4287
4289
|
value: el
|
|
@@ -4397,7 +4399,7 @@ function header(source) {
|
|
|
4397
4399
|
exports.header = header;
|
|
4398
4400
|
function headers(source) {
|
|
4399
4401
|
const [el] = parse(source);
|
|
4400
|
-
return el?.textContent.trimEnd().slice(el.firstChild.firstChild.textContent.length).split(
|
|
4402
|
+
return el?.textContent.trimEnd().slice(el.firstChild.firstChild.textContent.length).split(/\r?\n/) ?? [];
|
|
4401
4403
|
}
|
|
4402
4404
|
exports.headers = headers;
|
|
4403
4405
|
function parse(source) {
|
|
@@ -4505,39 +4507,39 @@ const parser_1 = __webpack_require__(605);
|
|
|
4505
4507
|
const context_1 = __webpack_require__(8669);
|
|
4506
4508
|
const segment_1 = __webpack_require__(3967);
|
|
4507
4509
|
const block_1 = __webpack_require__(7099);
|
|
4508
|
-
const normalize_1 = __webpack_require__(4490);
|
|
4509
4510
|
const header_1 = __webpack_require__(3652);
|
|
4510
4511
|
const figure_1 = __webpack_require__(1657);
|
|
4511
4512
|
const note_1 = __webpack_require__(165);
|
|
4512
4513
|
const url_1 = __webpack_require__(1904);
|
|
4513
4514
|
const dom_1 = __webpack_require__(394);
|
|
4514
|
-
function parse(source,
|
|
4515
|
+
function parse(source, opts = {}, options) {
|
|
4515
4516
|
const url = (0, header_1.headers)(source).find(field => field.toLowerCase().startsWith('url:'))?.slice(4).trim() ?? '';
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
if (
|
|
4526
|
-
if (context.host?.origin === 'null') throw new Error(`Invalid host: ${context.host.href}`);
|
|
4517
|
+
options = {
|
|
4518
|
+
host: opts.host ?? options?.host ?? new url_1.ReadonlyURL(location.pathname, location.origin),
|
|
4519
|
+
url: url ? new url_1.ReadonlyURL(url) : options?.url,
|
|
4520
|
+
id: opts.id ?? options?.id,
|
|
4521
|
+
local: opts.local ?? options?.local ?? false,
|
|
4522
|
+
caches: options?.caches,
|
|
4523
|
+
resources: options?.resources
|
|
4524
|
+
};
|
|
4525
|
+
if (options.id?.match(/[^0-9a-z/-]/i)) throw new Error('Invalid ID: ID must be alphanumeric');
|
|
4526
|
+
if (options.host?.origin === 'null') throw new Error(`Invalid host: ${options.host.href}`);
|
|
4527
4527
|
const node = (0, dom_1.frag)();
|
|
4528
4528
|
// @ts-expect-error
|
|
4529
|
-
|
|
4530
|
-
for (const [seg, attr] of (0, segment_1.segment)(source)) {
|
|
4531
|
-
|
|
4532
|
-
|
|
4529
|
+
options.header = true;
|
|
4530
|
+
for (const [seg, attr] of (0, segment_1.segment)(source, !options.local)) {
|
|
4531
|
+
options.segment = attr | 1 /* Segment.write */;
|
|
4532
|
+
const es = (0, block_1.block)((0, parser_1.input)(seg, new context_1.Context(options))).foldl((acc, {
|
|
4533
4533
|
value
|
|
4534
|
-
}) => void acc.push(value) || acc, [])
|
|
4534
|
+
}) => void acc.push(value) || acc, []);
|
|
4535
4535
|
// @ts-expect-error
|
|
4536
|
-
|
|
4536
|
+
options.header = false;
|
|
4537
|
+
if (es.length === 0) continue;
|
|
4538
|
+
node.append(...es);
|
|
4537
4539
|
}
|
|
4538
|
-
if (
|
|
4539
|
-
for (const _ of (0, figure_1.figure)(node,
|
|
4540
|
-
for (const _ of (0, note_1.note)(node,
|
|
4540
|
+
if (opts.test) return node;
|
|
4541
|
+
for (const _ of (0, figure_1.figure)(node, opts.notes, options));
|
|
4542
|
+
for (const _ of (0, note_1.note)(node, opts.notes, options));
|
|
4541
4543
|
return node;
|
|
4542
4544
|
}
|
|
4543
4545
|
exports.parse = parse;
|
|
@@ -4573,7 +4575,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
4573
4575
|
exports.block = void 0;
|
|
4574
4576
|
const parser_1 = __webpack_require__(605);
|
|
4575
4577
|
const combinator_1 = __webpack_require__(3484);
|
|
4576
|
-
const segment_1 = __webpack_require__(3967);
|
|
4577
4578
|
const header_1 = __webpack_require__(3009);
|
|
4578
4579
|
const source_1 = __webpack_require__(8745);
|
|
4579
4580
|
const pagebreak_1 = __webpack_require__(2946);
|
|
@@ -4596,14 +4597,7 @@ const reply_1 = __webpack_require__(3832);
|
|
|
4596
4597
|
const paragraph_1 = __webpack_require__(4330);
|
|
4597
4598
|
const random_1 = __webpack_require__(3158);
|
|
4598
4599
|
const dom_1 = __webpack_require__(394);
|
|
4599
|
-
exports.block = (0, combinator_1.
|
|
4600
|
-
resources: {
|
|
4601
|
-
// バックトラックのせいで文字数制限を受けないようにする。
|
|
4602
|
-
clock: segment_1.MAX_SEGMENT_SIZE * 6 + 1,
|
|
4603
|
-
recursions: [5 || 0 /* Recursion.block */, 20 || 0 /* Recursion.blockquote */, 40 || 0 /* Recursion.listitem */, 20 || 0 /* Recursion.inline */, 20 || 0 /* Recursion.annotation */, 20 || 0 /* Recursion.bracket */, 20 || 0 /* Recursion.terminal */]
|
|
4604
|
-
},
|
|
4605
|
-
backtracks: {}
|
|
4606
|
-
}, error((0, combinator_1.union)([source_1.emptysegment, input => {
|
|
4600
|
+
exports.block = error((0, combinator_1.union)([source_1.emptysegment, input => {
|
|
4607
4601
|
const {
|
|
4608
4602
|
source,
|
|
4609
4603
|
position,
|
|
@@ -4618,8 +4612,8 @@ exports.block = (0, combinator_1.reset)({
|
|
|
4618
4612
|
case 10 /* Segment.figure */:
|
|
4619
4613
|
return (0, figure_1.figure)(input);
|
|
4620
4614
|
}
|
|
4621
|
-
const
|
|
4622
|
-
switch (
|
|
4615
|
+
const char = source[position];
|
|
4616
|
+
switch (char) {
|
|
4623
4617
|
case "\u0007" /* Command.Error */:
|
|
4624
4618
|
throw new Error((0, combinator_1.firstline)(source, position + 1).trimEnd());
|
|
4625
4619
|
case '=':
|
|
@@ -4662,11 +4656,11 @@ exports.block = (0, combinator_1.reset)({
|
|
|
4662
4656
|
case '(':
|
|
4663
4657
|
return (0, olist_1.olist)(input);
|
|
4664
4658
|
default:
|
|
4665
|
-
if ('0' <=
|
|
4659
|
+
if ('0' <= char && char <= '9') return (0, olist_1.olist)(input);
|
|
4666
4660
|
}
|
|
4667
|
-
}, paragraph_1.paragraph]))
|
|
4661
|
+
}, paragraph_1.paragraph]));
|
|
4668
4662
|
function error(parser) {
|
|
4669
|
-
const reg = new RegExp(String.raw`^${"\u0007" /* Command.Error */}[^\n]*\n`);
|
|
4663
|
+
const reg = new RegExp(String.raw`^${"\u0007" /* Command.Error */}[^\r\n]*\r?\n`);
|
|
4670
4664
|
return (0, combinator_1.recover)(parser, ({
|
|
4671
4665
|
source,
|
|
4672
4666
|
position,
|
|
@@ -4741,7 +4735,7 @@ const combinator_1 = __webpack_require__(3484);
|
|
|
4741
4735
|
const autolink_1 = __webpack_require__(1671);
|
|
4742
4736
|
const util_1 = __webpack_require__(4992);
|
|
4743
4737
|
const dom_1 = __webpack_require__(394);
|
|
4744
|
-
const opener = /(`{3,})(?!`)([^\n]*)(?:$|\n)/y;
|
|
4738
|
+
const opener = /(`{3,})(?!`)([^\r\n]*)(?:$|\r?\n)/y;
|
|
4745
4739
|
const language = /^[0-9a-z]+(?:-[a-z][0-9a-z]*)*$/i;
|
|
4746
4740
|
exports.segment = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 300)));
|
|
4747
4741
|
exports.segment_ = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 300, false)), false);
|
|
@@ -4972,7 +4966,7 @@ const table_1 = __webpack_require__(3646);
|
|
|
4972
4966
|
const blockquote_1 = __webpack_require__(5885);
|
|
4973
4967
|
const placeholder_1 = __webpack_require__(4091);
|
|
4974
4968
|
const inline_1 = __webpack_require__(7973);
|
|
4975
|
-
exports.segment = (0, combinator_1.block)((0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.close)(label_1.segment, /(?!\S).*\n/y)), (0, combinator_1.union)([codeblock_1.segment, mathblock_1.segment, table_1.segment, blockquote_1.segment, placeholder_1.segment, (0, combinator_1.some)(source_1.contentline)])]), true, 8 /* Segment.fig */);
|
|
4969
|
+
exports.segment = (0, combinator_1.block)((0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.close)(label_1.segment, /(?!\S).*\r?\n/y)), (0, combinator_1.union)([codeblock_1.segment, mathblock_1.segment, table_1.segment, blockquote_1.segment, placeholder_1.segment, (0, combinator_1.some)(source_1.contentline)])]), true, 8 /* Segment.fig */);
|
|
4976
4970
|
exports.fig = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.verify)((0, combinator_1.convert)((source, context) => {
|
|
4977
4971
|
// Bug: TypeScript
|
|
4978
4972
|
const fence = (/^[^\n]*\n!?>+ /.test(source) && source.match(/^~{3,}(?=[^\S\n]*$)/gm) || []).reduce((max, fence) => fence > max ? fence : max, '~~') + '~';
|
|
@@ -5046,7 +5040,7 @@ const visibility_1 = __webpack_require__(6364);
|
|
|
5046
5040
|
const util_1 = __webpack_require__(4992);
|
|
5047
5041
|
const memoize_1 = __webpack_require__(6925);
|
|
5048
5042
|
const dom_1 = __webpack_require__(394);
|
|
5049
|
-
exports.segment = (0, combinator_1.block)((0, combinator_1.match)(/(~{3,})(?:figure )?(?=\[?\$)/y, (0, memoize_1.memoize)(([, fence], closer = new RegExp(String.raw`${fence}[^\S\n]*(?:$|\n)`, 'y')) => (0, combinator_1.close)((0, combinator_1.sequence)([source_1.contentline, (0, combinator_1.inits)([
|
|
5043
|
+
exports.segment = (0, combinator_1.block)((0, combinator_1.match)(/(~{3,})(?:figure )?(?=\[?\$)/y, (0, memoize_1.memoize)(([, fence], closer = new RegExp(String.raw`${fence}[^\S\r\n]*(?:$|\r?\n)`, 'y')) => (0, combinator_1.close)((0, combinator_1.sequence)([source_1.contentline, (0, combinator_1.inits)([
|
|
5050
5044
|
// All parsers which can include closing terms.
|
|
5051
5045
|
(0, combinator_1.union)([codeblock_1.segment_, mathblock_1.segment_, table_2.segment_, blockquote_1.segment, placeholder_1.segment_, (0, combinator_1.some)(source_1.contentline, closer)]), source_1.emptyline, (0, combinator_1.union)([source_1.emptyline, (0, combinator_1.some)(source_1.contentline, closer)])])]), closer), ([, fence]) => fence.length - 1, [], 2 ** 4 - 1)), true, 10 /* Segment.figure */);
|
|
5052
5046
|
exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.fmap)((0, combinator_1.convert)(source => source.slice(source.match(/^~+(?:\w+\s+)?/)[0].length, source.trimEnd().lastIndexOf('\n')), (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.sequence)([label_1.label, (0, source_1.str)(/(?!\S).*\n/y)])), (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([ulist_1.ulist, olist_1.olist, table_1.table, codeblock_1.codeblock, mathblock_1.mathblock, example_1.example, table_2.table, blockquote_1.blockquote, placeholder_1.placeholder, (0, combinator_1.line)(inline_1.media), (0, combinator_1.line)(inline_1.lineshortmedia)])), source_1.emptyline, (0, combinator_1.block)((0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))))])])), nodes => {
|
|
@@ -5156,7 +5150,7 @@ exports.message = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_
|
|
|
5156
5150
|
return new parser_1.List([new parser_1.Node((0, dom_1.html)('section', {
|
|
5157
5151
|
class: `message`,
|
|
5158
5152
|
'data-type': type
|
|
5159
|
-
}, [...(0, segment_1.segment)(body)].reduce((acc, [seg]) => (0, array_1.push)(acc, (0, util_1.unwrap)(content((0, parser_1.subinput)(seg, context)))), [(0, dom_1.html)('h1', title(type))])))]);
|
|
5153
|
+
}, [...(0, segment_1.segment)(body, false)].reduce((acc, [seg]) => (0, array_1.push)(acc, (0, util_1.unwrap)(content((0, parser_1.subinput)(seg, context)))), [(0, dom_1.html)('h1', title(type))])))]);
|
|
5160
5154
|
}));
|
|
5161
5155
|
function title(type) {
|
|
5162
5156
|
switch (type) {
|
|
@@ -5187,7 +5181,7 @@ const parser_1 = __webpack_require__(605);
|
|
|
5187
5181
|
const combinator_1 = __webpack_require__(3484);
|
|
5188
5182
|
const util_1 = __webpack_require__(4992);
|
|
5189
5183
|
const dom_1 = __webpack_require__(394);
|
|
5190
|
-
const opener = /(~{3,})(?!~)[^\n]*(?:$|\n)/y;
|
|
5184
|
+
const opener = /(~{3,})(?!~)[^\r\n]*(?:$|\r?\n)/y;
|
|
5191
5185
|
exports.segment = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 300)));
|
|
5192
5186
|
exports.segment_ = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 300, false)), false);
|
|
5193
5187
|
exports.placeholder = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(opener, Infinity), nodes => {
|
|
@@ -5220,7 +5214,7 @@ const visibility_1 = __webpack_require__(6364);
|
|
|
5220
5214
|
const alias_1 = __webpack_require__(5413);
|
|
5221
5215
|
const array_1 = __webpack_require__(6876);
|
|
5222
5216
|
const dom_1 = __webpack_require__(394);
|
|
5223
|
-
const opener = /(~{3,})table(?:\/(\S+))?(?!\S)([^\n]*)(?:$|\n)/y;
|
|
5217
|
+
const opener = /(~{3,})table(?:\/(\S+))?(?!\S)([^\r\n]*)(?:$|\r?\n)/y;
|
|
5224
5218
|
exports.segment = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 10000)));
|
|
5225
5219
|
exports.segment_ = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 10000, false)), false);
|
|
5226
5220
|
exports.table = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(opener, 10000),
|
|
@@ -5477,7 +5471,7 @@ const source_1 = __webpack_require__(8745);
|
|
|
5477
5471
|
const visibility_1 = __webpack_require__(6364);
|
|
5478
5472
|
const util_1 = __webpack_require__(4992);
|
|
5479
5473
|
const dom_1 = __webpack_require__(394);
|
|
5480
|
-
exports.segment = (0, combinator_1.block)((0, combinator_1.focus)(/#+ +\S[^\n]*(?:\n#+(?=$|
|
|
5474
|
+
exports.segment = (0, combinator_1.block)((0, combinator_1.focus)(/#+ +\S[^\r\n]*(?:\r?\n#+(?=$| |\r?\n)[^\r\n]*)*(?:$|\r?\n)/y, input => {
|
|
5481
5475
|
const context = input;
|
|
5482
5476
|
const {
|
|
5483
5477
|
source,
|
|
@@ -5554,7 +5548,7 @@ const parser_1 = __webpack_require__(605);
|
|
|
5554
5548
|
const combinator_1 = __webpack_require__(3484);
|
|
5555
5549
|
const util_1 = __webpack_require__(4992);
|
|
5556
5550
|
const dom_1 = __webpack_require__(394);
|
|
5557
|
-
const opener = /(\${2,})(?!\$)([^\n]*)(?:$|\n)/y;
|
|
5551
|
+
const opener = /(\${2,})(?!\$)([^\r\n]*)(?:$|\r?\n)/y;
|
|
5558
5552
|
exports.segment = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 300)));
|
|
5559
5553
|
exports.segment_ = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 300, false)), false);
|
|
5560
5554
|
exports.mathblock = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(opener, 300),
|
|
@@ -6010,8 +6004,10 @@ function format(list) {
|
|
|
6010
6004
|
Object.defineProperty(exports, "__esModule", ({
|
|
6011
6005
|
value: true
|
|
6012
6006
|
}));
|
|
6013
|
-
exports.CmdRegExp = exports.Context = void 0;
|
|
6007
|
+
exports.CmdRegExp = exports.Context = exports.MAX_INPUT_SIZE = exports.MAX_SEGMENT_SIZE = void 0;
|
|
6014
6008
|
const parser_1 = __webpack_require__(605);
|
|
6009
|
+
exports.MAX_SEGMENT_SIZE = 100_000; // 100,000 bytes (Max value size of FDB)
|
|
6010
|
+
exports.MAX_INPUT_SIZE = exports.MAX_SEGMENT_SIZE * 10;
|
|
6015
6011
|
class Context extends parser_1.Context {
|
|
6016
6012
|
constructor(options = {}) {
|
|
6017
6013
|
super(options);
|
|
@@ -6027,6 +6023,11 @@ class Context extends parser_1.Context {
|
|
|
6027
6023
|
id,
|
|
6028
6024
|
caches
|
|
6029
6025
|
} = options;
|
|
6026
|
+
this.resources ??= {
|
|
6027
|
+
// バックトラックのせいで文字数制限を受けないようにする。
|
|
6028
|
+
clock: exports.MAX_SEGMENT_SIZE * (6 + 1),
|
|
6029
|
+
recursions: [5 || 0 /* Recursion.block */, 20 || 0 /* Recursion.blockquote */, 40 || 0 /* Recursion.listitem */, 20 || 0 /* Recursion.inline */, 20 || 0 /* Recursion.annotation */, 20 || 0 /* Recursion.bracket */, 20 || 0 /* Recursion.terminal */]
|
|
6030
|
+
};
|
|
6030
6031
|
this.segment = segment ?? 0 /* Segment.unknown */;
|
|
6031
6032
|
this.local = local ?? false;
|
|
6032
6033
|
this.sequential = sequential ?? false;
|
|
@@ -6079,7 +6080,7 @@ const source_1 = __webpack_require__(8745);
|
|
|
6079
6080
|
const util_1 = __webpack_require__(4992);
|
|
6080
6081
|
const normalize_1 = __webpack_require__(4490);
|
|
6081
6082
|
const dom_1 = __webpack_require__(394);
|
|
6082
|
-
exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^\S\n]*\n(?=\S)/y, (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(context => context.header, (0, combinator_1.focus)(/(---+)[^\S\n]*\n(?:[a-z][0-9a-z]*(?:-[0-9a-z]+)*:[ \t]+\S[^\n]*\n){1,100}\1[^\S\n]*(?:$|\n)/yi, (0, combinator_1.convert)(source => (0, normalize_1.normalize)(source.slice(source.indexOf('\n') + 1, source.trimEnd().lastIndexOf('\n'))), (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([field])), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('aside', {
|
|
6083
|
+
exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^\S\r\n]*\r?\n(?=\S)/y, (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(context => context.header, (0, combinator_1.focus)(/(---+)[^\S\r\n]*\r?\n(?:[a-z][0-9a-z]*(?:-[0-9a-z]+)*:[ \t]+\S[^\r\n]*\r?\n){1,100}\1[^\S\r\n]*(?:$|\r?\n)/yi, (0, combinator_1.convert)(source => (0, normalize_1.normalize)(source.slice(source.indexOf('\n') + 1, source.trimEnd().lastIndexOf('\n'))), (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([field])), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('aside', {
|
|
6083
6084
|
class: 'header'
|
|
6084
6085
|
}, [(0, dom_1.html)('details', {
|
|
6085
6086
|
open: ''
|
|
@@ -6094,7 +6095,7 @@ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^
|
|
|
6094
6095
|
translate: 'no',
|
|
6095
6096
|
...(0, util_1.invalid)('header', 'syntax', 'Invalid syntax')
|
|
6096
6097
|
}, (0, normalize_1.normalize)(source.slice(position))))]);
|
|
6097
|
-
}])), (0, combinator_1.clear)((0, source_1.str)(/[^\S\n]*\n/y))])));
|
|
6098
|
+
}])), (0, combinator_1.clear)((0, source_1.str)(/[^\S\r\n]*\r?\n/y))])));
|
|
6098
6099
|
const field = (0, combinator_1.line)(({
|
|
6099
6100
|
source,
|
|
6100
6101
|
position
|
|
@@ -6181,7 +6182,8 @@ exports.inline = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input =>
|
|
|
6181
6182
|
case '{':
|
|
6182
6183
|
return (0, bracket_1.bracket)(input);
|
|
6183
6184
|
case '<':
|
|
6184
|
-
return (0, html_1.html)(input);
|
|
6185
|
+
if (isAlphabet(source[position + 1])) return (0, html_1.html)(input);
|
|
6186
|
+
break;
|
|
6185
6187
|
case '$':
|
|
6186
6188
|
if (source[position + 1] === '{') return (0, math_1.math)(input);
|
|
6187
6189
|
return (0, label_1.label)(input) || (0, math_1.math)(input);
|
|
@@ -6253,6 +6255,9 @@ Object.defineProperty(exports, "lineshortmedia", ({
|
|
|
6253
6255
|
return shortmedia_1.lineshortmedia;
|
|
6254
6256
|
}
|
|
6255
6257
|
}));
|
|
6258
|
+
function isAlphabet(char) {
|
|
6259
|
+
return 'a' <= char && char <= 'z';
|
|
6260
|
+
}
|
|
6256
6261
|
|
|
6257
6262
|
/***/ },
|
|
6258
6263
|
|
|
@@ -6298,9 +6303,9 @@ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1
|
|
|
6298
6303
|
ns.unshift(new parser_1.Node('('));
|
|
6299
6304
|
ns.push(new parser_1.Node(')'));
|
|
6300
6305
|
return new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
6301
|
-
class:
|
|
6306
|
+
class: (0, bracket_1.bracketname)(context, 1, 1)
|
|
6302
6307
|
}, ['(', (0, dom_1.html)('span', {
|
|
6303
|
-
class:
|
|
6308
|
+
class: (0, bracket_1.bracketname)(context, 2, 2)
|
|
6304
6309
|
}, (0, dom_1.defrag)((0, util_1.unwrap)(ns))), ')']))]);
|
|
6305
6310
|
}
|
|
6306
6311
|
const depth = MAX_DEPTH - (resources?.recursions[4 /* Recursion.annotation */] ?? resources?.recursions.at(-1) ?? MAX_DEPTH);
|
|
@@ -6339,7 +6344,7 @@ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1
|
|
|
6339
6344
|
context.position += 1;
|
|
6340
6345
|
recursion.add(depth);
|
|
6341
6346
|
return new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
6342
|
-
class: '
|
|
6347
|
+
class: 'paren'
|
|
6343
6348
|
}, ['(', (0, dom_1.html)('sup', {
|
|
6344
6349
|
class: 'annotation'
|
|
6345
6350
|
}, [(0, dom_1.html)('span', bs.head.value.childNodes)])]))]);
|
|
@@ -6348,7 +6353,7 @@ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1
|
|
|
6348
6353
|
context.position += 1;
|
|
6349
6354
|
recursion.add(depth);
|
|
6350
6355
|
return new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
6351
|
-
class: '
|
|
6356
|
+
class: 'paren'
|
|
6352
6357
|
}, ['(', (0, dom_1.html)('sup', {
|
|
6353
6358
|
class: 'annotation'
|
|
6354
6359
|
}, [(0, dom_1.html)('span', [bs.head.value])])]))]);
|
|
@@ -6362,7 +6367,7 @@ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1
|
|
|
6362
6367
|
context.range += 1;
|
|
6363
6368
|
}
|
|
6364
6369
|
bs = new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
6365
|
-
class: (0, bracket_1.bracketname)(context,
|
|
6370
|
+
class: (0, bracket_1.bracketname)(context, 2, context.position - position)
|
|
6366
6371
|
}, (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]);
|
|
6367
6372
|
bs.unshift(new parser_1.Node('('));
|
|
6368
6373
|
const cs = parser(context);
|
|
@@ -6370,9 +6375,10 @@ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1
|
|
|
6370
6375
|
cs && bs.import(cs);
|
|
6371
6376
|
bs.push(new parser_1.Node(')'));
|
|
6372
6377
|
context.position += 1;
|
|
6378
|
+
context.range += 1;
|
|
6373
6379
|
}
|
|
6374
6380
|
return new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
6375
|
-
class:
|
|
6381
|
+
class: (0, bracket_1.bracketname)(context, 1, context.position - position)
|
|
6376
6382
|
}, (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]);
|
|
6377
6383
|
})));
|
|
6378
6384
|
const parser = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(1, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]])));
|
|
@@ -6429,8 +6435,8 @@ exports.autolink = (0, combinator_1.lazy)(() => (0, combinator_1.state)(~1 /* St
|
|
|
6429
6435
|
position
|
|
6430
6436
|
} = input;
|
|
6431
6437
|
if (position === source.length) return;
|
|
6432
|
-
const
|
|
6433
|
-
switch (
|
|
6438
|
+
const char = source[position];
|
|
6439
|
+
switch (char) {
|
|
6434
6440
|
case '@':
|
|
6435
6441
|
return (0, account_1.account)(input);
|
|
6436
6442
|
case '#':
|
|
@@ -6456,7 +6462,7 @@ exports.autolink = (0, combinator_1.lazy)(() => (0, combinator_1.state)(~1 /* St
|
|
|
6456
6462
|
}
|
|
6457
6463
|
return (0, url_1.url)(input) || (0, email_1.email)(input);
|
|
6458
6464
|
default:
|
|
6459
|
-
if ((0, text_1.isAlphanumeric)(
|
|
6465
|
+
if ((0, text_1.isAlphanumeric)(char)) return (0, email_1.email)(input);
|
|
6460
6466
|
}
|
|
6461
6467
|
}));
|
|
6462
6468
|
|
|
@@ -6659,7 +6665,7 @@ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combin
|
|
|
6659
6665
|
Object.defineProperty(exports, "__esModule", ({
|
|
6660
6666
|
value: true
|
|
6661
6667
|
}));
|
|
6662
|
-
exports.bracket = exports.bracketname =
|
|
6668
|
+
exports.bracket = exports.bracketname = void 0;
|
|
6663
6669
|
const parser_1 = __webpack_require__(605);
|
|
6664
6670
|
const combinator_1 = __webpack_require__(3484);
|
|
6665
6671
|
const inline_1 = __webpack_require__(7973);
|
|
@@ -6667,17 +6673,12 @@ const link_1 = __webpack_require__(3628);
|
|
|
6667
6673
|
const source_1 = __webpack_require__(8745);
|
|
6668
6674
|
const util_1 = __webpack_require__(4992);
|
|
6669
6675
|
const dom_1 = __webpack_require__(394);
|
|
6670
|
-
|
|
6671
|
-
const indexF = new RegExp(exports.indexA.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => String.fromCodePoint(c.codePointAt(0) + 0xFEE0)), 'y');
|
|
6672
|
-
function bracketname(context, syntax, opener, closer) {
|
|
6676
|
+
function bracketname(context, opener, closer) {
|
|
6673
6677
|
const {
|
|
6674
|
-
source,
|
|
6675
|
-
position,
|
|
6676
6678
|
range,
|
|
6677
6679
|
linebreak
|
|
6678
6680
|
} = context;
|
|
6679
|
-
|
|
6680
|
-
return range - opener - closer === 0 || linebreak === 0 && range - opener - closer <= 16 && syntax.test(source) && syntax.lastIndex === position - closer ? 'paren' : 'bracket';
|
|
6681
|
+
return range - opener - closer === 0 || linebreak === 0 && range - opener - closer <= 16 ? 'paren' : 'bracket';
|
|
6681
6682
|
}
|
|
6682
6683
|
exports.bracketname = bracketname;
|
|
6683
6684
|
exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input => {
|
|
@@ -6703,14 +6704,14 @@ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input =>
|
|
|
6703
6704
|
}
|
|
6704
6705
|
}]));
|
|
6705
6706
|
const p1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
6706
|
-
class: bracketname(context,
|
|
6707
|
+
class: bracketname(context, 1, 1)
|
|
6707
6708
|
}, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
6708
|
-
class: bracketname(context,
|
|
6709
|
+
class: bracketname(context, 1, 0)
|
|
6709
6710
|
}, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs)))))])));
|
|
6710
6711
|
const p2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
6711
|
-
class: bracketname(context,
|
|
6712
|
+
class: bracketname(context, 1, 1)
|
|
6712
6713
|
}, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
6713
|
-
class: bracketname(context,
|
|
6714
|
+
class: bracketname(context, 1, 0)
|
|
6714
6715
|
}, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs)))))])));
|
|
6715
6716
|
const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, [2 | 4 /* Backtrack.common */], ([as, bs = new parser_1.List(), cs], context) => {
|
|
6716
6717
|
const {
|
|
@@ -7283,7 +7284,7 @@ exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.surround)(
|
|
|
7283
7284
|
Object.defineProperty(exports, "__esModule", ({
|
|
7284
7285
|
value: true
|
|
7285
7286
|
}));
|
|
7286
|
-
exports.attributes = exports.attribute = exports.html = void 0;
|
|
7287
|
+
exports.TAGS = exports.attributes = exports.attribute = exports.html = void 0;
|
|
7287
7288
|
const parser_1 = __webpack_require__(605);
|
|
7288
7289
|
const combinator_1 = __webpack_require__(3484);
|
|
7289
7290
|
const inline_1 = __webpack_require__(7973);
|
|
@@ -7301,16 +7302,16 @@ const attrspecs = {
|
|
|
7301
7302
|
};
|
|
7302
7303
|
Object.setPrototypeOf(attrspecs, null);
|
|
7303
7304
|
Object.values(attrspecs).forEach(o => Object.setPrototypeOf(o, null));
|
|
7304
|
-
exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.
|
|
7305
|
+
exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)(
|
|
7305
7306
|
// https://html.spec.whatwg.org/multipage/syntax.html#void-elements
|
|
7306
|
-
(0, source_1.str)(/<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[ >])/y), (0, combinator_1.precedence)(9, (0, combinator_1.some)((0, combinator_1.union)([exports.attribute]))), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Node(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs).import(cs))], new parser_1.List(), new parser_1.List(), context), as.head.value === '<wbr' ? 1 /* Flag.blank */ : 0 /* Flag.none */)]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Node(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs))], new parser_1.List(), new parser_1.List(), context))])), (0, combinator_1.match)(new RegExp(String.raw`<(${TAGS.join('|')})(?=[ >])`, 'y'), (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.precedence)(9, (0, combinator_1.some)(exports.attribute)), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, [], ([as, bs = new parser_1.List(), cs]) => as.import(bs).import(cs), ([as, bs = new parser_1.List()]) => as.import(bs)),
|
|
7307
|
+
(0, source_1.str)(/<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[ >])/y), (0, combinator_1.precedence)(9, (0, combinator_1.some)((0, combinator_1.union)([exports.attribute]))), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Node(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs).import(cs))], new parser_1.List(), new parser_1.List(), context), as.head.value === '<wbr' ? 1 /* Flag.blank */ : 0 /* Flag.none */)]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Node(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs))], new parser_1.List(), new parser_1.List(), context))])), (0, combinator_1.match)(new RegExp(String.raw`<(${exports.TAGS.join('|')})(?=[ >])`, 'y'), (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.precedence)(9, (0, combinator_1.some)(exports.attribute)), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, [], ([as, bs = new parser_1.List(), cs]) => as.import(bs).import(cs), ([as, bs = new parser_1.List()]) => as.import(bs)),
|
|
7307
7308
|
// 不可視のHTML構造が可視構造を変化させるべきでない。
|
|
7308
7309
|
// 可視のHTMLは優先度変更を検討する。
|
|
7309
7310
|
// このため`<>`記号は将来的に共通構造を変化させる可能性があり
|
|
7310
7311
|
// 共通構造を変化させない非構造文字列としては依然としてエスケープを要する。
|
|
7311
|
-
(0, combinator_1.precedence)(0, (0, combinator_1.recursion)(3 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', `</${tag}>`)), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, `</${tag}>`), true)])))), (0, source_1.str)(`</${tag}>`), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Node(elem(tag, true, [...(0, util_1.unwrap)(as)], bs, cs, context))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Node(elem(tag, true, [...(0, util_1.unwrap)(as)], bs, new parser_1.List(), context))])), ([, tag]) => tag,
|
|
7312
|
+
(0, combinator_1.precedence)(0, (0, combinator_1.recursion)(3 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', `</${tag}>`)), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, `</${tag}>`), true)])))), (0, source_1.str)(`</${tag}>`), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Node(elem(tag, true, [...(0, util_1.unwrap)(as)], bs, cs, context))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Node(elem(tag, true, [...(0, util_1.unwrap)(as)], bs, new parser_1.List(), context))])), ([, tag]) => tag2index(tag), Array(exports.TAGS.length))), (0, combinator_1.surround)(
|
|
7312
7313
|
// https://html.spec.whatwg.org/multipage/syntax.html#void-elements
|
|
7313
|
-
(0, source_1.str)(/<[a-z]+(?=[ >])/yi), (0, combinator_1.precedence)(9, (0, combinator_1.some)((0, combinator_1.union)([exports.attribute]))), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Node(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs).import(cs))], new parser_1.List(), new parser_1.List(), context))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Node(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs))], new parser_1.List(), new parser_1.List(), context))]))]))
|
|
7314
|
+
(0, source_1.str)(/<[a-z]+(?=[ >])/yi), (0, combinator_1.precedence)(9, (0, combinator_1.some)((0, combinator_1.union)([exports.attribute]))), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Node(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs).import(cs))], new parser_1.List(), new parser_1.List(), context))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Node(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs))], new parser_1.List(), new parser_1.List(), context))]))]));
|
|
7314
7315
|
exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/ [a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[ >])/yi), (0, source_1.str)(/ [^\s<>]+/y)]);
|
|
7315
7316
|
function elem(tag, content, as, bs, cs, context) {
|
|
7316
7317
|
if (!tags.includes(tag)) return ielem('tag', `Invalid HTML tag name "${tag}"`, context);
|
|
@@ -7362,7 +7363,8 @@ function attributes(syntax, spec, params) {
|
|
|
7362
7363
|
exports.attributes = attributes;
|
|
7363
7364
|
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element
|
|
7364
7365
|
// [...document.querySelectorAll('tbody > tr > td:first-child')].map(el => el.textContent.slice(1, -1))
|
|
7365
|
-
|
|
7366
|
+
exports.TAGS = ["html", "base", "head", "link", "meta", "style", "title", "body", "address", "article", "aside", "footer", "header", "h1", "h2", "h3", "h4", "h5", "h6", "hgroup", "main", "nav", "section", "blockquote", "dd", "div", "dl", "dt", "figcaption", "figure", "hr", "li", "menu", "ol", "p", "pre", "ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn", "em", "i", "kbd", "mark", "q", "rp", "rt", "ruby", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "area", "audio", "img", "map", "track", "video", "embed", "iframe", "object", "picture", "portal", "source", "svg", "math", "canvas", "noscript", "script", "del", "ins", "caption", "col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "button", "datalist", "fieldset", "form", "input", "label", "legend", "meter", "optgroup", "option", "output", "progress", "select", "textarea", "details", "dialog", "summary", "slot", "template", "acronym", "applet", "bgsound", "big", "blink", "center", "content", "dir", "font", "frame", "frameset", "image", "keygen", "marquee", "menuitem", "nobr", "noembed", "noframes", "param", "plaintext", "rb", "rtc", "shadow", "spacer", "strike", "tt", "xmp"];
|
|
7367
|
+
const tag2index = eval(['tag => {', 'switch(tag){', exports.TAGS.map((tag, i) => `case '${tag}':return ${i};`).join(''), 'default: throw new Error();', '}', '}'].join(''));
|
|
7366
7368
|
|
|
7367
7369
|
/***/ },
|
|
7368
7370
|
|
|
@@ -8413,7 +8415,7 @@ function* proc(note, defs) {
|
|
|
8413
8415
|
Object.defineProperty(exports, "__esModule", ({
|
|
8414
8416
|
value: true
|
|
8415
8417
|
}));
|
|
8416
|
-
exports.
|
|
8418
|
+
exports.segment = void 0;
|
|
8417
8419
|
const context_1 = __webpack_require__(8669);
|
|
8418
8420
|
const combinator_1 = __webpack_require__(3484);
|
|
8419
8421
|
const heading_1 = __webpack_require__(2778);
|
|
@@ -8421,9 +8423,8 @@ const codeblock_1 = __webpack_require__(9194);
|
|
|
8421
8423
|
const mathblock_1 = __webpack_require__(4903);
|
|
8422
8424
|
const extension_1 = __webpack_require__(6193);
|
|
8423
8425
|
const source_1 = __webpack_require__(8745);
|
|
8424
|
-
|
|
8425
|
-
|
|
8426
|
-
const parser = (0, combinator_1.union)([(0, combinator_1.some)(source_1.emptysegment, exports.MAX_SEGMENT_SIZE + 1), input => {
|
|
8426
|
+
const api_1 = __webpack_require__(5886);
|
|
8427
|
+
const parser = (0, combinator_1.union)([(0, combinator_1.some)(source_1.emptysegment, context_1.MAX_SEGMENT_SIZE + 1), input => {
|
|
8427
8428
|
const {
|
|
8428
8429
|
source,
|
|
8429
8430
|
position
|
|
@@ -8445,30 +8446,29 @@ const parser = (0, combinator_1.union)([(0, combinator_1.some)(source_1.emptyseg
|
|
|
8445
8446
|
case '#':
|
|
8446
8447
|
return (0, heading_1.segment)(input);
|
|
8447
8448
|
}
|
|
8448
|
-
}, (0, combinator_1.some)(source_1.contentline,
|
|
8449
|
-
function* segment(source) {
|
|
8450
|
-
if (!validate(source,
|
|
8451
|
-
for (let position = 0
|
|
8449
|
+
}, (0, combinator_1.some)(source_1.contentline, context_1.MAX_SEGMENT_SIZE + 1)]);
|
|
8450
|
+
function* segment(source, initial = true) {
|
|
8451
|
+
if (initial && !validate(source, context_1.MAX_INPUT_SIZE)) return yield [`${"\u0007" /* Command.Error */}Too large input over ${context_1.MAX_INPUT_SIZE.toLocaleString('en')} bytes.\n${source.slice(0, 1001)}`, 0 /* Segment.unknown */];
|
|
8452
|
+
for (let position = 0, len = source.length; position < len;) {
|
|
8452
8453
|
const context = new context_1.Context({
|
|
8453
8454
|
source,
|
|
8454
8455
|
position
|
|
8455
8456
|
});
|
|
8456
8457
|
const result = parser(context);
|
|
8457
|
-
const segs = result.length
|
|
8458
|
+
const segs = result.length === 0 ? [source.slice(position, context.position)] : result.foldl((acc, {
|
|
8458
8459
|
value
|
|
8459
|
-
}) =>
|
|
8460
|
+
}) => (acc.push(value), acc), []);
|
|
8460
8461
|
position = context.position;
|
|
8461
8462
|
for (let i = 0; i < segs.length; ++i) {
|
|
8462
8463
|
const seg = segs[i];
|
|
8463
|
-
validate(seg,
|
|
8464
|
+
initial && !validate(seg, context_1.MAX_SEGMENT_SIZE) ? yield [`${"\u0007" /* Command.Error */}Too large segment over ${context_1.MAX_SEGMENT_SIZE.toLocaleString('en')} bytes.\n${seg}`, 0 /* Segment.unknown */] : yield [initial ? (0, api_1.normalize)(seg) : seg, context.segment];
|
|
8464
8465
|
}
|
|
8465
8466
|
}
|
|
8466
8467
|
}
|
|
8467
8468
|
exports.segment = segment;
|
|
8468
8469
|
function validate(source, size) {
|
|
8469
|
-
return source.length <= size /
|
|
8470
|
+
return source.length <= size / 2 || source.length <= size && new Blob([source]).size <= size;
|
|
8470
8471
|
}
|
|
8471
|
-
exports.validate = validate;
|
|
8472
8472
|
|
|
8473
8473
|
/***/ },
|
|
8474
8474
|
|
|
@@ -8592,7 +8592,6 @@ const escsource = context => {
|
|
|
8592
8592
|
return new parser_1.List([new parser_1.Node(source.slice(position, position + 2))]);
|
|
8593
8593
|
}
|
|
8594
8594
|
case '\r':
|
|
8595
|
-
(0, combinator_1.consume)(-1, context);
|
|
8596
8595
|
return new parser_1.List();
|
|
8597
8596
|
case '\n':
|
|
8598
8597
|
context.linebreak ||= source.length - position;
|
|
@@ -8632,7 +8631,7 @@ const anyline = input => {
|
|
|
8632
8631
|
return new parser_1.List();
|
|
8633
8632
|
};
|
|
8634
8633
|
exports.anyline = anyline;
|
|
8635
|
-
const regEmptyline = /[^\S\n]*(?:$|\n)/y;
|
|
8634
|
+
const regEmptyline = /[^\S\r\n]*(?:$|\r?\n)/y;
|
|
8636
8635
|
const emptyline = input => {
|
|
8637
8636
|
const context = input;
|
|
8638
8637
|
const {
|
|
@@ -8667,12 +8666,13 @@ const emptysegment = input => {
|
|
|
8667
8666
|
};
|
|
8668
8667
|
exports.emptysegment = emptysegment;
|
|
8669
8668
|
function eoel(source, position) {
|
|
8670
|
-
|
|
8669
|
+
const char = source[position];
|
|
8670
|
+
if (char === '\n' || char === '\r' && source[position + 1] === '\n') return position + 1;
|
|
8671
8671
|
regEmptyline.lastIndex = position;
|
|
8672
8672
|
regEmptyline.test(source);
|
|
8673
8673
|
return regEmptyline.lastIndex || position;
|
|
8674
8674
|
}
|
|
8675
|
-
const regContentline = /[^\S\n]*\S[^\n]*(?:$|\n)/y;
|
|
8675
|
+
const regContentline = /[^\S\r\n]*\S[^\r\n]*(?:$|\r?\n)/y;
|
|
8676
8676
|
const contentline = input => {
|
|
8677
8677
|
const context = input;
|
|
8678
8678
|
const {
|
|
@@ -8680,7 +8680,8 @@ const contentline = input => {
|
|
|
8680
8680
|
position
|
|
8681
8681
|
} = context;
|
|
8682
8682
|
if (position === source.length) return;
|
|
8683
|
-
|
|
8683
|
+
const char = source[position];
|
|
8684
|
+
if (char === '\n' || char === '\r' && source[position + 1] === '\n') return;
|
|
8684
8685
|
regContentline.lastIndex = position;
|
|
8685
8686
|
regContentline.test(source);
|
|
8686
8687
|
const i = regContentline.lastIndex;
|
|
@@ -8764,7 +8765,6 @@ const text = input => {
|
|
|
8764
8765
|
return new parser_1.List([new parser_1.Node(source.slice(position + 1, context.position))]);
|
|
8765
8766
|
}
|
|
8766
8767
|
case '\r':
|
|
8767
|
-
(0, combinator_1.consume)(-1, context);
|
|
8768
8768
|
return new parser_1.List();
|
|
8769
8769
|
case '\n':
|
|
8770
8770
|
context.linebreak ||= source.length - position;
|
|
@@ -8883,8 +8883,8 @@ function isAlphanumeric(char) {
|
|
|
8883
8883
|
exports.isAlphanumeric = isAlphanumeric;
|
|
8884
8884
|
function seek(source, position, state) {
|
|
8885
8885
|
for (let i = position + 1; i < source.length; ++i) {
|
|
8886
|
-
const
|
|
8887
|
-
switch (
|
|
8886
|
+
const char = source[i];
|
|
8887
|
+
switch (char) {
|
|
8888
8888
|
case '\\':
|
|
8889
8889
|
case '!':
|
|
8890
8890
|
case '$':
|
|
@@ -8916,10 +8916,10 @@ function seek(source, position, state) {
|
|
|
8916
8916
|
case '+':
|
|
8917
8917
|
case '~':
|
|
8918
8918
|
case '=':
|
|
8919
|
-
if (source[i + 1] ===
|
|
8919
|
+
if (source[i + 1] === char) return i;
|
|
8920
8920
|
continue;
|
|
8921
8921
|
case '/':
|
|
8922
|
-
if (source[i + 1] ===
|
|
8922
|
+
if (source[i + 1] === char && source[i + 2] === char) return i;
|
|
8923
8923
|
continue;
|
|
8924
8924
|
case '%':
|
|
8925
8925
|
if (source[i + 1] === ']' && isWhitespace(source[i - 1], true)) return i;
|