securemark 0.295.1 → 0.295.2
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 +4 -0
- package/design.md +4 -3
- package/dist/index.js +514 -459
- package/markdown.d.ts +13 -28
- package/package.json +1 -1
- package/src/combinator/control/constraint/block.test.ts +6 -8
- package/src/combinator/control/constraint/contract.ts +7 -7
- package/src/combinator/control/constraint/line.test.ts +7 -9
- package/src/combinator/control/constraint/line.ts +0 -1
- package/src/combinator/control/manipulation/clear.ts +2 -2
- package/src/combinator/control/manipulation/convert.ts +3 -3
- package/src/combinator/control/manipulation/duplicate.ts +4 -4
- package/src/combinator/control/manipulation/fallback.ts +2 -2
- package/src/combinator/control/manipulation/fence.ts +3 -3
- package/src/combinator/control/manipulation/indent.test.ts +20 -22
- package/src/combinator/control/manipulation/indent.ts +2 -2
- package/src/combinator/control/manipulation/recovery.ts +3 -3
- package/src/combinator/control/manipulation/reverse.ts +2 -2
- package/src/combinator/control/manipulation/scope.ts +2 -4
- package/src/combinator/control/manipulation/surround.ts +32 -32
- package/src/combinator/control/monad/bind.ts +6 -6
- package/src/combinator/control/monad/fmap.ts +6 -6
- package/src/combinator/data/data.ts +2 -2
- package/src/combinator/data/{parser/context/delimiter.ts → delimiter.ts} +4 -4
- package/src/combinator/data/parser/context.test.ts +12 -11
- package/src/combinator/data/parser/context.ts +13 -14
- package/src/combinator/data/parser/inits.ts +5 -5
- package/src/combinator/data/parser/sequence.test.ts +12 -13
- package/src/combinator/data/parser/sequence.ts +5 -5
- package/src/combinator/data/parser/some.test.ts +15 -16
- package/src/combinator/data/parser/some.ts +5 -6
- package/src/combinator/data/parser/subsequence.test.ts +16 -17
- package/src/combinator/data/parser/subsequence.ts +3 -3
- package/src/combinator/data/parser/tails.ts +3 -3
- package/src/combinator/data/parser/union.test.ts +12 -13
- package/src/combinator/data/parser/union.ts +3 -3
- package/src/combinator/data/parser.ts +55 -32
- package/src/debug.test.ts +5 -3
- package/src/parser/api/bind.ts +8 -6
- package/src/parser/api/header.ts +4 -4
- package/src/parser/api/normalize.ts +2 -1
- package/src/parser/api/parse.test.ts +7 -6
- package/src/parser/api/parse.ts +9 -8
- package/src/parser/autolink.test.ts +18 -18
- package/src/parser/block/blockquote.test.ts +79 -79
- package/src/parser/block/blockquote.ts +5 -5
- package/src/parser/block/codeblock.test.ts +57 -57
- package/src/parser/block/codeblock.ts +3 -3
- package/src/parser/block/dlist.test.ts +57 -57
- package/src/parser/block/dlist.ts +6 -6
- package/src/parser/block/extension/aside.test.ts +9 -9
- package/src/parser/block/extension/aside.ts +5 -5
- package/src/parser/block/extension/example.test.ts +19 -19
- package/src/parser/block/extension/example.ts +6 -6
- package/src/parser/block/extension/fig.test.ts +36 -36
- package/src/parser/block/extension/figbase.test.ts +16 -16
- package/src/parser/block/extension/figbase.ts +2 -2
- package/src/parser/block/extension/figure.test.ts +63 -63
- package/src/parser/block/extension/figure.ts +3 -3
- package/src/parser/block/extension/message.test.ts +14 -14
- package/src/parser/block/extension/message.ts +5 -5
- package/src/parser/block/extension/placeholder.test.ts +13 -13
- package/src/parser/block/extension/placeholder.ts +2 -2
- package/src/parser/block/extension/table.test.ts +76 -76
- package/src/parser/block/extension/table.ts +14 -14
- package/src/parser/block/extension.test.ts +24 -24
- package/src/parser/block/heading.test.ts +59 -59
- package/src/parser/block/heading.ts +7 -7
- package/src/parser/block/ilist.test.ts +8 -12
- package/src/parser/block/ilist.ts +6 -6
- package/src/parser/block/mathblock.test.ts +32 -32
- package/src/parser/block/mathblock.ts +3 -3
- package/src/parser/block/mediablock.ts +3 -3
- package/src/parser/block/olist.test.ts +103 -103
- package/src/parser/block/olist.ts +5 -5
- package/src/parser/block/pagebreak.test.ts +16 -16
- package/src/parser/block/pagebreak.ts +2 -2
- package/src/parser/block/paragraph.test.ts +58 -58
- package/src/parser/block/paragraph.ts +2 -2
- package/src/parser/block/reply/cite.test.ts +40 -40
- package/src/parser/block/reply/cite.ts +6 -6
- package/src/parser/block/reply/quote.test.ts +51 -51
- package/src/parser/block/reply/quote.ts +3 -3
- package/src/parser/block/reply.test.ts +20 -20
- package/src/parser/block/reply.ts +3 -3
- package/src/parser/block/sidefence.test.ts +48 -48
- package/src/parser/block/sidefence.ts +4 -4
- package/src/parser/block/table.test.ts +50 -50
- package/src/parser/block/table.ts +12 -12
- package/src/parser/block/ulist.test.ts +53 -53
- package/src/parser/block/ulist.ts +6 -6
- package/src/parser/block.ts +6 -4
- package/src/parser/context.ts +39 -0
- package/src/parser/header.test.ts +23 -23
- package/src/parser/header.ts +5 -5
- package/src/parser/inline/annotation.test.ts +43 -43
- package/src/parser/inline/annotation.ts +14 -4
- package/src/parser/inline/autolink/account.test.ts +33 -33
- package/src/parser/inline/autolink/account.ts +9 -9
- package/src/parser/inline/autolink/anchor.test.ts +22 -22
- package/src/parser/inline/autolink/anchor.ts +4 -4
- package/src/parser/inline/autolink/channel.test.ts +15 -15
- package/src/parser/inline/autolink/email.test.ts +37 -37
- package/src/parser/inline/autolink/email.ts +2 -2
- package/src/parser/inline/autolink/hashnum.test.ts +33 -33
- package/src/parser/inline/autolink/hashnum.ts +6 -5
- package/src/parser/inline/autolink/hashtag.test.ts +60 -60
- package/src/parser/inline/autolink/hashtag.ts +4 -4
- package/src/parser/inline/autolink/url.test.ts +75 -75
- package/src/parser/inline/autolink/url.ts +4 -4
- package/src/parser/inline/bracket.test.ts +70 -70
- package/src/parser/inline/bracket.ts +35 -32
- package/src/parser/inline/code.test.ts +31 -31
- package/src/parser/inline/code.ts +4 -4
- package/src/parser/inline/deletion.test.ts +28 -28
- package/src/parser/inline/deletion.ts +4 -4
- package/src/parser/inline/emphasis.test.ts +40 -40
- package/src/parser/inline/emphasis.ts +3 -3
- package/src/parser/inline/emstrong.test.ts +101 -101
- package/src/parser/inline/emstrong.ts +23 -23
- package/src/parser/inline/extension/index.test.ts +92 -92
- package/src/parser/inline/extension/index.ts +5 -5
- package/src/parser/inline/extension/indexee.ts +5 -5
- package/src/parser/inline/extension/indexer.test.ts +24 -24
- package/src/parser/inline/extension/indexer.ts +2 -2
- package/src/parser/inline/extension/label.test.ts +33 -33
- package/src/parser/inline/extension/label.ts +2 -2
- package/src/parser/inline/extension/placeholder.test.ts +43 -43
- package/src/parser/inline/extension/placeholder.ts +4 -4
- package/src/parser/inline/html.test.ts +108 -108
- package/src/parser/inline/html.ts +10 -10
- package/src/parser/inline/htmlentity.test.ts +38 -38
- package/src/parser/inline/htmlentity.ts +5 -5
- package/src/parser/inline/insertion.test.ts +28 -28
- package/src/parser/inline/insertion.ts +4 -4
- package/src/parser/inline/italic.test.ts +55 -55
- package/src/parser/inline/italic.ts +4 -4
- package/src/parser/inline/link.test.ts +186 -187
- package/src/parser/inline/link.ts +16 -17
- package/src/parser/inline/mark.test.ts +31 -31
- package/src/parser/inline/mark.ts +5 -5
- package/src/parser/inline/math.test.ts +132 -132
- package/src/parser/inline/math.ts +2 -2
- package/src/parser/inline/media.test.ts +91 -91
- package/src/parser/inline/media.ts +15 -15
- package/src/parser/inline/reference.test.ts +109 -109
- package/src/parser/inline/reference.ts +15 -54
- package/src/parser/inline/remark.test.ts +50 -50
- package/src/parser/inline/remark.ts +5 -5
- package/src/parser/inline/ruby.test.ts +45 -45
- package/src/parser/inline/ruby.ts +17 -17
- package/src/parser/inline/shortmedia.test.ts +10 -10
- package/src/parser/inline/strong.test.ts +37 -37
- package/src/parser/inline/strong.ts +3 -3
- package/src/parser/inline/template.test.ts +23 -23
- package/src/parser/inline/template.ts +5 -5
- package/src/parser/inline.test.ts +224 -223
- package/src/parser/segment.ts +2 -2
- package/src/parser/source/escapable.test.ts +24 -24
- package/src/parser/source/escapable.ts +8 -8
- package/src/parser/source/line.test.ts +18 -18
- package/src/parser/source/str.ts +2 -2
- package/src/parser/source/text.test.ts +85 -85
- package/src/parser/source/text.ts +5 -5
- package/src/parser/source/unescapable.test.ts +24 -24
- package/src/parser/source/unescapable.ts +5 -5
- package/src/parser/util.ts +10 -11
- package/src/parser/visibility.ts +8 -9
- package/src/util/quote.ts +2 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.295.
|
|
1
|
+
/*! securemark v0.295.2 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"));
|
|
@@ -2665,7 +2665,6 @@ function line(parser) {
|
|
|
2665
2665
|
} = context;
|
|
2666
2666
|
if (position === source.length) return;
|
|
2667
2667
|
const line = firstline(source, position);
|
|
2668
|
-
context.offset ??= 0;
|
|
2669
2668
|
context.offset += position;
|
|
2670
2669
|
const result = parser((0, parser_1.input)(line, context));
|
|
2671
2670
|
context.position += position;
|
|
@@ -2764,7 +2763,7 @@ exports.dup = void 0;
|
|
|
2764
2763
|
const parser_1 = __webpack_require__(605);
|
|
2765
2764
|
const fmap_1 = __webpack_require__(2705);
|
|
2766
2765
|
function dup(parser) {
|
|
2767
|
-
return (0, fmap_1.fmap)(parser, nodes => new parser_1.List([new parser_1.
|
|
2766
|
+
return (0, fmap_1.fmap)(parser, nodes => new parser_1.List([new parser_1.Node(nodes)]));
|
|
2768
2767
|
}
|
|
2769
2768
|
exports.dup = dup;
|
|
2770
2769
|
|
|
@@ -2849,7 +2848,7 @@ function fence(opener, limit, separation = true) {
|
|
|
2849
2848
|
}
|
|
2850
2849
|
context.position += line.length;
|
|
2851
2850
|
}
|
|
2852
|
-
return new parser_1.List((0, array_1.push)([block, overflow, closer], matches).map(str => new parser_1.
|
|
2851
|
+
return new parser_1.List((0, array_1.push)([block, overflow, closer], matches).map(str => new parser_1.Node(str)));
|
|
2853
2852
|
});
|
|
2854
2853
|
}
|
|
2855
2854
|
exports.fence = fence;
|
|
@@ -2888,7 +2887,7 @@ function indent(opener, parser = false, separation = false) {
|
|
|
2888
2887
|
position
|
|
2889
2888
|
} = context;
|
|
2890
2889
|
context.position = source.length;
|
|
2891
|
-
return new parser_1.List([new parser_1.
|
|
2890
|
+
return new parser_1.List([new parser_1.Node(source.slice(position))]);
|
|
2892
2891
|
}))), ([indent]) => indent.length * 2 + -(indent[0] === ' '), [], 2 ** 4 - 1)), separation), (lines, context) => parser((0, parser_1.subinput)(trimBlockEnd(lines.foldl((acc, node) => acc + node.value, '')), context))));
|
|
2893
2892
|
}
|
|
2894
2893
|
exports.indent = indent;
|
|
@@ -3036,7 +3035,6 @@ function focus(scope, parser, slice = true) {
|
|
|
3036
3035
|
context.position += result && context.position === position ? range : 0;
|
|
3037
3036
|
return result;
|
|
3038
3037
|
}
|
|
3039
|
-
context.offset ??= 0;
|
|
3040
3038
|
context.offset += position;
|
|
3041
3039
|
const result = parser((0, parser_1.input)(src, context));
|
|
3042
3040
|
context.position += position;
|
|
@@ -3069,7 +3067,6 @@ function rewrite(scope, parser, slice = true) {
|
|
|
3069
3067
|
return res2;
|
|
3070
3068
|
}
|
|
3071
3069
|
const src = source.slice(position, context.position);
|
|
3072
|
-
context.offset ??= 0;
|
|
3073
3070
|
context.offset += position;
|
|
3074
3071
|
const res2 = parser((0, parser_1.input)(src, context));
|
|
3075
3072
|
context.position += position;
|
|
@@ -3169,8 +3166,8 @@ exports.close = close;
|
|
|
3169
3166
|
const commandsize = 2;
|
|
3170
3167
|
function isBacktrack(context, backtrack, position = context.position, length = 1) {
|
|
3171
3168
|
const {
|
|
3172
|
-
backtracks
|
|
3173
|
-
offset
|
|
3169
|
+
backtracks,
|
|
3170
|
+
offset
|
|
3174
3171
|
} = context;
|
|
3175
3172
|
for (let i = 0; i < length; ++i) {
|
|
3176
3173
|
if (backtracks[position + i + offset] & backtrack >>> commandsize) return true;
|
|
@@ -3182,8 +3179,8 @@ function setBacktrack(context, backtrack, position, length = 1) {
|
|
|
3182
3179
|
// バックトラックの可能性がなく記録不要の場合もあるが判別が面倒なので省略
|
|
3183
3180
|
|
|
3184
3181
|
const {
|
|
3185
|
-
backtracks
|
|
3186
|
-
offset
|
|
3182
|
+
backtracks,
|
|
3183
|
+
offset
|
|
3187
3184
|
} = context;
|
|
3188
3185
|
for (let i = 0; i < length; ++i) {
|
|
3189
3186
|
backtracks[position + i + offset] |= backtrack >>> commandsize;
|
|
@@ -3408,6 +3405,162 @@ exports.List = List;
|
|
|
3408
3405
|
|
|
3409
3406
|
/***/ },
|
|
3410
3407
|
|
|
3408
|
+
/***/ 385
|
|
3409
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
3410
|
+
|
|
3411
|
+
"use strict";
|
|
3412
|
+
|
|
3413
|
+
|
|
3414
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
3415
|
+
value: true
|
|
3416
|
+
}));
|
|
3417
|
+
exports.Delimiters = void 0;
|
|
3418
|
+
const combinator_1 = __webpack_require__(3484);
|
|
3419
|
+
class Delimiters {
|
|
3420
|
+
constructor() {
|
|
3421
|
+
this.tree = {};
|
|
3422
|
+
this.map = new Map();
|
|
3423
|
+
this.delimiters = [];
|
|
3424
|
+
this.stack = [];
|
|
3425
|
+
this.states = [];
|
|
3426
|
+
}
|
|
3427
|
+
// 手間を惜しまなければ規定のパターンはすべて配列のインデクスに変換可能。
|
|
3428
|
+
static signature(pattern) {
|
|
3429
|
+
switch (typeof pattern) {
|
|
3430
|
+
case 'undefined':
|
|
3431
|
+
return 1 << 7;
|
|
3432
|
+
case 'string':
|
|
3433
|
+
if (pattern.length === 1) {
|
|
3434
|
+
const code = pattern.charCodeAt(0);
|
|
3435
|
+
return code;
|
|
3436
|
+
}
|
|
3437
|
+
return `s:${pattern}`;
|
|
3438
|
+
case 'object':
|
|
3439
|
+
return `r/${pattern.source}`;
|
|
3440
|
+
}
|
|
3441
|
+
}
|
|
3442
|
+
static matcher(pattern) {
|
|
3443
|
+
switch (typeof pattern) {
|
|
3444
|
+
case 'undefined':
|
|
3445
|
+
return () => undefined;
|
|
3446
|
+
case 'string':
|
|
3447
|
+
case 'object':
|
|
3448
|
+
const match = (0, combinator_1.matcher)(pattern, false);
|
|
3449
|
+
return input => match(input) !== undefined || undefined;
|
|
3450
|
+
}
|
|
3451
|
+
}
|
|
3452
|
+
registry(signature) {
|
|
3453
|
+
if (typeof signature === 'number') {
|
|
3454
|
+
return this.tree[signature] ??= [];
|
|
3455
|
+
} else {
|
|
3456
|
+
const ds = this.map.get(signature);
|
|
3457
|
+
if (ds) return ds;
|
|
3458
|
+
const blank = [];
|
|
3459
|
+
this.map.set(signature, blank);
|
|
3460
|
+
return blank;
|
|
3461
|
+
}
|
|
3462
|
+
}
|
|
3463
|
+
push(delims) {
|
|
3464
|
+
const {
|
|
3465
|
+
delimiters,
|
|
3466
|
+
stack
|
|
3467
|
+
} = this;
|
|
3468
|
+
// シグネチャ数以下
|
|
3469
|
+
|
|
3470
|
+
for (let i = 0; i < delims.length; ++i) {
|
|
3471
|
+
const {
|
|
3472
|
+
signature,
|
|
3473
|
+
matcher,
|
|
3474
|
+
precedence
|
|
3475
|
+
} = delims[i];
|
|
3476
|
+
const memory = this.registry(signature);
|
|
3477
|
+
const index = memory[0]?.index ?? delimiters.length;
|
|
3478
|
+
if (memory.length === 0) {
|
|
3479
|
+
const delimiter = {
|
|
3480
|
+
memory,
|
|
3481
|
+
index,
|
|
3482
|
+
signature,
|
|
3483
|
+
matcher,
|
|
3484
|
+
precedence,
|
|
3485
|
+
state: true
|
|
3486
|
+
};
|
|
3487
|
+
delimiters[index] = delimiter;
|
|
3488
|
+
memory.push(delimiter);
|
|
3489
|
+
stack.push(index);
|
|
3490
|
+
} else {
|
|
3491
|
+
stack.push(-1);
|
|
3492
|
+
}
|
|
3493
|
+
// 現状各優先順位は固定
|
|
3494
|
+
}
|
|
3495
|
+
}
|
|
3496
|
+
pop(count) {
|
|
3497
|
+
const {
|
|
3498
|
+
delimiters,
|
|
3499
|
+
stack
|
|
3500
|
+
} = this;
|
|
3501
|
+
for (let i = 0; i < count; ++i) {
|
|
3502
|
+
const index = stack.pop();
|
|
3503
|
+
if (index === -1) continue;
|
|
3504
|
+
const {
|
|
3505
|
+
memory
|
|
3506
|
+
} = delimiters[index];
|
|
3507
|
+
if (memory.length === 1) {
|
|
3508
|
+
memory.pop();
|
|
3509
|
+
delimiters.pop();
|
|
3510
|
+
} else {
|
|
3511
|
+
memory.pop();
|
|
3512
|
+
delimiters[index] = memory.at(-1);
|
|
3513
|
+
}
|
|
3514
|
+
}
|
|
3515
|
+
}
|
|
3516
|
+
shift(precedence) {
|
|
3517
|
+
const {
|
|
3518
|
+
delimiters
|
|
3519
|
+
} = this;
|
|
3520
|
+
const indexes = [];
|
|
3521
|
+
for (let i = delimiters.length; i--;) {
|
|
3522
|
+
const delimiter = delimiters[i];
|
|
3523
|
+
if (delimiter.precedence >= precedence || !delimiter.state) continue;
|
|
3524
|
+
delimiter.state = false;
|
|
3525
|
+
indexes.push(i);
|
|
3526
|
+
}
|
|
3527
|
+
this.states.push(indexes);
|
|
3528
|
+
}
|
|
3529
|
+
unshift() {
|
|
3530
|
+
const {
|
|
3531
|
+
delimiters
|
|
3532
|
+
} = this;
|
|
3533
|
+
const indexes = this.states.pop();
|
|
3534
|
+
for (let i = indexes.length; i--;) {
|
|
3535
|
+
delimiters[indexes[i]].state = true;
|
|
3536
|
+
}
|
|
3537
|
+
}
|
|
3538
|
+
match(input) {
|
|
3539
|
+
const {
|
|
3540
|
+
precedence
|
|
3541
|
+
} = input.context;
|
|
3542
|
+
const {
|
|
3543
|
+
delimiters
|
|
3544
|
+
} = this;
|
|
3545
|
+
for (let i = delimiters.length; i--;) {
|
|
3546
|
+
const delimiter = delimiters[i];
|
|
3547
|
+
if (delimiter.precedence <= precedence || !delimiter.state) continue;
|
|
3548
|
+
switch (delimiter.matcher(input)) {
|
|
3549
|
+
case true:
|
|
3550
|
+
return true;
|
|
3551
|
+
case false:
|
|
3552
|
+
return false;
|
|
3553
|
+
default:
|
|
3554
|
+
continue;
|
|
3555
|
+
}
|
|
3556
|
+
}
|
|
3557
|
+
return false;
|
|
3558
|
+
}
|
|
3559
|
+
}
|
|
3560
|
+
exports.Delimiters = Delimiters;
|
|
3561
|
+
|
|
3562
|
+
/***/ },
|
|
3563
|
+
|
|
3411
3564
|
/***/ 605
|
|
3412
3565
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
3413
3566
|
|
|
@@ -3417,7 +3570,7 @@ exports.List = List;
|
|
|
3417
3570
|
Object.defineProperty(exports, "__esModule", ({
|
|
3418
3571
|
value: true
|
|
3419
3572
|
}));
|
|
3420
|
-
exports.failsafe = exports.subinput = exports.input = exports.
|
|
3573
|
+
exports.failsafe = exports.subinput = exports.input = exports.Context = exports.Node = exports.List = void 0;
|
|
3421
3574
|
const data_1 = __webpack_require__(3602);
|
|
3422
3575
|
Object.defineProperty(exports, "List", ({
|
|
3423
3576
|
enumerable: true,
|
|
@@ -3425,21 +3578,45 @@ Object.defineProperty(exports, "List", ({
|
|
|
3425
3578
|
return data_1.List;
|
|
3426
3579
|
}
|
|
3427
3580
|
}));
|
|
3428
|
-
|
|
3581
|
+
const delimiter_1 = __webpack_require__(385);
|
|
3582
|
+
class Node {
|
|
3429
3583
|
constructor(value) {
|
|
3430
3584
|
this.value = value;
|
|
3431
3585
|
this.next = undefined;
|
|
3432
3586
|
this.prev = undefined;
|
|
3433
3587
|
}
|
|
3434
3588
|
}
|
|
3435
|
-
exports.
|
|
3589
|
+
exports.Node = Node;
|
|
3590
|
+
class Context {
|
|
3591
|
+
constructor({
|
|
3592
|
+
source,
|
|
3593
|
+
position,
|
|
3594
|
+
resources,
|
|
3595
|
+
delimiters,
|
|
3596
|
+
precedence,
|
|
3597
|
+
state,
|
|
3598
|
+
linebreak,
|
|
3599
|
+
range,
|
|
3600
|
+
offset,
|
|
3601
|
+
backtracks
|
|
3602
|
+
} = {}) {
|
|
3603
|
+
this.source = source ?? '';
|
|
3604
|
+
this.position = position ?? 0;
|
|
3605
|
+
this.resources = resources;
|
|
3606
|
+
this.precedence = precedence ?? 0;
|
|
3607
|
+
this.delimiters = delimiters ?? new delimiter_1.Delimiters();
|
|
3608
|
+
this.state = state ?? 0;
|
|
3609
|
+
this.linebreak = linebreak ?? 0;
|
|
3610
|
+
this.range = range ?? 0;
|
|
3611
|
+
this.offset = offset ?? 0;
|
|
3612
|
+
this.backtracks = backtracks ?? {};
|
|
3613
|
+
}
|
|
3614
|
+
}
|
|
3615
|
+
exports.Context = Context;
|
|
3436
3616
|
function input(source, context) {
|
|
3437
|
-
// @ts-expect-error
|
|
3438
3617
|
context.source = source;
|
|
3439
|
-
// @ts-expect-error
|
|
3440
3618
|
context.position = 0;
|
|
3441
3619
|
return {
|
|
3442
|
-
// @ts-expect-error
|
|
3443
3620
|
context
|
|
3444
3621
|
};
|
|
3445
3622
|
}
|
|
@@ -3450,7 +3627,7 @@ function subinput(source, context) {
|
|
|
3450
3627
|
...context,
|
|
3451
3628
|
source,
|
|
3452
3629
|
position: 0,
|
|
3453
|
-
offset:
|
|
3630
|
+
offset: 0,
|
|
3454
3631
|
backtracks: {}
|
|
3455
3632
|
}
|
|
3456
3633
|
};
|
|
@@ -3476,8 +3653,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
3476
3653
|
value: true
|
|
3477
3654
|
}));
|
|
3478
3655
|
exports.matcher = exports.constraint = exports.state = exports.precedence = exports.recursion = exports.consume = exports.creation = exports.context = exports.reset = void 0;
|
|
3479
|
-
const alias_1 = __webpack_require__(5413);
|
|
3480
3656
|
const parser_1 = __webpack_require__(605);
|
|
3657
|
+
const alias_1 = __webpack_require__(5413);
|
|
3481
3658
|
const assign_1 = __webpack_require__(9888);
|
|
3482
3659
|
function reset(base, parser) {
|
|
3483
3660
|
const changes = Object.entries(base);
|
|
@@ -3590,7 +3767,7 @@ function precedence(precedence, parser) {
|
|
|
3590
3767
|
} = input;
|
|
3591
3768
|
const {
|
|
3592
3769
|
delimiters,
|
|
3593
|
-
precedence: p
|
|
3770
|
+
precedence: p
|
|
3594
3771
|
} = context;
|
|
3595
3772
|
const shift = delimiters && precedence > p;
|
|
3596
3773
|
context.precedence = precedence;
|
|
@@ -3650,7 +3827,7 @@ function matcher(pattern, advance) {
|
|
|
3650
3827
|
if (advance) {
|
|
3651
3828
|
context.position += pattern.length;
|
|
3652
3829
|
}
|
|
3653
|
-
return new parser_1.List([new parser_1.
|
|
3830
|
+
return new parser_1.List([new parser_1.Node(pattern)]);
|
|
3654
3831
|
};
|
|
3655
3832
|
case 'object':
|
|
3656
3833
|
return ({
|
|
@@ -3667,7 +3844,7 @@ function matcher(pattern, advance) {
|
|
|
3667
3844
|
if (advance) {
|
|
3668
3845
|
context.position += src.length;
|
|
3669
3846
|
}
|
|
3670
|
-
return new parser_1.List([new parser_1.
|
|
3847
|
+
return new parser_1.List([new parser_1.Node(src)]);
|
|
3671
3848
|
};
|
|
3672
3849
|
}
|
|
3673
3850
|
}
|
|
@@ -3675,162 +3852,6 @@ exports.matcher = matcher;
|
|
|
3675
3852
|
|
|
3676
3853
|
/***/ },
|
|
3677
3854
|
|
|
3678
|
-
/***/ 5691
|
|
3679
|
-
(__unused_webpack_module, exports, __webpack_require__) {
|
|
3680
|
-
|
|
3681
|
-
"use strict";
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
Object.defineProperty(exports, "__esModule", ({
|
|
3685
|
-
value: true
|
|
3686
|
-
}));
|
|
3687
|
-
exports.Delimiters = void 0;
|
|
3688
|
-
const combinator_1 = __webpack_require__(3484);
|
|
3689
|
-
class Delimiters {
|
|
3690
|
-
constructor() {
|
|
3691
|
-
this.tree = {};
|
|
3692
|
-
this.map = new Map();
|
|
3693
|
-
this.delimiters = [];
|
|
3694
|
-
this.stack = [];
|
|
3695
|
-
this.states = [];
|
|
3696
|
-
}
|
|
3697
|
-
// 手間を惜しまなければ規定のパターンはすべて配列のインデクスに変換可能。
|
|
3698
|
-
static signature(pattern) {
|
|
3699
|
-
switch (typeof pattern) {
|
|
3700
|
-
case 'undefined':
|
|
3701
|
-
return 1 << 7;
|
|
3702
|
-
case 'string':
|
|
3703
|
-
if (pattern.length === 1) {
|
|
3704
|
-
const code = pattern.charCodeAt(0);
|
|
3705
|
-
return code;
|
|
3706
|
-
}
|
|
3707
|
-
return `s:${pattern}`;
|
|
3708
|
-
case 'object':
|
|
3709
|
-
return `r/${pattern.source}`;
|
|
3710
|
-
}
|
|
3711
|
-
}
|
|
3712
|
-
static matcher(pattern) {
|
|
3713
|
-
switch (typeof pattern) {
|
|
3714
|
-
case 'undefined':
|
|
3715
|
-
return () => undefined;
|
|
3716
|
-
case 'string':
|
|
3717
|
-
case 'object':
|
|
3718
|
-
const match = (0, combinator_1.matcher)(pattern, false);
|
|
3719
|
-
return input => match(input) !== undefined || undefined;
|
|
3720
|
-
}
|
|
3721
|
-
}
|
|
3722
|
-
registry(signature) {
|
|
3723
|
-
if (typeof signature === 'number') {
|
|
3724
|
-
return this.tree[signature] ??= [];
|
|
3725
|
-
} else {
|
|
3726
|
-
const ds = this.map.get(signature);
|
|
3727
|
-
if (ds) return ds;
|
|
3728
|
-
const blank = [];
|
|
3729
|
-
this.map.set(signature, blank);
|
|
3730
|
-
return blank;
|
|
3731
|
-
}
|
|
3732
|
-
}
|
|
3733
|
-
push(delims) {
|
|
3734
|
-
const {
|
|
3735
|
-
delimiters,
|
|
3736
|
-
stack
|
|
3737
|
-
} = this;
|
|
3738
|
-
// シグネチャ数以下
|
|
3739
|
-
|
|
3740
|
-
for (let i = 0; i < delims.length; ++i) {
|
|
3741
|
-
const {
|
|
3742
|
-
signature,
|
|
3743
|
-
matcher,
|
|
3744
|
-
precedence
|
|
3745
|
-
} = delims[i];
|
|
3746
|
-
const memory = this.registry(signature);
|
|
3747
|
-
const index = memory[0]?.index ?? delimiters.length;
|
|
3748
|
-
if (memory.length === 0) {
|
|
3749
|
-
const delimiter = {
|
|
3750
|
-
memory,
|
|
3751
|
-
index,
|
|
3752
|
-
signature,
|
|
3753
|
-
matcher,
|
|
3754
|
-
precedence,
|
|
3755
|
-
state: true
|
|
3756
|
-
};
|
|
3757
|
-
delimiters[index] = delimiter;
|
|
3758
|
-
memory.push(delimiter);
|
|
3759
|
-
stack.push(index);
|
|
3760
|
-
} else {
|
|
3761
|
-
stack.push(-1);
|
|
3762
|
-
}
|
|
3763
|
-
// 現状各優先順位は固定
|
|
3764
|
-
}
|
|
3765
|
-
}
|
|
3766
|
-
pop(count) {
|
|
3767
|
-
const {
|
|
3768
|
-
delimiters,
|
|
3769
|
-
stack
|
|
3770
|
-
} = this;
|
|
3771
|
-
for (let i = 0; i < count; ++i) {
|
|
3772
|
-
const index = stack.pop();
|
|
3773
|
-
if (index === -1) continue;
|
|
3774
|
-
const {
|
|
3775
|
-
memory
|
|
3776
|
-
} = delimiters[index];
|
|
3777
|
-
if (memory.length === 1) {
|
|
3778
|
-
memory.pop();
|
|
3779
|
-
delimiters.pop();
|
|
3780
|
-
} else {
|
|
3781
|
-
memory.pop();
|
|
3782
|
-
delimiters[index] = memory.at(-1);
|
|
3783
|
-
}
|
|
3784
|
-
}
|
|
3785
|
-
}
|
|
3786
|
-
shift(precedence) {
|
|
3787
|
-
const {
|
|
3788
|
-
delimiters
|
|
3789
|
-
} = this;
|
|
3790
|
-
const indexes = [];
|
|
3791
|
-
for (let i = delimiters.length; i--;) {
|
|
3792
|
-
const delimiter = delimiters[i];
|
|
3793
|
-
if (delimiter.precedence >= precedence || !delimiter.state) continue;
|
|
3794
|
-
delimiter.state = false;
|
|
3795
|
-
indexes.push(i);
|
|
3796
|
-
}
|
|
3797
|
-
this.states.push(indexes);
|
|
3798
|
-
}
|
|
3799
|
-
unshift() {
|
|
3800
|
-
const {
|
|
3801
|
-
delimiters
|
|
3802
|
-
} = this;
|
|
3803
|
-
const indexes = this.states.pop();
|
|
3804
|
-
for (let i = indexes.length; i--;) {
|
|
3805
|
-
delimiters[indexes[i]].state = true;
|
|
3806
|
-
}
|
|
3807
|
-
}
|
|
3808
|
-
match(input) {
|
|
3809
|
-
const {
|
|
3810
|
-
precedence = 0
|
|
3811
|
-
} = input.context;
|
|
3812
|
-
const {
|
|
3813
|
-
delimiters
|
|
3814
|
-
} = this;
|
|
3815
|
-
for (let i = delimiters.length; i--;) {
|
|
3816
|
-
const delimiter = delimiters[i];
|
|
3817
|
-
if (delimiter.precedence <= precedence || !delimiter.state) continue;
|
|
3818
|
-
switch (delimiter.matcher(input)) {
|
|
3819
|
-
case true:
|
|
3820
|
-
return true;
|
|
3821
|
-
case false:
|
|
3822
|
-
return false;
|
|
3823
|
-
default:
|
|
3824
|
-
continue;
|
|
3825
|
-
}
|
|
3826
|
-
}
|
|
3827
|
-
return false;
|
|
3828
|
-
}
|
|
3829
|
-
}
|
|
3830
|
-
exports.Delimiters = Delimiters;
|
|
3831
|
-
|
|
3832
|
-
/***/ },
|
|
3833
|
-
|
|
3834
3855
|
/***/ 2861
|
|
3835
3856
|
(__unused_webpack_module, exports) {
|
|
3836
3857
|
|
|
@@ -3853,7 +3874,7 @@ function inits(parsers, resume) {
|
|
|
3853
3874
|
let nodes;
|
|
3854
3875
|
for (let len = parsers.length, i = 0; i < len; ++i) {
|
|
3855
3876
|
if (context.position === source.length) break;
|
|
3856
|
-
if (context.delimiters
|
|
3877
|
+
if (context.delimiters.match(input)) break;
|
|
3857
3878
|
const result = parsers[i](input);
|
|
3858
3879
|
if (result === undefined) break;
|
|
3859
3880
|
nodes = nodes?.import(result) ?? result;
|
|
@@ -3888,7 +3909,7 @@ function sequence(parsers, resume) {
|
|
|
3888
3909
|
let nodes;
|
|
3889
3910
|
for (let len = parsers.length, i = 0; i < len; ++i) {
|
|
3890
3911
|
if (context.position === source.length) return;
|
|
3891
|
-
if (context.delimiters
|
|
3912
|
+
if (context.delimiters.match(input)) return;
|
|
3892
3913
|
const result = parsers[i](input);
|
|
3893
3914
|
if (result === undefined) return;
|
|
3894
3915
|
nodes = nodes?.import(result) ?? result;
|
|
@@ -3911,7 +3932,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
3911
3932
|
value: true
|
|
3912
3933
|
}));
|
|
3913
3934
|
exports.some = void 0;
|
|
3914
|
-
const delimiter_1 = __webpack_require__(
|
|
3935
|
+
const delimiter_1 = __webpack_require__(385);
|
|
3915
3936
|
function some(parser, end, delimiters = [], limit = -1) {
|
|
3916
3937
|
if (typeof end === 'number') return some(parser, undefined, delimiters, end);
|
|
3917
3938
|
const match = delimiter_1.Delimiters.matcher(end);
|
|
@@ -3931,13 +3952,12 @@ function some(parser, end, delimiters = [], limit = -1) {
|
|
|
3931
3952
|
//assert(context.backtracks ??= {});
|
|
3932
3953
|
let nodes;
|
|
3933
3954
|
if (delims.length > 0) {
|
|
3934
|
-
context.delimiters ??= new delimiter_1.Delimiters();
|
|
3935
3955
|
context.delimiters.push(delims);
|
|
3936
3956
|
}
|
|
3937
3957
|
// whileは数倍遅い
|
|
3938
3958
|
for (const len = source.length; context.position < len;) {
|
|
3939
3959
|
if (match(input)) break;
|
|
3940
|
-
if (context.delimiters
|
|
3960
|
+
if (context.delimiters.match(input)) break;
|
|
3941
3961
|
const result = parser(input);
|
|
3942
3962
|
if (result === undefined) break;
|
|
3943
3963
|
nodes = nodes?.import(result) ?? result;
|
|
@@ -4118,21 +4138,21 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
4118
4138
|
value: true
|
|
4119
4139
|
}));
|
|
4120
4140
|
exports.bind = void 0;
|
|
4141
|
+
const context_1 = __webpack_require__(8669);
|
|
4121
4142
|
const parser_1 = __webpack_require__(605);
|
|
4122
4143
|
const segment_1 = __webpack_require__(3967);
|
|
4123
|
-
const header_1 = __webpack_require__(3009);
|
|
4124
4144
|
const block_1 = __webpack_require__(7099);
|
|
4125
4145
|
const normalize_1 = __webpack_require__(4490);
|
|
4126
|
-
const
|
|
4146
|
+
const header_1 = __webpack_require__(3652);
|
|
4127
4147
|
const figure_1 = __webpack_require__(1657);
|
|
4128
4148
|
const note_1 = __webpack_require__(165);
|
|
4129
4149
|
const url_1 = __webpack_require__(1904);
|
|
4130
4150
|
const array_1 = __webpack_require__(6876);
|
|
4131
4151
|
function bind(target, settings) {
|
|
4132
|
-
const context = {
|
|
4152
|
+
const context = new context_1.Context({
|
|
4133
4153
|
...settings,
|
|
4134
4154
|
host: settings.host ?? new url_1.ReadonlyURL(location.pathname, location.origin)
|
|
4135
|
-
};
|
|
4155
|
+
});
|
|
4136
4156
|
if (context.id?.match(/[^0-9a-z/-]/i)) throw new Error('Invalid ID: ID must be alphanumeric');
|
|
4137
4157
|
if (context.host?.origin === 'null') throw new Error(`Invalid host: ${context.host.href}`);
|
|
4138
4158
|
const blocks = [];
|
|
@@ -4147,7 +4167,7 @@ function bind(target, settings) {
|
|
|
4147
4167
|
};
|
|
4148
4168
|
function* parse(source) {
|
|
4149
4169
|
if (settings.chunk && revision) throw new Error('Chunks cannot be updated');
|
|
4150
|
-
const url = (0,
|
|
4170
|
+
const url = (0, header_1.headers)(source).find(field => field.toLowerCase().startsWith('url:'))?.slice(4).trim() ?? '';
|
|
4151
4171
|
source = (0, normalize_1.normalize)(source);
|
|
4152
4172
|
// @ts-expect-error
|
|
4153
4173
|
context.url = url ? new url_1.ReadonlyURL(url) : undefined;
|
|
@@ -4174,13 +4194,15 @@ function bind(target, settings) {
|
|
|
4174
4194
|
}
|
|
4175
4195
|
const base = next(head);
|
|
4176
4196
|
let index = head;
|
|
4197
|
+
// @ts-expect-error
|
|
4198
|
+
context.header = true;
|
|
4177
4199
|
for (; index < sourceSegments.length - last; ++index) {
|
|
4178
4200
|
const seg = sourceSegments[index];
|
|
4179
|
-
const es = (
|
|
4180
|
-
header: index === 0
|
|
4181
|
-
})) || (0, block_1.block)((0, parser_1.input)(seg, context)))?.foldl((acc, {
|
|
4201
|
+
const es = (0, block_1.block)((0, parser_1.input)(seg, context))?.foldl((acc, {
|
|
4182
4202
|
value
|
|
4183
4203
|
}) => void acc.push(value) || acc, []) ?? [];
|
|
4204
|
+
// @ts-expect-error
|
|
4205
|
+
context.header = false;
|
|
4184
4206
|
blocks.splice(index, 0, [seg, es, url]);
|
|
4185
4207
|
if (es.length === 0) continue;
|
|
4186
4208
|
// All deletion processes always run after all addition processes have done.
|
|
@@ -4346,7 +4368,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
4346
4368
|
value: true
|
|
4347
4369
|
}));
|
|
4348
4370
|
exports.headers = exports.header = void 0;
|
|
4349
|
-
const
|
|
4371
|
+
const context_1 = __webpack_require__(8669);
|
|
4350
4372
|
const header_1 = __webpack_require__(3009);
|
|
4351
4373
|
function header(source) {
|
|
4352
4374
|
const [, pos = 0] = parse(source);
|
|
@@ -4359,10 +4381,14 @@ function headers(source) {
|
|
|
4359
4381
|
}
|
|
4360
4382
|
exports.headers = headers;
|
|
4361
4383
|
function parse(source) {
|
|
4362
|
-
const
|
|
4363
|
-
|
|
4384
|
+
const context = new context_1.Context({
|
|
4385
|
+
source
|
|
4386
|
+
});
|
|
4387
|
+
const result = (0, header_1.header)({
|
|
4388
|
+
context
|
|
4389
|
+
});
|
|
4364
4390
|
const el = result?.head?.value;
|
|
4365
|
-
return el?.tagName === 'ASIDE' ? [el,
|
|
4391
|
+
return el?.tagName === 'ASIDE' ? [el, context.position] : [];
|
|
4366
4392
|
}
|
|
4367
4393
|
|
|
4368
4394
|
/***/ },
|
|
@@ -4378,6 +4404,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
4378
4404
|
}));
|
|
4379
4405
|
exports.escape = exports.invisibleHTMLEntityNames = exports.normalize = void 0;
|
|
4380
4406
|
const parser_1 = __webpack_require__(605);
|
|
4407
|
+
const context_1 = __webpack_require__(8669);
|
|
4381
4408
|
const htmlentity_1 = __webpack_require__(470);
|
|
4382
4409
|
const UNICODE_REPLACEMENT_CHARACTER = '\uFFFD';
|
|
4383
4410
|
function normalize(source) {
|
|
@@ -4399,7 +4426,7 @@ function sanitize(source) {
|
|
|
4399
4426
|
// https://en.wikipedia.org/wiki/Whitespace_character
|
|
4400
4427
|
exports.invisibleHTMLEntityNames = ['Tab', 'NewLine', 'NonBreakingSpace', 'nbsp', 'shy', 'ensp', 'emsp', 'emsp13', 'emsp14', 'numsp', 'puncsp', 'ThinSpace', 'thinsp', 'VeryThinSpace', 'hairsp', 'ZeroWidthSpace', 'NegativeVeryThinSpace', 'NegativeThinSpace', 'NegativeMediumSpace', 'NegativeThickSpace', 'zwj', 'zwnj', 'lrm', 'rlm', 'MediumSpace', 'NoBreak', 'ApplyFunction', 'af', 'InvisibleTimes', 'it', 'InvisibleComma', 'ic'];
|
|
4401
4428
|
const unreadableEscapeHTMLEntityNames = exports.invisibleHTMLEntityNames.filter(name => !['Tab', 'NewLine', 'NonBreakingSpace', 'nbsp', 'zwj', 'zwnj'].includes(name));
|
|
4402
|
-
const unreadableEscapeCharacters = unreadableEscapeHTMLEntityNames.map(name => (0, htmlentity_1.unsafehtmlentity)((0, parser_1.input)(`&${name};`,
|
|
4429
|
+
const unreadableEscapeCharacters = unreadableEscapeHTMLEntityNames.map(name => (0, htmlentity_1.unsafehtmlentity)((0, parser_1.input)(`&${name};`, new context_1.Context())).head.value);
|
|
4403
4430
|
const unreadableEscapeCharacter = new RegExp(`[${unreadableEscapeCharacters.join('')}]`, 'g');
|
|
4404
4431
|
// https://www.pandanoir.info/entry/2018/03/11/193000
|
|
4405
4432
|
// http://anti.rosx.net/etc/memo/002_space.html
|
|
@@ -4452,35 +4479,36 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
4452
4479
|
}));
|
|
4453
4480
|
exports.parse = void 0;
|
|
4454
4481
|
const parser_1 = __webpack_require__(605);
|
|
4482
|
+
const context_1 = __webpack_require__(8669);
|
|
4455
4483
|
const segment_1 = __webpack_require__(3967);
|
|
4456
|
-
const header_1 = __webpack_require__(3009);
|
|
4457
4484
|
const block_1 = __webpack_require__(7099);
|
|
4458
4485
|
const normalize_1 = __webpack_require__(4490);
|
|
4459
|
-
const
|
|
4486
|
+
const header_1 = __webpack_require__(3652);
|
|
4460
4487
|
const figure_1 = __webpack_require__(1657);
|
|
4461
4488
|
const note_1 = __webpack_require__(165);
|
|
4462
4489
|
const url_1 = __webpack_require__(1904);
|
|
4463
4490
|
const dom_1 = __webpack_require__(394);
|
|
4464
4491
|
function parse(source, options = {}, context) {
|
|
4465
|
-
const url = (0,
|
|
4492
|
+
const url = (0, header_1.headers)(source).find(field => field.toLowerCase().startsWith('url:'))?.slice(4).trim() ?? '';
|
|
4466
4493
|
source = !context ? (0, normalize_1.normalize)(source) : source;
|
|
4467
|
-
context = {
|
|
4494
|
+
context = new context_1.Context({
|
|
4468
4495
|
host: options.host ?? context?.host ?? new url_1.ReadonlyURL(location.pathname, location.origin),
|
|
4469
4496
|
url: url ? new url_1.ReadonlyURL(url) : context?.url,
|
|
4470
4497
|
id: options.id ?? context?.id,
|
|
4471
4498
|
caches: context?.caches,
|
|
4472
4499
|
resources: context?.resources
|
|
4473
|
-
};
|
|
4500
|
+
});
|
|
4474
4501
|
if (context.id?.match(/[^0-9a-z/-]/i)) throw new Error('Invalid ID: ID must be alphanumeric');
|
|
4475
4502
|
if (context.host?.origin === 'null') throw new Error(`Invalid host: ${context.host.href}`);
|
|
4476
4503
|
const node = (0, dom_1.frag)();
|
|
4477
|
-
|
|
4504
|
+
// @ts-expect-error
|
|
4505
|
+
context.header = true;
|
|
4478
4506
|
for (const seg of (0, segment_1.segment)(source)) {
|
|
4479
|
-
node.append(...((
|
|
4480
|
-
header: index++ === 0
|
|
4481
|
-
})) || (0, block_1.block)((0, parser_1.input)(seg, context)))?.foldl((acc, {
|
|
4507
|
+
node.append(...((0, block_1.block)((0, parser_1.input)(seg, context))?.foldl((acc, {
|
|
4482
4508
|
value
|
|
4483
4509
|
}) => void acc.push(value) || acc, []) ?? []));
|
|
4510
|
+
// @ts-expect-error
|
|
4511
|
+
context.header = false;
|
|
4484
4512
|
}
|
|
4485
4513
|
if (options.test) return node;
|
|
4486
4514
|
for (const _ of (0, figure_1.figure)(node, options.notes, context));
|
|
@@ -4502,7 +4530,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
4502
4530
|
}));
|
|
4503
4531
|
exports.autolink = void 0;
|
|
4504
4532
|
const combinator_1 = __webpack_require__(3484);
|
|
4505
|
-
const autolink_1 = __webpack_require__(
|
|
4533
|
+
const autolink_1 = __webpack_require__(5691);
|
|
4506
4534
|
const source_1 = __webpack_require__(8745);
|
|
4507
4535
|
exports.autolink = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([autolink_1.autolink, source_1.unescsource])));
|
|
4508
4536
|
|
|
@@ -4521,6 +4549,7 @@ exports.block = void 0;
|
|
|
4521
4549
|
const parser_1 = __webpack_require__(605);
|
|
4522
4550
|
const combinator_1 = __webpack_require__(3484);
|
|
4523
4551
|
const segment_1 = __webpack_require__(3967);
|
|
4552
|
+
const header_1 = __webpack_require__(3009);
|
|
4524
4553
|
const source_1 = __webpack_require__(8745);
|
|
4525
4554
|
const pagebreak_1 = __webpack_require__(2946);
|
|
4526
4555
|
const heading_1 = __webpack_require__(2778);
|
|
@@ -4542,7 +4571,7 @@ const dom_1 = __webpack_require__(394);
|
|
|
4542
4571
|
exports.block = (0, combinator_1.reset)({
|
|
4543
4572
|
resources: {
|
|
4544
4573
|
// バックトラックのせいで文字数制限を受けないようにする。
|
|
4545
|
-
clock: segment_1.MAX_SEGMENT_SIZE *
|
|
4574
|
+
clock: segment_1.MAX_SEGMENT_SIZE * 6 + 1,
|
|
4546
4575
|
recursions: [10 || 0 /* Recursion.block */, 20 || 0 /* Recursion.blockquote */, 40 || 0 /* Recursion.listitem */, 20 || 0 /* Recursion.inline */, 20 || 0 /* Recursion.bracket */, 20 || 0 /* Recursion.terminal */]
|
|
4547
4576
|
},
|
|
4548
4577
|
backtracks: {}
|
|
@@ -4567,6 +4596,7 @@ exports.block = (0, combinator_1.reset)({
|
|
|
4567
4596
|
if (source[position + 1] === ' ') return (0, dlist_1.dlist)(input);
|
|
4568
4597
|
break;
|
|
4569
4598
|
case '-':
|
|
4599
|
+
if (source.startsWith('---', position)) return (0, header_1.header)(input);
|
|
4570
4600
|
if (source[position + 1] === ' ') return (0, ulist_1.ulist)(input) || (0, ilist_1.ilist)(input);
|
|
4571
4601
|
break;
|
|
4572
4602
|
case '+':
|
|
@@ -4615,10 +4645,10 @@ function error(parser) {
|
|
|
4615
4645
|
position,
|
|
4616
4646
|
id
|
|
4617
4647
|
}
|
|
4618
|
-
}, reason) => new parser_1.List([new parser_1.
|
|
4648
|
+
}, reason) => new parser_1.List([new parser_1.Node((0, dom_1.html)('h1', {
|
|
4619
4649
|
id: id !== '' ? `error:${(0, random_1.rnd0Z)(8)}` : undefined,
|
|
4620
4650
|
class: 'error'
|
|
4621
|
-
}, reason instanceof Error ? `${reason.name}: ${reason.message}` : `UnknownError: ${reason}`)), new parser_1.
|
|
4651
|
+
}, reason instanceof Error ? `${reason.name}: ${reason.message}` : `UnknownError: ${reason}`)), new parser_1.Node((0, dom_1.html)('pre', {
|
|
4622
4652
|
class: 'error',
|
|
4623
4653
|
translate: 'no'
|
|
4624
4654
|
}, source.slice(position).replace(reg, '').slice(0, 1001).replace(/^(.{997}).{4}$/s, '$1...') || undefined))]));
|
|
@@ -4648,7 +4678,7 @@ exports.blockquote = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, co
|
|
|
4648
4678
|
const opener = /(?=>>+(?:$|[ \n]))/y;
|
|
4649
4679
|
const indent = (0, combinator_1.block)((0, combinator_1.open)(opener, (0, combinator_1.some)(source_1.contentline, />(?:$|[ \n])/y)), false);
|
|
4650
4680
|
const unindent = source => source.replace(/(?<=^|\n)>(?: |(?=>*(?:$|[ \n])))|\n$/g, '');
|
|
4651
|
-
const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(2 /* Recursion.blockquote */, (0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, source, true)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (0, combinator_1.fmap)(autolink_1.autolink, ns => new parser_1.List([new parser_1.
|
|
4681
|
+
const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(2 /* Recursion.blockquote */, (0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, source, true)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (0, combinator_1.fmap)(autolink_1.autolink, ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), true))]))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
|
|
4652
4682
|
const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(2 /* Recursion.blockquote */, (0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, markdown, true)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, ({
|
|
4653
4683
|
context
|
|
4654
4684
|
}) => {
|
|
@@ -4666,8 +4696,8 @@ const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combina
|
|
|
4666
4696
|
}
|
|
4667
4697
|
}, context);
|
|
4668
4698
|
context.position = source.length;
|
|
4669
|
-
return new parser_1.List([new parser_1.
|
|
4670
|
-
}, true))]))), ns => new parser_1.List([new parser_1.
|
|
4699
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('section', [document, (0, dom_1.html)('h2', 'References'), references]))]);
|
|
4700
|
+
}, true))]))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
|
|
4671
4701
|
|
|
4672
4702
|
/***/ },
|
|
4673
4703
|
|
|
@@ -4714,7 +4744,7 @@ exports.codeblock = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinato
|
|
|
4714
4744
|
name in params ? params.invalid = `Duplicate ${name} attribute` : params[name] = value;
|
|
4715
4745
|
return params;
|
|
4716
4746
|
}, {}) ?? {};
|
|
4717
|
-
if (!closer || overflow || params.invalid) return new parser_1.List([new parser_1.
|
|
4747
|
+
if (!closer || overflow || params.invalid) return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
|
|
4718
4748
|
class: 'invalid',
|
|
4719
4749
|
translate: 'no',
|
|
4720
4750
|
...(0, util_1.invalid)('codeblock', !closer || overflow ? 'fence' : 'argument', !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : params.invalid)
|
|
@@ -4726,7 +4756,7 @@ exports.codeblock = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinato
|
|
|
4726
4756
|
'data-line': params.line || undefined,
|
|
4727
4757
|
'data-path': params.path || undefined
|
|
4728
4758
|
}, params.lang ? context.caches?.code?.get(`${params.lang ?? ''}\n${body.slice(0, -1)}`)?.cloneNode(true).childNodes || body.slice(0, -1) || undefined : (0, dom_1.defrag)((0, util_1.unwrap)((0, autolink_1.autolink)((0, parser_1.subinput)(body.slice(0, -1), context)))));
|
|
4729
|
-
return new parser_1.List([new parser_1.
|
|
4759
|
+
return new parser_1.List([new parser_1.Node(el)]);
|
|
4730
4760
|
}));
|
|
4731
4761
|
|
|
4732
4762
|
/***/ },
|
|
@@ -4748,13 +4778,13 @@ const source_1 = __webpack_require__(8745);
|
|
|
4748
4778
|
const visibility_1 = __webpack_require__(6364);
|
|
4749
4779
|
const util_1 = __webpack_require__(4992);
|
|
4750
4780
|
const dom_1 = __webpack_require__(394);
|
|
4751
|
-
exports.dlist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/~ +(?=\S)/y, (0, combinator_1.some)((0, combinator_1.inits)([(0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */ | 32 /* State.index */ | 16 /* State.label */ | 8 /* State.link */, (0, combinator_1.some)(term)), (0, combinator_1.some)(desc)]))), ns => new parser_1.List([new parser_1.
|
|
4752
|
-
const term = (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.open)(/~ +(?=\S)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))), true), ns => new parser_1.List([new parser_1.
|
|
4781
|
+
exports.dlist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/~ +(?=\S)/y, (0, combinator_1.some)((0, combinator_1.inits)([(0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */ | 32 /* State.index */ | 16 /* State.label */ | 8 /* State.link */, (0, combinator_1.some)(term)), (0, combinator_1.some)(desc)]))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('dl', (0, util_1.unwrap)(fillTrailingDescription(ns))))]))));
|
|
4782
|
+
const term = (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.open)(/~ +(?=\S)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))), true), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('dt', {
|
|
4753
4783
|
'data-index': (0, inline_1.dataindex)(ns)
|
|
4754
4784
|
}, (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]))));
|
|
4755
|
-
const desc = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)(/: +(?=\S)|/y, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, /[~:] +(?=\S)/y), (0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]))))), true), ns => new parser_1.List([new parser_1.
|
|
4785
|
+
const desc = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)(/: +(?=\S)|/y, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, /[~:] +(?=\S)/y), (0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]))))), true), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('dd', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false);
|
|
4756
4786
|
function fillTrailingDescription(nodes) {
|
|
4757
|
-
return nodes.last?.value.tagName === 'DT' ? nodes.push(new parser_1.
|
|
4787
|
+
return nodes.last?.value.tagName === 'DT' ? nodes.push(new parser_1.Node((0, dom_1.html)('dd'))) && nodes : nodes;
|
|
4758
4788
|
}
|
|
4759
4789
|
|
|
4760
4790
|
/***/ },
|
|
@@ -4803,7 +4833,7 @@ exports.aside = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combina
|
|
|
4803
4833
|
// Bug: Type mismatch between outer and inner.
|
|
4804
4834
|
(nodes, context) => {
|
|
4805
4835
|
const [body, overflow, closer, opener, delim, param] = (0, util_1.unwrap)(nodes);
|
|
4806
|
-
if (!closer || overflow || param.trimStart()) return new parser_1.List([new parser_1.
|
|
4836
|
+
if (!closer || overflow || param.trimStart()) return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
|
|
4807
4837
|
class: 'invalid',
|
|
4808
4838
|
translate: 'no',
|
|
4809
4839
|
...(0, util_1.invalid)('aside', !closer || overflow ? 'fence' : 'argument', !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : 'Invalid argument')
|
|
@@ -4818,12 +4848,12 @@ exports.aside = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combina
|
|
|
4818
4848
|
}
|
|
4819
4849
|
}, context);
|
|
4820
4850
|
const heading = 'H1 H2 H3 H4 H5 H6'.split(' ').includes(document.firstElementChild?.tagName) && document.firstElementChild;
|
|
4821
|
-
if (!heading) return new parser_1.List([new parser_1.
|
|
4851
|
+
if (!heading) return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
|
|
4822
4852
|
class: 'invalid',
|
|
4823
4853
|
translate: 'no',
|
|
4824
4854
|
...(0, util_1.invalid)('aside', 'content', 'Missing the title at the first line')
|
|
4825
4855
|
}, `${opener}${body}${closer}`))]);
|
|
4826
|
-
return new parser_1.List([new parser_1.
|
|
4856
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('aside', {
|
|
4827
4857
|
id: (0, indexee_1.identity)('index', context.id, heading),
|
|
4828
4858
|
class: 'aside'
|
|
4829
4859
|
}, [document, (0, dom_1.html)('h2', 'References'), references]))]);
|
|
@@ -4851,7 +4881,7 @@ exports.example = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combi
|
|
|
4851
4881
|
// Bug: Type mismatch between outer and inner.
|
|
4852
4882
|
(nodes, context) => {
|
|
4853
4883
|
const [body, overflow, closer, opener, delim, type = 'markdown', param] = (0, util_1.unwrap)(nodes);
|
|
4854
|
-
if (!closer || overflow || param.trimStart()) return new parser_1.List([new parser_1.
|
|
4884
|
+
if (!closer || overflow || param.trimStart()) return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
|
|
4855
4885
|
class: 'invalid',
|
|
4856
4886
|
translate: 'no',
|
|
4857
4887
|
...(0, util_1.invalid)('example', !closer || overflow ? 'fence' : 'argument', !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : 'Invalid argument')
|
|
@@ -4868,7 +4898,7 @@ exports.example = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combi
|
|
|
4868
4898
|
references
|
|
4869
4899
|
}
|
|
4870
4900
|
}, context);
|
|
4871
|
-
return new parser_1.List([new parser_1.
|
|
4901
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('aside', {
|
|
4872
4902
|
class: 'example',
|
|
4873
4903
|
'data-type': 'markdown'
|
|
4874
4904
|
}, [(0, dom_1.html)('pre', {
|
|
@@ -4876,14 +4906,14 @@ exports.example = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combi
|
|
|
4876
4906
|
}, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, dom_1.html)('section', [document, (0, dom_1.html)('h2', 'References'), references])]))]);
|
|
4877
4907
|
}
|
|
4878
4908
|
case 'math':
|
|
4879
|
-
return new parser_1.List([new parser_1.
|
|
4909
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('aside', {
|
|
4880
4910
|
class: 'example',
|
|
4881
4911
|
'data-type': 'math'
|
|
4882
4912
|
}, [(0, dom_1.html)('pre', {
|
|
4883
4913
|
translate: 'no'
|
|
4884
4914
|
}, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, mathblock_1.mathblock)((0, parser_1.subinput)(`$$\n${body}$$`, context)).head.value]))]);
|
|
4885
4915
|
default:
|
|
4886
|
-
return new parser_1.List([new parser_1.
|
|
4916
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
|
|
4887
4917
|
class: 'invalid',
|
|
4888
4918
|
translate: 'no',
|
|
4889
4919
|
...(0, util_1.invalid)('example', 'type', 'Invalid example type')
|
|
@@ -4951,7 +4981,7 @@ exports.figbase = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_
|
|
|
4951
4981
|
}]) => {
|
|
4952
4982
|
const label = el.getAttribute('data-label');
|
|
4953
4983
|
const group = label.split('-', 1)[0];
|
|
4954
|
-
return new parser_1.List([new parser_1.
|
|
4984
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('figure', {
|
|
4955
4985
|
'data-label': label,
|
|
4956
4986
|
'data-group': group,
|
|
4957
4987
|
hidden: ''
|
|
@@ -4993,7 +5023,7 @@ exports.segment = (0, combinator_1.block)((0, combinator_1.match)(/(~{3,})(?:fig
|
|
|
4993
5023
|
(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)));
|
|
4994
5024
|
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 => {
|
|
4995
5025
|
const [label, param, content, ...caption] = (0, util_1.unwrap)(nodes);
|
|
4996
|
-
return new parser_1.List([new parser_1.
|
|
5026
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('figure', attributes(label.getAttribute('data-label'), param, content, caption), [(0, dom_1.html)('figcaption', [(0, dom_1.html)('span', {
|
|
4997
5027
|
class: 'figindex'
|
|
4998
5028
|
}), (0, dom_1.html)('span', {
|
|
4999
5029
|
class: 'figtext'
|
|
@@ -5001,7 +5031,7 @@ exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinat
|
|
|
5001
5031
|
})), (0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})(?:figure(?=$|[ \n])|\[?\$)[^\n]*(?:$|\n)/y, 300), (nodes, context) => {
|
|
5002
5032
|
const [body, overflow, closer, opener, delim] = (0, util_1.unwrap)(nodes);
|
|
5003
5033
|
const violation = !closer && ['fence', `Missing the closing delimiter "${delim}"`] || overflow && ['fence', `Invalid trailing line after the closing delimiter "${delim}"`] || !(0, label_1.segment)((0, parser_1.subinput)(opener.match(/^~+(?:figure )?(\[?\$\S+)/)?.[1] ?? '', context)) && ['label', 'Invalid label'] || /^~+(?:figure )?(\[?\$\S+)[^\S\n]+\S/.test(opener) && ['argument', 'Invalid argument'] || ['content', 'Invalid content'];
|
|
5004
|
-
return new parser_1.List([new parser_1.
|
|
5034
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
|
|
5005
5035
|
class: 'invalid',
|
|
5006
5036
|
translate: 'no',
|
|
5007
5037
|
...(0, util_1.invalid)('figure', violation[0], violation[1])
|
|
@@ -5078,7 +5108,7 @@ exports.message = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_
|
|
|
5078
5108
|
// Bug: Type mismatch between outer and inner.
|
|
5079
5109
|
(nodes, context) => {
|
|
5080
5110
|
const [body, overflow, closer, opener, delim, type, param] = (0, util_1.unwrap)(nodes);
|
|
5081
|
-
if (!closer || overflow || param.trimStart()) return new parser_1.List([new parser_1.
|
|
5111
|
+
if (!closer || overflow || param.trimStart()) return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
|
|
5082
5112
|
class: 'invalid',
|
|
5083
5113
|
translate: 'no',
|
|
5084
5114
|
...(0, util_1.invalid)('message', !closer || overflow ? 'fence' : 'argument', !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : 'Invalid argument')
|
|
@@ -5089,13 +5119,13 @@ exports.message = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_
|
|
|
5089
5119
|
case 'warning':
|
|
5090
5120
|
break;
|
|
5091
5121
|
default:
|
|
5092
|
-
return new parser_1.List([new parser_1.
|
|
5122
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
|
|
5093
5123
|
class: 'invalid',
|
|
5094
5124
|
translate: 'no',
|
|
5095
5125
|
...(0, util_1.invalid)('message', 'type', 'Invalid message type')
|
|
5096
5126
|
}, `${opener}${body}${closer}`))]);
|
|
5097
5127
|
}
|
|
5098
|
-
return new parser_1.List([new parser_1.
|
|
5128
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('section', {
|
|
5099
5129
|
class: `message`,
|
|
5100
5130
|
'data-type': type
|
|
5101
5131
|
}, [...(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))])))]);
|
|
@@ -5134,7 +5164,7 @@ exports.segment = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator
|
|
|
5134
5164
|
exports.segment_ = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 300, false)), false);
|
|
5135
5165
|
exports.placeholder = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(opener, Infinity), nodes => {
|
|
5136
5166
|
const [body, overflow, closer, opener, delim] = (0, util_1.unwrap)(nodes);
|
|
5137
|
-
return new parser_1.List([new parser_1.
|
|
5167
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
|
|
5138
5168
|
class: 'invalid',
|
|
5139
5169
|
translate: 'no',
|
|
5140
5170
|
...(0, util_1.invalid)('extension', 'fence', !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : 'Invalid argument')
|
|
@@ -5153,13 +5183,13 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
5153
5183
|
value: true
|
|
5154
5184
|
}));
|
|
5155
5185
|
exports.table = exports.segment_ = exports.segment = void 0;
|
|
5156
|
-
const alias_1 = __webpack_require__(5413);
|
|
5157
5186
|
const parser_1 = __webpack_require__(605);
|
|
5158
5187
|
const combinator_1 = __webpack_require__(3484);
|
|
5159
5188
|
const inline_1 = __webpack_require__(7973);
|
|
5160
5189
|
const source_1 = __webpack_require__(8745);
|
|
5161
5190
|
const util_1 = __webpack_require__(4992);
|
|
5162
5191
|
const visibility_1 = __webpack_require__(6364);
|
|
5192
|
+
const alias_1 = __webpack_require__(5413);
|
|
5163
5193
|
const array_1 = __webpack_require__(6876);
|
|
5164
5194
|
const dom_1 = __webpack_require__(394);
|
|
5165
5195
|
const opener = /(~{3,})table(?:\/(\S+))?(?!\S)([^\n]*)(?:$|\n)/y;
|
|
@@ -5169,7 +5199,7 @@ exports.table = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.
|
|
|
5169
5199
|
// Bug: Type mismatch between outer and inner.
|
|
5170
5200
|
(nodes, context) => {
|
|
5171
5201
|
const [body, overflow, closer, opener, delim, type, param] = (0, util_1.unwrap)(nodes);
|
|
5172
|
-
if (!closer || overflow || param.trimStart()) return new parser_1.List([new parser_1.
|
|
5202
|
+
if (!closer || overflow || param.trimStart()) return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
|
|
5173
5203
|
class: 'invalid',
|
|
5174
5204
|
translate: 'no',
|
|
5175
5205
|
...(0, util_1.invalid)('table', !closer || overflow ? 'fence' : 'argument', !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : 'Invalid argument')
|
|
@@ -5177,28 +5207,28 @@ exports.table = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.
|
|
|
5177
5207
|
switch (type) {
|
|
5178
5208
|
case 'grid':
|
|
5179
5209
|
case undefined:
|
|
5180
|
-
return (parser((0, parser_1.subinput)(body, context)) ?? new parser_1.List([new parser_1.
|
|
5210
|
+
return (parser((0, parser_1.subinput)(body, context)) ?? new parser_1.List([new parser_1.Node((0, dom_1.html)('table'))])).foldl((acc, {
|
|
5181
5211
|
value
|
|
5182
|
-
}) => acc.push(new parser_1.
|
|
5212
|
+
}) => acc.push(new parser_1.Node((0, dom_1.define)(value, {
|
|
5183
5213
|
'data-type': type
|
|
5184
5214
|
}))) && acc, new parser_1.List());
|
|
5185
5215
|
default:
|
|
5186
|
-
return new parser_1.List([new parser_1.
|
|
5216
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
|
|
5187
5217
|
class: 'invalid',
|
|
5188
5218
|
translate: 'no',
|
|
5189
5219
|
...(0, util_1.invalid)('table', 'argument', 'Invalid table type')
|
|
5190
5220
|
}, `${opener}${body}${closer}`))]);
|
|
5191
5221
|
}
|
|
5192
5222
|
}));
|
|
5193
|
-
const parser = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([row])), rows => new parser_1.List([new parser_1.
|
|
5194
|
-
const row = (0, combinator_1.lazy)(() => (0, combinator_1.dup)((0, combinator_1.fmap)((0, combinator_1.subsequence)([(0, combinator_1.union)([align]), (0, combinator_1.some)((0, combinator_1.union)([head, data, (0, combinator_1.some)(dataline, alignment), source_1.emptyline]))]), ns => Array.isArray(ns.head?.value) ? ns : ns.unshift(new parser_1.
|
|
5223
|
+
const parser = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([row])), rows => new parser_1.List([new parser_1.Node((0, dom_1.html)('table', format([...(0, util_1.unwrap)(rows)])))]))));
|
|
5224
|
+
const row = (0, combinator_1.lazy)(() => (0, combinator_1.dup)((0, combinator_1.fmap)((0, combinator_1.subsequence)([(0, combinator_1.union)([align]), (0, combinator_1.some)((0, combinator_1.union)([head, data, (0, combinator_1.some)(dataline, alignment), source_1.emptyline]))]), ns => Array.isArray(ns.head?.value) ? ns : ns.unshift(new parser_1.Node([[]])) && ns)));
|
|
5195
5225
|
const alignment = /[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)/y;
|
|
5196
5226
|
const align = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.union)([(0, source_1.str)(alignment)]), ([{
|
|
5197
5227
|
value
|
|
5198
|
-
}]) => new parser_1.List([new parser_1.
|
|
5228
|
+
}]) => new parser_1.List([new parser_1.Node(value.split('/').map(s => s.split('')))])));
|
|
5199
5229
|
const delimiter = /[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)|[#:](?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=[ \n])/y;
|
|
5200
|
-
const head = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/#(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=[ \n])/y), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.union)([(0, combinator_1.block)((0, combinator_1.surround)(/\s/y, (0, combinator_1.union)([inline_1.medialink, inline_1.media, inline_1.lineshortmedia]), /[^\S\n]*(?:$|\n)/y)), (0, combinator_1.open)(/(?:[^\S\n]*\n|\s)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))), true)])), true), ns => new parser_1.List([new parser_1.
|
|
5201
|
-
const data = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/:(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=[ \n])/y), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.union)([(0, combinator_1.block)((0, combinator_1.surround)(/\s/y, (0, combinator_1.union)([inline_1.medialink, inline_1.media, inline_1.lineshortmedia]), /[^\S\n]*(?:$|\n)/y)), (0, combinator_1.open)(/(?:[^\S\n]*\n|\s)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, combinator_1.some)(inline_1.inline))), true)])), true), ns => new parser_1.List([new parser_1.
|
|
5230
|
+
const head = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/#(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=[ \n])/y), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.union)([(0, combinator_1.block)((0, combinator_1.surround)(/\s/y, (0, combinator_1.union)([inline_1.medialink, inline_1.media, inline_1.lineshortmedia]), /[^\S\n]*(?:$|\n)/y)), (0, combinator_1.open)(/(?:[^\S\n]*\n|\s)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))), true)])), true), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('th', attributes(ns.shift().value), (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false);
|
|
5231
|
+
const data = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/:(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=[ \n])/y), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.union)([(0, combinator_1.block)((0, combinator_1.surround)(/\s/y, (0, combinator_1.union)([inline_1.medialink, inline_1.media, inline_1.lineshortmedia]), /[^\S\n]*(?:$|\n)/y)), (0, combinator_1.open)(/(?:[^\S\n]*\n|\s)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, combinator_1.some)(inline_1.inline))), true)])), true), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('td', attributes(ns.shift().value), (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false);
|
|
5202
5232
|
const dataline = (0, combinator_1.line)((0, combinator_1.rewrite)(source_1.contentline, (0, combinator_1.union)([(0, combinator_1.validate)(/!+ /y, (0, combinator_1.convert)(source => `:${source}`, data)), (0, combinator_1.convert)(source => `: ${source}`, data)])));
|
|
5203
5233
|
function attributes(source) {
|
|
5204
5234
|
let [, rowspan = undefined, colspan = undefined, highlight = undefined, extension = undefined] = source.match(/^[#:](?:(\d+)?:(\d+)?)?(?:(!+)([+]?))?$/) ?? [];
|
|
@@ -5425,12 +5455,12 @@ exports.segment = (0, combinator_1.block)((0, combinator_1.focus)(/#+ +\S[^\n]*(
|
|
|
5425
5455
|
} = input;
|
|
5426
5456
|
const {
|
|
5427
5457
|
source,
|
|
5428
|
-
range
|
|
5458
|
+
range
|
|
5429
5459
|
} = context;
|
|
5430
5460
|
const acc = new parser_1.List();
|
|
5431
5461
|
for (const len = context.position + range; context.position < len;) {
|
|
5432
5462
|
const line = (0, combinator_1.firstline)(source, context.position);
|
|
5433
|
-
acc.push(new parser_1.
|
|
5463
|
+
acc.push(new parser_1.Node(line));
|
|
5434
5464
|
context.position += line.length;
|
|
5435
5465
|
}
|
|
5436
5466
|
return acc;
|
|
@@ -5439,9 +5469,9 @@ exports.heading = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segm
|
|
|
5439
5469
|
// その他の表示制御は各所のCSSで行う。
|
|
5440
5470
|
(0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */ | 32 /* State.index */ | 16 /* State.label */ | 8 /* State.link */, (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.open)((0, source_1.str)(/##+/y), (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))), true), (0, combinator_1.open)((0, source_1.str)('#'), (0, combinator_1.state)(251 /* State.linkers */, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline]))))), true)]), (nodes, context) => {
|
|
5441
5471
|
const [h, ...ns] = (0, util_1.unwrap)(nodes);
|
|
5442
|
-
return new parser_1.List([h.length <= 6 ? new parser_1.
|
|
5472
|
+
return new parser_1.List([h.length <= 6 ? new parser_1.Node((0, dom_1.html)(`h${h.length}`, {
|
|
5443
5473
|
'data-index': (0, inline_1.dataindex)(nodes)
|
|
5444
|
-
}, (0, dom_1.defrag)(ns))) : new parser_1.
|
|
5474
|
+
}, (0, dom_1.defrag)(ns))) : new parser_1.Node((0, dom_1.html)(`h6`, {
|
|
5445
5475
|
class: 'invalid',
|
|
5446
5476
|
...(0, util_1.invalid)('heading', 'syntax', 'Heading level must be up to 6')
|
|
5447
5477
|
}, context.source.slice(context.position - context.range, context.position)))]);
|
|
@@ -5469,7 +5499,7 @@ const visibility_1 = __webpack_require__(6364);
|
|
|
5469
5499
|
const util_1 = __webpack_require__(4992);
|
|
5470
5500
|
const dom_1 = __webpack_require__(394);
|
|
5471
5501
|
exports.ilist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(/[-+*] /y, exports.ilist_)));
|
|
5472
|
-
exports.ilist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/[-+*](?:$|[ \n])/y, (0, combinator_1.some)((0, combinator_1.recursion)(3 /* Recursion.listitem */, (0, combinator_1.union)([(0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/[-+*](?:$|[ \n])/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))), true)), (0, combinator_1.indent)((0, combinator_1.union)([ulist_1.ulist_, olist_1.olist_, exports.ilist_]))]), exports.ilistitem), ns => new parser_1.List([new parser_1.
|
|
5502
|
+
exports.ilist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/[-+*](?:$|[ \n])/y, (0, combinator_1.some)((0, combinator_1.recursion)(3 /* Recursion.listitem */, (0, combinator_1.union)([(0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/[-+*](?:$|[ \n])/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))), true)), (0, combinator_1.indent)((0, combinator_1.union)([ulist_1.ulist_, olist_1.olist_, exports.ilist_]))]), exports.ilistitem), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('li', (0, dom_1.defrag)((0, util_1.unwrap)((0, ulist_1.fillFirstLine)(ns)))))]))])))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('ul', {
|
|
5473
5503
|
class: 'invalid',
|
|
5474
5504
|
...(0, util_1.invalid)('list', 'syntax', 'Use "-" instead of "+" or "*"')
|
|
5475
5505
|
}, (0, util_1.unwrap)(ns)))]))));
|
|
@@ -5477,11 +5507,11 @@ exports.ilistitem = (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.
|
|
|
5477
5507
|
context: {
|
|
5478
5508
|
source
|
|
5479
5509
|
}
|
|
5480
|
-
}) => new parser_1.List([new parser_1.
|
|
5510
|
+
}) => new parser_1.List([new parser_1.Node(source)]))]), ({
|
|
5481
5511
|
context: {
|
|
5482
5512
|
source
|
|
5483
5513
|
}
|
|
5484
|
-
}) => new parser_1.List([new parser_1.
|
|
5514
|
+
}) => new parser_1.List([new parser_1.Node(''), new parser_1.Node((0, dom_1.html)('span', {
|
|
5485
5515
|
class: 'invalid',
|
|
5486
5516
|
...(0, util_1.invalid)('list', 'syntax', 'Fix the indent or the head of the list item')
|
|
5487
5517
|
}, source.replace('\n', '')))]));
|
|
@@ -5513,10 +5543,10 @@ exports.mathblock = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinato
|
|
|
5513
5543
|
} = {}
|
|
5514
5544
|
}) => {
|
|
5515
5545
|
const [body, overflow, closer, opener, delim, param] = (0, util_1.unwrap)(nodes);
|
|
5516
|
-
return new parser_1.List([delim.length === 2 && closer && !overflow && param.trimStart() === '' ? new parser_1.
|
|
5546
|
+
return new parser_1.List([delim.length === 2 && closer && !overflow && param.trimStart() === '' ? new parser_1.Node(cache?.get(`${delim}\n${body}${delim}`)?.cloneNode(true) || (0, dom_1.html)('div', {
|
|
5517
5547
|
class: 'math',
|
|
5518
5548
|
translate: 'no'
|
|
5519
|
-
}, `${delim}\n${body}${delim}`)) : new parser_1.
|
|
5549
|
+
}, `${delim}\n${body}${delim}`)) : new parser_1.Node((0, dom_1.html)('pre', {
|
|
5520
5550
|
class: 'invalid',
|
|
5521
5551
|
translate: 'no',
|
|
5522
5552
|
...(0, util_1.invalid)('mathblock', delim.length > 2 ? 'syntax' : !closer || overflow ? 'fence' : 'argument', delim.length > 2 ? 'Invalid syntax' : !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : 'Invalid argument')
|
|
@@ -5544,10 +5574,10 @@ exports.mediablock = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinat
|
|
|
5544
5574
|
context: {
|
|
5545
5575
|
source
|
|
5546
5576
|
}
|
|
5547
|
-
}) => new parser_1.List([new parser_1.
|
|
5577
|
+
}) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
5548
5578
|
class: 'invalid',
|
|
5549
5579
|
...(0, util_1.invalid)('mediablock', 'syntax', 'Not media syntax')
|
|
5550
|
-
}, source.replace('\n', '')))]))))]), ns => new parser_1.List([new parser_1.
|
|
5580
|
+
}, source.replace('\n', '')))]))))]), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('div', (0, util_1.unwrap)(ns)))])));
|
|
5551
5581
|
|
|
5552
5582
|
/***/ },
|
|
5553
5583
|
|
|
@@ -5576,21 +5606,21 @@ const openers = {
|
|
|
5576
5606
|
};
|
|
5577
5607
|
exports.olist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(new RegExp([/(?:[0-9]+)(?:-[0-9]+)*\. /y.source, /\((?:[0-9]+)\)(?:-[0-9]+)* /y.source].join('|'), 'y'), exports.olist_)));
|
|
5578
5608
|
exports.olist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.match)(openers['.'], (0, memoize_1.memoize)(ms => list(type(ms[1]), '.'), ms => idx(ms[1]), [])), (0, combinator_1.match)(openers['('], (0, memoize_1.memoize)(ms => list(type(ms[1]), '('), ms => idx(ms[1]), []))])));
|
|
5579
|
-
const list = (type, form) => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(3 /* Recursion.listitem */, (0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(heads[form], (0, combinator_1.subsequence)([ulist_1.checkbox, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline]))))]), true)), (0, combinator_1.indent)((0, combinator_1.union)([ulist_1.ulist_, exports.olist_, ilist_1.ilist_]))]), ilist_1.ilistitem), ns => new parser_1.List([new parser_1.
|
|
5609
|
+
const list = (type, form) => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(3 /* Recursion.listitem */, (0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(heads[form], (0, combinator_1.subsequence)([ulist_1.checkbox, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline]))))]), true)), (0, combinator_1.indent)((0, combinator_1.union)([ulist_1.ulist_, exports.olist_, ilist_1.ilist_]))]), ilist_1.ilistitem), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('li', {
|
|
5580
5610
|
'data-index': (0, inline_1.dataindex)(ns),
|
|
5581
5611
|
'data-marker': ns.shift()?.value || undefined
|
|
5582
|
-
}, (0, dom_1.defrag)((0, util_1.unwrap)((0, ulist_1.fillFirstLine)(ns)))))])))]))), ns => new parser_1.List([new parser_1.
|
|
5612
|
+
}, (0, dom_1.defrag)((0, util_1.unwrap)((0, ulist_1.fillFirstLine)(ns)))))])))]))), ns => new parser_1.List([new parser_1.Node(format((0, dom_1.html)('ol', (0, util_1.unwrap)(ns)), type, form))]));
|
|
5583
5613
|
const heads = {
|
|
5584
5614
|
'.': (0, combinator_1.focus)(openers['.'], ({
|
|
5585
5615
|
context: {
|
|
5586
5616
|
source
|
|
5587
5617
|
}
|
|
5588
|
-
}) => new parser_1.List([new parser_1.
|
|
5618
|
+
}) => new parser_1.List([new parser_1.Node(source.trimEnd().split('.', 1)[0] + '.')])),
|
|
5589
5619
|
'(': (0, combinator_1.focus)(openers['('], ({
|
|
5590
5620
|
context: {
|
|
5591
5621
|
source
|
|
5592
5622
|
}
|
|
5593
|
-
}) => new parser_1.List([new parser_1.
|
|
5623
|
+
}) => new parser_1.List([new parser_1.Node(source.trimEnd().replace(/^\($/, '(1)').replace(/^\((\w+)$/, '($1)'))]))
|
|
5594
5624
|
};
|
|
5595
5625
|
function idx(value) {
|
|
5596
5626
|
switch (value) {
|
|
@@ -5695,7 +5725,7 @@ exports.pagebreak = void 0;
|
|
|
5695
5725
|
const parser_1 = __webpack_require__(605);
|
|
5696
5726
|
const combinator_1 = __webpack_require__(3484);
|
|
5697
5727
|
const dom_1 = __webpack_require__(394);
|
|
5698
|
-
exports.pagebreak = (0, combinator_1.block)((0, combinator_1.line)((0, combinator_1.focus)(/={3,}[^\S\n]*(?:$|\n)/y, () => new parser_1.List([new parser_1.
|
|
5728
|
+
exports.pagebreak = (0, combinator_1.block)((0, combinator_1.line)((0, combinator_1.focus)(/={3,}[^\S\n]*(?:$|\n)/y, () => new parser_1.List([new parser_1.Node((0, dom_1.html)('hr'))]))));
|
|
5699
5729
|
|
|
5700
5730
|
/***/ },
|
|
5701
5731
|
|
|
@@ -5715,7 +5745,7 @@ const inline_1 = __webpack_require__(7973);
|
|
|
5715
5745
|
const visibility_1 = __webpack_require__(6364);
|
|
5716
5746
|
const util_1 = __webpack_require__(4992);
|
|
5717
5747
|
const dom_1 = __webpack_require__(394);
|
|
5718
|
-
exports.paragraph = (0, combinator_1.block)((0, combinator_1.fmap)((0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline])))), ns => new parser_1.List([new parser_1.
|
|
5748
|
+
exports.paragraph = (0, combinator_1.block)((0, combinator_1.fmap)((0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline])))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('p', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])));
|
|
5719
5749
|
|
|
5720
5750
|
/***/ },
|
|
5721
5751
|
|
|
@@ -5742,7 +5772,7 @@ const delimiter = new RegExp(`${cite_1.syntax.source}|${quote_1.syntax.source}`,
|
|
|
5742
5772
|
exports.reply = (0, combinator_1.block)((0, combinator_1.validate)(cite_1.syntax, (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([cite_1.cite, quote_1.quote, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, delimiter), (0, visibility_1.visualize)((0, combinator_1.fmap)((0, combinator_1.some)(inline_1.inline), (ns, {
|
|
5743
5773
|
source,
|
|
5744
5774
|
position
|
|
5745
|
-
}) => source[position - 1] === '\n' ? ns : ns.push(new parser_1.
|
|
5775
|
+
}) => source[position - 1] === '\n' ? ns : ns.push(new parser_1.Node((0, dom_1.html)('br'))) && ns)))])), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('p', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(ns)))))]))));
|
|
5746
5776
|
|
|
5747
5777
|
/***/ },
|
|
5748
5778
|
|
|
@@ -5770,13 +5800,13 @@ exports.cite = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.op
|
|
|
5770
5800
|
context: {
|
|
5771
5801
|
source
|
|
5772
5802
|
}
|
|
5773
|
-
}) => new parser_1.List([new parser_1.
|
|
5803
|
+
}) => new parser_1.List([new parser_1.Node((0, dom_1.html)('a', {
|
|
5774
5804
|
class: 'anchor'
|
|
5775
5805
|
}, source))])), (0, combinator_1.focus)(/>>https?:\/\/\S+(?=\s*$)/y, ({
|
|
5776
5806
|
context: {
|
|
5777
5807
|
source
|
|
5778
5808
|
}
|
|
5779
|
-
}) => new parser_1.List([new parser_1.
|
|
5809
|
+
}) => new parser_1.List([new parser_1.Node((0, dom_1.html)('a', {
|
|
5780
5810
|
class: 'anchor',
|
|
5781
5811
|
href: source.slice(2).trimEnd(),
|
|
5782
5812
|
target: '_blank'
|
|
@@ -5784,17 +5814,17 @@ exports.cite = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.op
|
|
|
5784
5814
|
context: {
|
|
5785
5815
|
source
|
|
5786
5816
|
}
|
|
5787
|
-
}) => new parser_1.List([new parser_1.
|
|
5817
|
+
}) => new parser_1.List([new parser_1.Node(source)]))])), nodes => {
|
|
5788
5818
|
const quotes = nodes.head.value;
|
|
5789
5819
|
const node = nodes.last.value;
|
|
5790
|
-
return new parser_1.List([new parser_1.
|
|
5820
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('span', typeof node === 'object' ? {
|
|
5791
5821
|
class: 'cite'
|
|
5792
5822
|
} : {
|
|
5793
5823
|
class: 'cite invalid',
|
|
5794
5824
|
...(0, util_1.invalid)('cite', 'syntax', 'Invalid syntax')
|
|
5795
5825
|
}, (0, dom_1.defrag)([`${quotes}>`, typeof node === 'object' ? (0, dom_1.define)(node, {
|
|
5796
5826
|
'data-depth': `${quotes.length + 1}`
|
|
5797
|
-
}, node.innerText.slice(1)) : node.slice(1)]))), new parser_1.
|
|
5827
|
+
}, node.innerText.slice(1)) : node.slice(1)]))), new parser_1.Node((0, dom_1.html)('br'))]);
|
|
5798
5828
|
}));
|
|
5799
5829
|
|
|
5800
5830
|
/***/ },
|
|
@@ -5812,7 +5842,7 @@ exports.quote = exports.syntax = void 0;
|
|
|
5812
5842
|
const parser_1 = __webpack_require__(605);
|
|
5813
5843
|
const combinator_1 = __webpack_require__(3484);
|
|
5814
5844
|
const math_1 = __webpack_require__(2962);
|
|
5815
|
-
const autolink_1 = __webpack_require__(
|
|
5845
|
+
const autolink_1 = __webpack_require__(5691);
|
|
5816
5846
|
const source_1 = __webpack_require__(8745);
|
|
5817
5847
|
const util_1 = __webpack_require__(4992);
|
|
5818
5848
|
const dom_1 = __webpack_require__(394);
|
|
@@ -5822,7 +5852,7 @@ exports.quote = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combina
|
|
|
5822
5852
|
math_1.math, autolink_1.autolink, source_1.unescsource])))), (ns, {
|
|
5823
5853
|
source,
|
|
5824
5854
|
position
|
|
5825
|
-
}) => new parser_1.List([new parser_1.
|
|
5855
|
+
}) => new parser_1.List([new parser_1.Node(source[position - 1] === '\n' ? ns.pop().value : (0, dom_1.html)('br')), new parser_1.Node((0, dom_1.html)('span', {
|
|
5826
5856
|
class: 'quote'
|
|
5827
5857
|
}, (0, dom_1.defrag)((0, util_1.unwrap)(ns))))].reverse())), false));
|
|
5828
5858
|
|
|
@@ -5846,13 +5876,13 @@ const util_1 = __webpack_require__(4992);
|
|
|
5846
5876
|
const dom_1 = __webpack_require__(394);
|
|
5847
5877
|
exports.sidefence = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.focus)(/\|+ [^\n]*(?:\n\|+(?=$|[ \n])[^\n]*)*(?:$|\n)/y, (0, combinator_1.union)([source])), ([{
|
|
5848
5878
|
value
|
|
5849
|
-
}]) => new parser_1.List([new parser_1.
|
|
5879
|
+
}]) => new parser_1.List([new parser_1.Node((0, dom_1.define)(value, {
|
|
5850
5880
|
class: 'invalid',
|
|
5851
5881
|
...(0, util_1.invalid)('sidefence', 'syntax', 'Reserved syntax')
|
|
5852
5882
|
}))]))));
|
|
5853
5883
|
const opener = /(?=\|\|+(?:$|[ \n]))/y;
|
|
5854
5884
|
const unindent = source => source.replace(/(?<=^|\n)\|(?: |(?=\|*(?:$|[ \n])))|\n$/g, '');
|
|
5855
|
-
const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(1 /* Recursion.block */, (0, combinator_1.union)([(0, combinator_1.focus)(/(?:\|\|+(?=$|[ \n])[^\n]*(?:$|\n))+/y, (0, combinator_1.convert)(unindent, source, true)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (0, combinator_1.fmap)(autolink_1.autolink, ns => new parser_1.List([new parser_1.
|
|
5885
|
+
const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(1 /* Recursion.block */, (0, combinator_1.union)([(0, combinator_1.focus)(/(?:\|\|+(?=$|[ \n])[^\n]*(?:$|\n))+/y, (0, combinator_1.convert)(unindent, source, true)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (0, combinator_1.fmap)(autolink_1.autolink, ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), true))]))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
|
|
5856
5886
|
|
|
5857
5887
|
/***/ },
|
|
5858
5888
|
|
|
@@ -5875,12 +5905,12 @@ const util_1 = __webpack_require__(4992);
|
|
|
5875
5905
|
const duff_1 = __webpack_require__(9202);
|
|
5876
5906
|
const array_1 = __webpack_require__(6876);
|
|
5877
5907
|
const dom_1 = __webpack_require__(394);
|
|
5878
|
-
exports.table = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/\|[^\n]*(?:\n\|[^\n]*){2}/y, (0, combinator_1.sequence)([row((0, combinator_1.some)(head), true), row((0, combinator_1.some)(align), false), (0, combinator_1.some)(row((0, combinator_1.some)(data), true))])), rows => new parser_1.List([new parser_1.
|
|
5879
|
-
const row = (parser, optional) => (0, combinator_1.fallback)((0, combinator_1.fmap)((0, combinator_1.line)((0, combinator_1.surround)(/(?=\|)/y, (0, combinator_1.some)((0, combinator_1.union)([parser])), /\|?\s*$/y, optional)), ns => new parser_1.List([new parser_1.
|
|
5908
|
+
exports.table = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/\|[^\n]*(?:\n\|[^\n]*){2}/y, (0, combinator_1.sequence)([row((0, combinator_1.some)(head), true), row((0, combinator_1.some)(align), false), (0, combinator_1.some)(row((0, combinator_1.some)(data), true))])), rows => new parser_1.List([new parser_1.Node((0, dom_1.html)('table', [(0, dom_1.html)('thead', [rows.shift().value]), (0, dom_1.html)('tbody', (0, util_1.unwrap)(format(rows)))]))]))));
|
|
5909
|
+
const row = (parser, optional) => (0, combinator_1.fallback)((0, combinator_1.fmap)((0, combinator_1.line)((0, combinator_1.surround)(/(?=\|)/y, (0, combinator_1.some)((0, combinator_1.union)([parser])), /\|?\s*$/y, optional)), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('tr', (0, util_1.unwrap)(ns)))])), (0, combinator_1.rewrite)(source_1.contentline, ({
|
|
5880
5910
|
context: {
|
|
5881
5911
|
source
|
|
5882
5912
|
}
|
|
5883
|
-
}) => new parser_1.List([new parser_1.
|
|
5913
|
+
}) => new parser_1.List([new parser_1.Node((0, dom_1.html)('tr', {
|
|
5884
5914
|
class: 'invalid',
|
|
5885
5915
|
...(0, util_1.invalid)('table-row', 'syntax', 'Missing the start symbol of the table row')
|
|
5886
5916
|
}, [(0, dom_1.html)('td', source.replace('\n', ''))]))])));
|
|
@@ -5888,18 +5918,18 @@ const align = (0, combinator_1.fmap)((0, combinator_1.open)('|', (0, combinator_
|
|
|
5888
5918
|
context: {
|
|
5889
5919
|
source,
|
|
5890
5920
|
position,
|
|
5891
|
-
range
|
|
5921
|
+
range
|
|
5892
5922
|
}
|
|
5893
|
-
}) => new parser_1.List([new parser_1.
|
|
5923
|
+
}) => new parser_1.List([new parser_1.Node(source[position + range - 1] === ':' ? 'center' : 'start')]), false), (0, combinator_1.focus)(/-+:?/y, ({
|
|
5894
5924
|
context: {
|
|
5895
5925
|
source,
|
|
5896
5926
|
position,
|
|
5897
|
-
range
|
|
5927
|
+
range
|
|
5898
5928
|
}
|
|
5899
|
-
}) => new parser_1.List([new parser_1.
|
|
5929
|
+
}) => new parser_1.List([new parser_1.Node(source[position + range - 1] === ':' ? 'end' : '')]), false)])), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('td', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]));
|
|
5900
5930
|
const cell = (0, combinator_1.surround)(/\|\s*(?=\S)/y, (0, combinator_1.union)([(0, combinator_1.close)(inline_1.medialink, /\s*(?=\||$)/y), (0, combinator_1.close)(inline_1.media, /\s*(?=\||$)/y), (0, combinator_1.close)(inline_1.shortmedia, /\s*(?=\||$)/y), (0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline, /\|/y, [[/\|?\s*$/y, 9]]))]), /[^|]*/y, true);
|
|
5901
|
-
const head = (0, combinator_1.fmap)(cell, ns => new parser_1.List([new parser_1.
|
|
5902
|
-
const data = (0, combinator_1.fmap)(cell, ns => new parser_1.List([new parser_1.
|
|
5931
|
+
const head = (0, combinator_1.fmap)(cell, ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('th', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]));
|
|
5932
|
+
const data = (0, combinator_1.fmap)(cell, ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('td', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]));
|
|
5903
5933
|
function format(rows) {
|
|
5904
5934
|
const aligns = rows.head.value.className === 'invalid' ? [] : (0, duff_1.duffReduce)(rows.shift().value.children, (acc, el) => (0, array_1.push)(acc, [el.textContent]), []);
|
|
5905
5935
|
for (const {
|
|
@@ -5937,15 +5967,15 @@ const visibility_1 = __webpack_require__(6364);
|
|
|
5937
5967
|
const util_1 = __webpack_require__(4992);
|
|
5938
5968
|
const dom_1 = __webpack_require__(394);
|
|
5939
5969
|
exports.ulist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)('- ', exports.ulist_)));
|
|
5940
|
-
exports.ulist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/-(?=$|[ \n])/y, (0, combinator_1.some)((0, combinator_1.recursion)(3 /* Recursion.listitem */, (0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/-(?:$|[ \n])/y, (0, combinator_1.subsequence)([exports.checkbox, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline]))))]), true)), (0, combinator_1.indent)((0, combinator_1.union)([exports.ulist_, olist_1.olist_, ilist_1.ilist_]))]), ilist_1.ilistitem), ns => new parser_1.List([new parser_1.
|
|
5970
|
+
exports.ulist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/-(?=$|[ \n])/y, (0, combinator_1.some)((0, combinator_1.recursion)(3 /* Recursion.listitem */, (0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/-(?:$|[ \n])/y, (0, combinator_1.subsequence)([exports.checkbox, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline]))))]), true)), (0, combinator_1.indent)((0, combinator_1.union)([exports.ulist_, olist_1.olist_, ilist_1.ilist_]))]), ilist_1.ilistitem), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('li', {
|
|
5941
5971
|
'data-index': (0, inline_1.dataindex)(ns)
|
|
5942
|
-
}, (0, dom_1.defrag)((0, util_1.unwrap)(fillFirstLine(ns)))))])))])))), ns => new parser_1.List([new parser_1.
|
|
5972
|
+
}, (0, dom_1.defrag)((0, util_1.unwrap)(fillFirstLine(ns)))))])))])))), ns => new parser_1.List([new parser_1.Node(format((0, dom_1.html)('ul', (0, util_1.unwrap)(ns))))]))));
|
|
5943
5973
|
exports.checkbox = (0, combinator_1.focus)(/\[[xX ]\](?=$|[ \n])/y, ({
|
|
5944
5974
|
context: {
|
|
5945
5975
|
source,
|
|
5946
5976
|
position
|
|
5947
5977
|
}
|
|
5948
|
-
}) => new parser_1.List([new parser_1.
|
|
5978
|
+
}) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
5949
5979
|
class: 'checkbox'
|
|
5950
5980
|
}, source[position + 1].trimStart() ? '☑' : '☐'))]), false);
|
|
5951
5981
|
function fillFirstLine(nodes) {
|
|
@@ -5954,7 +5984,7 @@ function fillFirstLine(nodes) {
|
|
|
5954
5984
|
switch (node.tagName) {
|
|
5955
5985
|
case 'UL':
|
|
5956
5986
|
case 'OL':
|
|
5957
|
-
nodes.unshift(new parser_1.
|
|
5987
|
+
nodes.unshift(new parser_1.Node((0, dom_1.html)('br')));
|
|
5958
5988
|
}
|
|
5959
5989
|
return nodes;
|
|
5960
5990
|
}
|
|
@@ -5968,6 +5998,45 @@ function format(list) {
|
|
|
5968
5998
|
|
|
5969
5999
|
/***/ },
|
|
5970
6000
|
|
|
6001
|
+
/***/ 8669
|
|
6002
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
6003
|
+
|
|
6004
|
+
"use strict";
|
|
6005
|
+
|
|
6006
|
+
|
|
6007
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
6008
|
+
value: true
|
|
6009
|
+
}));
|
|
6010
|
+
exports.CmdRegExp = exports.Context = void 0;
|
|
6011
|
+
const parser_1 = __webpack_require__(605);
|
|
6012
|
+
class Context extends parser_1.Context {
|
|
6013
|
+
constructor(options = {}) {
|
|
6014
|
+
super(options);
|
|
6015
|
+
const {
|
|
6016
|
+
buffer,
|
|
6017
|
+
sequential,
|
|
6018
|
+
header,
|
|
6019
|
+
host,
|
|
6020
|
+
url,
|
|
6021
|
+
id,
|
|
6022
|
+
caches
|
|
6023
|
+
} = options;
|
|
6024
|
+
this.buffer = buffer ?? new parser_1.List();
|
|
6025
|
+
this.sequential = sequential ?? false;
|
|
6026
|
+
this.header = header;
|
|
6027
|
+
this.host = host;
|
|
6028
|
+
this.url = url;
|
|
6029
|
+
this.id = id;
|
|
6030
|
+
this.caches = caches;
|
|
6031
|
+
}
|
|
6032
|
+
}
|
|
6033
|
+
exports.Context = Context;
|
|
6034
|
+
exports.CmdRegExp = {
|
|
6035
|
+
Error: /\x07/g
|
|
6036
|
+
};
|
|
6037
|
+
|
|
6038
|
+
/***/ },
|
|
6039
|
+
|
|
5971
6040
|
/***/ 3009
|
|
5972
6041
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
5973
6042
|
|
|
@@ -5986,11 +6055,11 @@ const normalize_1 = __webpack_require__(4490);
|
|
|
5986
6055
|
const dom_1 = __webpack_require__(394);
|
|
5987
6056
|
exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+ *\n(?=\S)/y, (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(({
|
|
5988
6057
|
context
|
|
5989
|
-
}) => context.header ?? true, (0, combinator_1.focus)(/(---+) *\n(?:[A-Za-z][0-9A-Za-z]*(?:-[0-9A-Za-z]+)*:[ \t]+\S[^\n]*\n){1,100}\1 *(?:$|\n)/y, (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.
|
|
6058
|
+
}) => context.header ?? true, (0, combinator_1.focus)(/(---+) *\n(?:[A-Za-z][0-9A-Za-z]*(?:-[0-9A-Za-z]+)*:[ \t]+\S[^\n]*\n){1,100}\1 *(?:$|\n)/y, (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', {
|
|
5990
6059
|
class: 'header'
|
|
5991
6060
|
}, [(0, dom_1.html)('details', {
|
|
5992
6061
|
open: ''
|
|
5993
|
-
}, (0, dom_1.defrag)((0, util_1.unwrap)(ns.unshift(new parser_1.
|
|
6062
|
+
}, (0, dom_1.defrag)((0, util_1.unwrap)(ns.unshift(new parser_1.Node((0, dom_1.html)('summary', 'Header'))) && ns)))]))]))))), ({
|
|
5994
6063
|
context
|
|
5995
6064
|
}) => {
|
|
5996
6065
|
const {
|
|
@@ -5998,7 +6067,7 @@ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+ *
|
|
|
5998
6067
|
position
|
|
5999
6068
|
} = context;
|
|
6000
6069
|
context.position += source.length;
|
|
6001
|
-
return new parser_1.List([new parser_1.
|
|
6070
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
|
|
6002
6071
|
class: 'invalid',
|
|
6003
6072
|
translate: 'no',
|
|
6004
6073
|
...(0, util_1.invalid)('header', 'syntax', 'Invalid syntax')
|
|
@@ -6012,7 +6081,7 @@ const field = (0, combinator_1.line)(({
|
|
|
6012
6081
|
}) => {
|
|
6013
6082
|
const name = source.slice(position, source.indexOf(':', position));
|
|
6014
6083
|
const value = source.slice(position + name.length + 1).trim();
|
|
6015
|
-
return new parser_1.List([new parser_1.
|
|
6084
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
6016
6085
|
class: 'field',
|
|
6017
6086
|
'data-name': name.toLowerCase(),
|
|
6018
6087
|
'data-value': value
|
|
@@ -6056,7 +6125,7 @@ const math_1 = __webpack_require__(2962);
|
|
|
6056
6125
|
const code_1 = __webpack_require__(3481);
|
|
6057
6126
|
const htmlentity_1 = __webpack_require__(470);
|
|
6058
6127
|
const bracket_1 = __webpack_require__(4526);
|
|
6059
|
-
const autolink_1 = __webpack_require__(
|
|
6128
|
+
const autolink_1 = __webpack_require__(5691);
|
|
6060
6129
|
const source_1 = __webpack_require__(8745);
|
|
6061
6130
|
const stars = (0, source_1.strs)('*');
|
|
6062
6131
|
exports.inline = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input => {
|
|
@@ -6185,13 +6254,26 @@ const inline_1 = __webpack_require__(7973);
|
|
|
6185
6254
|
const visibility_1 = __webpack_require__(6364);
|
|
6186
6255
|
const util_1 = __webpack_require__(4992);
|
|
6187
6256
|
const dom_1 = __webpack_require__(394);
|
|
6188
|
-
exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(128 /* State.annotation */, (0, combinator_1.surround)('((', (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */, (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[')', 1]])))), '))', false, [2, 1 | 4 /* Backtrack.common */, 3 | 128 /* Backtrack.doublebracket */], ([, ns], context) => context.linebreak === 0 ? new parser_1.List([new parser_1.
|
|
6257
|
+
exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(128 /* State.annotation */, (0, combinator_1.surround)('((', (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */, (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[')', 1]])))), '))', false, [2, 1 | 4 /* Backtrack.common */, 3 | 128 /* Backtrack.doublebracket */], ([, ns], context) => context.linebreak === 0 ? new parser_1.List([new parser_1.Node((0, dom_1.html)('sup', {
|
|
6189
6258
|
class: 'annotation'
|
|
6190
|
-
}, [(0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(ns))))]))]) : undefined)
|
|
6259
|
+
}, [(0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(ns))))]))]) : undefined, (_, context) => {
|
|
6260
|
+
const {
|
|
6261
|
+
source,
|
|
6262
|
+
position,
|
|
6263
|
+
range,
|
|
6264
|
+
linebreak
|
|
6265
|
+
} = context;
|
|
6266
|
+
const head = position - range;
|
|
6267
|
+
if (source[position] !== ')') {
|
|
6268
|
+
(0, combinator_1.setBacktrack)(context, 2 | 4 /* Backtrack.common */, head + 1);
|
|
6269
|
+
} else if (linebreak !== 0) {
|
|
6270
|
+
(0, combinator_1.setBacktrack)(context, 2 | 128 /* Backtrack.doublebracket */, head + 1);
|
|
6271
|
+
}
|
|
6272
|
+
})));
|
|
6191
6273
|
|
|
6192
6274
|
/***/ },
|
|
6193
6275
|
|
|
6194
|
-
/***/
|
|
6276
|
+
/***/ 5691
|
|
6195
6277
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
6196
6278
|
|
|
6197
6279
|
"use strict";
|
|
@@ -6281,7 +6363,7 @@ exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /*
|
|
|
6281
6363
|
const param = nodes.foldl((acc, {
|
|
6282
6364
|
value
|
|
6283
6365
|
}) => acc ? acc + '+' + value : value, '');
|
|
6284
|
-
return new parser_1.List([new parser_1.
|
|
6366
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Node(`@${host}${account}${hashes}`)]), new parser_1.List([new parser_1.Node(host ? `https://${host}@${account}?ch=${param}` : `/@${account}?ch=${param}`)]), context), {
|
|
6285
6367
|
class: 'channel'
|
|
6286
6368
|
}))]);
|
|
6287
6369
|
}, ([[{
|
|
@@ -6292,7 +6374,7 @@ exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /*
|
|
|
6292
6374
|
if (context.source[context.position] === '#') {
|
|
6293
6375
|
return void (0, combinator_1.setBacktrack)(context, 2 | 8 /* Backtrack.unescapable */, context.position - context.range);
|
|
6294
6376
|
}
|
|
6295
|
-
return new parser_1.List([new parser_1.
|
|
6377
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Node(`@${host}${account}`)]), new parser_1.List([new parser_1.Node(host ? `https://${host}@${account}` : `/@${account}`)]), context), {
|
|
6296
6378
|
class: 'account'
|
|
6297
6379
|
}))]);
|
|
6298
6380
|
}))));
|
|
@@ -6323,7 +6405,7 @@ const dom_1 = __webpack_require__(394);
|
|
|
6323
6405
|
// 外部表現は投稿ごとに投稿者の投稿時のタイムゾーンに統一する(非時系列順)
|
|
6324
6406
|
exports.anchor = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(/(?<![0-9a-z])>>/yi, (0, source_1.str)(/[0-9a-z]+(?:-[0-9a-z]+)*(?!-?[0-9a-z@#]|>>|:\S)/yi), '', false, [3 | 8 /* Backtrack.unescapable */], ([, [{
|
|
6325
6407
|
value
|
|
6326
|
-
}]], context) => new parser_1.List([new parser_1.
|
|
6408
|
+
}]], context) => new parser_1.List([new parser_1.Node((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Node(`>>${value}`)]), new parser_1.List([new parser_1.Node(`?at=${value}`)]), context), {
|
|
6327
6409
|
class: 'anchor'
|
|
6328
6410
|
}))])))));
|
|
6329
6411
|
|
|
@@ -6348,7 +6430,7 @@ exports.email = (0, combinator_1.constraint)(1 /* State.autolink */, (0, combina
|
|
|
6348
6430
|
value
|
|
6349
6431
|
}]) => value.length <= 254), '', false, [3 | 8 /* Backtrack.unescapable */], ([, [{
|
|
6350
6432
|
value
|
|
6351
|
-
}]]) => new parser_1.List([new parser_1.
|
|
6433
|
+
}]]) => new parser_1.List([new parser_1.Node((0, dom_1.html)('a', {
|
|
6352
6434
|
class: 'email',
|
|
6353
6435
|
href: `mailto:${value}`
|
|
6354
6436
|
}, value))]))));
|
|
@@ -6371,9 +6453,11 @@ const link_1 = __webpack_require__(3628);
|
|
|
6371
6453
|
const hashtag_1 = __webpack_require__(5764);
|
|
6372
6454
|
const source_1 = __webpack_require__(8745);
|
|
6373
6455
|
const dom_1 = __webpack_require__(394);
|
|
6374
|
-
exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(new RegExp([/(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu'), (0, source_1.str)(new RegExp([/[0-9]{1,9}(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu')), '', false,
|
|
6456
|
+
exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(new RegExp([/(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu'), (0, source_1.str)(new RegExp([/[0-9]{1,9}(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu')), '', false,
|
|
6457
|
+
// unescapableを使用するべきだがhashtagとの重複を回避するためescapableを使用する。
|
|
6458
|
+
[3 | 16 /* Backtrack.escapable */], ([, [{
|
|
6375
6459
|
value
|
|
6376
|
-
}]], context) => new parser_1.List([new parser_1.
|
|
6460
|
+
}]], context) => new parser_1.List([new parser_1.Node((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Node(`#${value}`)]), new parser_1.List([new parser_1.Node(value)]), context), {
|
|
6377
6461
|
class: 'hashnum',
|
|
6378
6462
|
href: null
|
|
6379
6463
|
}))])))));
|
|
@@ -6402,7 +6486,7 @@ exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /*
|
|
|
6402
6486
|
value
|
|
6403
6487
|
}]) => /^[0-9]{0,4}[^0-9]/.test(value)), new RegExp([/(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('|').replace(/emoji/g, exports.emoji.source), 'yu'), false, [3 | 8 /* Backtrack.unescapable */], ([, [{
|
|
6404
6488
|
value
|
|
6405
|
-
}]], context) => new parser_1.List([new parser_1.
|
|
6489
|
+
}]], context) => new parser_1.List([new parser_1.Node((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Node(`#${value}`)]), new parser_1.List([new parser_1.Node(`/hashtags/${value}`)]), context), {
|
|
6406
6490
|
class: 'hashtag'
|
|
6407
6491
|
}))])))));
|
|
6408
6492
|
|
|
@@ -6425,7 +6509,7 @@ const link_1 = __webpack_require__(3628);
|
|
|
6425
6509
|
const source_1 = __webpack_require__(8745);
|
|
6426
6510
|
exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(/(?<![0-9A-Za-z][.+-]?|[@#])https?:\/\/(?=[\x21-\x7E])/y, (0, combinator_1.precedence)(0, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(source_1.unescsource, /(?<![-+*=~^_,.;:!?]|\/{3})(?:[-+*=~^_,.;:!?]|\/{3,}(?!\/))*(?=[\\$"`\[\](){}<>()[]{}|]|[^\x21-\x7E]|$)/y), (0, combinator_1.precedence)(1, (0, combinator_1.verify)(bracket, ns => ns.length > 0))]), undefined, [[/[^\x21-\x7E]|\$/y, 9]])), false, [3 | 8 /* Backtrack.unescapable */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, ({
|
|
6427
6511
|
context
|
|
6428
|
-
}) => new parser_1.List([new parser_1.
|
|
6512
|
+
}) => new parser_1.List([new parser_1.Node((0, link_1.parse)(new parser_1.List(), new parser_1.List([new parser_1.Node(context.source)]), context))]))), (0, combinator_1.open)((0, source_1.str)(/[^:]+/y), (0, combinator_1.some)(inline_1.inline))])));
|
|
6429
6513
|
exports.lineurl = (0, combinator_1.lazy)(() => (0, combinator_1.focus)(/(?<=^|[\r\n])!?https?:\/\/\S+(?=[^\S\n]*(?=$|\n))/y, (0, combinator_1.tails)([(0, source_1.str)('!'), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, ({
|
|
6430
6514
|
context
|
|
6431
6515
|
}) => {
|
|
@@ -6434,7 +6518,7 @@ exports.lineurl = (0, combinator_1.lazy)(() => (0, combinator_1.focus)(/(?<=^|[\
|
|
|
6434
6518
|
position
|
|
6435
6519
|
} = context;
|
|
6436
6520
|
context.position -= source[0] === '!' ? 1 : 0;
|
|
6437
|
-
return new parser_1.List([new parser_1.
|
|
6521
|
+
return new parser_1.List([new parser_1.Node((0, link_1.parse)(new parser_1.List(), new parser_1.List([new parser_1.Node(source.slice(position))]), context))]);
|
|
6438
6522
|
})), (0, source_1.str)(/[^:]+/y)])])));
|
|
6439
6523
|
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')')), (0, source_1.str)(')'), true, [3 | 8 /* Backtrack.unescapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']')), (0, source_1.str)(']'), true, [3 | 8 /* Backtrack.unescapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}')), (0, source_1.str)('}'), true, [3 | 8 /* Backtrack.unescapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.unescsource, '"'))), (0, source_1.str)('"'), true, [3 | 8 /* Backtrack.unescapable */], undefined, () => new parser_1.List())]));
|
|
6440
6524
|
|
|
@@ -6487,51 +6571,48 @@ const p1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.
|
|
|
6487
6571
|
const {
|
|
6488
6572
|
source,
|
|
6489
6573
|
position,
|
|
6490
|
-
range
|
|
6574
|
+
range
|
|
6491
6575
|
} = context;
|
|
6492
6576
|
const head = position - range;
|
|
6493
|
-
if (context.linebreak !== 0
|
|
6494
|
-
|
|
6577
|
+
if (context.linebreak !== 0) {
|
|
6578
|
+
if (head > 0 && source[head - 1] === '(') {
|
|
6579
|
+
(0, combinator_1.setBacktrack)(context, 2 | 128 /* Backtrack.doublebracket */, head - 1);
|
|
6580
|
+
}
|
|
6581
|
+
} else if (source[position] !== ')' && source[head - 1] === '(') {
|
|
6582
|
+
(0, combinator_1.setBacktrack)(context, 2 | 128 /* Backtrack.doublebracket */, head - 1);
|
|
6495
6583
|
}
|
|
6496
6584
|
const str = source.slice(position - range + 1, position - 1);
|
|
6497
|
-
return indexA.test(str) ? new parser_1.List([new parser_1.
|
|
6585
|
+
return indexA.test(str) ? new parser_1.List([new parser_1.Node(as.head.value), new parser_1.Node(str), new parser_1.Node(cs.head.value)]) : new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
6498
6586
|
class: 'paren'
|
|
6499
6587
|
}, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]);
|
|
6500
|
-
}, ([as, bs = new parser_1.List()]
|
|
6501
|
-
const {
|
|
6502
|
-
source,
|
|
6503
|
-
position,
|
|
6504
|
-
range = 0
|
|
6505
|
-
} = context;
|
|
6506
|
-
const head = position - range;
|
|
6507
|
-
if (context.linebreak !== 0 || source[head + 1] !== '(') {
|
|
6508
|
-
(0, combinator_1.setBacktrack)(context, 2 | 128 /* Backtrack.doublebracket */, head);
|
|
6509
|
-
}
|
|
6510
|
-
return as.import(bs);
|
|
6511
|
-
}));
|
|
6588
|
+
}, ([as, bs = new parser_1.List()]) => as.import(bs)));
|
|
6512
6589
|
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 = [], cs], {
|
|
6513
6590
|
source,
|
|
6514
6591
|
position,
|
|
6515
|
-
range
|
|
6592
|
+
range
|
|
6516
6593
|
}) => {
|
|
6517
6594
|
const str = source.slice(position - range + 1, position - 1);
|
|
6518
|
-
return indexF.test(str) ? new parser_1.List([new parser_1.
|
|
6595
|
+
return indexF.test(str) ? new parser_1.List([new parser_1.Node(as.head.value), new parser_1.Node(str), new parser_1.Node(cs.head.value)]) : new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
6519
6596
|
class: 'paren'
|
|
6520
6597
|
}, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]);
|
|
6521
6598
|
}, ([as, bs = new parser_1.List()]) => as.import(bs)));
|
|
6522
6599
|
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) => {
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
if (
|
|
6531
|
-
(0, combinator_1.setBacktrack)(context, 2 | 128 /* Backtrack.doublebracket */, head);
|
|
6600
|
+
const {
|
|
6601
|
+
source,
|
|
6602
|
+
position,
|
|
6603
|
+
range
|
|
6604
|
+
} = context;
|
|
6605
|
+
const head = position - range;
|
|
6606
|
+
if (context.linebreak !== 0) {
|
|
6607
|
+
if (head > 0 && source[head - 1] === '[') {
|
|
6608
|
+
(0, combinator_1.setBacktrack)(context, 2 | 128 /* Backtrack.doublebracket */, head - 1);
|
|
6532
6609
|
}
|
|
6610
|
+
} else if (source[position] !== ']' && source[head - 1] === '[') {
|
|
6611
|
+
(0, combinator_1.setBacktrack)(context, 2 | 128 /* Backtrack.doublebracket */, head - 1);
|
|
6612
|
+
}
|
|
6613
|
+
if (context.state & 8 /* State.link */) {
|
|
6533
6614
|
if (context.linebreak !== 0) {
|
|
6534
|
-
(0, combinator_1.setBacktrack)(context, 2 |
|
|
6615
|
+
(0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */ | 32 /* Backtrack.ruby */, head);
|
|
6535
6616
|
} else if (source[position] !== '{') {
|
|
6536
6617
|
(0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head);
|
|
6537
6618
|
} else {
|
|
@@ -6572,12 +6653,12 @@ const parser_1 = __webpack_require__(605);
|
|
|
6572
6653
|
const combinator_1 = __webpack_require__(3484);
|
|
6573
6654
|
const util_1 = __webpack_require__(4992);
|
|
6574
6655
|
const dom_1 = __webpack_require__(394);
|
|
6575
|
-
exports.code = (0, combinator_1.match)(/(`+)(?!`)([^\n]*?)(?:((?<!`)\1(?!`))|(?=$|\n))/y, ([whole, opener, body, closer]) => () => closer ? new parser_1.List([new parser_1.
|
|
6656
|
+
exports.code = (0, combinator_1.match)(/(`+)(?!`)([^\n]*?)(?:((?<!`)\1(?!`))|(?=$|\n))/y, ([whole, opener, body, closer]) => () => closer ? new parser_1.List([new parser_1.Node((0, dom_1.html)('code', {
|
|
6576
6657
|
'data-src': whole
|
|
6577
|
-
}, format(body)))]) : body ? new parser_1.List([new parser_1.
|
|
6658
|
+
}, format(body)))]) : body ? new parser_1.List([new parser_1.Node((0, dom_1.html)('code', {
|
|
6578
6659
|
class: 'invalid',
|
|
6579
6660
|
...(0, util_1.invalid)('code', 'syntax', `Missing the closing symbol "${opener}"`)
|
|
6580
|
-
}, whole))]) : new parser_1.List([new parser_1.
|
|
6661
|
+
}, whole))]) : new parser_1.List([new parser_1.Node(opener)]));
|
|
6581
6662
|
function format(text) {
|
|
6582
6663
|
return text.length > 2 && text[0] === ' ' && text[1] === '`' && text.at(-1) === ' ' ? text.slice(1, -1) : text;
|
|
6583
6664
|
}
|
|
@@ -6604,7 +6685,7 @@ exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0,
|
|
|
6604
6685
|
buffer
|
|
6605
6686
|
}) => buffer.import(bs), ([, bs], {
|
|
6606
6687
|
buffer
|
|
6607
|
-
}) => bs && buffer.import(bs).push(new parser_1.
|
|
6688
|
+
}) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer), nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('del', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]))));
|
|
6608
6689
|
|
|
6609
6690
|
/***/ },
|
|
6610
6691
|
|
|
@@ -6626,7 +6707,7 @@ const source_1 = __webpack_require__(8745);
|
|
|
6626
6707
|
const visibility_1 = __webpack_require__(6364);
|
|
6627
6708
|
const util_1 = __webpack_require__(4992);
|
|
6628
6709
|
const dom_1 = __webpack_require__(394);
|
|
6629
|
-
exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)(/\*(?!\*)/y), (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)]))))), (0, source_1.str)('*'), false, [], ([, bs]) => new parser_1.List([new parser_1.
|
|
6710
|
+
exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)(/\*(?!\*)/y), (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)]))))), (0, source_1.str)('*'), false, [], ([, bs]) => new parser_1.List([new parser_1.Node((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]), ([as, bs]) => bs && as.import(bs)));
|
|
6630
6711
|
|
|
6631
6712
|
/***/ },
|
|
6632
6713
|
|
|
@@ -6656,7 +6737,7 @@ const subemphasis = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, comb
|
|
|
6656
6737
|
// このため終端記号の後ろを見て終端を中止し同じ構文を再帰的に適用してはならない。
|
|
6657
6738
|
exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, util_1.repeat)('***', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)])))), (0, source_1.str)(/\*{1,3}/y), false, [], ([, bs, cs], context) => {
|
|
6658
6739
|
const {
|
|
6659
|
-
buffer
|
|
6740
|
+
buffer
|
|
6660
6741
|
} = context;
|
|
6661
6742
|
switch (cs.head.value) {
|
|
6662
6743
|
case '***':
|
|
@@ -6668,18 +6749,18 @@ exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0,
|
|
|
6668
6749
|
} = context;
|
|
6669
6750
|
if (source.startsWith('*', context.position)) {
|
|
6670
6751
|
context.position += 1;
|
|
6671
|
-
buffer.push(new parser_1.
|
|
6752
|
+
buffer.push(new parser_1.Node((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))));
|
|
6672
6753
|
buffer.import(ds);
|
|
6673
|
-
return new parser_1.List([new parser_1.
|
|
6754
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(buffer)))), new parser_1.Node("\u001F" /* Command.Separator */)]);
|
|
6674
6755
|
} else {
|
|
6675
|
-
buffer.push(new parser_1.
|
|
6756
|
+
buffer.push(new parser_1.Node((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))));
|
|
6676
6757
|
buffer.import(ds);
|
|
6677
|
-
buffer.push(new parser_1.
|
|
6758
|
+
buffer.push(new parser_1.Node("\u001F" /* Command.Separator */));
|
|
6678
6759
|
return prepend('*', buffer);
|
|
6679
6760
|
}
|
|
6680
6761
|
})({
|
|
6681
6762
|
context
|
|
6682
|
-
}) ?? prepend('*', buffer.import(new parser_1.List([new parser_1.
|
|
6763
|
+
}) ?? prepend('*', buffer.import(new parser_1.List([new parser_1.Node((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))), new parser_1.Node("\u001F" /* Command.Separator */)])));
|
|
6683
6764
|
case '*':
|
|
6684
6765
|
return (0, combinator_1.bind)(substrong, ds => {
|
|
6685
6766
|
const {
|
|
@@ -6687,34 +6768,34 @@ exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0,
|
|
|
6687
6768
|
} = context;
|
|
6688
6769
|
if (source.startsWith('**', context.position)) {
|
|
6689
6770
|
context.position += 2;
|
|
6690
|
-
buffer.push(new parser_1.
|
|
6771
|
+
buffer.push(new parser_1.Node((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))));
|
|
6691
6772
|
buffer.import(ds);
|
|
6692
|
-
return new parser_1.List([new parser_1.
|
|
6773
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(buffer)))), new parser_1.Node("\u001F" /* Command.Separator */)]);
|
|
6693
6774
|
} else {
|
|
6694
|
-
buffer.push(new parser_1.
|
|
6775
|
+
buffer.push(new parser_1.Node((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))));
|
|
6695
6776
|
buffer.import(ds);
|
|
6696
|
-
buffer.push(new parser_1.
|
|
6777
|
+
buffer.push(new parser_1.Node("\u001F" /* Command.Separator */));
|
|
6697
6778
|
return prepend('**', buffer);
|
|
6698
6779
|
}
|
|
6699
6780
|
})({
|
|
6700
6781
|
context
|
|
6701
|
-
}) ?? prepend('**', buffer.import(new parser_1.List([new parser_1.
|
|
6782
|
+
}) ?? prepend('**', buffer.import(new parser_1.List([new parser_1.Node((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))), new parser_1.Node("\u001F" /* Command.Separator */)])));
|
|
6702
6783
|
}
|
|
6703
6784
|
}, ([, bs], {
|
|
6704
6785
|
buffer
|
|
6705
|
-
}) => bs && buffer.import(bs) && buffer.push(new parser_1.
|
|
6786
|
+
}) => bs && buffer.import(bs) && buffer.push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer),
|
|
6706
6787
|
// 3以上の`*`に対してemの適用を保証する
|
|
6707
|
-
nodes => new parser_1.List([new parser_1.
|
|
6788
|
+
nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('em', [(0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(nodes)))]))]), (nodes, context, prefix, postfix, state) => {
|
|
6708
6789
|
context.position += postfix;
|
|
6709
6790
|
if (state) {
|
|
6710
6791
|
switch (postfix) {
|
|
6711
6792
|
case 0:
|
|
6712
6793
|
break;
|
|
6713
6794
|
case 1:
|
|
6714
|
-
nodes = new parser_1.List([new parser_1.
|
|
6795
|
+
nodes = new parser_1.List([new parser_1.Node((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]);
|
|
6715
6796
|
break;
|
|
6716
6797
|
case 2:
|
|
6717
|
-
nodes = new parser_1.List([new parser_1.
|
|
6798
|
+
nodes = new parser_1.List([new parser_1.Node((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]);
|
|
6718
6799
|
break;
|
|
6719
6800
|
default:
|
|
6720
6801
|
}
|
|
@@ -6730,7 +6811,7 @@ nodes => new parser_1.List([new parser_1.Data((0, dom_1.html)('em', [(0, dom_1.h
|
|
|
6730
6811
|
} = context;
|
|
6731
6812
|
if (source.startsWith('*', context.position)) {
|
|
6732
6813
|
context.position += 1;
|
|
6733
|
-
return new parser_1.List([new parser_1.
|
|
6814
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(nodes.import(ds)))))]);
|
|
6734
6815
|
} else {
|
|
6735
6816
|
return prepend('*', nodes.import(ds));
|
|
6736
6817
|
}
|
|
@@ -6746,7 +6827,7 @@ nodes => new parser_1.List([new parser_1.Data((0, dom_1.html)('em', [(0, dom_1.h
|
|
|
6746
6827
|
} = context;
|
|
6747
6828
|
if (source.startsWith('**', context.position)) {
|
|
6748
6829
|
context.position += 2;
|
|
6749
|
-
return new parser_1.List([new parser_1.
|
|
6830
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(nodes.import(ds)))))]);
|
|
6750
6831
|
} else {
|
|
6751
6832
|
return prepend('**', nodes.import(ds));
|
|
6752
6833
|
}
|
|
@@ -6766,7 +6847,7 @@ function prepend(prefix, nodes) {
|
|
|
6766
6847
|
if (typeof nodes.head?.value === 'string') {
|
|
6767
6848
|
nodes.head.value = prefix + nodes.head.value;
|
|
6768
6849
|
} else {
|
|
6769
|
-
nodes.unshift(new parser_1.
|
|
6850
|
+
nodes.unshift(new parser_1.Node(prefix));
|
|
6770
6851
|
}
|
|
6771
6852
|
return nodes;
|
|
6772
6853
|
}
|
|
@@ -6810,12 +6891,12 @@ const source_1 = __webpack_require__(8745);
|
|
|
6810
6891
|
const visibility_1 = __webpack_require__(6364);
|
|
6811
6892
|
const util_1 = __webpack_require__(4992);
|
|
6812
6893
|
const dom_1 = __webpack_require__(394);
|
|
6813
|
-
exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(32 /* State.index */, (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)((0, source_1.str)('[#'), (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.inits)([inline_1.inline, exports.signature]), ']', [[']', 1]])))), (0, source_1.str)(']'), false, [3 | 4 /* Backtrack.common */], ([, bs], context) => context.linebreak === 0 && (0, visibility_1.trimBlankNodeEnd)(bs).length > 0 ? new parser_1.List([new parser_1.
|
|
6894
|
+
exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(32 /* State.index */, (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)((0, source_1.str)('[#'), (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.inits)([inline_1.inline, exports.signature]), ']', [[']', 1]])))), (0, source_1.str)(']'), false, [3 | 4 /* Backtrack.common */], ([, bs], context) => context.linebreak === 0 && (0, visibility_1.trimBlankNodeEnd)(bs).length > 0 ? new parser_1.List([new parser_1.Node((0, dom_1.html)('a', {
|
|
6814
6895
|
'data-index': dataindex(bs)
|
|
6815
6896
|
}, (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]) : undefined, undefined)), ns => {
|
|
6816
6897
|
if (ns.length === 1) {
|
|
6817
6898
|
const el = ns.head.value;
|
|
6818
|
-
return new parser_1.List([new parser_1.
|
|
6899
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.define)(el, {
|
|
6819
6900
|
id: el.id ? null : undefined,
|
|
6820
6901
|
class: 'index',
|
|
6821
6902
|
href: el.id ? `#${el.id}` : undefined
|
|
@@ -6829,7 +6910,7 @@ exports.signature = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('|',
|
|
|
6829
6910
|
const index = (0, indexee_1.identity)('index', undefined, ns.foldl((acc, {
|
|
6830
6911
|
value
|
|
6831
6912
|
}) => acc + value, ''))?.slice(7);
|
|
6832
|
-
return index && context.linebreak === 0 ? new parser_1.List([new parser_1.
|
|
6913
|
+
return index && context.linebreak === 0 ? new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
6833
6914
|
class: 'indexer',
|
|
6834
6915
|
'data-index': index
|
|
6835
6916
|
}))]) : undefined;
|
|
@@ -6866,7 +6947,7 @@ const dom_1 = __webpack_require__(394);
|
|
|
6866
6947
|
function indexee(parser) {
|
|
6867
6948
|
return (0, combinator_1.fmap)(parser, (ns, {
|
|
6868
6949
|
id
|
|
6869
|
-
}) => ns.length === 1 ? new parser_1.List([new parser_1.
|
|
6950
|
+
}) => ns.length === 1 ? new parser_1.List([new parser_1.Node((0, dom_1.define)(ns.head.value, {
|
|
6870
6951
|
id: identity('index', id, ns.head.value),
|
|
6871
6952
|
'data-index': null
|
|
6872
6953
|
}))]) : ns);
|
|
@@ -7007,7 +7088,7 @@ const dom_1 = __webpack_require__(394);
|
|
|
7007
7088
|
// 複合生成インデクスを手動で同期させるより最初から重複のない
|
|
7008
7089
|
// テキストまたはインデクスを付けて同期が必要な機会を減らすのが
|
|
7009
7090
|
// 継続的編集において最も簡便となる。
|
|
7010
|
-
exports.indexer = (0, combinator_1.surround)(/ \[(?=\|\S)/y, (0, combinator_1.union)([index_1.signature, (0, combinator_1.focus)(/\|(?=\])/y, () => new parser_1.List([new parser_1.
|
|
7091
|
+
exports.indexer = (0, combinator_1.surround)(/ \[(?=\|\S)/y, (0, combinator_1.union)([index_1.signature, (0, combinator_1.focus)(/\|(?=\])/y, () => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
7011
7092
|
class: 'indexer',
|
|
7012
7093
|
'data-index': ''
|
|
7013
7094
|
}))]))]), /\][^\S\n]*(?:$|\n)/y);
|
|
@@ -7032,7 +7113,7 @@ const body = (0, source_1.str)(/\$[A-Za-z]*(?:(?:-[A-Za-z][0-9A-Za-z]*)+|-(?:(?:
|
|
|
7032
7113
|
exports.segment = (0, combinator_1.clear)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body]));
|
|
7033
7114
|
exports.label = (0, combinator_1.constraint)(16 /* State.label */, (0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']', false, [1 | 4 /* Backtrack.common */]), body]), ([{
|
|
7034
7115
|
value
|
|
7035
|
-
}]) => new parser_1.List([new parser_1.
|
|
7116
|
+
}]) => new parser_1.List([new parser_1.Node((0, dom_1.html)('a', {
|
|
7036
7117
|
class: 'label',
|
|
7037
7118
|
'data-label': value.slice(value[1] === '-' ? 0 : 1).toLowerCase()
|
|
7038
7119
|
}, value))])));
|
|
@@ -7077,7 +7158,7 @@ const dom_1 = __webpack_require__(394);
|
|
|
7077
7158
|
// All syntax surrounded by square brackets shouldn't contain line breaks.
|
|
7078
7159
|
exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.surround)(
|
|
7079
7160
|
// ^はabbrで使用済みだが^:などのようにして分離使用可能
|
|
7080
|
-
(0, source_1.str)(/\[[:^|]/y), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])))), (0, source_1.str)(']'), false, [3 | 4 /* Backtrack.common */], (_, context) => new parser_1.List([new parser_1.
|
|
7161
|
+
(0, source_1.str)(/\[[:^|]/y), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])))), (0, source_1.str)(']'), false, [3 | 4 /* Backtrack.common */], (_, context) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
7081
7162
|
class: 'invalid',
|
|
7082
7163
|
...(0, util_1.invalid)('extension', 'syntax', `Invalid start symbol or linebreak`)
|
|
7083
7164
|
}, context.source.slice(context.position - context.range, context.position)))]), ([as, bs]) => bs && as.import(bs)));
|
|
@@ -7113,14 +7194,14 @@ Object.setPrototypeOf(attrspecs, null);
|
|
|
7113
7194
|
Object.values(attrspecs).forEach(o => Object.setPrototypeOf(o, null));
|
|
7114
7195
|
exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/<[a-z]+(?=[ >])/yi, (0, combinator_1.union)([(0, combinator_1.surround)(
|
|
7115
7196
|
// https://html.spec.whatwg.org/multipage/syntax.html#void-elements
|
|
7116
|
-
(0, source_1.str)(/<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[ >])/y), (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.
|
|
7197
|
+
(0, source_1.str)(/<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[ >])/y), (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))])), (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.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)),
|
|
7117
7198
|
// 不可視のHTML構造が可視構造を変化させるべきでない。
|
|
7118
7199
|
// 可視のHTMLは優先度変更を検討する。
|
|
7119
7200
|
// このため<>は将来的に共通構造を変化させる可能性があり
|
|
7120
7201
|
// 共通構造を変化させない非構造文字列としては依然としてエスケープを要する。
|
|
7121
|
-
(0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* 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.
|
|
7202
|
+
(0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* 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, new Map())), (0, combinator_1.surround)(
|
|
7122
7203
|
// https://html.spec.whatwg.org/multipage/syntax.html#void-elements
|
|
7123
|
-
(0, source_1.str)(/<[a-z]+(?=[ >])/yi), (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.
|
|
7204
|
+
(0, source_1.str)(/<[a-z]+(?=[ >])/yi), (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))]))])));
|
|
7124
7205
|
exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/ [a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[ >])/yi), (0, source_1.str)(/ [^\s<>]+/y)]);
|
|
7125
7206
|
function elem(tag, content, as, bs, cs, context) {
|
|
7126
7207
|
if (!tags.includes(tag)) return ielem('tag', `Invalid HTML tag name "${tag}"`, context);
|
|
@@ -7191,10 +7272,10 @@ const combinator_1 = __webpack_require__(3484);
|
|
|
7191
7272
|
const source_1 = __webpack_require__(8745);
|
|
7192
7273
|
const util_1 = __webpack_require__(4992);
|
|
7193
7274
|
const dom_1 = __webpack_require__(394);
|
|
7194
|
-
exports.unsafehtmlentity = (0, combinator_1.surround)((0, source_1.str)('&'), (0, source_1.str)(/[0-9A-Za-z]+/y), (0, source_1.str)(';'), false, [3 | 8 /* Backtrack.unescapable */], ([as, bs, cs]) => new parser_1.List([new parser_1.
|
|
7275
|
+
exports.unsafehtmlentity = (0, combinator_1.surround)((0, source_1.str)('&'), (0, source_1.str)(/[0-9A-Za-z]+/y), (0, source_1.str)(';'), false, [3 | 8 /* Backtrack.unescapable */], ([as, bs, cs]) => new parser_1.List([new parser_1.Node(parser(as.head.value + bs.head.value + cs.head.value))]), ([as, bs]) => new parser_1.List([new parser_1.Node(as.head.value + (bs?.head?.value ?? ''))]));
|
|
7195
7276
|
exports.htmlentity = (0, combinator_1.fmap)((0, combinator_1.union)([exports.unsafehtmlentity]), ([{
|
|
7196
7277
|
value
|
|
7197
|
-
}]) => new parser_1.List([length === 1 || value.at(-1) !== ';' ? new parser_1.
|
|
7278
|
+
}]) => new parser_1.List([length === 1 || value.at(-1) !== ';' ? new parser_1.Node(value) : new parser_1.Node((0, dom_1.html)('span', {
|
|
7198
7279
|
class: 'invalid',
|
|
7199
7280
|
...(0, util_1.invalid)('htmlentity', 'syntax', 'Invalid HTML entity')
|
|
7200
7281
|
}, value))]));
|
|
@@ -7226,7 +7307,7 @@ exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0,
|
|
|
7226
7307
|
buffer
|
|
7227
7308
|
}) => buffer.import(bs), ([, bs], {
|
|
7228
7309
|
buffer
|
|
7229
|
-
}) => bs && buffer.import(bs).push(new parser_1.
|
|
7310
|
+
}) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer), nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('ins', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]))));
|
|
7230
7311
|
|
|
7231
7312
|
/***/ },
|
|
7232
7313
|
|
|
@@ -7253,7 +7334,7 @@ exports.italic = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0
|
|
|
7253
7334
|
buffer
|
|
7254
7335
|
}) => buffer.import(bs), ([, bs], {
|
|
7255
7336
|
buffer
|
|
7256
|
-
}) => bs && buffer.import(bs).push(new parser_1.
|
|
7337
|
+
}) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer), nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('i', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]))));
|
|
7257
7338
|
|
|
7258
7339
|
/***/ },
|
|
7259
7340
|
|
|
@@ -7285,11 +7366,11 @@ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /
|
|
|
7285
7366
|
const head = context.position - context.range;
|
|
7286
7367
|
return void (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */ | 32 /* Backtrack.ruby */, head);
|
|
7287
7368
|
}
|
|
7288
|
-
return ns.push(new parser_1.
|
|
7369
|
+
return ns.push(new parser_1.Node("\u001F" /* Command.Separator */)) && ns;
|
|
7289
7370
|
})),
|
|
7290
7371
|
// `{ `と`{`で個別にバックトラックが発生し+1nされる。
|
|
7291
7372
|
// 自己再帰的にパースしてもオプションの不要なパースによる計算量の増加により相殺される。
|
|
7292
|
-
(0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y, false, [], undefined, ([as, bs]) => bs && as.import(bs).push(new parser_1.
|
|
7373
|
+
(0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y, false, [], undefined, ([as, bs]) => bs && as.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && as))]), ([{
|
|
7293
7374
|
value: content
|
|
7294
7375
|
}, {
|
|
7295
7376
|
value: params = undefined
|
|
@@ -7306,21 +7387,21 @@ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /
|
|
|
7306
7387
|
}
|
|
7307
7388
|
if (params.last.value === "\u0018" /* Command.Cancel */) {
|
|
7308
7389
|
params.pop();
|
|
7309
|
-
return new parser_1.List([new parser_1.
|
|
7390
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
7310
7391
|
class: 'invalid',
|
|
7311
7392
|
...(0, util_1.invalid)('link', 'syntax', 'Missing the closing symbol "}"')
|
|
7312
7393
|
}, context.source.slice(context.position - context.range, context.position)))]);
|
|
7313
7394
|
}
|
|
7314
7395
|
if (content.length !== 0 && (0, visibility_1.trimBlankNodeEnd)(content).length === 0) return;
|
|
7315
|
-
return new parser_1.List([new parser_1.
|
|
7396
|
+
return new parser_1.List([new parser_1.Node(parse(content, params, context))]);
|
|
7316
7397
|
})))));
|
|
7317
7398
|
exports.medialink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */ | 4 /* State.media */, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.bind)((0, combinator_1.sequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.union)([inline_1.media, inline_1.shortmedia]), ']')), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y))]), ([{
|
|
7318
7399
|
value: content
|
|
7319
7400
|
}, {
|
|
7320
7401
|
value: params
|
|
7321
|
-
}], context) => new parser_1.List([new parser_1.
|
|
7402
|
+
}], context) => new parser_1.List([new parser_1.Node(parse(content, params, context))])))));
|
|
7322
7403
|
exports.uri = (0, combinator_1.union)([(0, combinator_1.open)(/ /y, (0, source_1.str)(/\S+/y)), (0, source_1.str)(/[^\s{}]+/y)]);
|
|
7323
|
-
exports.option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/ nofollow(?=[ }])/y), () => new parser_1.List([new parser_1.
|
|
7404
|
+
exports.option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/ nofollow(?=[ }])/y), () => new parser_1.List([new parser_1.Node(' rel="nofollow"')])), (0, source_1.str)(/ [a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[ }])/yi), (0, source_1.str)(/ [^\s{}]+/y)]);
|
|
7324
7405
|
function parse(content, params, context) {
|
|
7325
7406
|
const INSECURE_URI = params.shift().value;
|
|
7326
7407
|
(0, combinator_1.consume)(10, context);
|
|
@@ -7433,16 +7514,16 @@ exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(251 /*
|
|
|
7433
7514
|
buffer
|
|
7434
7515
|
}) => buffer.import(bs), ([, bs], {
|
|
7435
7516
|
buffer
|
|
7436
|
-
}) => bs && buffer.import(bs).push(new parser_1.
|
|
7517
|
+
}) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer), (nodes, {
|
|
7437
7518
|
id
|
|
7438
7519
|
}) => {
|
|
7439
7520
|
const el = (0, dom_1.html)('mark', (0, dom_1.defrag)((0, util_1.unwrap)(nodes)));
|
|
7440
7521
|
(0, dom_1.define)(el, {
|
|
7441
7522
|
id: (0, indexee_1.identity)('mark', id, (0, indexee_1.signature)(el))
|
|
7442
7523
|
});
|
|
7443
|
-
return el.id ? new parser_1.List([new parser_1.
|
|
7524
|
+
return el.id ? new parser_1.List([new parser_1.Node(el), new parser_1.Node((0, dom_1.html)('a', {
|
|
7444
7525
|
href: `#${el.id}`
|
|
7445
|
-
}))]) : new parser_1.List([new parser_1.
|
|
7526
|
+
}))]) : new parser_1.List([new parser_1.Node(el)]);
|
|
7446
7527
|
})))));
|
|
7447
7528
|
|
|
7448
7529
|
/***/ },
|
|
@@ -7470,7 +7551,7 @@ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combin
|
|
|
7470
7551
|
math: cache
|
|
7471
7552
|
} = {}
|
|
7472
7553
|
}
|
|
7473
|
-
}) => new parser_1.List([new parser_1.
|
|
7554
|
+
}) => new parser_1.List([new parser_1.Node(cache?.get(source)?.cloneNode(true) || (0, dom_1.html)('span', !forbiddenCommand.test(source) ? {
|
|
7474
7555
|
class: 'math',
|
|
7475
7556
|
translate: 'no',
|
|
7476
7557
|
'data-src': source
|
|
@@ -7515,7 +7596,7 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
|
|
|
7515
7596
|
return void (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */ | 32 /* Backtrack.ruby */, head);
|
|
7516
7597
|
}
|
|
7517
7598
|
return ns;
|
|
7518
|
-
})), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), / ?}/y, false, [], undefined, ([as, bs]) => bs && as.import(bs).push(new parser_1.
|
|
7599
|
+
})), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), / ?}/y, false, [], undefined, ([as, bs]) => bs && as.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && as))]), nodes => nodes.length === 1 ? new parser_1.List([new parser_1.Node(new parser_1.List([new parser_1.Node('')])), nodes.delete(nodes.head)]) : new parser_1.List([new parser_1.Node(new parser_1.List([new parser_1.Node(nodes.head.value.foldl((acc, {
|
|
7519
7600
|
value
|
|
7520
7601
|
}) => acc + value, ''))])), nodes.delete(nodes.last)])), ([{
|
|
7521
7602
|
value: [{
|
|
@@ -7529,7 +7610,7 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
|
|
|
7529
7610
|
(0, combinator_1.consume)(100, context);
|
|
7530
7611
|
if (params.last.value === "\u0018" /* Command.Cancel */) {
|
|
7531
7612
|
params.pop();
|
|
7532
|
-
return new parser_1.List([new parser_1.
|
|
7613
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
7533
7614
|
class: 'invalid',
|
|
7534
7615
|
...(0, util_1.invalid)('media', 'syntax', 'Missing the closing symbol "}"')
|
|
7535
7616
|
}, '!' + context.source.slice(context.position - context.range, context.position)))]);
|
|
@@ -7547,16 +7628,16 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
|
|
|
7547
7628
|
'data-src': uri?.source
|
|
7548
7629
|
});
|
|
7549
7630
|
el.setAttribute('alt', text);
|
|
7550
|
-
if (!sanitize(el, uri)) return new parser_1.List([new parser_1.
|
|
7631
|
+
if (!sanitize(el, uri)) return new parser_1.List([new parser_1.Node(el)]);
|
|
7551
7632
|
const [attrs, linkparams] = (0, html_1.attributes)('media', optspec, (0, util_1.unwrap)(params));
|
|
7552
7633
|
(0, dom_1.define)(el, attrs);
|
|
7553
7634
|
// Awaiting the generic support for attr().
|
|
7554
7635
|
if (el.hasAttribute('aspect-ratio')) {
|
|
7555
7636
|
el.style.aspectRatio = el.getAttribute('aspect-ratio');
|
|
7556
7637
|
}
|
|
7557
|
-
if (context.state & 8 /* State.link */) return new parser_1.List([new parser_1.
|
|
7558
|
-
if (cache && cache.tagName !== 'IMG') return new parser_1.List([new parser_1.
|
|
7559
|
-
return new parser_1.List([new parser_1.
|
|
7638
|
+
if (context.state & 8 /* State.link */) return new parser_1.List([new parser_1.Node(el)]);
|
|
7639
|
+
if (cache && cache.tagName !== 'IMG') return new parser_1.List([new parser_1.Node(el)]);
|
|
7640
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.define)((0, link_1.parse)(new parser_1.List(), linkparams.reduce((acc, p) => acc.push(new parser_1.Node(p)) && acc, new parser_1.List([new parser_1.Node(INSECURE_URI)])), context), {
|
|
7560
7641
|
class: null,
|
|
7561
7642
|
target: '_blank'
|
|
7562
7643
|
}, [el]))]);
|
|
@@ -7568,7 +7649,7 @@ const option = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combina
|
|
|
7568
7649
|
value: b
|
|
7569
7650
|
}], [{
|
|
7570
7651
|
value: c
|
|
7571
|
-
}]]) => b === 'x' ? new parser_1.List([new parser_1.
|
|
7652
|
+
}]]) => b === 'x' ? new parser_1.List([new parser_1.Node(`width="${a}"`), new parser_1.Node(`height="${c}"`)]) : new parser_1.List([new parser_1.Node(`aspect-ratio="${a}/${c}"`)])), link_1.option]));
|
|
7572
7653
|
function sanitize(target, uri) {
|
|
7573
7654
|
let type;
|
|
7574
7655
|
let message;
|
|
@@ -7618,78 +7699,50 @@ const dom_1 = __webpack_require__(394);
|
|
|
7618
7699
|
exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64 /* State.reference */, (0, combinator_1.surround)((0, source_1.str)('[['), (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */, (0, combinator_1.subsequence)([abbr, (0, visibility_1.trimBlankStart)((0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))]))), ']]', false, [2, 1 | 4 /* Backtrack.common */, 3 | 128 /* Backtrack.doublebracket */], ([, ns], context) => {
|
|
7619
7700
|
const {
|
|
7620
7701
|
position,
|
|
7621
|
-
range
|
|
7622
|
-
linebreak
|
|
7702
|
+
range,
|
|
7703
|
+
linebreak
|
|
7623
7704
|
} = context;
|
|
7624
7705
|
if (linebreak === 0) {
|
|
7625
|
-
return new parser_1.List([new parser_1.
|
|
7706
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(ns))))]))]);
|
|
7626
7707
|
} else {
|
|
7627
7708
|
const head = position - range;
|
|
7628
7709
|
(0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head, 2);
|
|
7629
7710
|
}
|
|
7630
|
-
}, (
|
|
7631
|
-
if (!bs) return;
|
|
7711
|
+
}, (_, context) => {
|
|
7632
7712
|
const {
|
|
7633
7713
|
source,
|
|
7634
7714
|
position,
|
|
7635
|
-
range
|
|
7636
|
-
linebreak
|
|
7637
|
-
state = 0
|
|
7715
|
+
range,
|
|
7716
|
+
linebreak
|
|
7638
7717
|
} = context;
|
|
7639
7718
|
const head = position - range;
|
|
7640
7719
|
if (source[position] !== ']') {
|
|
7641
7720
|
(0, combinator_1.setBacktrack)(context, 2 | 4 /* Backtrack.common */, head, 2);
|
|
7642
7721
|
} else if (linebreak !== 0) {
|
|
7643
|
-
(0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */ | 32 /* Backtrack.ruby */, head, 2);
|
|
7722
|
+
(0, combinator_1.setBacktrack)(context, 2 | 128 /* Backtrack.doublebracket */ | 64 /* Backtrack.link */ | 32 /* Backtrack.ruby */, head, 2);
|
|
7644
7723
|
} else {
|
|
7645
|
-
if (state & 128 /* State.annotation */) {
|
|
7646
|
-
bs.push(new parser_1.Data(source[position]));
|
|
7647
|
-
}
|
|
7648
7724
|
context.position += 1;
|
|
7649
|
-
|
|
7650
|
-
|
|
7725
|
+
if (source[context.position] !== '{' || (0, combinator_1.isBacktrack)(context, 1 | 64 /* Backtrack.link */) || !(0, link_1.textlink)({
|
|
7726
|
+
context
|
|
7727
|
+
})) {
|
|
7651
7728
|
(0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head + 1);
|
|
7652
|
-
result = new parser_1.List();
|
|
7653
|
-
} else {
|
|
7654
|
-
result = !(0, combinator_1.isBacktrack)(context, 1 | 64 /* Backtrack.link */) ? (0, link_1.textlink)({
|
|
7655
|
-
context
|
|
7656
|
-
}) : undefined;
|
|
7657
|
-
context.range = range;
|
|
7658
|
-
if (!result) {
|
|
7659
|
-
(0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head + 1);
|
|
7660
|
-
result = new parser_1.List();
|
|
7661
|
-
}
|
|
7662
|
-
}
|
|
7663
|
-
if (context.position === source.length) {
|
|
7664
|
-
(0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head);
|
|
7665
|
-
} else {
|
|
7666
|
-
const next = (0, combinator_1.surround)('', (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]), (0, source_1.str)(']'), true, [], ([, cs = new parser_1.List(), ds]) => cs.import(ds), ([, cs = new parser_1.List()]) => {
|
|
7667
|
-
(0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head);
|
|
7668
|
-
return cs;
|
|
7669
|
-
})({
|
|
7670
|
-
context
|
|
7671
|
-
});
|
|
7672
|
-
if (state & 128 /* State.annotation */ && next) {
|
|
7673
|
-
return as.import(bs).import(result).import(next);
|
|
7674
|
-
}
|
|
7675
7729
|
}
|
|
7676
7730
|
context.position = position;
|
|
7677
7731
|
}
|
|
7678
|
-
return state & 128 /* State.annotation */ ? as.import(bs) : undefined;
|
|
7679
7732
|
})));
|
|
7680
7733
|
// Chicago-Style
|
|
7681
7734
|
const abbr = (0, combinator_1.surround)((0, source_1.str)('^'), (0, combinator_1.union)([(0, source_1.str)(/(?=[A-Z])(?:[0-9A-Za-z]'?|(?:[-.:]|\.?\??,? ?)(?!['\-.:?, ]))+/y)]), /\|?(?=]])|\|/y, true, [], ([, ns], context) => {
|
|
7682
7735
|
const {
|
|
7683
7736
|
source,
|
|
7684
7737
|
position,
|
|
7685
|
-
range
|
|
7738
|
+
range
|
|
7686
7739
|
} = context;
|
|
7687
|
-
if (!ns) return new parser_1.List([new parser_1.
|
|
7740
|
+
if (!ns) return new parser_1.List([new parser_1.Node(''), new parser_1.Node(source.slice(position - range, source[position - 1] === '|' ? position - 1 : position))]);
|
|
7688
7741
|
context.position += source[position] === ' ' ? 1 : 0;
|
|
7689
|
-
return new parser_1.List([new parser_1.
|
|
7742
|
+
return new parser_1.List([new parser_1.Node("\u001F" /* Command.Separator */), new parser_1.Node(ns.head.value.trimEnd())]);
|
|
7690
7743
|
}, (_, context) => {
|
|
7691
7744
|
context.position -= context.range;
|
|
7692
|
-
return new parser_1.List([new parser_1.
|
|
7745
|
+
return new parser_1.List([new parser_1.Node('')]);
|
|
7693
7746
|
});
|
|
7694
7747
|
function attributes(ns) {
|
|
7695
7748
|
switch (ns.head.value) {
|
|
@@ -7730,7 +7783,7 @@ const inline_1 = __webpack_require__(7973);
|
|
|
7730
7783
|
const source_1 = __webpack_require__(8745);
|
|
7731
7784
|
const util_1 = __webpack_require__(4992);
|
|
7732
7785
|
const dom_1 = __webpack_require__(394);
|
|
7733
|
-
exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.fallback)((0, combinator_1.surround)((0, source_1.str)(/\[%(?=[ \n])/y), (0, combinator_1.precedence)(3, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), /[ \n]%\]/y, [[/[ \n]%\]/y, 3]]))), (0, combinator_1.close)(source_1.text, (0, source_1.str)(`%]`)), true, [], ([as, bs = new parser_1.List(), cs]) => new parser_1.List([new parser_1.
|
|
7786
|
+
exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.fallback)((0, combinator_1.surround)((0, source_1.str)(/\[%(?=[ \n])/y), (0, combinator_1.precedence)(3, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), /[ \n]%\]/y, [[/[ \n]%\]/y, 3]]))), (0, combinator_1.close)(source_1.text, (0, source_1.str)(`%]`)), true, [], ([as, bs = new parser_1.List(), cs]) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
7734
7787
|
class: 'remark'
|
|
7735
7788
|
}, [(0, dom_1.html)('input', {
|
|
7736
7789
|
type: 'checkbox'
|
|
@@ -7738,7 +7791,7 @@ exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.fallback)((0, com
|
|
|
7738
7791
|
context: {
|
|
7739
7792
|
source
|
|
7740
7793
|
}
|
|
7741
|
-
}) => new parser_1.List([new parser_1.
|
|
7794
|
+
}) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
7742
7795
|
class: 'invalid',
|
|
7743
7796
|
...(0, util_1.invalid)('remark', 'syntax', 'Invalid start symbol')
|
|
7744
7797
|
}, source))]))));
|
|
@@ -7776,23 +7829,23 @@ exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combinato
|
|
|
7776
7829
|
}
|
|
7777
7830
|
switch (true) {
|
|
7778
7831
|
case texts.length >= rubies.length:
|
|
7779
|
-
return new parser_1.List([new parser_1.
|
|
7832
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('ruby', (0, dom_1.defrag)((0, util_1.unwrap)([...zip(texts, rubies)].reduce((acc, [{
|
|
7780
7833
|
value: text = ''
|
|
7781
7834
|
} = {}, {
|
|
7782
7835
|
value: ruby = ''
|
|
7783
|
-
} = {}]) => acc.import(ruby ? new parser_1.List([new parser_1.
|
|
7836
|
+
} = {}]) => acc.import(ruby ? new parser_1.List([new parser_1.Node(text), new parser_1.Node((0, dom_1.html)('rp', '(')), new parser_1.Node((0, dom_1.html)('rt', ruby)), new parser_1.Node((0, dom_1.html)('rp', ')'))]) : new parser_1.List([new parser_1.Node(text), new parser_1.Node((0, dom_1.html)('rt'))])), new parser_1.List())))))]);
|
|
7784
7837
|
case texts.length === 1 && [...texts.head.value].length >= rubies.length:
|
|
7785
|
-
return new parser_1.List([new parser_1.
|
|
7838
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('ruby', (0, dom_1.defrag)((0, util_1.unwrap)([...zip(new parser_1.List([...texts.head.value].map(char => new parser_1.Node(char))), rubies)].reduce((acc, [{
|
|
7786
7839
|
value: text = ''
|
|
7787
7840
|
} = {}, {
|
|
7788
7841
|
value: ruby = ''
|
|
7789
|
-
} = {}]) => acc.import(ruby ? new parser_1.List([new parser_1.
|
|
7842
|
+
} = {}]) => acc.import(ruby ? new parser_1.List([new parser_1.Node(text), new parser_1.Node((0, dom_1.html)('rp', '(')), new parser_1.Node((0, dom_1.html)('rt', ruby)), new parser_1.Node((0, dom_1.html)('rp', ')'))]) : new parser_1.List([new parser_1.Node(text), new parser_1.Node((0, dom_1.html)('rt'))])), new parser_1.List())))))]);
|
|
7790
7843
|
default:
|
|
7791
|
-
return new parser_1.List([new parser_1.
|
|
7844
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('ruby', (0, dom_1.defrag)((0, util_1.unwrap)(new parser_1.List([new parser_1.Node(texts.foldr(({
|
|
7792
7845
|
value
|
|
7793
|
-
}, acc) => value + ' ' + acc, '').slice(0, -1)), new parser_1.
|
|
7846
|
+
}, acc) => value + ' ' + acc, '').slice(0, -1)), new parser_1.Node((0, dom_1.html)('rp', '(')), new parser_1.Node((0, dom_1.html)('rt', rubies.foldr(({
|
|
7794
7847
|
value
|
|
7795
|
-
}, acc) => value + ' ' + acc, '').trim())), new parser_1.
|
|
7848
|
+
}, acc) => value + ' ' + acc, '').trim())), new parser_1.Node((0, dom_1.html)('rp', ')'))])))))]);
|
|
7796
7849
|
}
|
|
7797
7850
|
}));
|
|
7798
7851
|
const delimiter = /[$"`\[\](){}<>()[]{}|]|\\?\n/y;
|
|
@@ -7803,7 +7856,7 @@ const text = input => {
|
|
|
7803
7856
|
const {
|
|
7804
7857
|
source
|
|
7805
7858
|
} = context;
|
|
7806
|
-
const acc = new parser_1.List([new parser_1.
|
|
7859
|
+
const acc = new parser_1.List([new parser_1.Node('')]);
|
|
7807
7860
|
let state = false;
|
|
7808
7861
|
context.sequential = true;
|
|
7809
7862
|
for (let {
|
|
@@ -7822,7 +7875,7 @@ const text = input => {
|
|
|
7822
7875
|
{
|
|
7823
7876
|
if (source[position].trimStart() === '') {
|
|
7824
7877
|
state ||= acc.last.value.trimStart() !== '';
|
|
7825
|
-
acc.push(new parser_1.
|
|
7878
|
+
acc.push(new parser_1.Node(''));
|
|
7826
7879
|
context.position += 1;
|
|
7827
7880
|
continue;
|
|
7828
7881
|
}
|
|
@@ -7885,7 +7938,7 @@ const source_1 = __webpack_require__(8745);
|
|
|
7885
7938
|
const visibility_1 = __webpack_require__(6364);
|
|
7886
7939
|
const util_1 = __webpack_require__(4992);
|
|
7887
7940
|
const dom_1 = __webpack_require__(394);
|
|
7888
|
-
exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)(/\*\*(?!\*)/y), (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([emphasis_1.emphasis, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)]))))), (0, source_1.str)('**'), false, [], ([, bs]) => new parser_1.List([new parser_1.
|
|
7941
|
+
exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)(/\*\*(?!\*)/y), (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([emphasis_1.emphasis, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)]))))), (0, source_1.str)('**'), false, [], ([, bs]) => new parser_1.List([new parser_1.Node((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]), ([as, bs]) => bs && as.import(bs)));
|
|
7889
7942
|
|
|
7890
7943
|
/***/ },
|
|
7891
7944
|
|
|
@@ -7904,9 +7957,9 @@ const combinator_1 = __webpack_require__(3484);
|
|
|
7904
7957
|
const source_1 = __webpack_require__(8745);
|
|
7905
7958
|
const util_1 = __webpack_require__(4992);
|
|
7906
7959
|
const dom_1 = __webpack_require__(394);
|
|
7907
|
-
exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{{'), (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}}'), true, [], ([as, bs = new parser_1.List(), cs]) => new parser_1.List([new parser_1.
|
|
7960
|
+
exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{{'), (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}}'), true, [], ([as, bs = new parser_1.List(), cs]) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
7908
7961
|
class: 'template'
|
|
7909
|
-
}, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]), ([, bs], context) => bs && new parser_1.List([new parser_1.
|
|
7962
|
+
}, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]), ([, bs], context) => bs && new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
7910
7963
|
class: 'invalid',
|
|
7911
7964
|
...(0, util_1.invalid)('template', 'syntax', `Missing the closing symbol "}}"`)
|
|
7912
7965
|
}, context.source.slice(context.position - context.range, context.position)))])));
|
|
@@ -8231,6 +8284,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
8231
8284
|
value: true
|
|
8232
8285
|
}));
|
|
8233
8286
|
exports.validate = exports.segment = exports.MAX_INPUT_SIZE = exports.MAX_SEGMENT_SIZE = void 0;
|
|
8287
|
+
const context_1 = __webpack_require__(8669);
|
|
8234
8288
|
const combinator_1 = __webpack_require__(3484);
|
|
8235
8289
|
const heading_1 = __webpack_require__(2778);
|
|
8236
8290
|
const codeblock_1 = __webpack_require__(9194);
|
|
@@ -8269,10 +8323,10 @@ const parser = (0, combinator_1.union)([(0, combinator_1.some)(source_1.emptylin
|
|
|
8269
8323
|
function* segment(source) {
|
|
8270
8324
|
if (!validate(source, exports.MAX_INPUT_SIZE)) return yield `${"\u0007" /* Command.Error */}Too large input over ${exports.MAX_INPUT_SIZE.toLocaleString('en')} bytes.\n${source.slice(0, 1001)}`;
|
|
8271
8325
|
for (let position = 0; position < source.length;) {
|
|
8272
|
-
const context = {
|
|
8326
|
+
const context = new context_1.Context({
|
|
8273
8327
|
source,
|
|
8274
8328
|
position
|
|
8275
|
-
};
|
|
8329
|
+
});
|
|
8276
8330
|
const result = parser({
|
|
8277
8331
|
context
|
|
8278
8332
|
});
|
|
@@ -8396,31 +8450,31 @@ const escsource = ({
|
|
|
8396
8450
|
case "\u001B" /* Command.Escape */:
|
|
8397
8451
|
(0, combinator_1.consume)(1, context);
|
|
8398
8452
|
context.position += 1;
|
|
8399
|
-
return new parser_1.List([new parser_1.
|
|
8453
|
+
return new parser_1.List([new parser_1.Node(source.slice(position + 1, position + 2))]);
|
|
8400
8454
|
case '\\':
|
|
8401
8455
|
switch (source[position + 1]) {
|
|
8402
8456
|
case undefined:
|
|
8403
|
-
return new parser_1.List([new parser_1.
|
|
8457
|
+
return new parser_1.List([new parser_1.Node(char)]);
|
|
8404
8458
|
case '\n':
|
|
8405
|
-
return new parser_1.List([new parser_1.
|
|
8459
|
+
return new parser_1.List([new parser_1.Node(char)]);
|
|
8406
8460
|
default:
|
|
8407
8461
|
(0, combinator_1.consume)(1, context);
|
|
8408
8462
|
context.position += 1;
|
|
8409
|
-
return new parser_1.List([new parser_1.
|
|
8463
|
+
return new parser_1.List([new parser_1.Node(source.slice(position, position + 2))]);
|
|
8410
8464
|
}
|
|
8411
8465
|
case '\r':
|
|
8412
8466
|
(0, combinator_1.consume)(-1, context);
|
|
8413
8467
|
return new parser_1.List();
|
|
8414
8468
|
case '\n':
|
|
8415
8469
|
context.linebreak ||= source.length - position;
|
|
8416
|
-
return new parser_1.List([new parser_1.
|
|
8470
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('br'))]);
|
|
8417
8471
|
default:
|
|
8418
|
-
if (context.sequential) return new parser_1.List([new parser_1.
|
|
8472
|
+
if (context.sequential) return new parser_1.List([new parser_1.Node(char)]);
|
|
8419
8473
|
let i = (0, text_1.next)(source, position, delimiter);
|
|
8420
8474
|
i -= position;
|
|
8421
8475
|
(0, combinator_1.consume)(i - 1, context);
|
|
8422
8476
|
context.position += i - 1;
|
|
8423
|
-
return new parser_1.List([new parser_1.
|
|
8477
|
+
return new parser_1.List([new parser_1.Node(source.slice(position, context.position))]);
|
|
8424
8478
|
}
|
|
8425
8479
|
};
|
|
8426
8480
|
exports.escsource = escsource;
|
|
@@ -8520,7 +8574,7 @@ function strs(pattern) {
|
|
|
8520
8574
|
acc += pattern;
|
|
8521
8575
|
context.position += pattern.length;
|
|
8522
8576
|
}
|
|
8523
|
-
return new parser_1.List([new parser_1.
|
|
8577
|
+
return new parser_1.List([new parser_1.Node(acc)]);
|
|
8524
8578
|
};
|
|
8525
8579
|
}
|
|
8526
8580
|
exports.strs = strs;
|
|
@@ -8565,16 +8619,16 @@ const text = input => {
|
|
|
8565
8619
|
default:
|
|
8566
8620
|
(0, combinator_1.consume)(1, context);
|
|
8567
8621
|
context.position += 1;
|
|
8568
|
-
return new parser_1.List([new parser_1.
|
|
8622
|
+
return new parser_1.List([new parser_1.Node(source.slice(position + 1, context.position))]);
|
|
8569
8623
|
}
|
|
8570
8624
|
case '\r':
|
|
8571
8625
|
(0, combinator_1.consume)(-1, context);
|
|
8572
8626
|
return new parser_1.List();
|
|
8573
8627
|
case '\n':
|
|
8574
8628
|
context.linebreak ||= source.length - position;
|
|
8575
|
-
return new parser_1.List([new parser_1.
|
|
8629
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('br'))]);
|
|
8576
8630
|
default:
|
|
8577
|
-
if (context.sequential) return new parser_1.List([new parser_1.
|
|
8631
|
+
if (context.sequential) return new parser_1.List([new parser_1.Node(char)]);
|
|
8578
8632
|
exports.nonWhitespace.lastIndex = position + 1;
|
|
8579
8633
|
const s = canSkip(source, position);
|
|
8580
8634
|
let i = s ? exports.nonWhitespace.test(source) ? exports.nonWhitespace.lastIndex - 1 : source.length : next(source, position);
|
|
@@ -8584,7 +8638,7 @@ const text = input => {
|
|
|
8584
8638
|
(0, combinator_1.consume)(i - 1, context);
|
|
8585
8639
|
context.position += i - 1;
|
|
8586
8640
|
const linestart = position === 0 || source[position - 1] === '\n';
|
|
8587
|
-
return position === context.position || s && !linestart || lineend ? new parser_1.List() : new parser_1.List([new parser_1.
|
|
8641
|
+
return position === context.position || s && !linestart || lineend ? new parser_1.List() : new parser_1.List([new parser_1.Node(source.slice(position, context.position))]);
|
|
8588
8642
|
}
|
|
8589
8643
|
};
|
|
8590
8644
|
exports.text = text;
|
|
@@ -8843,20 +8897,20 @@ const unescsource = ({
|
|
|
8843
8897
|
case "\u001B" /* Command.Escape */:
|
|
8844
8898
|
(0, combinator_1.consume)(1, context);
|
|
8845
8899
|
context.position += 1;
|
|
8846
|
-
return new parser_1.List([new parser_1.
|
|
8900
|
+
return new parser_1.List([new parser_1.Node(source.slice(position + 1, position + 2))]);
|
|
8847
8901
|
case '\r':
|
|
8848
8902
|
return new parser_1.List();
|
|
8849
8903
|
case '\n':
|
|
8850
8904
|
context.linebreak ||= source.length - position;
|
|
8851
|
-
return new parser_1.List([new parser_1.
|
|
8905
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('br'))]);
|
|
8852
8906
|
default:
|
|
8853
|
-
if (context.sequential) return new parser_1.List([new parser_1.
|
|
8907
|
+
if (context.sequential) return new parser_1.List([new parser_1.Node(char)]);
|
|
8854
8908
|
text_1.nonWhitespace.lastIndex = position + 1;
|
|
8855
8909
|
let i = (0, text_1.canSkip)(source, position) ? text_1.nonWhitespace.test(source) ? text_1.nonWhitespace.lastIndex - 1 : source.length : (0, text_1.next)(source, position, exports.delimiter);
|
|
8856
8910
|
i -= position;
|
|
8857
8911
|
(0, combinator_1.consume)(i - 1, context);
|
|
8858
8912
|
context.position += i - 1;
|
|
8859
|
-
return new parser_1.List([new parser_1.
|
|
8913
|
+
return new parser_1.List([new parser_1.Node(source.slice(position, context.position))]);
|
|
8860
8914
|
}
|
|
8861
8915
|
};
|
|
8862
8916
|
exports.unescsource = unescsource;
|
|
@@ -8873,8 +8927,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
8873
8927
|
value: true
|
|
8874
8928
|
}));
|
|
8875
8929
|
exports.stringify = exports.unmarkInvalid = exports.markInvalid = exports.invalid = exports.repeat = exports.unwrap = void 0;
|
|
8876
|
-
const alias_1 = __webpack_require__(5413);
|
|
8877
8930
|
const parser_1 = __webpack_require__(605);
|
|
8931
|
+
const alias_1 = __webpack_require__(5413);
|
|
8878
8932
|
const dom_1 = __webpack_require__(394);
|
|
8879
8933
|
function* unwrap(nodes) {
|
|
8880
8934
|
if (nodes === undefined) return;
|
|
@@ -8886,7 +8940,7 @@ exports.unwrap = unwrap;
|
|
|
8886
8940
|
function repeat(symbol, parser, cons, termination = (nodes, context, prefix, postfix) => {
|
|
8887
8941
|
const acc = new parser_1.List();
|
|
8888
8942
|
if (prefix > 0) {
|
|
8889
|
-
acc.push(new parser_1.
|
|
8943
|
+
acc.push(new parser_1.Node(symbol[0].repeat(prefix)));
|
|
8890
8944
|
}
|
|
8891
8945
|
acc.import(nodes);
|
|
8892
8946
|
if (postfix > 0) {
|
|
@@ -8894,7 +8948,7 @@ function repeat(symbol, parser, cons, termination = (nodes, context, prefix, pos
|
|
|
8894
8948
|
source,
|
|
8895
8949
|
position
|
|
8896
8950
|
} = context;
|
|
8897
|
-
acc.push(new parser_1.
|
|
8951
|
+
acc.push(new parser_1.Node(source.slice(position, position + postfix)));
|
|
8898
8952
|
context.position += postfix;
|
|
8899
8953
|
}
|
|
8900
8954
|
return acc;
|
|
@@ -9633,11 +9687,12 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
9633
9687
|
}));
|
|
9634
9688
|
exports.quote = void 0;
|
|
9635
9689
|
const parser_1 = __webpack_require__(605);
|
|
9690
|
+
const context_1 = __webpack_require__(8669);
|
|
9636
9691
|
const cite_1 = __webpack_require__(1200);
|
|
9637
9692
|
function quote(anchor, range) {
|
|
9638
9693
|
const {
|
|
9639
9694
|
context
|
|
9640
|
-
} = (0, parser_1.input)('',
|
|
9695
|
+
} = (0, parser_1.input)('', new context_1.Context());
|
|
9641
9696
|
(0, cite_1.cite)((0, parser_1.input)(`>>${anchor}`, context));
|
|
9642
9697
|
if (context.position !== context.source.length) throw new Error(`Invalid anchor: ${anchor}`);
|
|
9643
9698
|
fit(range);
|