securemark 0.295.0 → 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 +8 -0
- package/design.md +4 -3
- package/dist/index.js +529 -484
- 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 +66 -66
- 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 +15 -5
- 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 +16 -55
- 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;
|
|
@@ -3111,7 +3108,7 @@ function surround(opener, parser, closer, optional = false, backtracks = [], f,
|
|
|
3111
3108
|
case 'object':
|
|
3112
3109
|
closer = (0, combinator_1.clear)((0, combinator_1.matcher)(closer, true));
|
|
3113
3110
|
}
|
|
3114
|
-
const [rbs, wbs] = reduce(backtracks);
|
|
3111
|
+
const [blen, rbs, wbs] = reduce(backtracks);
|
|
3115
3112
|
return (0, parser_1.failsafe)(input => {
|
|
3116
3113
|
const {
|
|
3117
3114
|
context
|
|
@@ -3129,7 +3126,7 @@ function surround(opener, parser, closer, optional = false, backtracks = [], f,
|
|
|
3129
3126
|
if (!nodesO) {
|
|
3130
3127
|
return void revert(context, linebreak);
|
|
3131
3128
|
}
|
|
3132
|
-
if (rbs && isBacktrack(context, rbs, position,
|
|
3129
|
+
if (rbs && isBacktrack(context, rbs, position, blen)) {
|
|
3133
3130
|
return void revert(context, linebreak);
|
|
3134
3131
|
}
|
|
3135
3132
|
const nodesM = context.position < source.length ? parser(input) : undefined;
|
|
@@ -3158,30 +3155,22 @@ function surround(opener, parser, closer, optional = false, backtracks = [], f,
|
|
|
3158
3155
|
});
|
|
3159
3156
|
}
|
|
3160
3157
|
exports.surround = surround;
|
|
3161
|
-
function open(opener, parser, optional, backtracks) {
|
|
3158
|
+
function open(opener, parser, optional, backtracks = []) {
|
|
3162
3159
|
return surround(opener, parser, '', optional, backtracks);
|
|
3163
3160
|
}
|
|
3164
3161
|
exports.open = open;
|
|
3165
|
-
function close(parser, closer, optional, backtracks) {
|
|
3162
|
+
function close(parser, closer, optional, backtracks = []) {
|
|
3166
3163
|
return surround('', parser, closer, optional, backtracks);
|
|
3167
3164
|
}
|
|
3168
3165
|
exports.close = close;
|
|
3169
3166
|
const commandsize = 2;
|
|
3170
3167
|
function isBacktrack(context, backtrack, position = context.position, length = 1) {
|
|
3171
|
-
if (length === 0) return false;
|
|
3172
|
-
const {
|
|
3173
|
-
source
|
|
3174
|
-
} = context;
|
|
3175
|
-
if (position === source.length) return false;
|
|
3176
3168
|
const {
|
|
3177
|
-
backtracks
|
|
3178
|
-
offset
|
|
3169
|
+
backtracks,
|
|
3170
|
+
offset
|
|
3179
3171
|
} = context;
|
|
3180
3172
|
for (let i = 0; i < length; ++i) {
|
|
3181
|
-
if (position + i
|
|
3182
|
-
if (i > 0 && source[position + i] !== source[position]) break;
|
|
3183
|
-
const pos = position + i + offset;
|
|
3184
|
-
if (backtracks[pos] & backtrack >>> commandsize) return true;
|
|
3173
|
+
if (backtracks[position + i + offset] & backtrack >>> commandsize) return true;
|
|
3185
3174
|
}
|
|
3186
3175
|
return false;
|
|
3187
3176
|
}
|
|
@@ -3189,34 +3178,32 @@ exports.isBacktrack = isBacktrack;
|
|
|
3189
3178
|
function setBacktrack(context, backtrack, position, length = 1) {
|
|
3190
3179
|
// バックトラックの可能性がなく記録不要の場合もあるが判別が面倒なので省略
|
|
3191
3180
|
|
|
3192
|
-
if (length === 0) return;
|
|
3193
3181
|
const {
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
if (position === source.length) return;
|
|
3197
|
-
const {
|
|
3198
|
-
backtracks = {},
|
|
3199
|
-
offset = 0
|
|
3182
|
+
backtracks,
|
|
3183
|
+
offset
|
|
3200
3184
|
} = context;
|
|
3201
3185
|
for (let i = 0; i < length; ++i) {
|
|
3202
|
-
|
|
3203
|
-
const pos = position + i + offset;
|
|
3204
|
-
backtracks[pos] |= backtrack >>> commandsize;
|
|
3186
|
+
backtracks[position + i + offset] |= backtrack >>> commandsize;
|
|
3205
3187
|
}
|
|
3206
3188
|
}
|
|
3207
3189
|
exports.setBacktrack = setBacktrack;
|
|
3208
3190
|
function reduce(backtracks) {
|
|
3191
|
+
let len = 1;
|
|
3209
3192
|
let rbs = 0;
|
|
3210
3193
|
let wbs = 0;
|
|
3211
3194
|
for (const backtrack of backtracks) {
|
|
3212
|
-
if (backtrack
|
|
3195
|
+
if (backtrack >>> commandsize === 0) {
|
|
3196
|
+
len = backtrack;
|
|
3197
|
+
continue;
|
|
3198
|
+
}
|
|
3199
|
+
if (1 & backtrack) {
|
|
3213
3200
|
rbs |= backtrack;
|
|
3214
3201
|
}
|
|
3215
|
-
if (
|
|
3202
|
+
if (2 & backtrack) {
|
|
3216
3203
|
wbs |= backtrack;
|
|
3217
3204
|
}
|
|
3218
3205
|
}
|
|
3219
|
-
return [rbs, wbs];
|
|
3206
|
+
return [len, rbs, wbs];
|
|
3220
3207
|
}
|
|
3221
3208
|
function revert(context, linebreak) {
|
|
3222
3209
|
context.linebreak = linebreak;
|
|
@@ -3418,6 +3405,162 @@ exports.List = List;
|
|
|
3418
3405
|
|
|
3419
3406
|
/***/ },
|
|
3420
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
|
+
|
|
3421
3564
|
/***/ 605
|
|
3422
3565
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
3423
3566
|
|
|
@@ -3427,7 +3570,7 @@ exports.List = List;
|
|
|
3427
3570
|
Object.defineProperty(exports, "__esModule", ({
|
|
3428
3571
|
value: true
|
|
3429
3572
|
}));
|
|
3430
|
-
exports.failsafe = exports.subinput = exports.input = exports.
|
|
3573
|
+
exports.failsafe = exports.subinput = exports.input = exports.Context = exports.Node = exports.List = void 0;
|
|
3431
3574
|
const data_1 = __webpack_require__(3602);
|
|
3432
3575
|
Object.defineProperty(exports, "List", ({
|
|
3433
3576
|
enumerable: true,
|
|
@@ -3435,21 +3578,45 @@ Object.defineProperty(exports, "List", ({
|
|
|
3435
3578
|
return data_1.List;
|
|
3436
3579
|
}
|
|
3437
3580
|
}));
|
|
3438
|
-
|
|
3581
|
+
const delimiter_1 = __webpack_require__(385);
|
|
3582
|
+
class Node {
|
|
3439
3583
|
constructor(value) {
|
|
3440
3584
|
this.value = value;
|
|
3441
3585
|
this.next = undefined;
|
|
3442
3586
|
this.prev = undefined;
|
|
3443
3587
|
}
|
|
3444
3588
|
}
|
|
3445
|
-
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;
|
|
3446
3616
|
function input(source, context) {
|
|
3447
|
-
// @ts-expect-error
|
|
3448
3617
|
context.source = source;
|
|
3449
|
-
// @ts-expect-error
|
|
3450
3618
|
context.position = 0;
|
|
3451
3619
|
return {
|
|
3452
|
-
// @ts-expect-error
|
|
3453
3620
|
context
|
|
3454
3621
|
};
|
|
3455
3622
|
}
|
|
@@ -3460,7 +3627,7 @@ function subinput(source, context) {
|
|
|
3460
3627
|
...context,
|
|
3461
3628
|
source,
|
|
3462
3629
|
position: 0,
|
|
3463
|
-
offset:
|
|
3630
|
+
offset: 0,
|
|
3464
3631
|
backtracks: {}
|
|
3465
3632
|
}
|
|
3466
3633
|
};
|
|
@@ -3486,8 +3653,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
3486
3653
|
value: true
|
|
3487
3654
|
}));
|
|
3488
3655
|
exports.matcher = exports.constraint = exports.state = exports.precedence = exports.recursion = exports.consume = exports.creation = exports.context = exports.reset = void 0;
|
|
3489
|
-
const alias_1 = __webpack_require__(5413);
|
|
3490
3656
|
const parser_1 = __webpack_require__(605);
|
|
3657
|
+
const alias_1 = __webpack_require__(5413);
|
|
3491
3658
|
const assign_1 = __webpack_require__(9888);
|
|
3492
3659
|
function reset(base, parser) {
|
|
3493
3660
|
const changes = Object.entries(base);
|
|
@@ -3600,7 +3767,7 @@ function precedence(precedence, parser) {
|
|
|
3600
3767
|
} = input;
|
|
3601
3768
|
const {
|
|
3602
3769
|
delimiters,
|
|
3603
|
-
precedence: p
|
|
3770
|
+
precedence: p
|
|
3604
3771
|
} = context;
|
|
3605
3772
|
const shift = delimiters && precedence > p;
|
|
3606
3773
|
context.precedence = precedence;
|
|
@@ -3660,7 +3827,7 @@ function matcher(pattern, advance) {
|
|
|
3660
3827
|
if (advance) {
|
|
3661
3828
|
context.position += pattern.length;
|
|
3662
3829
|
}
|
|
3663
|
-
return new parser_1.List([new parser_1.
|
|
3830
|
+
return new parser_1.List([new parser_1.Node(pattern)]);
|
|
3664
3831
|
};
|
|
3665
3832
|
case 'object':
|
|
3666
3833
|
return ({
|
|
@@ -3677,7 +3844,7 @@ function matcher(pattern, advance) {
|
|
|
3677
3844
|
if (advance) {
|
|
3678
3845
|
context.position += src.length;
|
|
3679
3846
|
}
|
|
3680
|
-
return new parser_1.List([new parser_1.
|
|
3847
|
+
return new parser_1.List([new parser_1.Node(src)]);
|
|
3681
3848
|
};
|
|
3682
3849
|
}
|
|
3683
3850
|
}
|
|
@@ -3685,162 +3852,6 @@ exports.matcher = matcher;
|
|
|
3685
3852
|
|
|
3686
3853
|
/***/ },
|
|
3687
3854
|
|
|
3688
|
-
/***/ 5691
|
|
3689
|
-
(__unused_webpack_module, exports, __webpack_require__) {
|
|
3690
|
-
|
|
3691
|
-
"use strict";
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
Object.defineProperty(exports, "__esModule", ({
|
|
3695
|
-
value: true
|
|
3696
|
-
}));
|
|
3697
|
-
exports.Delimiters = void 0;
|
|
3698
|
-
const combinator_1 = __webpack_require__(3484);
|
|
3699
|
-
class Delimiters {
|
|
3700
|
-
constructor() {
|
|
3701
|
-
this.tree = {};
|
|
3702
|
-
this.map = new Map();
|
|
3703
|
-
this.delimiters = [];
|
|
3704
|
-
this.stack = [];
|
|
3705
|
-
this.states = [];
|
|
3706
|
-
}
|
|
3707
|
-
// 手間を惜しまなければ規定のパターンはすべて配列のインデクスに変換可能。
|
|
3708
|
-
static signature(pattern) {
|
|
3709
|
-
switch (typeof pattern) {
|
|
3710
|
-
case 'undefined':
|
|
3711
|
-
return 1 << 7;
|
|
3712
|
-
case 'string':
|
|
3713
|
-
if (pattern.length === 1) {
|
|
3714
|
-
const code = pattern.charCodeAt(0);
|
|
3715
|
-
return code;
|
|
3716
|
-
}
|
|
3717
|
-
return `s:${pattern}`;
|
|
3718
|
-
case 'object':
|
|
3719
|
-
return `r/${pattern.source}`;
|
|
3720
|
-
}
|
|
3721
|
-
}
|
|
3722
|
-
static matcher(pattern) {
|
|
3723
|
-
switch (typeof pattern) {
|
|
3724
|
-
case 'undefined':
|
|
3725
|
-
return () => undefined;
|
|
3726
|
-
case 'string':
|
|
3727
|
-
case 'object':
|
|
3728
|
-
const match = (0, combinator_1.matcher)(pattern, false);
|
|
3729
|
-
return input => match(input) !== undefined || undefined;
|
|
3730
|
-
}
|
|
3731
|
-
}
|
|
3732
|
-
registry(signature) {
|
|
3733
|
-
if (typeof signature === 'number') {
|
|
3734
|
-
return this.tree[signature] ??= [];
|
|
3735
|
-
} else {
|
|
3736
|
-
const ds = this.map.get(signature);
|
|
3737
|
-
if (ds) return ds;
|
|
3738
|
-
const blank = [];
|
|
3739
|
-
this.map.set(signature, blank);
|
|
3740
|
-
return blank;
|
|
3741
|
-
}
|
|
3742
|
-
}
|
|
3743
|
-
push(delims) {
|
|
3744
|
-
const {
|
|
3745
|
-
delimiters,
|
|
3746
|
-
stack
|
|
3747
|
-
} = this;
|
|
3748
|
-
// シグネチャ数以下
|
|
3749
|
-
|
|
3750
|
-
for (let i = 0; i < delims.length; ++i) {
|
|
3751
|
-
const {
|
|
3752
|
-
signature,
|
|
3753
|
-
matcher,
|
|
3754
|
-
precedence
|
|
3755
|
-
} = delims[i];
|
|
3756
|
-
const memory = this.registry(signature);
|
|
3757
|
-
const index = memory[0]?.index ?? delimiters.length;
|
|
3758
|
-
if (memory.length === 0) {
|
|
3759
|
-
const delimiter = {
|
|
3760
|
-
memory,
|
|
3761
|
-
index,
|
|
3762
|
-
signature,
|
|
3763
|
-
matcher,
|
|
3764
|
-
precedence,
|
|
3765
|
-
state: true
|
|
3766
|
-
};
|
|
3767
|
-
delimiters[index] = delimiter;
|
|
3768
|
-
memory.push(delimiter);
|
|
3769
|
-
stack.push(index);
|
|
3770
|
-
} else {
|
|
3771
|
-
stack.push(-1);
|
|
3772
|
-
}
|
|
3773
|
-
// 現状各優先順位は固定
|
|
3774
|
-
}
|
|
3775
|
-
}
|
|
3776
|
-
pop(count) {
|
|
3777
|
-
const {
|
|
3778
|
-
delimiters,
|
|
3779
|
-
stack
|
|
3780
|
-
} = this;
|
|
3781
|
-
for (let i = 0; i < count; ++i) {
|
|
3782
|
-
const index = stack.pop();
|
|
3783
|
-
if (index === -1) continue;
|
|
3784
|
-
const {
|
|
3785
|
-
memory
|
|
3786
|
-
} = delimiters[index];
|
|
3787
|
-
if (memory.length === 1) {
|
|
3788
|
-
memory.pop();
|
|
3789
|
-
delimiters.pop();
|
|
3790
|
-
} else {
|
|
3791
|
-
memory.pop();
|
|
3792
|
-
delimiters[index] = memory.at(-1);
|
|
3793
|
-
}
|
|
3794
|
-
}
|
|
3795
|
-
}
|
|
3796
|
-
shift(precedence) {
|
|
3797
|
-
const {
|
|
3798
|
-
delimiters
|
|
3799
|
-
} = this;
|
|
3800
|
-
const indexes = [];
|
|
3801
|
-
for (let i = delimiters.length; i--;) {
|
|
3802
|
-
const delimiter = delimiters[i];
|
|
3803
|
-
if (delimiter.precedence >= precedence || !delimiter.state) continue;
|
|
3804
|
-
delimiter.state = false;
|
|
3805
|
-
indexes.push(i);
|
|
3806
|
-
}
|
|
3807
|
-
this.states.push(indexes);
|
|
3808
|
-
}
|
|
3809
|
-
unshift() {
|
|
3810
|
-
const {
|
|
3811
|
-
delimiters
|
|
3812
|
-
} = this;
|
|
3813
|
-
const indexes = this.states.pop();
|
|
3814
|
-
for (let i = indexes.length; i--;) {
|
|
3815
|
-
delimiters[indexes[i]].state = true;
|
|
3816
|
-
}
|
|
3817
|
-
}
|
|
3818
|
-
match(input) {
|
|
3819
|
-
const {
|
|
3820
|
-
precedence = 0
|
|
3821
|
-
} = input.context;
|
|
3822
|
-
const {
|
|
3823
|
-
delimiters
|
|
3824
|
-
} = this;
|
|
3825
|
-
for (let i = delimiters.length; i--;) {
|
|
3826
|
-
const delimiter = delimiters[i];
|
|
3827
|
-
if (delimiter.precedence <= precedence || !delimiter.state) continue;
|
|
3828
|
-
switch (delimiter.matcher(input)) {
|
|
3829
|
-
case true:
|
|
3830
|
-
return true;
|
|
3831
|
-
case false:
|
|
3832
|
-
return false;
|
|
3833
|
-
default:
|
|
3834
|
-
continue;
|
|
3835
|
-
}
|
|
3836
|
-
}
|
|
3837
|
-
return false;
|
|
3838
|
-
}
|
|
3839
|
-
}
|
|
3840
|
-
exports.Delimiters = Delimiters;
|
|
3841
|
-
|
|
3842
|
-
/***/ },
|
|
3843
|
-
|
|
3844
3855
|
/***/ 2861
|
|
3845
3856
|
(__unused_webpack_module, exports) {
|
|
3846
3857
|
|
|
@@ -3863,7 +3874,7 @@ function inits(parsers, resume) {
|
|
|
3863
3874
|
let nodes;
|
|
3864
3875
|
for (let len = parsers.length, i = 0; i < len; ++i) {
|
|
3865
3876
|
if (context.position === source.length) break;
|
|
3866
|
-
if (context.delimiters
|
|
3877
|
+
if (context.delimiters.match(input)) break;
|
|
3867
3878
|
const result = parsers[i](input);
|
|
3868
3879
|
if (result === undefined) break;
|
|
3869
3880
|
nodes = nodes?.import(result) ?? result;
|
|
@@ -3898,7 +3909,7 @@ function sequence(parsers, resume) {
|
|
|
3898
3909
|
let nodes;
|
|
3899
3910
|
for (let len = parsers.length, i = 0; i < len; ++i) {
|
|
3900
3911
|
if (context.position === source.length) return;
|
|
3901
|
-
if (context.delimiters
|
|
3912
|
+
if (context.delimiters.match(input)) return;
|
|
3902
3913
|
const result = parsers[i](input);
|
|
3903
3914
|
if (result === undefined) return;
|
|
3904
3915
|
nodes = nodes?.import(result) ?? result;
|
|
@@ -3921,7 +3932,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
3921
3932
|
value: true
|
|
3922
3933
|
}));
|
|
3923
3934
|
exports.some = void 0;
|
|
3924
|
-
const delimiter_1 = __webpack_require__(
|
|
3935
|
+
const delimiter_1 = __webpack_require__(385);
|
|
3925
3936
|
function some(parser, end, delimiters = [], limit = -1) {
|
|
3926
3937
|
if (typeof end === 'number') return some(parser, undefined, delimiters, end);
|
|
3927
3938
|
const match = delimiter_1.Delimiters.matcher(end);
|
|
@@ -3941,13 +3952,12 @@ function some(parser, end, delimiters = [], limit = -1) {
|
|
|
3941
3952
|
//assert(context.backtracks ??= {});
|
|
3942
3953
|
let nodes;
|
|
3943
3954
|
if (delims.length > 0) {
|
|
3944
|
-
context.delimiters ??= new delimiter_1.Delimiters();
|
|
3945
3955
|
context.delimiters.push(delims);
|
|
3946
3956
|
}
|
|
3947
3957
|
// whileは数倍遅い
|
|
3948
3958
|
for (const len = source.length; context.position < len;) {
|
|
3949
3959
|
if (match(input)) break;
|
|
3950
|
-
if (context.delimiters
|
|
3960
|
+
if (context.delimiters.match(input)) break;
|
|
3951
3961
|
const result = parser(input);
|
|
3952
3962
|
if (result === undefined) break;
|
|
3953
3963
|
nodes = nodes?.import(result) ?? result;
|
|
@@ -4128,21 +4138,21 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
4128
4138
|
value: true
|
|
4129
4139
|
}));
|
|
4130
4140
|
exports.bind = void 0;
|
|
4141
|
+
const context_1 = __webpack_require__(8669);
|
|
4131
4142
|
const parser_1 = __webpack_require__(605);
|
|
4132
4143
|
const segment_1 = __webpack_require__(3967);
|
|
4133
|
-
const header_1 = __webpack_require__(3009);
|
|
4134
4144
|
const block_1 = __webpack_require__(7099);
|
|
4135
4145
|
const normalize_1 = __webpack_require__(4490);
|
|
4136
|
-
const
|
|
4146
|
+
const header_1 = __webpack_require__(3652);
|
|
4137
4147
|
const figure_1 = __webpack_require__(1657);
|
|
4138
4148
|
const note_1 = __webpack_require__(165);
|
|
4139
4149
|
const url_1 = __webpack_require__(1904);
|
|
4140
4150
|
const array_1 = __webpack_require__(6876);
|
|
4141
4151
|
function bind(target, settings) {
|
|
4142
|
-
const context = {
|
|
4152
|
+
const context = new context_1.Context({
|
|
4143
4153
|
...settings,
|
|
4144
4154
|
host: settings.host ?? new url_1.ReadonlyURL(location.pathname, location.origin)
|
|
4145
|
-
};
|
|
4155
|
+
});
|
|
4146
4156
|
if (context.id?.match(/[^0-9a-z/-]/i)) throw new Error('Invalid ID: ID must be alphanumeric');
|
|
4147
4157
|
if (context.host?.origin === 'null') throw new Error(`Invalid host: ${context.host.href}`);
|
|
4148
4158
|
const blocks = [];
|
|
@@ -4157,7 +4167,7 @@ function bind(target, settings) {
|
|
|
4157
4167
|
};
|
|
4158
4168
|
function* parse(source) {
|
|
4159
4169
|
if (settings.chunk && revision) throw new Error('Chunks cannot be updated');
|
|
4160
|
-
const url = (0,
|
|
4170
|
+
const url = (0, header_1.headers)(source).find(field => field.toLowerCase().startsWith('url:'))?.slice(4).trim() ?? '';
|
|
4161
4171
|
source = (0, normalize_1.normalize)(source);
|
|
4162
4172
|
// @ts-expect-error
|
|
4163
4173
|
context.url = url ? new url_1.ReadonlyURL(url) : undefined;
|
|
@@ -4184,13 +4194,15 @@ function bind(target, settings) {
|
|
|
4184
4194
|
}
|
|
4185
4195
|
const base = next(head);
|
|
4186
4196
|
let index = head;
|
|
4197
|
+
// @ts-expect-error
|
|
4198
|
+
context.header = true;
|
|
4187
4199
|
for (; index < sourceSegments.length - last; ++index) {
|
|
4188
4200
|
const seg = sourceSegments[index];
|
|
4189
|
-
const es = (
|
|
4190
|
-
header: index === 0
|
|
4191
|
-
})) || (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, {
|
|
4192
4202
|
value
|
|
4193
4203
|
}) => void acc.push(value) || acc, []) ?? [];
|
|
4204
|
+
// @ts-expect-error
|
|
4205
|
+
context.header = false;
|
|
4194
4206
|
blocks.splice(index, 0, [seg, es, url]);
|
|
4195
4207
|
if (es.length === 0) continue;
|
|
4196
4208
|
// All deletion processes always run after all addition processes have done.
|
|
@@ -4356,7 +4368,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
4356
4368
|
value: true
|
|
4357
4369
|
}));
|
|
4358
4370
|
exports.headers = exports.header = void 0;
|
|
4359
|
-
const
|
|
4371
|
+
const context_1 = __webpack_require__(8669);
|
|
4360
4372
|
const header_1 = __webpack_require__(3009);
|
|
4361
4373
|
function header(source) {
|
|
4362
4374
|
const [, pos = 0] = parse(source);
|
|
@@ -4369,10 +4381,14 @@ function headers(source) {
|
|
|
4369
4381
|
}
|
|
4370
4382
|
exports.headers = headers;
|
|
4371
4383
|
function parse(source) {
|
|
4372
|
-
const
|
|
4373
|
-
|
|
4384
|
+
const context = new context_1.Context({
|
|
4385
|
+
source
|
|
4386
|
+
});
|
|
4387
|
+
const result = (0, header_1.header)({
|
|
4388
|
+
context
|
|
4389
|
+
});
|
|
4374
4390
|
const el = result?.head?.value;
|
|
4375
|
-
return el?.tagName === 'ASIDE' ? [el,
|
|
4391
|
+
return el?.tagName === 'ASIDE' ? [el, context.position] : [];
|
|
4376
4392
|
}
|
|
4377
4393
|
|
|
4378
4394
|
/***/ },
|
|
@@ -4388,6 +4404,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
4388
4404
|
}));
|
|
4389
4405
|
exports.escape = exports.invisibleHTMLEntityNames = exports.normalize = void 0;
|
|
4390
4406
|
const parser_1 = __webpack_require__(605);
|
|
4407
|
+
const context_1 = __webpack_require__(8669);
|
|
4391
4408
|
const htmlentity_1 = __webpack_require__(470);
|
|
4392
4409
|
const UNICODE_REPLACEMENT_CHARACTER = '\uFFFD';
|
|
4393
4410
|
function normalize(source) {
|
|
@@ -4409,7 +4426,7 @@ function sanitize(source) {
|
|
|
4409
4426
|
// https://en.wikipedia.org/wiki/Whitespace_character
|
|
4410
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'];
|
|
4411
4428
|
const unreadableEscapeHTMLEntityNames = exports.invisibleHTMLEntityNames.filter(name => !['Tab', 'NewLine', 'NonBreakingSpace', 'nbsp', 'zwj', 'zwnj'].includes(name));
|
|
4412
|
-
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);
|
|
4413
4430
|
const unreadableEscapeCharacter = new RegExp(`[${unreadableEscapeCharacters.join('')}]`, 'g');
|
|
4414
4431
|
// https://www.pandanoir.info/entry/2018/03/11/193000
|
|
4415
4432
|
// http://anti.rosx.net/etc/memo/002_space.html
|
|
@@ -4462,35 +4479,36 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
4462
4479
|
}));
|
|
4463
4480
|
exports.parse = void 0;
|
|
4464
4481
|
const parser_1 = __webpack_require__(605);
|
|
4482
|
+
const context_1 = __webpack_require__(8669);
|
|
4465
4483
|
const segment_1 = __webpack_require__(3967);
|
|
4466
|
-
const header_1 = __webpack_require__(3009);
|
|
4467
4484
|
const block_1 = __webpack_require__(7099);
|
|
4468
4485
|
const normalize_1 = __webpack_require__(4490);
|
|
4469
|
-
const
|
|
4486
|
+
const header_1 = __webpack_require__(3652);
|
|
4470
4487
|
const figure_1 = __webpack_require__(1657);
|
|
4471
4488
|
const note_1 = __webpack_require__(165);
|
|
4472
4489
|
const url_1 = __webpack_require__(1904);
|
|
4473
4490
|
const dom_1 = __webpack_require__(394);
|
|
4474
4491
|
function parse(source, options = {}, context) {
|
|
4475
|
-
const url = (0,
|
|
4492
|
+
const url = (0, header_1.headers)(source).find(field => field.toLowerCase().startsWith('url:'))?.slice(4).trim() ?? '';
|
|
4476
4493
|
source = !context ? (0, normalize_1.normalize)(source) : source;
|
|
4477
|
-
context = {
|
|
4494
|
+
context = new context_1.Context({
|
|
4478
4495
|
host: options.host ?? context?.host ?? new url_1.ReadonlyURL(location.pathname, location.origin),
|
|
4479
4496
|
url: url ? new url_1.ReadonlyURL(url) : context?.url,
|
|
4480
4497
|
id: options.id ?? context?.id,
|
|
4481
4498
|
caches: context?.caches,
|
|
4482
4499
|
resources: context?.resources
|
|
4483
|
-
};
|
|
4500
|
+
});
|
|
4484
4501
|
if (context.id?.match(/[^0-9a-z/-]/i)) throw new Error('Invalid ID: ID must be alphanumeric');
|
|
4485
4502
|
if (context.host?.origin === 'null') throw new Error(`Invalid host: ${context.host.href}`);
|
|
4486
4503
|
const node = (0, dom_1.frag)();
|
|
4487
|
-
|
|
4504
|
+
// @ts-expect-error
|
|
4505
|
+
context.header = true;
|
|
4488
4506
|
for (const seg of (0, segment_1.segment)(source)) {
|
|
4489
|
-
node.append(...((
|
|
4490
|
-
header: index++ === 0
|
|
4491
|
-
})) || (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, {
|
|
4492
4508
|
value
|
|
4493
4509
|
}) => void acc.push(value) || acc, []) ?? []));
|
|
4510
|
+
// @ts-expect-error
|
|
4511
|
+
context.header = false;
|
|
4494
4512
|
}
|
|
4495
4513
|
if (options.test) return node;
|
|
4496
4514
|
for (const _ of (0, figure_1.figure)(node, options.notes, context));
|
|
@@ -4512,7 +4530,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
4512
4530
|
}));
|
|
4513
4531
|
exports.autolink = void 0;
|
|
4514
4532
|
const combinator_1 = __webpack_require__(3484);
|
|
4515
|
-
const autolink_1 = __webpack_require__(
|
|
4533
|
+
const autolink_1 = __webpack_require__(5691);
|
|
4516
4534
|
const source_1 = __webpack_require__(8745);
|
|
4517
4535
|
exports.autolink = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([autolink_1.autolink, source_1.unescsource])));
|
|
4518
4536
|
|
|
@@ -4531,6 +4549,7 @@ exports.block = void 0;
|
|
|
4531
4549
|
const parser_1 = __webpack_require__(605);
|
|
4532
4550
|
const combinator_1 = __webpack_require__(3484);
|
|
4533
4551
|
const segment_1 = __webpack_require__(3967);
|
|
4552
|
+
const header_1 = __webpack_require__(3009);
|
|
4534
4553
|
const source_1 = __webpack_require__(8745);
|
|
4535
4554
|
const pagebreak_1 = __webpack_require__(2946);
|
|
4536
4555
|
const heading_1 = __webpack_require__(2778);
|
|
@@ -4552,7 +4571,7 @@ const dom_1 = __webpack_require__(394);
|
|
|
4552
4571
|
exports.block = (0, combinator_1.reset)({
|
|
4553
4572
|
resources: {
|
|
4554
4573
|
// バックトラックのせいで文字数制限を受けないようにする。
|
|
4555
|
-
clock: segment_1.MAX_SEGMENT_SIZE *
|
|
4574
|
+
clock: segment_1.MAX_SEGMENT_SIZE * 6 + 1,
|
|
4556
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 */]
|
|
4557
4576
|
},
|
|
4558
4577
|
backtracks: {}
|
|
@@ -4577,6 +4596,7 @@ exports.block = (0, combinator_1.reset)({
|
|
|
4577
4596
|
if (source[position + 1] === ' ') return (0, dlist_1.dlist)(input);
|
|
4578
4597
|
break;
|
|
4579
4598
|
case '-':
|
|
4599
|
+
if (source.startsWith('---', position)) return (0, header_1.header)(input);
|
|
4580
4600
|
if (source[position + 1] === ' ') return (0, ulist_1.ulist)(input) || (0, ilist_1.ilist)(input);
|
|
4581
4601
|
break;
|
|
4582
4602
|
case '+':
|
|
@@ -4625,10 +4645,10 @@ function error(parser) {
|
|
|
4625
4645
|
position,
|
|
4626
4646
|
id
|
|
4627
4647
|
}
|
|
4628
|
-
}, reason) => new parser_1.List([new parser_1.
|
|
4648
|
+
}, reason) => new parser_1.List([new parser_1.Node((0, dom_1.html)('h1', {
|
|
4629
4649
|
id: id !== '' ? `error:${(0, random_1.rnd0Z)(8)}` : undefined,
|
|
4630
4650
|
class: 'error'
|
|
4631
|
-
}, 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', {
|
|
4632
4652
|
class: 'error',
|
|
4633
4653
|
translate: 'no'
|
|
4634
4654
|
}, source.slice(position).replace(reg, '').slice(0, 1001).replace(/^(.{997}).{4}$/s, '$1...') || undefined))]));
|
|
@@ -4658,7 +4678,7 @@ exports.blockquote = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, co
|
|
|
4658
4678
|
const opener = /(?=>>+(?:$|[ \n]))/y;
|
|
4659
4679
|
const indent = (0, combinator_1.block)((0, combinator_1.open)(opener, (0, combinator_1.some)(source_1.contentline, />(?:$|[ \n])/y)), false);
|
|
4660
4680
|
const unindent = source => source.replace(/(?<=^|\n)>(?: |(?=>*(?:$|[ \n])))|\n$/g, '');
|
|
4661
|
-
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)))])));
|
|
4662
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, ({
|
|
4663
4683
|
context
|
|
4664
4684
|
}) => {
|
|
@@ -4676,8 +4696,8 @@ const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combina
|
|
|
4676
4696
|
}
|
|
4677
4697
|
}, context);
|
|
4678
4698
|
context.position = source.length;
|
|
4679
|
-
return new parser_1.List([new parser_1.
|
|
4680
|
-
}, 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)))])));
|
|
4681
4701
|
|
|
4682
4702
|
/***/ },
|
|
4683
4703
|
|
|
@@ -4724,7 +4744,7 @@ exports.codeblock = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinato
|
|
|
4724
4744
|
name in params ? params.invalid = `Duplicate ${name} attribute` : params[name] = value;
|
|
4725
4745
|
return params;
|
|
4726
4746
|
}, {}) ?? {};
|
|
4727
|
-
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', {
|
|
4728
4748
|
class: 'invalid',
|
|
4729
4749
|
translate: 'no',
|
|
4730
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)
|
|
@@ -4736,7 +4756,7 @@ exports.codeblock = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinato
|
|
|
4736
4756
|
'data-line': params.line || undefined,
|
|
4737
4757
|
'data-path': params.path || undefined
|
|
4738
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)))));
|
|
4739
|
-
return new parser_1.List([new parser_1.
|
|
4759
|
+
return new parser_1.List([new parser_1.Node(el)]);
|
|
4740
4760
|
}));
|
|
4741
4761
|
|
|
4742
4762
|
/***/ },
|
|
@@ -4758,13 +4778,13 @@ const source_1 = __webpack_require__(8745);
|
|
|
4758
4778
|
const visibility_1 = __webpack_require__(6364);
|
|
4759
4779
|
const util_1 = __webpack_require__(4992);
|
|
4760
4780
|
const dom_1 = __webpack_require__(394);
|
|
4761
|
-
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.
|
|
4762
|
-
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', {
|
|
4763
4783
|
'data-index': (0, inline_1.dataindex)(ns)
|
|
4764
4784
|
}, (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]))));
|
|
4765
|
-
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);
|
|
4766
4786
|
function fillTrailingDescription(nodes) {
|
|
4767
|
-
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;
|
|
4768
4788
|
}
|
|
4769
4789
|
|
|
4770
4790
|
/***/ },
|
|
@@ -4813,7 +4833,7 @@ exports.aside = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combina
|
|
|
4813
4833
|
// Bug: Type mismatch between outer and inner.
|
|
4814
4834
|
(nodes, context) => {
|
|
4815
4835
|
const [body, overflow, closer, opener, delim, param] = (0, util_1.unwrap)(nodes);
|
|
4816
|
-
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', {
|
|
4817
4837
|
class: 'invalid',
|
|
4818
4838
|
translate: 'no',
|
|
4819
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')
|
|
@@ -4828,12 +4848,12 @@ exports.aside = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combina
|
|
|
4828
4848
|
}
|
|
4829
4849
|
}, context);
|
|
4830
4850
|
const heading = 'H1 H2 H3 H4 H5 H6'.split(' ').includes(document.firstElementChild?.tagName) && document.firstElementChild;
|
|
4831
|
-
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', {
|
|
4832
4852
|
class: 'invalid',
|
|
4833
4853
|
translate: 'no',
|
|
4834
4854
|
...(0, util_1.invalid)('aside', 'content', 'Missing the title at the first line')
|
|
4835
4855
|
}, `${opener}${body}${closer}`))]);
|
|
4836
|
-
return new parser_1.List([new parser_1.
|
|
4856
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('aside', {
|
|
4837
4857
|
id: (0, indexee_1.identity)('index', context.id, heading),
|
|
4838
4858
|
class: 'aside'
|
|
4839
4859
|
}, [document, (0, dom_1.html)('h2', 'References'), references]))]);
|
|
@@ -4861,7 +4881,7 @@ exports.example = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combi
|
|
|
4861
4881
|
// Bug: Type mismatch between outer and inner.
|
|
4862
4882
|
(nodes, context) => {
|
|
4863
4883
|
const [body, overflow, closer, opener, delim, type = 'markdown', param] = (0, util_1.unwrap)(nodes);
|
|
4864
|
-
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', {
|
|
4865
4885
|
class: 'invalid',
|
|
4866
4886
|
translate: 'no',
|
|
4867
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')
|
|
@@ -4878,7 +4898,7 @@ exports.example = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combi
|
|
|
4878
4898
|
references
|
|
4879
4899
|
}
|
|
4880
4900
|
}, context);
|
|
4881
|
-
return new parser_1.List([new parser_1.
|
|
4901
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('aside', {
|
|
4882
4902
|
class: 'example',
|
|
4883
4903
|
'data-type': 'markdown'
|
|
4884
4904
|
}, [(0, dom_1.html)('pre', {
|
|
@@ -4886,14 +4906,14 @@ exports.example = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combi
|
|
|
4886
4906
|
}, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, dom_1.html)('section', [document, (0, dom_1.html)('h2', 'References'), references])]))]);
|
|
4887
4907
|
}
|
|
4888
4908
|
case 'math':
|
|
4889
|
-
return new parser_1.List([new parser_1.
|
|
4909
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('aside', {
|
|
4890
4910
|
class: 'example',
|
|
4891
4911
|
'data-type': 'math'
|
|
4892
4912
|
}, [(0, dom_1.html)('pre', {
|
|
4893
4913
|
translate: 'no'
|
|
4894
4914
|
}, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, mathblock_1.mathblock)((0, parser_1.subinput)(`$$\n${body}$$`, context)).head.value]))]);
|
|
4895
4915
|
default:
|
|
4896
|
-
return new parser_1.List([new parser_1.
|
|
4916
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
|
|
4897
4917
|
class: 'invalid',
|
|
4898
4918
|
translate: 'no',
|
|
4899
4919
|
...(0, util_1.invalid)('example', 'type', 'Invalid example type')
|
|
@@ -4961,7 +4981,7 @@ exports.figbase = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_
|
|
|
4961
4981
|
}]) => {
|
|
4962
4982
|
const label = el.getAttribute('data-label');
|
|
4963
4983
|
const group = label.split('-', 1)[0];
|
|
4964
|
-
return new parser_1.List([new parser_1.
|
|
4984
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('figure', {
|
|
4965
4985
|
'data-label': label,
|
|
4966
4986
|
'data-group': group,
|
|
4967
4987
|
hidden: ''
|
|
@@ -5003,7 +5023,7 @@ exports.segment = (0, combinator_1.block)((0, combinator_1.match)(/(~{3,})(?:fig
|
|
|
5003
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)));
|
|
5004
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 => {
|
|
5005
5025
|
const [label, param, content, ...caption] = (0, util_1.unwrap)(nodes);
|
|
5006
|
-
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', {
|
|
5007
5027
|
class: 'figindex'
|
|
5008
5028
|
}), (0, dom_1.html)('span', {
|
|
5009
5029
|
class: 'figtext'
|
|
@@ -5011,7 +5031,7 @@ exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinat
|
|
|
5011
5031
|
})), (0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})(?:figure(?=$|[ \n])|\[?\$)[^\n]*(?:$|\n)/y, 300), (nodes, context) => {
|
|
5012
5032
|
const [body, overflow, closer, opener, delim] = (0, util_1.unwrap)(nodes);
|
|
5013
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'];
|
|
5014
|
-
return new parser_1.List([new parser_1.
|
|
5034
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
|
|
5015
5035
|
class: 'invalid',
|
|
5016
5036
|
translate: 'no',
|
|
5017
5037
|
...(0, util_1.invalid)('figure', violation[0], violation[1])
|
|
@@ -5088,7 +5108,7 @@ exports.message = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_
|
|
|
5088
5108
|
// Bug: Type mismatch between outer and inner.
|
|
5089
5109
|
(nodes, context) => {
|
|
5090
5110
|
const [body, overflow, closer, opener, delim, type, param] = (0, util_1.unwrap)(nodes);
|
|
5091
|
-
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', {
|
|
5092
5112
|
class: 'invalid',
|
|
5093
5113
|
translate: 'no',
|
|
5094
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')
|
|
@@ -5099,13 +5119,13 @@ exports.message = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_
|
|
|
5099
5119
|
case 'warning':
|
|
5100
5120
|
break;
|
|
5101
5121
|
default:
|
|
5102
|
-
return new parser_1.List([new parser_1.
|
|
5122
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
|
|
5103
5123
|
class: 'invalid',
|
|
5104
5124
|
translate: 'no',
|
|
5105
5125
|
...(0, util_1.invalid)('message', 'type', 'Invalid message type')
|
|
5106
5126
|
}, `${opener}${body}${closer}`))]);
|
|
5107
5127
|
}
|
|
5108
|
-
return new parser_1.List([new parser_1.
|
|
5128
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('section', {
|
|
5109
5129
|
class: `message`,
|
|
5110
5130
|
'data-type': type
|
|
5111
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))])))]);
|
|
@@ -5144,7 +5164,7 @@ exports.segment = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator
|
|
|
5144
5164
|
exports.segment_ = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 300, false)), false);
|
|
5145
5165
|
exports.placeholder = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(opener, Infinity), nodes => {
|
|
5146
5166
|
const [body, overflow, closer, opener, delim] = (0, util_1.unwrap)(nodes);
|
|
5147
|
-
return new parser_1.List([new parser_1.
|
|
5167
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
|
|
5148
5168
|
class: 'invalid',
|
|
5149
5169
|
translate: 'no',
|
|
5150
5170
|
...(0, util_1.invalid)('extension', 'fence', !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : 'Invalid argument')
|
|
@@ -5163,13 +5183,13 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
5163
5183
|
value: true
|
|
5164
5184
|
}));
|
|
5165
5185
|
exports.table = exports.segment_ = exports.segment = void 0;
|
|
5166
|
-
const alias_1 = __webpack_require__(5413);
|
|
5167
5186
|
const parser_1 = __webpack_require__(605);
|
|
5168
5187
|
const combinator_1 = __webpack_require__(3484);
|
|
5169
5188
|
const inline_1 = __webpack_require__(7973);
|
|
5170
5189
|
const source_1 = __webpack_require__(8745);
|
|
5171
5190
|
const util_1 = __webpack_require__(4992);
|
|
5172
5191
|
const visibility_1 = __webpack_require__(6364);
|
|
5192
|
+
const alias_1 = __webpack_require__(5413);
|
|
5173
5193
|
const array_1 = __webpack_require__(6876);
|
|
5174
5194
|
const dom_1 = __webpack_require__(394);
|
|
5175
5195
|
const opener = /(~{3,})table(?:\/(\S+))?(?!\S)([^\n]*)(?:$|\n)/y;
|
|
@@ -5179,7 +5199,7 @@ exports.table = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.
|
|
|
5179
5199
|
// Bug: Type mismatch between outer and inner.
|
|
5180
5200
|
(nodes, context) => {
|
|
5181
5201
|
const [body, overflow, closer, opener, delim, type, param] = (0, util_1.unwrap)(nodes);
|
|
5182
|
-
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', {
|
|
5183
5203
|
class: 'invalid',
|
|
5184
5204
|
translate: 'no',
|
|
5185
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')
|
|
@@ -5187,28 +5207,28 @@ exports.table = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.
|
|
|
5187
5207
|
switch (type) {
|
|
5188
5208
|
case 'grid':
|
|
5189
5209
|
case undefined:
|
|
5190
|
-
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, {
|
|
5191
5211
|
value
|
|
5192
|
-
}) => acc.push(new parser_1.
|
|
5212
|
+
}) => acc.push(new parser_1.Node((0, dom_1.define)(value, {
|
|
5193
5213
|
'data-type': type
|
|
5194
5214
|
}))) && acc, new parser_1.List());
|
|
5195
5215
|
default:
|
|
5196
|
-
return new parser_1.List([new parser_1.
|
|
5216
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
|
|
5197
5217
|
class: 'invalid',
|
|
5198
5218
|
translate: 'no',
|
|
5199
5219
|
...(0, util_1.invalid)('table', 'argument', 'Invalid table type')
|
|
5200
5220
|
}, `${opener}${body}${closer}`))]);
|
|
5201
5221
|
}
|
|
5202
5222
|
}));
|
|
5203
|
-
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.
|
|
5204
|
-
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)));
|
|
5205
5225
|
const alignment = /[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)/y;
|
|
5206
5226
|
const align = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.union)([(0, source_1.str)(alignment)]), ([{
|
|
5207
5227
|
value
|
|
5208
|
-
}]) => new parser_1.List([new parser_1.
|
|
5228
|
+
}]) => new parser_1.List([new parser_1.Node(value.split('/').map(s => s.split('')))])));
|
|
5209
5229
|
const delimiter = /[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)|[#:](?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=[ \n])/y;
|
|
5210
|
-
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.
|
|
5211
|
-
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);
|
|
5212
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)])));
|
|
5213
5233
|
function attributes(source) {
|
|
5214
5234
|
let [, rowspan = undefined, colspan = undefined, highlight = undefined, extension = undefined] = source.match(/^[#:](?:(\d+)?:(\d+)?)?(?:(!+)([+]?))?$/) ?? [];
|
|
@@ -5435,12 +5455,12 @@ exports.segment = (0, combinator_1.block)((0, combinator_1.focus)(/#+ +\S[^\n]*(
|
|
|
5435
5455
|
} = input;
|
|
5436
5456
|
const {
|
|
5437
5457
|
source,
|
|
5438
|
-
range
|
|
5458
|
+
range
|
|
5439
5459
|
} = context;
|
|
5440
5460
|
const acc = new parser_1.List();
|
|
5441
5461
|
for (const len = context.position + range; context.position < len;) {
|
|
5442
5462
|
const line = (0, combinator_1.firstline)(source, context.position);
|
|
5443
|
-
acc.push(new parser_1.
|
|
5463
|
+
acc.push(new parser_1.Node(line));
|
|
5444
5464
|
context.position += line.length;
|
|
5445
5465
|
}
|
|
5446
5466
|
return acc;
|
|
@@ -5449,9 +5469,9 @@ exports.heading = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segm
|
|
|
5449
5469
|
// その他の表示制御は各所のCSSで行う。
|
|
5450
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) => {
|
|
5451
5471
|
const [h, ...ns] = (0, util_1.unwrap)(nodes);
|
|
5452
|
-
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}`, {
|
|
5453
5473
|
'data-index': (0, inline_1.dataindex)(nodes)
|
|
5454
|
-
}, (0, dom_1.defrag)(ns))) : new parser_1.
|
|
5474
|
+
}, (0, dom_1.defrag)(ns))) : new parser_1.Node((0, dom_1.html)(`h6`, {
|
|
5455
5475
|
class: 'invalid',
|
|
5456
5476
|
...(0, util_1.invalid)('heading', 'syntax', 'Heading level must be up to 6')
|
|
5457
5477
|
}, context.source.slice(context.position - context.range, context.position)))]);
|
|
@@ -5479,7 +5499,7 @@ const visibility_1 = __webpack_require__(6364);
|
|
|
5479
5499
|
const util_1 = __webpack_require__(4992);
|
|
5480
5500
|
const dom_1 = __webpack_require__(394);
|
|
5481
5501
|
exports.ilist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(/[-+*] /y, exports.ilist_)));
|
|
5482
|
-
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', {
|
|
5483
5503
|
class: 'invalid',
|
|
5484
5504
|
...(0, util_1.invalid)('list', 'syntax', 'Use "-" instead of "+" or "*"')
|
|
5485
5505
|
}, (0, util_1.unwrap)(ns)))]))));
|
|
@@ -5487,11 +5507,11 @@ exports.ilistitem = (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.
|
|
|
5487
5507
|
context: {
|
|
5488
5508
|
source
|
|
5489
5509
|
}
|
|
5490
|
-
}) => new parser_1.List([new parser_1.
|
|
5510
|
+
}) => new parser_1.List([new parser_1.Node(source)]))]), ({
|
|
5491
5511
|
context: {
|
|
5492
5512
|
source
|
|
5493
5513
|
}
|
|
5494
|
-
}) => 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', {
|
|
5495
5515
|
class: 'invalid',
|
|
5496
5516
|
...(0, util_1.invalid)('list', 'syntax', 'Fix the indent or the head of the list item')
|
|
5497
5517
|
}, source.replace('\n', '')))]));
|
|
@@ -5523,10 +5543,10 @@ exports.mathblock = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinato
|
|
|
5523
5543
|
} = {}
|
|
5524
5544
|
}) => {
|
|
5525
5545
|
const [body, overflow, closer, opener, delim, param] = (0, util_1.unwrap)(nodes);
|
|
5526
|
-
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', {
|
|
5527
5547
|
class: 'math',
|
|
5528
5548
|
translate: 'no'
|
|
5529
|
-
}, `${delim}\n${body}${delim}`)) : new parser_1.
|
|
5549
|
+
}, `${delim}\n${body}${delim}`)) : new parser_1.Node((0, dom_1.html)('pre', {
|
|
5530
5550
|
class: 'invalid',
|
|
5531
5551
|
translate: 'no',
|
|
5532
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')
|
|
@@ -5554,10 +5574,10 @@ exports.mediablock = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinat
|
|
|
5554
5574
|
context: {
|
|
5555
5575
|
source
|
|
5556
5576
|
}
|
|
5557
|
-
}) => new parser_1.List([new parser_1.
|
|
5577
|
+
}) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
5558
5578
|
class: 'invalid',
|
|
5559
5579
|
...(0, util_1.invalid)('mediablock', 'syntax', 'Not media syntax')
|
|
5560
|
-
}, 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)))])));
|
|
5561
5581
|
|
|
5562
5582
|
/***/ },
|
|
5563
5583
|
|
|
@@ -5586,21 +5606,21 @@ const openers = {
|
|
|
5586
5606
|
};
|
|
5587
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_)));
|
|
5588
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]), []))])));
|
|
5589
|
-
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', {
|
|
5590
5610
|
'data-index': (0, inline_1.dataindex)(ns),
|
|
5591
5611
|
'data-marker': ns.shift()?.value || undefined
|
|
5592
|
-
}, (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))]));
|
|
5593
5613
|
const heads = {
|
|
5594
5614
|
'.': (0, combinator_1.focus)(openers['.'], ({
|
|
5595
5615
|
context: {
|
|
5596
5616
|
source
|
|
5597
5617
|
}
|
|
5598
|
-
}) => new parser_1.List([new parser_1.
|
|
5618
|
+
}) => new parser_1.List([new parser_1.Node(source.trimEnd().split('.', 1)[0] + '.')])),
|
|
5599
5619
|
'(': (0, combinator_1.focus)(openers['('], ({
|
|
5600
5620
|
context: {
|
|
5601
5621
|
source
|
|
5602
5622
|
}
|
|
5603
|
-
}) => new parser_1.List([new parser_1.
|
|
5623
|
+
}) => new parser_1.List([new parser_1.Node(source.trimEnd().replace(/^\($/, '(1)').replace(/^\((\w+)$/, '($1)'))]))
|
|
5604
5624
|
};
|
|
5605
5625
|
function idx(value) {
|
|
5606
5626
|
switch (value) {
|
|
@@ -5705,7 +5725,7 @@ exports.pagebreak = void 0;
|
|
|
5705
5725
|
const parser_1 = __webpack_require__(605);
|
|
5706
5726
|
const combinator_1 = __webpack_require__(3484);
|
|
5707
5727
|
const dom_1 = __webpack_require__(394);
|
|
5708
|
-
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'))]))));
|
|
5709
5729
|
|
|
5710
5730
|
/***/ },
|
|
5711
5731
|
|
|
@@ -5725,7 +5745,7 @@ const inline_1 = __webpack_require__(7973);
|
|
|
5725
5745
|
const visibility_1 = __webpack_require__(6364);
|
|
5726
5746
|
const util_1 = __webpack_require__(4992);
|
|
5727
5747
|
const dom_1 = __webpack_require__(394);
|
|
5728
|
-
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))))])));
|
|
5729
5749
|
|
|
5730
5750
|
/***/ },
|
|
5731
5751
|
|
|
@@ -5752,7 +5772,7 @@ const delimiter = new RegExp(`${cite_1.syntax.source}|${quote_1.syntax.source}`,
|
|
|
5752
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, {
|
|
5753
5773
|
source,
|
|
5754
5774
|
position
|
|
5755
|
-
}) => 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)))))]))));
|
|
5756
5776
|
|
|
5757
5777
|
/***/ },
|
|
5758
5778
|
|
|
@@ -5780,13 +5800,13 @@ exports.cite = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.op
|
|
|
5780
5800
|
context: {
|
|
5781
5801
|
source
|
|
5782
5802
|
}
|
|
5783
|
-
}) => new parser_1.List([new parser_1.
|
|
5803
|
+
}) => new parser_1.List([new parser_1.Node((0, dom_1.html)('a', {
|
|
5784
5804
|
class: 'anchor'
|
|
5785
5805
|
}, source))])), (0, combinator_1.focus)(/>>https?:\/\/\S+(?=\s*$)/y, ({
|
|
5786
5806
|
context: {
|
|
5787
5807
|
source
|
|
5788
5808
|
}
|
|
5789
|
-
}) => new parser_1.List([new parser_1.
|
|
5809
|
+
}) => new parser_1.List([new parser_1.Node((0, dom_1.html)('a', {
|
|
5790
5810
|
class: 'anchor',
|
|
5791
5811
|
href: source.slice(2).trimEnd(),
|
|
5792
5812
|
target: '_blank'
|
|
@@ -5794,17 +5814,17 @@ exports.cite = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.op
|
|
|
5794
5814
|
context: {
|
|
5795
5815
|
source
|
|
5796
5816
|
}
|
|
5797
|
-
}) => new parser_1.List([new parser_1.
|
|
5817
|
+
}) => new parser_1.List([new parser_1.Node(source)]))])), nodes => {
|
|
5798
5818
|
const quotes = nodes.head.value;
|
|
5799
5819
|
const node = nodes.last.value;
|
|
5800
|
-
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' ? {
|
|
5801
5821
|
class: 'cite'
|
|
5802
5822
|
} : {
|
|
5803
5823
|
class: 'cite invalid',
|
|
5804
5824
|
...(0, util_1.invalid)('cite', 'syntax', 'Invalid syntax')
|
|
5805
5825
|
}, (0, dom_1.defrag)([`${quotes}>`, typeof node === 'object' ? (0, dom_1.define)(node, {
|
|
5806
5826
|
'data-depth': `${quotes.length + 1}`
|
|
5807
|
-
}, 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'))]);
|
|
5808
5828
|
}));
|
|
5809
5829
|
|
|
5810
5830
|
/***/ },
|
|
@@ -5822,7 +5842,7 @@ exports.quote = exports.syntax = void 0;
|
|
|
5822
5842
|
const parser_1 = __webpack_require__(605);
|
|
5823
5843
|
const combinator_1 = __webpack_require__(3484);
|
|
5824
5844
|
const math_1 = __webpack_require__(2962);
|
|
5825
|
-
const autolink_1 = __webpack_require__(
|
|
5845
|
+
const autolink_1 = __webpack_require__(5691);
|
|
5826
5846
|
const source_1 = __webpack_require__(8745);
|
|
5827
5847
|
const util_1 = __webpack_require__(4992);
|
|
5828
5848
|
const dom_1 = __webpack_require__(394);
|
|
@@ -5832,7 +5852,7 @@ exports.quote = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combina
|
|
|
5832
5852
|
math_1.math, autolink_1.autolink, source_1.unescsource])))), (ns, {
|
|
5833
5853
|
source,
|
|
5834
5854
|
position
|
|
5835
|
-
}) => 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', {
|
|
5836
5856
|
class: 'quote'
|
|
5837
5857
|
}, (0, dom_1.defrag)((0, util_1.unwrap)(ns))))].reverse())), false));
|
|
5838
5858
|
|
|
@@ -5856,13 +5876,13 @@ const util_1 = __webpack_require__(4992);
|
|
|
5856
5876
|
const dom_1 = __webpack_require__(394);
|
|
5857
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])), ([{
|
|
5858
5878
|
value
|
|
5859
|
-
}]) => new parser_1.List([new parser_1.
|
|
5879
|
+
}]) => new parser_1.List([new parser_1.Node((0, dom_1.define)(value, {
|
|
5860
5880
|
class: 'invalid',
|
|
5861
5881
|
...(0, util_1.invalid)('sidefence', 'syntax', 'Reserved syntax')
|
|
5862
5882
|
}))]))));
|
|
5863
5883
|
const opener = /(?=\|\|+(?:$|[ \n]))/y;
|
|
5864
5884
|
const unindent = source => source.replace(/(?<=^|\n)\|(?: |(?=\|*(?:$|[ \n])))|\n$/g, '');
|
|
5865
|
-
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)))])));
|
|
5866
5886
|
|
|
5867
5887
|
/***/ },
|
|
5868
5888
|
|
|
@@ -5885,12 +5905,12 @@ const util_1 = __webpack_require__(4992);
|
|
|
5885
5905
|
const duff_1 = __webpack_require__(9202);
|
|
5886
5906
|
const array_1 = __webpack_require__(6876);
|
|
5887
5907
|
const dom_1 = __webpack_require__(394);
|
|
5888
|
-
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.
|
|
5889
|
-
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, ({
|
|
5890
5910
|
context: {
|
|
5891
5911
|
source
|
|
5892
5912
|
}
|
|
5893
|
-
}) => new parser_1.List([new parser_1.
|
|
5913
|
+
}) => new parser_1.List([new parser_1.Node((0, dom_1.html)('tr', {
|
|
5894
5914
|
class: 'invalid',
|
|
5895
5915
|
...(0, util_1.invalid)('table-row', 'syntax', 'Missing the start symbol of the table row')
|
|
5896
5916
|
}, [(0, dom_1.html)('td', source.replace('\n', ''))]))])));
|
|
@@ -5898,18 +5918,18 @@ const align = (0, combinator_1.fmap)((0, combinator_1.open)('|', (0, combinator_
|
|
|
5898
5918
|
context: {
|
|
5899
5919
|
source,
|
|
5900
5920
|
position,
|
|
5901
|
-
range
|
|
5921
|
+
range
|
|
5902
5922
|
}
|
|
5903
|
-
}) => 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, ({
|
|
5904
5924
|
context: {
|
|
5905
5925
|
source,
|
|
5906
5926
|
position,
|
|
5907
|
-
range
|
|
5927
|
+
range
|
|
5908
5928
|
}
|
|
5909
|
-
}) => 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))))]));
|
|
5910
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);
|
|
5911
|
-
const head = (0, combinator_1.fmap)(cell, ns => new parser_1.List([new parser_1.
|
|
5912
|
-
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))))]));
|
|
5913
5933
|
function format(rows) {
|
|
5914
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]), []);
|
|
5915
5935
|
for (const {
|
|
@@ -5947,15 +5967,15 @@ const visibility_1 = __webpack_require__(6364);
|
|
|
5947
5967
|
const util_1 = __webpack_require__(4992);
|
|
5948
5968
|
const dom_1 = __webpack_require__(394);
|
|
5949
5969
|
exports.ulist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)('- ', exports.ulist_)));
|
|
5950
|
-
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', {
|
|
5951
5971
|
'data-index': (0, inline_1.dataindex)(ns)
|
|
5952
|
-
}, (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))))]))));
|
|
5953
5973
|
exports.checkbox = (0, combinator_1.focus)(/\[[xX ]\](?=$|[ \n])/y, ({
|
|
5954
5974
|
context: {
|
|
5955
5975
|
source,
|
|
5956
5976
|
position
|
|
5957
5977
|
}
|
|
5958
|
-
}) => new parser_1.List([new parser_1.
|
|
5978
|
+
}) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
5959
5979
|
class: 'checkbox'
|
|
5960
5980
|
}, source[position + 1].trimStart() ? '☑' : '☐'))]), false);
|
|
5961
5981
|
function fillFirstLine(nodes) {
|
|
@@ -5964,7 +5984,7 @@ function fillFirstLine(nodes) {
|
|
|
5964
5984
|
switch (node.tagName) {
|
|
5965
5985
|
case 'UL':
|
|
5966
5986
|
case 'OL':
|
|
5967
|
-
nodes.unshift(new parser_1.
|
|
5987
|
+
nodes.unshift(new parser_1.Node((0, dom_1.html)('br')));
|
|
5968
5988
|
}
|
|
5969
5989
|
return nodes;
|
|
5970
5990
|
}
|
|
@@ -5978,6 +5998,45 @@ function format(list) {
|
|
|
5978
5998
|
|
|
5979
5999
|
/***/ },
|
|
5980
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
|
+
|
|
5981
6040
|
/***/ 3009
|
|
5982
6041
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
5983
6042
|
|
|
@@ -5996,11 +6055,11 @@ const normalize_1 = __webpack_require__(4490);
|
|
|
5996
6055
|
const dom_1 = __webpack_require__(394);
|
|
5997
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)(({
|
|
5998
6057
|
context
|
|
5999
|
-
}) => 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', {
|
|
6000
6059
|
class: 'header'
|
|
6001
6060
|
}, [(0, dom_1.html)('details', {
|
|
6002
6061
|
open: ''
|
|
6003
|
-
}, (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)))]))]))))), ({
|
|
6004
6063
|
context
|
|
6005
6064
|
}) => {
|
|
6006
6065
|
const {
|
|
@@ -6008,7 +6067,7 @@ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+ *
|
|
|
6008
6067
|
position
|
|
6009
6068
|
} = context;
|
|
6010
6069
|
context.position += source.length;
|
|
6011
|
-
return new parser_1.List([new parser_1.
|
|
6070
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
|
|
6012
6071
|
class: 'invalid',
|
|
6013
6072
|
translate: 'no',
|
|
6014
6073
|
...(0, util_1.invalid)('header', 'syntax', 'Invalid syntax')
|
|
@@ -6022,7 +6081,7 @@ const field = (0, combinator_1.line)(({
|
|
|
6022
6081
|
}) => {
|
|
6023
6082
|
const name = source.slice(position, source.indexOf(':', position));
|
|
6024
6083
|
const value = source.slice(position + name.length + 1).trim();
|
|
6025
|
-
return new parser_1.List([new parser_1.
|
|
6084
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
6026
6085
|
class: 'field',
|
|
6027
6086
|
'data-name': name.toLowerCase(),
|
|
6028
6087
|
'data-value': value
|
|
@@ -6066,7 +6125,7 @@ const math_1 = __webpack_require__(2962);
|
|
|
6066
6125
|
const code_1 = __webpack_require__(3481);
|
|
6067
6126
|
const htmlentity_1 = __webpack_require__(470);
|
|
6068
6127
|
const bracket_1 = __webpack_require__(4526);
|
|
6069
|
-
const autolink_1 = __webpack_require__(
|
|
6128
|
+
const autolink_1 = __webpack_require__(5691);
|
|
6070
6129
|
const source_1 = __webpack_require__(8745);
|
|
6071
6130
|
const stars = (0, source_1.strs)('*');
|
|
6072
6131
|
exports.inline = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input => {
|
|
@@ -6195,13 +6254,26 @@ const inline_1 = __webpack_require__(7973);
|
|
|
6195
6254
|
const visibility_1 = __webpack_require__(6364);
|
|
6196
6255
|
const util_1 = __webpack_require__(4992);
|
|
6197
6256
|
const dom_1 = __webpack_require__(394);
|
|
6198
|
-
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, [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', {
|
|
6199
6258
|
class: 'annotation'
|
|
6200
|
-
}, [(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
|
+
})));
|
|
6201
6273
|
|
|
6202
6274
|
/***/ },
|
|
6203
6275
|
|
|
6204
|
-
/***/
|
|
6276
|
+
/***/ 5691
|
|
6205
6277
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
6206
6278
|
|
|
6207
6279
|
"use strict";
|
|
@@ -6291,7 +6363,7 @@ exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /*
|
|
|
6291
6363
|
const param = nodes.foldl((acc, {
|
|
6292
6364
|
value
|
|
6293
6365
|
}) => acc ? acc + '+' + value : value, '');
|
|
6294
|
-
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), {
|
|
6295
6367
|
class: 'channel'
|
|
6296
6368
|
}))]);
|
|
6297
6369
|
}, ([[{
|
|
@@ -6302,7 +6374,7 @@ exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /*
|
|
|
6302
6374
|
if (context.source[context.position] === '#') {
|
|
6303
6375
|
return void (0, combinator_1.setBacktrack)(context, 2 | 8 /* Backtrack.unescapable */, context.position - context.range);
|
|
6304
6376
|
}
|
|
6305
|
-
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), {
|
|
6306
6378
|
class: 'account'
|
|
6307
6379
|
}))]);
|
|
6308
6380
|
}))));
|
|
@@ -6333,7 +6405,7 @@ const dom_1 = __webpack_require__(394);
|
|
|
6333
6405
|
// 外部表現は投稿ごとに投稿者の投稿時のタイムゾーンに統一する(非時系列順)
|
|
6334
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 */], ([, [{
|
|
6335
6407
|
value
|
|
6336
|
-
}]], 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), {
|
|
6337
6409
|
class: 'anchor'
|
|
6338
6410
|
}))])))));
|
|
6339
6411
|
|
|
@@ -6358,7 +6430,7 @@ exports.email = (0, combinator_1.constraint)(1 /* State.autolink */, (0, combina
|
|
|
6358
6430
|
value
|
|
6359
6431
|
}]) => value.length <= 254), '', false, [3 | 8 /* Backtrack.unescapable */], ([, [{
|
|
6360
6432
|
value
|
|
6361
|
-
}]]) => new parser_1.List([new parser_1.
|
|
6433
|
+
}]]) => new parser_1.List([new parser_1.Node((0, dom_1.html)('a', {
|
|
6362
6434
|
class: 'email',
|
|
6363
6435
|
href: `mailto:${value}`
|
|
6364
6436
|
}, value))]))));
|
|
@@ -6381,9 +6453,11 @@ const link_1 = __webpack_require__(3628);
|
|
|
6381
6453
|
const hashtag_1 = __webpack_require__(5764);
|
|
6382
6454
|
const source_1 = __webpack_require__(8745);
|
|
6383
6455
|
const dom_1 = __webpack_require__(394);
|
|
6384
|
-
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 */], ([, [{
|
|
6385
6459
|
value
|
|
6386
|
-
}]], 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), {
|
|
6387
6461
|
class: 'hashnum',
|
|
6388
6462
|
href: null
|
|
6389
6463
|
}))])))));
|
|
@@ -6412,7 +6486,7 @@ exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /*
|
|
|
6412
6486
|
value
|
|
6413
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 */], ([, [{
|
|
6414
6488
|
value
|
|
6415
|
-
}]], 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), {
|
|
6416
6490
|
class: 'hashtag'
|
|
6417
6491
|
}))])))));
|
|
6418
6492
|
|
|
@@ -6435,7 +6509,7 @@ const link_1 = __webpack_require__(3628);
|
|
|
6435
6509
|
const source_1 = __webpack_require__(8745);
|
|
6436
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 */, ({
|
|
6437
6511
|
context
|
|
6438
|
-
}) => 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))])));
|
|
6439
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 */, ({
|
|
6440
6514
|
context
|
|
6441
6515
|
}) => {
|
|
@@ -6444,7 +6518,7 @@ exports.lineurl = (0, combinator_1.lazy)(() => (0, combinator_1.focus)(/(?<=^|[\
|
|
|
6444
6518
|
position
|
|
6445
6519
|
} = context;
|
|
6446
6520
|
context.position -= source[0] === '!' ? 1 : 0;
|
|
6447
|
-
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))]);
|
|
6448
6522
|
})), (0, source_1.str)(/[^:]+/y)])])));
|
|
6449
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())]));
|
|
6450
6524
|
|
|
@@ -6497,51 +6571,48 @@ const p1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.
|
|
|
6497
6571
|
const {
|
|
6498
6572
|
source,
|
|
6499
6573
|
position,
|
|
6500
|
-
range
|
|
6574
|
+
range
|
|
6501
6575
|
} = context;
|
|
6502
6576
|
const head = position - range;
|
|
6503
|
-
if (context.linebreak !== 0
|
|
6504
|
-
|
|
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);
|
|
6505
6583
|
}
|
|
6506
6584
|
const str = source.slice(position - range + 1, position - 1);
|
|
6507
|
-
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', {
|
|
6508
6586
|
class: 'paren'
|
|
6509
6587
|
}, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]);
|
|
6510
|
-
}, ([as, bs = new parser_1.List()]
|
|
6511
|
-
const {
|
|
6512
|
-
source,
|
|
6513
|
-
position,
|
|
6514
|
-
range = 0
|
|
6515
|
-
} = context;
|
|
6516
|
-
const head = position - range;
|
|
6517
|
-
if (context.linebreak !== 0 || source[head + 1] !== '(') {
|
|
6518
|
-
(0, combinator_1.setBacktrack)(context, 2 | 128 /* Backtrack.doublebracket */, head);
|
|
6519
|
-
}
|
|
6520
|
-
return as.import(bs);
|
|
6521
|
-
}));
|
|
6588
|
+
}, ([as, bs = new parser_1.List()]) => as.import(bs)));
|
|
6522
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], {
|
|
6523
6590
|
source,
|
|
6524
6591
|
position,
|
|
6525
|
-
range
|
|
6592
|
+
range
|
|
6526
6593
|
}) => {
|
|
6527
6594
|
const str = source.slice(position - range + 1, position - 1);
|
|
6528
|
-
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', {
|
|
6529
6596
|
class: 'paren'
|
|
6530
6597
|
}, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]);
|
|
6531
6598
|
}, ([as, bs = new parser_1.List()]) => as.import(bs)));
|
|
6532
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) => {
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
if (
|
|
6541
|
-
(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);
|
|
6542
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 */) {
|
|
6543
6614
|
if (context.linebreak !== 0) {
|
|
6544
|
-
(0, combinator_1.setBacktrack)(context, 2 |
|
|
6615
|
+
(0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */ | 32 /* Backtrack.ruby */, head);
|
|
6545
6616
|
} else if (source[position] !== '{') {
|
|
6546
6617
|
(0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head);
|
|
6547
6618
|
} else {
|
|
@@ -6582,12 +6653,12 @@ const parser_1 = __webpack_require__(605);
|
|
|
6582
6653
|
const combinator_1 = __webpack_require__(3484);
|
|
6583
6654
|
const util_1 = __webpack_require__(4992);
|
|
6584
6655
|
const dom_1 = __webpack_require__(394);
|
|
6585
|
-
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', {
|
|
6586
6657
|
'data-src': whole
|
|
6587
|
-
}, 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', {
|
|
6588
6659
|
class: 'invalid',
|
|
6589
6660
|
...(0, util_1.invalid)('code', 'syntax', `Missing the closing symbol "${opener}"`)
|
|
6590
|
-
}, whole))]) : new parser_1.List([new parser_1.
|
|
6661
|
+
}, whole))]) : new parser_1.List([new parser_1.Node(opener)]));
|
|
6591
6662
|
function format(text) {
|
|
6592
6663
|
return text.length > 2 && text[0] === ' ' && text[1] === '`' && text.at(-1) === ' ' ? text.slice(1, -1) : text;
|
|
6593
6664
|
}
|
|
@@ -6614,7 +6685,7 @@ exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0,
|
|
|
6614
6685
|
buffer
|
|
6615
6686
|
}) => buffer.import(bs), ([, bs], {
|
|
6616
6687
|
buffer
|
|
6617
|
-
}) => 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))))]))));
|
|
6618
6689
|
|
|
6619
6690
|
/***/ },
|
|
6620
6691
|
|
|
@@ -6636,7 +6707,7 @@ const source_1 = __webpack_require__(8745);
|
|
|
6636
6707
|
const visibility_1 = __webpack_require__(6364);
|
|
6637
6708
|
const util_1 = __webpack_require__(4992);
|
|
6638
6709
|
const dom_1 = __webpack_require__(394);
|
|
6639
|
-
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)));
|
|
6640
6711
|
|
|
6641
6712
|
/***/ },
|
|
6642
6713
|
|
|
@@ -6666,7 +6737,7 @@ const subemphasis = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, comb
|
|
|
6666
6737
|
// このため終端記号の後ろを見て終端を中止し同じ構文を再帰的に適用してはならない。
|
|
6667
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) => {
|
|
6668
6739
|
const {
|
|
6669
|
-
buffer
|
|
6740
|
+
buffer
|
|
6670
6741
|
} = context;
|
|
6671
6742
|
switch (cs.head.value) {
|
|
6672
6743
|
case '***':
|
|
@@ -6678,18 +6749,18 @@ exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0,
|
|
|
6678
6749
|
} = context;
|
|
6679
6750
|
if (source.startsWith('*', context.position)) {
|
|
6680
6751
|
context.position += 1;
|
|
6681
|
-
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)))));
|
|
6682
6753
|
buffer.import(ds);
|
|
6683
|
-
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 */)]);
|
|
6684
6755
|
} else {
|
|
6685
|
-
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)))));
|
|
6686
6757
|
buffer.import(ds);
|
|
6687
|
-
buffer.push(new parser_1.
|
|
6758
|
+
buffer.push(new parser_1.Node("\u001F" /* Command.Separator */));
|
|
6688
6759
|
return prepend('*', buffer);
|
|
6689
6760
|
}
|
|
6690
6761
|
})({
|
|
6691
6762
|
context
|
|
6692
|
-
}) ?? 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 */)])));
|
|
6693
6764
|
case '*':
|
|
6694
6765
|
return (0, combinator_1.bind)(substrong, ds => {
|
|
6695
6766
|
const {
|
|
@@ -6697,34 +6768,34 @@ exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0,
|
|
|
6697
6768
|
} = context;
|
|
6698
6769
|
if (source.startsWith('**', context.position)) {
|
|
6699
6770
|
context.position += 2;
|
|
6700
|
-
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)))));
|
|
6701
6772
|
buffer.import(ds);
|
|
6702
|
-
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 */)]);
|
|
6703
6774
|
} else {
|
|
6704
|
-
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)))));
|
|
6705
6776
|
buffer.import(ds);
|
|
6706
|
-
buffer.push(new parser_1.
|
|
6777
|
+
buffer.push(new parser_1.Node("\u001F" /* Command.Separator */));
|
|
6707
6778
|
return prepend('**', buffer);
|
|
6708
6779
|
}
|
|
6709
6780
|
})({
|
|
6710
6781
|
context
|
|
6711
|
-
}) ?? 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 */)])));
|
|
6712
6783
|
}
|
|
6713
6784
|
}, ([, bs], {
|
|
6714
6785
|
buffer
|
|
6715
|
-
}) => bs && buffer.import(bs) && buffer.push(new parser_1.
|
|
6786
|
+
}) => bs && buffer.import(bs) && buffer.push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer),
|
|
6716
6787
|
// 3以上の`*`に対してemの適用を保証する
|
|
6717
|
-
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) => {
|
|
6718
6789
|
context.position += postfix;
|
|
6719
6790
|
if (state) {
|
|
6720
6791
|
switch (postfix) {
|
|
6721
6792
|
case 0:
|
|
6722
6793
|
break;
|
|
6723
6794
|
case 1:
|
|
6724
|
-
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))))]);
|
|
6725
6796
|
break;
|
|
6726
6797
|
case 2:
|
|
6727
|
-
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))))]);
|
|
6728
6799
|
break;
|
|
6729
6800
|
default:
|
|
6730
6801
|
}
|
|
@@ -6740,7 +6811,7 @@ nodes => new parser_1.List([new parser_1.Data((0, dom_1.html)('em', [(0, dom_1.h
|
|
|
6740
6811
|
} = context;
|
|
6741
6812
|
if (source.startsWith('*', context.position)) {
|
|
6742
6813
|
context.position += 1;
|
|
6743
|
-
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)))))]);
|
|
6744
6815
|
} else {
|
|
6745
6816
|
return prepend('*', nodes.import(ds));
|
|
6746
6817
|
}
|
|
@@ -6756,7 +6827,7 @@ nodes => new parser_1.List([new parser_1.Data((0, dom_1.html)('em', [(0, dom_1.h
|
|
|
6756
6827
|
} = context;
|
|
6757
6828
|
if (source.startsWith('**', context.position)) {
|
|
6758
6829
|
context.position += 2;
|
|
6759
|
-
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)))))]);
|
|
6760
6831
|
} else {
|
|
6761
6832
|
return prepend('**', nodes.import(ds));
|
|
6762
6833
|
}
|
|
@@ -6776,7 +6847,7 @@ function prepend(prefix, nodes) {
|
|
|
6776
6847
|
if (typeof nodes.head?.value === 'string') {
|
|
6777
6848
|
nodes.head.value = prefix + nodes.head.value;
|
|
6778
6849
|
} else {
|
|
6779
|
-
nodes.unshift(new parser_1.
|
|
6850
|
+
nodes.unshift(new parser_1.Node(prefix));
|
|
6780
6851
|
}
|
|
6781
6852
|
return nodes;
|
|
6782
6853
|
}
|
|
@@ -6820,12 +6891,12 @@ const source_1 = __webpack_require__(8745);
|
|
|
6820
6891
|
const visibility_1 = __webpack_require__(6364);
|
|
6821
6892
|
const util_1 = __webpack_require__(4992);
|
|
6822
6893
|
const dom_1 = __webpack_require__(394);
|
|
6823
|
-
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', {
|
|
6824
6895
|
'data-index': dataindex(bs)
|
|
6825
6896
|
}, (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]) : undefined, undefined)), ns => {
|
|
6826
6897
|
if (ns.length === 1) {
|
|
6827
6898
|
const el = ns.head.value;
|
|
6828
|
-
return new parser_1.List([new parser_1.
|
|
6899
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.define)(el, {
|
|
6829
6900
|
id: el.id ? null : undefined,
|
|
6830
6901
|
class: 'index',
|
|
6831
6902
|
href: el.id ? `#${el.id}` : undefined
|
|
@@ -6839,7 +6910,7 @@ exports.signature = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('|',
|
|
|
6839
6910
|
const index = (0, indexee_1.identity)('index', undefined, ns.foldl((acc, {
|
|
6840
6911
|
value
|
|
6841
6912
|
}) => acc + value, ''))?.slice(7);
|
|
6842
|
-
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', {
|
|
6843
6914
|
class: 'indexer',
|
|
6844
6915
|
'data-index': index
|
|
6845
6916
|
}))]) : undefined;
|
|
@@ -6876,7 +6947,7 @@ const dom_1 = __webpack_require__(394);
|
|
|
6876
6947
|
function indexee(parser) {
|
|
6877
6948
|
return (0, combinator_1.fmap)(parser, (ns, {
|
|
6878
6949
|
id
|
|
6879
|
-
}) => 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, {
|
|
6880
6951
|
id: identity('index', id, ns.head.value),
|
|
6881
6952
|
'data-index': null
|
|
6882
6953
|
}))]) : ns);
|
|
@@ -7017,7 +7088,7 @@ const dom_1 = __webpack_require__(394);
|
|
|
7017
7088
|
// 複合生成インデクスを手動で同期させるより最初から重複のない
|
|
7018
7089
|
// テキストまたはインデクスを付けて同期が必要な機会を減らすのが
|
|
7019
7090
|
// 継続的編集において最も簡便となる。
|
|
7020
|
-
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', {
|
|
7021
7092
|
class: 'indexer',
|
|
7022
7093
|
'data-index': ''
|
|
7023
7094
|
}))]))]), /\][^\S\n]*(?:$|\n)/y);
|
|
@@ -7042,7 +7113,7 @@ const body = (0, source_1.str)(/\$[A-Za-z]*(?:(?:-[A-Za-z][0-9A-Za-z]*)+|-(?:(?:
|
|
|
7042
7113
|
exports.segment = (0, combinator_1.clear)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body]));
|
|
7043
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]), ([{
|
|
7044
7115
|
value
|
|
7045
|
-
}]) => new parser_1.List([new parser_1.
|
|
7116
|
+
}]) => new parser_1.List([new parser_1.Node((0, dom_1.html)('a', {
|
|
7046
7117
|
class: 'label',
|
|
7047
7118
|
'data-label': value.slice(value[1] === '-' ? 0 : 1).toLowerCase()
|
|
7048
7119
|
}, value))])));
|
|
@@ -7087,7 +7158,7 @@ const dom_1 = __webpack_require__(394);
|
|
|
7087
7158
|
// All syntax surrounded by square brackets shouldn't contain line breaks.
|
|
7088
7159
|
exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.surround)(
|
|
7089
7160
|
// ^はabbrで使用済みだが^:などのようにして分離使用可能
|
|
7090
|
-
(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', {
|
|
7091
7162
|
class: 'invalid',
|
|
7092
7163
|
...(0, util_1.invalid)('extension', 'syntax', `Invalid start symbol or linebreak`)
|
|
7093
7164
|
}, context.source.slice(context.position - context.range, context.position)))]), ([as, bs]) => bs && as.import(bs)));
|
|
@@ -7123,14 +7194,14 @@ Object.setPrototypeOf(attrspecs, null);
|
|
|
7123
7194
|
Object.values(attrspecs).forEach(o => Object.setPrototypeOf(o, null));
|
|
7124
7195
|
exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/<[a-z]+(?=[ >])/yi, (0, combinator_1.union)([(0, combinator_1.surround)(
|
|
7125
7196
|
// https://html.spec.whatwg.org/multipage/syntax.html#void-elements
|
|
7126
|
-
(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)),
|
|
7127
7198
|
// 不可視のHTML構造が可視構造を変化させるべきでない。
|
|
7128
7199
|
// 可視のHTMLは優先度変更を検討する。
|
|
7129
7200
|
// このため<>は将来的に共通構造を変化させる可能性があり
|
|
7130
7201
|
// 共通構造を変化させない非構造文字列としては依然としてエスケープを要する。
|
|
7131
|
-
(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)(
|
|
7132
7203
|
// https://html.spec.whatwg.org/multipage/syntax.html#void-elements
|
|
7133
|
-
(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))]))])));
|
|
7134
7205
|
exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/ [a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[ >])/yi), (0, source_1.str)(/ [^\s<>]+/y)]);
|
|
7135
7206
|
function elem(tag, content, as, bs, cs, context) {
|
|
7136
7207
|
if (!tags.includes(tag)) return ielem('tag', `Invalid HTML tag name "${tag}"`, context);
|
|
@@ -7201,10 +7272,10 @@ const combinator_1 = __webpack_require__(3484);
|
|
|
7201
7272
|
const source_1 = __webpack_require__(8745);
|
|
7202
7273
|
const util_1 = __webpack_require__(4992);
|
|
7203
7274
|
const dom_1 = __webpack_require__(394);
|
|
7204
|
-
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 ?? ''))]));
|
|
7205
7276
|
exports.htmlentity = (0, combinator_1.fmap)((0, combinator_1.union)([exports.unsafehtmlentity]), ([{
|
|
7206
7277
|
value
|
|
7207
|
-
}]) => 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', {
|
|
7208
7279
|
class: 'invalid',
|
|
7209
7280
|
...(0, util_1.invalid)('htmlentity', 'syntax', 'Invalid HTML entity')
|
|
7210
7281
|
}, value))]));
|
|
@@ -7236,7 +7307,7 @@ exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0,
|
|
|
7236
7307
|
buffer
|
|
7237
7308
|
}) => buffer.import(bs), ([, bs], {
|
|
7238
7309
|
buffer
|
|
7239
|
-
}) => 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))))]))));
|
|
7240
7311
|
|
|
7241
7312
|
/***/ },
|
|
7242
7313
|
|
|
@@ -7263,7 +7334,7 @@ exports.italic = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0
|
|
|
7263
7334
|
buffer
|
|
7264
7335
|
}) => buffer.import(bs), ([, bs], {
|
|
7265
7336
|
buffer
|
|
7266
|
-
}) => 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))))]))));
|
|
7267
7338
|
|
|
7268
7339
|
/***/ },
|
|
7269
7340
|
|
|
@@ -7295,11 +7366,11 @@ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /
|
|
|
7295
7366
|
const head = context.position - context.range;
|
|
7296
7367
|
return void (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */ | 32 /* Backtrack.ruby */, head);
|
|
7297
7368
|
}
|
|
7298
|
-
return ns.push(new parser_1.
|
|
7369
|
+
return ns.push(new parser_1.Node("\u001F" /* Command.Separator */)) && ns;
|
|
7299
7370
|
})),
|
|
7300
7371
|
// `{ `と`{`で個別にバックトラックが発生し+1nされる。
|
|
7301
7372
|
// 自己再帰的にパースしてもオプションの不要なパースによる計算量の増加により相殺される。
|
|
7302
|
-
(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))]), ([{
|
|
7303
7374
|
value: content
|
|
7304
7375
|
}, {
|
|
7305
7376
|
value: params = undefined
|
|
@@ -7316,21 +7387,21 @@ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /
|
|
|
7316
7387
|
}
|
|
7317
7388
|
if (params.last.value === "\u0018" /* Command.Cancel */) {
|
|
7318
7389
|
params.pop();
|
|
7319
|
-
return new parser_1.List([new parser_1.
|
|
7390
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
7320
7391
|
class: 'invalid',
|
|
7321
7392
|
...(0, util_1.invalid)('link', 'syntax', 'Missing the closing symbol "}"')
|
|
7322
7393
|
}, context.source.slice(context.position - context.range, context.position)))]);
|
|
7323
7394
|
}
|
|
7324
7395
|
if (content.length !== 0 && (0, visibility_1.trimBlankNodeEnd)(content).length === 0) return;
|
|
7325
|
-
return new parser_1.List([new parser_1.
|
|
7396
|
+
return new parser_1.List([new parser_1.Node(parse(content, params, context))]);
|
|
7326
7397
|
})))));
|
|
7327
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))]), ([{
|
|
7328
7399
|
value: content
|
|
7329
7400
|
}, {
|
|
7330
7401
|
value: params
|
|
7331
|
-
}], context) => new parser_1.List([new parser_1.
|
|
7402
|
+
}], context) => new parser_1.List([new parser_1.Node(parse(content, params, context))])))));
|
|
7332
7403
|
exports.uri = (0, combinator_1.union)([(0, combinator_1.open)(/ /y, (0, source_1.str)(/\S+/y)), (0, source_1.str)(/[^\s{}]+/y)]);
|
|
7333
|
-
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)]);
|
|
7334
7405
|
function parse(content, params, context) {
|
|
7335
7406
|
const INSECURE_URI = params.shift().value;
|
|
7336
7407
|
(0, combinator_1.consume)(10, context);
|
|
@@ -7443,16 +7514,16 @@ exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(251 /*
|
|
|
7443
7514
|
buffer
|
|
7444
7515
|
}) => buffer.import(bs), ([, bs], {
|
|
7445
7516
|
buffer
|
|
7446
|
-
}) => bs && buffer.import(bs).push(new parser_1.
|
|
7517
|
+
}) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer), (nodes, {
|
|
7447
7518
|
id
|
|
7448
7519
|
}) => {
|
|
7449
7520
|
const el = (0, dom_1.html)('mark', (0, dom_1.defrag)((0, util_1.unwrap)(nodes)));
|
|
7450
7521
|
(0, dom_1.define)(el, {
|
|
7451
7522
|
id: (0, indexee_1.identity)('mark', id, (0, indexee_1.signature)(el))
|
|
7452
7523
|
});
|
|
7453
|
-
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', {
|
|
7454
7525
|
href: `#${el.id}`
|
|
7455
|
-
}))]) : new parser_1.List([new parser_1.
|
|
7526
|
+
}))]) : new parser_1.List([new parser_1.Node(el)]);
|
|
7456
7527
|
})))));
|
|
7457
7528
|
|
|
7458
7529
|
/***/ },
|
|
@@ -7480,7 +7551,7 @@ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combin
|
|
|
7480
7551
|
math: cache
|
|
7481
7552
|
} = {}
|
|
7482
7553
|
}
|
|
7483
|
-
}) => 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) ? {
|
|
7484
7555
|
class: 'math',
|
|
7485
7556
|
translate: 'no',
|
|
7486
7557
|
'data-src': source
|
|
@@ -7525,7 +7596,7 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
|
|
|
7525
7596
|
return void (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */ | 32 /* Backtrack.ruby */, head);
|
|
7526
7597
|
}
|
|
7527
7598
|
return ns;
|
|
7528
|
-
})), (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, {
|
|
7529
7600
|
value
|
|
7530
7601
|
}) => acc + value, ''))])), nodes.delete(nodes.last)])), ([{
|
|
7531
7602
|
value: [{
|
|
@@ -7539,7 +7610,7 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
|
|
|
7539
7610
|
(0, combinator_1.consume)(100, context);
|
|
7540
7611
|
if (params.last.value === "\u0018" /* Command.Cancel */) {
|
|
7541
7612
|
params.pop();
|
|
7542
|
-
return new parser_1.List([new parser_1.
|
|
7613
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
7543
7614
|
class: 'invalid',
|
|
7544
7615
|
...(0, util_1.invalid)('media', 'syntax', 'Missing the closing symbol "}"')
|
|
7545
7616
|
}, '!' + context.source.slice(context.position - context.range, context.position)))]);
|
|
@@ -7557,16 +7628,16 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
|
|
|
7557
7628
|
'data-src': uri?.source
|
|
7558
7629
|
});
|
|
7559
7630
|
el.setAttribute('alt', text);
|
|
7560
|
-
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)]);
|
|
7561
7632
|
const [attrs, linkparams] = (0, html_1.attributes)('media', optspec, (0, util_1.unwrap)(params));
|
|
7562
7633
|
(0, dom_1.define)(el, attrs);
|
|
7563
7634
|
// Awaiting the generic support for attr().
|
|
7564
7635
|
if (el.hasAttribute('aspect-ratio')) {
|
|
7565
7636
|
el.style.aspectRatio = el.getAttribute('aspect-ratio');
|
|
7566
7637
|
}
|
|
7567
|
-
if (context.state & 8 /* State.link */) return new parser_1.List([new parser_1.
|
|
7568
|
-
if (cache && cache.tagName !== 'IMG') return new parser_1.List([new parser_1.
|
|
7569
|
-
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), {
|
|
7570
7641
|
class: null,
|
|
7571
7642
|
target: '_blank'
|
|
7572
7643
|
}, [el]))]);
|
|
@@ -7578,7 +7649,7 @@ const option = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combina
|
|
|
7578
7649
|
value: b
|
|
7579
7650
|
}], [{
|
|
7580
7651
|
value: c
|
|
7581
|
-
}]]) => 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]));
|
|
7582
7653
|
function sanitize(target, uri) {
|
|
7583
7654
|
let type;
|
|
7584
7655
|
let message;
|
|
@@ -7625,81 +7696,53 @@ const source_1 = __webpack_require__(8745);
|
|
|
7625
7696
|
const visibility_1 = __webpack_require__(6364);
|
|
7626
7697
|
const util_1 = __webpack_require__(4992);
|
|
7627
7698
|
const dom_1 = __webpack_require__(394);
|
|
7628
|
-
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, [1 | 4 /* Backtrack.common */, 3 | 128 /* Backtrack.doublebracket */], ([, ns], context) => {
|
|
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) => {
|
|
7629
7700
|
const {
|
|
7630
7701
|
position,
|
|
7631
|
-
range
|
|
7632
|
-
linebreak
|
|
7702
|
+
range,
|
|
7703
|
+
linebreak
|
|
7633
7704
|
} = context;
|
|
7634
7705
|
if (linebreak === 0) {
|
|
7635
|
-
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))))]))]);
|
|
7636
7707
|
} else {
|
|
7637
7708
|
const head = position - range;
|
|
7638
7709
|
(0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head, 2);
|
|
7639
7710
|
}
|
|
7640
|
-
}, (
|
|
7641
|
-
if (!bs) return;
|
|
7711
|
+
}, (_, context) => {
|
|
7642
7712
|
const {
|
|
7643
7713
|
source,
|
|
7644
7714
|
position,
|
|
7645
|
-
range
|
|
7646
|
-
linebreak
|
|
7647
|
-
state = 0
|
|
7715
|
+
range,
|
|
7716
|
+
linebreak
|
|
7648
7717
|
} = context;
|
|
7649
7718
|
const head = position - range;
|
|
7650
7719
|
if (source[position] !== ']') {
|
|
7651
7720
|
(0, combinator_1.setBacktrack)(context, 2 | 4 /* Backtrack.common */, head, 2);
|
|
7652
7721
|
} else if (linebreak !== 0) {
|
|
7653
|
-
(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);
|
|
7654
7723
|
} else {
|
|
7655
|
-
if (state & 128 /* State.annotation */) {
|
|
7656
|
-
bs.push(new parser_1.Data(source[position]));
|
|
7657
|
-
}
|
|
7658
7724
|
context.position += 1;
|
|
7659
|
-
|
|
7660
|
-
|
|
7725
|
+
if (source[context.position] !== '{' || (0, combinator_1.isBacktrack)(context, 1 | 64 /* Backtrack.link */) || !(0, link_1.textlink)({
|
|
7726
|
+
context
|
|
7727
|
+
})) {
|
|
7661
7728
|
(0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head + 1);
|
|
7662
|
-
result = new parser_1.List();
|
|
7663
|
-
} else {
|
|
7664
|
-
result = !(0, combinator_1.isBacktrack)(context, 1 | 64 /* Backtrack.link */) ? (0, link_1.textlink)({
|
|
7665
|
-
context
|
|
7666
|
-
}) : undefined;
|
|
7667
|
-
context.range = range;
|
|
7668
|
-
if (!result) {
|
|
7669
|
-
(0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head + 1);
|
|
7670
|
-
result = new parser_1.List();
|
|
7671
|
-
}
|
|
7672
|
-
}
|
|
7673
|
-
if (context.position === source.length) {
|
|
7674
|
-
(0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head);
|
|
7675
|
-
} else {
|
|
7676
|
-
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()]) => {
|
|
7677
|
-
(0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head);
|
|
7678
|
-
return cs;
|
|
7679
|
-
})({
|
|
7680
|
-
context
|
|
7681
|
-
});
|
|
7682
|
-
if (state & 128 /* State.annotation */ && next) {
|
|
7683
|
-
return as.import(bs).import(result).import(next);
|
|
7684
|
-
}
|
|
7685
7729
|
}
|
|
7686
7730
|
context.position = position;
|
|
7687
7731
|
}
|
|
7688
|
-
return state & 128 /* State.annotation */ ? as.import(bs) : undefined;
|
|
7689
7732
|
})));
|
|
7690
7733
|
// Chicago-Style
|
|
7691
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) => {
|
|
7692
7735
|
const {
|
|
7693
7736
|
source,
|
|
7694
7737
|
position,
|
|
7695
|
-
range
|
|
7738
|
+
range
|
|
7696
7739
|
} = context;
|
|
7697
|
-
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))]);
|
|
7698
7741
|
context.position += source[position] === ' ' ? 1 : 0;
|
|
7699
|
-
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())]);
|
|
7700
7743
|
}, (_, context) => {
|
|
7701
7744
|
context.position -= context.range;
|
|
7702
|
-
return new parser_1.List([new parser_1.
|
|
7745
|
+
return new parser_1.List([new parser_1.Node('')]);
|
|
7703
7746
|
});
|
|
7704
7747
|
function attributes(ns) {
|
|
7705
7748
|
switch (ns.head.value) {
|
|
@@ -7740,7 +7783,7 @@ const inline_1 = __webpack_require__(7973);
|
|
|
7740
7783
|
const source_1 = __webpack_require__(8745);
|
|
7741
7784
|
const util_1 = __webpack_require__(4992);
|
|
7742
7785
|
const dom_1 = __webpack_require__(394);
|
|
7743
|
-
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', {
|
|
7744
7787
|
class: 'remark'
|
|
7745
7788
|
}, [(0, dom_1.html)('input', {
|
|
7746
7789
|
type: 'checkbox'
|
|
@@ -7748,7 +7791,7 @@ exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.fallback)((0, com
|
|
|
7748
7791
|
context: {
|
|
7749
7792
|
source
|
|
7750
7793
|
}
|
|
7751
|
-
}) => new parser_1.List([new parser_1.
|
|
7794
|
+
}) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
7752
7795
|
class: 'invalid',
|
|
7753
7796
|
...(0, util_1.invalid)('remark', 'syntax', 'Invalid start symbol')
|
|
7754
7797
|
}, source))]))));
|
|
@@ -7786,23 +7829,23 @@ exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combinato
|
|
|
7786
7829
|
}
|
|
7787
7830
|
switch (true) {
|
|
7788
7831
|
case texts.length >= rubies.length:
|
|
7789
|
-
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, [{
|
|
7790
7833
|
value: text = ''
|
|
7791
7834
|
} = {}, {
|
|
7792
7835
|
value: ruby = ''
|
|
7793
|
-
} = {}]) => 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())))))]);
|
|
7794
7837
|
case texts.length === 1 && [...texts.head.value].length >= rubies.length:
|
|
7795
|
-
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, [{
|
|
7796
7839
|
value: text = ''
|
|
7797
7840
|
} = {}, {
|
|
7798
7841
|
value: ruby = ''
|
|
7799
|
-
} = {}]) => 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())))))]);
|
|
7800
7843
|
default:
|
|
7801
|
-
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(({
|
|
7802
7845
|
value
|
|
7803
|
-
}, 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(({
|
|
7804
7847
|
value
|
|
7805
|
-
}, acc) => value + ' ' + acc, '').trim())), new parser_1.
|
|
7848
|
+
}, acc) => value + ' ' + acc, '').trim())), new parser_1.Node((0, dom_1.html)('rp', ')'))])))))]);
|
|
7806
7849
|
}
|
|
7807
7850
|
}));
|
|
7808
7851
|
const delimiter = /[$"`\[\](){}<>()[]{}|]|\\?\n/y;
|
|
@@ -7813,7 +7856,7 @@ const text = input => {
|
|
|
7813
7856
|
const {
|
|
7814
7857
|
source
|
|
7815
7858
|
} = context;
|
|
7816
|
-
const acc = new parser_1.List([new parser_1.
|
|
7859
|
+
const acc = new parser_1.List([new parser_1.Node('')]);
|
|
7817
7860
|
let state = false;
|
|
7818
7861
|
context.sequential = true;
|
|
7819
7862
|
for (let {
|
|
@@ -7832,7 +7875,7 @@ const text = input => {
|
|
|
7832
7875
|
{
|
|
7833
7876
|
if (source[position].trimStart() === '') {
|
|
7834
7877
|
state ||= acc.last.value.trimStart() !== '';
|
|
7835
|
-
acc.push(new parser_1.
|
|
7878
|
+
acc.push(new parser_1.Node(''));
|
|
7836
7879
|
context.position += 1;
|
|
7837
7880
|
continue;
|
|
7838
7881
|
}
|
|
@@ -7895,7 +7938,7 @@ const source_1 = __webpack_require__(8745);
|
|
|
7895
7938
|
const visibility_1 = __webpack_require__(6364);
|
|
7896
7939
|
const util_1 = __webpack_require__(4992);
|
|
7897
7940
|
const dom_1 = __webpack_require__(394);
|
|
7898
|
-
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)));
|
|
7899
7942
|
|
|
7900
7943
|
/***/ },
|
|
7901
7944
|
|
|
@@ -7914,9 +7957,9 @@ const combinator_1 = __webpack_require__(3484);
|
|
|
7914
7957
|
const source_1 = __webpack_require__(8745);
|
|
7915
7958
|
const util_1 = __webpack_require__(4992);
|
|
7916
7959
|
const dom_1 = __webpack_require__(394);
|
|
7917
|
-
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', {
|
|
7918
7961
|
class: 'template'
|
|
7919
|
-
}, (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', {
|
|
7920
7963
|
class: 'invalid',
|
|
7921
7964
|
...(0, util_1.invalid)('template', 'syntax', `Missing the closing symbol "}}"`)
|
|
7922
7965
|
}, context.source.slice(context.position - context.range, context.position)))])));
|
|
@@ -8241,6 +8284,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
8241
8284
|
value: true
|
|
8242
8285
|
}));
|
|
8243
8286
|
exports.validate = exports.segment = exports.MAX_INPUT_SIZE = exports.MAX_SEGMENT_SIZE = void 0;
|
|
8287
|
+
const context_1 = __webpack_require__(8669);
|
|
8244
8288
|
const combinator_1 = __webpack_require__(3484);
|
|
8245
8289
|
const heading_1 = __webpack_require__(2778);
|
|
8246
8290
|
const codeblock_1 = __webpack_require__(9194);
|
|
@@ -8279,10 +8323,10 @@ const parser = (0, combinator_1.union)([(0, combinator_1.some)(source_1.emptylin
|
|
|
8279
8323
|
function* segment(source) {
|
|
8280
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)}`;
|
|
8281
8325
|
for (let position = 0; position < source.length;) {
|
|
8282
|
-
const context = {
|
|
8326
|
+
const context = new context_1.Context({
|
|
8283
8327
|
source,
|
|
8284
8328
|
position
|
|
8285
|
-
};
|
|
8329
|
+
});
|
|
8286
8330
|
const result = parser({
|
|
8287
8331
|
context
|
|
8288
8332
|
});
|
|
@@ -8406,31 +8450,31 @@ const escsource = ({
|
|
|
8406
8450
|
case "\u001B" /* Command.Escape */:
|
|
8407
8451
|
(0, combinator_1.consume)(1, context);
|
|
8408
8452
|
context.position += 1;
|
|
8409
|
-
return new parser_1.List([new parser_1.
|
|
8453
|
+
return new parser_1.List([new parser_1.Node(source.slice(position + 1, position + 2))]);
|
|
8410
8454
|
case '\\':
|
|
8411
8455
|
switch (source[position + 1]) {
|
|
8412
8456
|
case undefined:
|
|
8413
|
-
return new parser_1.List([new parser_1.
|
|
8457
|
+
return new parser_1.List([new parser_1.Node(char)]);
|
|
8414
8458
|
case '\n':
|
|
8415
|
-
return new parser_1.List([new parser_1.
|
|
8459
|
+
return new parser_1.List([new parser_1.Node(char)]);
|
|
8416
8460
|
default:
|
|
8417
8461
|
(0, combinator_1.consume)(1, context);
|
|
8418
8462
|
context.position += 1;
|
|
8419
|
-
return new parser_1.List([new parser_1.
|
|
8463
|
+
return new parser_1.List([new parser_1.Node(source.slice(position, position + 2))]);
|
|
8420
8464
|
}
|
|
8421
8465
|
case '\r':
|
|
8422
8466
|
(0, combinator_1.consume)(-1, context);
|
|
8423
8467
|
return new parser_1.List();
|
|
8424
8468
|
case '\n':
|
|
8425
8469
|
context.linebreak ||= source.length - position;
|
|
8426
|
-
return new parser_1.List([new parser_1.
|
|
8470
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('br'))]);
|
|
8427
8471
|
default:
|
|
8428
|
-
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)]);
|
|
8429
8473
|
let i = (0, text_1.next)(source, position, delimiter);
|
|
8430
8474
|
i -= position;
|
|
8431
8475
|
(0, combinator_1.consume)(i - 1, context);
|
|
8432
8476
|
context.position += i - 1;
|
|
8433
|
-
return new parser_1.List([new parser_1.
|
|
8477
|
+
return new parser_1.List([new parser_1.Node(source.slice(position, context.position))]);
|
|
8434
8478
|
}
|
|
8435
8479
|
};
|
|
8436
8480
|
exports.escsource = escsource;
|
|
@@ -8530,7 +8574,7 @@ function strs(pattern) {
|
|
|
8530
8574
|
acc += pattern;
|
|
8531
8575
|
context.position += pattern.length;
|
|
8532
8576
|
}
|
|
8533
|
-
return new parser_1.List([new parser_1.
|
|
8577
|
+
return new parser_1.List([new parser_1.Node(acc)]);
|
|
8534
8578
|
};
|
|
8535
8579
|
}
|
|
8536
8580
|
exports.strs = strs;
|
|
@@ -8575,16 +8619,16 @@ const text = input => {
|
|
|
8575
8619
|
default:
|
|
8576
8620
|
(0, combinator_1.consume)(1, context);
|
|
8577
8621
|
context.position += 1;
|
|
8578
|
-
return new parser_1.List([new parser_1.
|
|
8622
|
+
return new parser_1.List([new parser_1.Node(source.slice(position + 1, context.position))]);
|
|
8579
8623
|
}
|
|
8580
8624
|
case '\r':
|
|
8581
8625
|
(0, combinator_1.consume)(-1, context);
|
|
8582
8626
|
return new parser_1.List();
|
|
8583
8627
|
case '\n':
|
|
8584
8628
|
context.linebreak ||= source.length - position;
|
|
8585
|
-
return new parser_1.List([new parser_1.
|
|
8629
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('br'))]);
|
|
8586
8630
|
default:
|
|
8587
|
-
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)]);
|
|
8588
8632
|
exports.nonWhitespace.lastIndex = position + 1;
|
|
8589
8633
|
const s = canSkip(source, position);
|
|
8590
8634
|
let i = s ? exports.nonWhitespace.test(source) ? exports.nonWhitespace.lastIndex - 1 : source.length : next(source, position);
|
|
@@ -8594,7 +8638,7 @@ const text = input => {
|
|
|
8594
8638
|
(0, combinator_1.consume)(i - 1, context);
|
|
8595
8639
|
context.position += i - 1;
|
|
8596
8640
|
const linestart = position === 0 || source[position - 1] === '\n';
|
|
8597
|
-
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))]);
|
|
8598
8642
|
}
|
|
8599
8643
|
};
|
|
8600
8644
|
exports.text = text;
|
|
@@ -8853,20 +8897,20 @@ const unescsource = ({
|
|
|
8853
8897
|
case "\u001B" /* Command.Escape */:
|
|
8854
8898
|
(0, combinator_1.consume)(1, context);
|
|
8855
8899
|
context.position += 1;
|
|
8856
|
-
return new parser_1.List([new parser_1.
|
|
8900
|
+
return new parser_1.List([new parser_1.Node(source.slice(position + 1, position + 2))]);
|
|
8857
8901
|
case '\r':
|
|
8858
8902
|
return new parser_1.List();
|
|
8859
8903
|
case '\n':
|
|
8860
8904
|
context.linebreak ||= source.length - position;
|
|
8861
|
-
return new parser_1.List([new parser_1.
|
|
8905
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('br'))]);
|
|
8862
8906
|
default:
|
|
8863
|
-
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)]);
|
|
8864
8908
|
text_1.nonWhitespace.lastIndex = position + 1;
|
|
8865
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);
|
|
8866
8910
|
i -= position;
|
|
8867
8911
|
(0, combinator_1.consume)(i - 1, context);
|
|
8868
8912
|
context.position += i - 1;
|
|
8869
|
-
return new parser_1.List([new parser_1.
|
|
8913
|
+
return new parser_1.List([new parser_1.Node(source.slice(position, context.position))]);
|
|
8870
8914
|
}
|
|
8871
8915
|
};
|
|
8872
8916
|
exports.unescsource = unescsource;
|
|
@@ -8883,8 +8927,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
8883
8927
|
value: true
|
|
8884
8928
|
}));
|
|
8885
8929
|
exports.stringify = exports.unmarkInvalid = exports.markInvalid = exports.invalid = exports.repeat = exports.unwrap = void 0;
|
|
8886
|
-
const alias_1 = __webpack_require__(5413);
|
|
8887
8930
|
const parser_1 = __webpack_require__(605);
|
|
8931
|
+
const alias_1 = __webpack_require__(5413);
|
|
8888
8932
|
const dom_1 = __webpack_require__(394);
|
|
8889
8933
|
function* unwrap(nodes) {
|
|
8890
8934
|
if (nodes === undefined) return;
|
|
@@ -8896,7 +8940,7 @@ exports.unwrap = unwrap;
|
|
|
8896
8940
|
function repeat(symbol, parser, cons, termination = (nodes, context, prefix, postfix) => {
|
|
8897
8941
|
const acc = new parser_1.List();
|
|
8898
8942
|
if (prefix > 0) {
|
|
8899
|
-
acc.push(new parser_1.
|
|
8943
|
+
acc.push(new parser_1.Node(symbol[0].repeat(prefix)));
|
|
8900
8944
|
}
|
|
8901
8945
|
acc.import(nodes);
|
|
8902
8946
|
if (postfix > 0) {
|
|
@@ -8904,7 +8948,7 @@ function repeat(symbol, parser, cons, termination = (nodes, context, prefix, pos
|
|
|
8904
8948
|
source,
|
|
8905
8949
|
position
|
|
8906
8950
|
} = context;
|
|
8907
|
-
acc.push(new parser_1.
|
|
8951
|
+
acc.push(new parser_1.Node(source.slice(position, position + postfix)));
|
|
8908
8952
|
context.position += postfix;
|
|
8909
8953
|
}
|
|
8910
8954
|
return acc;
|
|
@@ -9643,11 +9687,12 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
9643
9687
|
}));
|
|
9644
9688
|
exports.quote = void 0;
|
|
9645
9689
|
const parser_1 = __webpack_require__(605);
|
|
9690
|
+
const context_1 = __webpack_require__(8669);
|
|
9646
9691
|
const cite_1 = __webpack_require__(1200);
|
|
9647
9692
|
function quote(anchor, range) {
|
|
9648
9693
|
const {
|
|
9649
9694
|
context
|
|
9650
|
-
} = (0, parser_1.input)('',
|
|
9695
|
+
} = (0, parser_1.input)('', new context_1.Context());
|
|
9651
9696
|
(0, cite_1.cite)((0, parser_1.input)(`>>${anchor}`, context));
|
|
9652
9697
|
if (context.position !== context.source.length) throw new Error(`Invalid anchor: ${anchor}`);
|
|
9653
9698
|
fit(range);
|