securemark 0.291.0 → 0.292.0
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 +13 -2
- package/dist/index.js +1101 -760
- package/markdown.d.ts +17 -17
- package/package.json +1 -1
- package/src/combinator/control/constraint/block.test.ts +8 -5
- package/src/combinator/control/constraint/block.ts +9 -9
- package/src/combinator/control/constraint/contract.ts +20 -28
- package/src/combinator/control/constraint/line.test.ts +9 -6
- package/src/combinator/control/constraint/line.ts +21 -22
- package/src/combinator/control/manipulation/convert.ts +29 -13
- package/src/combinator/control/manipulation/fence.ts +18 -15
- package/src/combinator/control/manipulation/indent.test.ts +17 -14
- package/src/combinator/control/manipulation/indent.ts +21 -10
- package/src/combinator/control/manipulation/match.ts +11 -10
- package/src/combinator/control/manipulation/recovery.ts +6 -2
- package/src/combinator/control/manipulation/scope.ts +37 -38
- package/src/combinator/control/manipulation/surround.ts +78 -60
- package/src/combinator/control/manipulation/trim.test.ts +12 -9
- package/src/combinator/control/monad/bind.ts +16 -16
- package/src/combinator/control/monad/fmap.ts +6 -6
- package/src/combinator/data/parser/context/delimiter.ts +8 -7
- package/src/combinator/data/parser/context.test.ts +19 -14
- package/src/combinator/data/parser/context.ts +20 -16
- package/src/combinator/data/parser/inits.ts +13 -14
- package/src/combinator/data/parser/sequence.test.ts +16 -15
- package/src/combinator/data/parser/sequence.ts +13 -14
- package/src/combinator/data/parser/some.test.ts +19 -18
- package/src/combinator/data/parser/some.ts +13 -15
- package/src/combinator/data/parser/subsequence.test.ts +22 -21
- 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 +16 -15
- package/src/combinator/data/parser/union.ts +2 -2
- package/src/combinator/data/parser.ts +66 -28
- package/src/debug.test.ts +3 -3
- package/src/parser/api/bind.ts +3 -3
- package/src/parser/api/header.ts +7 -6
- package/src/parser/api/normalize.ts +2 -2
- package/src/parser/api/parse.test.ts +14 -15
- package/src/parser/api/parse.ts +3 -3
- package/src/parser/autolink.test.ts +19 -17
- package/src/parser/block/blockquote.test.ts +86 -84
- package/src/parser/block/blockquote.ts +4 -2
- package/src/parser/block/codeblock.test.ts +58 -56
- package/src/parser/block/codeblock.ts +3 -3
- package/src/parser/block/dlist.test.ts +58 -56
- package/src/parser/block/extension/aside.test.ts +10 -8
- package/src/parser/block/extension/aside.ts +1 -1
- package/src/parser/block/extension/example.test.ts +20 -18
- package/src/parser/block/extension/example.ts +3 -3
- package/src/parser/block/extension/fig.test.ts +38 -36
- package/src/parser/block/extension/fig.ts +1 -1
- package/src/parser/block/extension/figbase.test.ts +17 -15
- package/src/parser/block/extension/figure.test.ts +64 -62
- package/src/parser/block/extension/figure.ts +3 -2
- package/src/parser/block/extension/message.test.ts +15 -13
- package/src/parser/block/extension/message.ts +3 -3
- package/src/parser/block/extension/placeholder.test.ts +3 -1
- package/src/parser/block/extension/table.test.ts +73 -71
- package/src/parser/block/extension/table.ts +5 -5
- package/src/parser/block/extension.test.ts +3 -1
- package/src/parser/block/heading.test.ts +65 -64
- package/src/parser/block/heading.ts +3 -3
- package/src/parser/block/ilist.test.ts +3 -1
- package/src/parser/block/ilist.ts +3 -3
- package/src/parser/block/mathblock.test.ts +33 -31
- package/src/parser/block/mathblock.ts +1 -1
- package/src/parser/block/mediablock.ts +2 -2
- package/src/parser/block/olist.test.ts +99 -97
- package/src/parser/block/olist.ts +2 -2
- package/src/parser/block/pagebreak.test.ts +17 -15
- package/src/parser/block/pagebreak.ts +1 -1
- package/src/parser/block/paragraph.test.ts +60 -57
- package/src/parser/block/reply/cite.test.ts +41 -39
- package/src/parser/block/reply/cite.ts +3 -3
- package/src/parser/block/reply/quote.test.ts +52 -50
- package/src/parser/block/reply.test.ts +21 -19
- package/src/parser/block/sidefence.test.ts +51 -49
- package/src/parser/block/table.test.ts +51 -50
- package/src/parser/block/table.ts +6 -6
- package/src/parser/block/ulist.test.ts +52 -50
- package/src/parser/block/ulist.ts +2 -2
- package/src/parser/block.ts +6 -5
- package/src/parser/context.ts +1 -0
- package/src/parser/header.test.ts +22 -21
- package/src/parser/header.ts +25 -13
- package/src/parser/inline/annotation.test.ts +44 -42
- package/src/parser/inline/annotation.ts +2 -2
- package/src/parser/inline/autolink/account.test.ts +32 -30
- package/src/parser/inline/autolink/account.ts +1 -1
- package/src/parser/inline/autolink/anchor.test.ts +23 -21
- package/src/parser/inline/autolink/anchor.ts +1 -1
- package/src/parser/inline/autolink/channel.test.ts +16 -14
- package/src/parser/inline/autolink/channel.ts +2 -2
- package/src/parser/inline/autolink/email.test.ts +38 -36
- package/src/parser/inline/autolink/email.ts +2 -2
- package/src/parser/inline/autolink/hashnum.test.ts +39 -37
- package/src/parser/inline/autolink/hashnum.ts +1 -1
- package/src/parser/inline/autolink/hashtag.test.ts +58 -56
- package/src/parser/inline/autolink/hashtag.ts +1 -1
- package/src/parser/inline/autolink/url.test.ts +76 -74
- package/src/parser/inline/autolink/url.ts +6 -6
- package/src/parser/inline/bracket.test.ts +69 -67
- package/src/parser/inline/bracket.ts +32 -32
- package/src/parser/inline/code.test.ts +32 -29
- package/src/parser/inline/code.ts +20 -13
- package/src/parser/inline/deletion.test.ts +29 -27
- package/src/parser/inline/deletion.ts +2 -2
- package/src/parser/inline/emphasis.test.ts +40 -36
- package/src/parser/inline/emphasis.ts +2 -2
- package/src/parser/inline/emstrong.test.ts +102 -96
- package/src/parser/inline/emstrong.ts +96 -36
- package/src/parser/inline/extension/index.test.ts +91 -89
- package/src/parser/inline/extension/index.ts +18 -30
- package/src/parser/inline/extension/indexee.ts +1 -1
- package/src/parser/inline/extension/indexer.test.ts +26 -24
- package/src/parser/inline/extension/indexer.ts +1 -1
- package/src/parser/inline/extension/label.test.ts +34 -32
- package/src/parser/inline/extension/placeholder.test.ts +44 -42
- package/src/parser/inline/extension/placeholder.ts +11 -8
- package/src/parser/inline/html.test.ts +108 -106
- package/src/parser/inline/html.ts +24 -23
- package/src/parser/inline/htmlentity.test.ts +39 -37
- package/src/parser/inline/htmlentity.ts +9 -3
- package/src/parser/inline/insertion.test.ts +29 -27
- package/src/parser/inline/insertion.ts +2 -2
- package/src/parser/inline/italic.test.ts +55 -53
- package/src/parser/inline/italic.ts +2 -2
- package/src/parser/inline/link.test.ts +187 -185
- package/src/parser/inline/link.ts +30 -12
- package/src/parser/inline/mark.test.ts +31 -29
- package/src/parser/inline/mark.ts +3 -3
- package/src/parser/inline/math.test.ts +133 -131
- package/src/parser/inline/math.ts +2 -2
- package/src/parser/inline/media.test.ts +93 -91
- package/src/parser/inline/media.ts +41 -17
- package/src/parser/inline/reference.test.ts +110 -108
- package/src/parser/inline/reference.ts +49 -40
- package/src/parser/inline/remark.test.ts +53 -51
- package/src/parser/inline/remark.ts +3 -3
- package/src/parser/inline/ruby.test.ts +46 -44
- package/src/parser/inline/ruby.ts +29 -32
- package/src/parser/inline/shortmedia.test.ts +11 -9
- package/src/parser/inline/strong.test.ts +37 -33
- package/src/parser/inline/strong.ts +6 -3
- package/src/parser/inline/template.test.ts +24 -22
- package/src/parser/inline/template.ts +20 -11
- package/src/parser/inline.test.ts +221 -220
- package/src/parser/inline.ts +13 -8
- package/src/parser/segment.ts +13 -8
- package/src/parser/source/escapable.test.ts +24 -22
- package/src/parser/source/escapable.ts +26 -41
- package/src/parser/source/line.test.ts +19 -17
- package/src/parser/source/line.ts +3 -3
- package/src/parser/source/str.ts +28 -11
- package/src/parser/source/text.test.ts +85 -83
- package/src/parser/source/text.ts +26 -54
- package/src/parser/source/unescapable.test.ts +24 -22
- package/src/parser/source/unescapable.ts +18 -33
- package/src/parser/source.ts +1 -1
- package/src/parser/util.ts +36 -33
- package/src/parser/visibility.ts +19 -15
- package/src/util/quote.ts +4 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.
|
|
1
|
+
/*! securemark v0.292.0 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"));
|
|
@@ -2464,17 +2464,20 @@ exports.block = void 0;
|
|
|
2464
2464
|
const parser_1 = __webpack_require__(605);
|
|
2465
2465
|
const line_1 = __webpack_require__(8287);
|
|
2466
2466
|
function block(parser, separation = true) {
|
|
2467
|
-
return input => {
|
|
2467
|
+
return (0, parser_1.failsafe)(input => {
|
|
2468
2468
|
const {
|
|
2469
|
-
|
|
2469
|
+
context
|
|
2470
2470
|
} = input;
|
|
2471
|
-
|
|
2471
|
+
const {
|
|
2472
|
+
source,
|
|
2473
|
+
position
|
|
2474
|
+
} = context;
|
|
2475
|
+
if (position === source.length) return;
|
|
2472
2476
|
const result = parser(input);
|
|
2473
2477
|
if (result === undefined) return;
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
};
|
|
2478
|
+
if (separation && !(0, line_1.isBlank)((0, line_1.firstline)(source, context.position))) return;
|
|
2479
|
+
return context.position === source.length || source[context.position - 1] === '\n' ? result : undefined;
|
|
2480
|
+
});
|
|
2478
2481
|
}
|
|
2479
2482
|
exports.block = block;
|
|
2480
2483
|
|
|
@@ -2495,16 +2498,18 @@ const parser_1 = __webpack_require__(605);
|
|
|
2495
2498
|
function validate(patterns, parser) {
|
|
2496
2499
|
if (typeof patterns === 'function') return guard(patterns, parser);
|
|
2497
2500
|
if (!(0, alias_1.isArray)(patterns)) return validate([patterns], parser);
|
|
2498
|
-
const match = __webpack_require__.g.eval(['source =>', patterns.map(pattern => typeof pattern === 'string' ? `|| source.
|
|
2501
|
+
const match = __webpack_require__.g.eval(['({ source, position }) =>', patterns.map(pattern => typeof pattern === 'string' ? `|| source.startsWith('${pattern}', position)` : `|| /${pattern.source}/${pattern.flags}.test(source.slice(position))`).join('').slice(2)].join(''));
|
|
2499
2502
|
return input => {
|
|
2500
2503
|
const {
|
|
2501
|
-
|
|
2504
|
+
context
|
|
2502
2505
|
} = input;
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2506
|
+
const {
|
|
2507
|
+
source,
|
|
2508
|
+
position
|
|
2509
|
+
} = context;
|
|
2510
|
+
if (position === source.length) return;
|
|
2511
|
+
if (!match(context)) return;
|
|
2512
|
+
return parser(input);
|
|
2508
2513
|
};
|
|
2509
2514
|
}
|
|
2510
2515
|
exports.validate = validate;
|
|
@@ -2512,17 +2517,19 @@ function guard(f, parser) {
|
|
|
2512
2517
|
return input => f(input) ? parser(input) : undefined;
|
|
2513
2518
|
}
|
|
2514
2519
|
function verify(parser, cond) {
|
|
2515
|
-
return input => {
|
|
2520
|
+
return (0, parser_1.failsafe)(input => {
|
|
2516
2521
|
const {
|
|
2517
|
-
source,
|
|
2518
2522
|
context
|
|
2519
2523
|
} = input;
|
|
2520
|
-
|
|
2524
|
+
const {
|
|
2525
|
+
source,
|
|
2526
|
+
position
|
|
2527
|
+
} = context;
|
|
2528
|
+
if (position === source.length) return;
|
|
2521
2529
|
const result = parser(input);
|
|
2522
|
-
if (result
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
};
|
|
2530
|
+
if (result && !cond((0, parser_1.eval)(result), context)) return;
|
|
2531
|
+
return result;
|
|
2532
|
+
});
|
|
2526
2533
|
}
|
|
2527
2534
|
exports.verify = verify;
|
|
2528
2535
|
|
|
@@ -2540,34 +2547,32 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
2540
2547
|
exports.isBlank = exports.firstline = exports.line = void 0;
|
|
2541
2548
|
const parser_1 = __webpack_require__(605);
|
|
2542
2549
|
function line(parser) {
|
|
2543
|
-
return ({
|
|
2544
|
-
source,
|
|
2550
|
+
return (0, parser_1.failsafe)(({
|
|
2545
2551
|
context
|
|
2546
2552
|
}) => {
|
|
2547
|
-
|
|
2548
|
-
|
|
2553
|
+
const {
|
|
2554
|
+
source,
|
|
2555
|
+
position
|
|
2556
|
+
} = context;
|
|
2557
|
+
if (position === source.length) return;
|
|
2558
|
+
const line = firstline(source, position);
|
|
2549
2559
|
context.offset ??= 0;
|
|
2550
|
-
context.offset +=
|
|
2551
|
-
const result = parser(
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
context.offset -=
|
|
2560
|
+
context.offset += position;
|
|
2561
|
+
const result = parser((0, parser_1.input)(line, context));
|
|
2562
|
+
context.position += position;
|
|
2563
|
+
context.position += result && context.position === position ? line.length : 0;
|
|
2564
|
+
context.source = source;
|
|
2565
|
+
context.offset -= position;
|
|
2556
2566
|
if (result === undefined) return;
|
|
2557
|
-
|
|
2558
|
-
|
|
2567
|
+
if (!isBlank(source.slice(context.position, position + line.length))) return;
|
|
2568
|
+
context.position = position + line.length;
|
|
2569
|
+
return [(0, parser_1.eval)(result)];
|
|
2570
|
+
});
|
|
2559
2571
|
}
|
|
2560
2572
|
exports.line = line;
|
|
2561
|
-
function firstline(source) {
|
|
2562
|
-
const i = source.indexOf('\n');
|
|
2563
|
-
|
|
2564
|
-
case -1:
|
|
2565
|
-
return source;
|
|
2566
|
-
case 0:
|
|
2567
|
-
return '\n';
|
|
2568
|
-
default:
|
|
2569
|
-
return source.slice(0, i + 1);
|
|
2570
|
-
}
|
|
2573
|
+
function firstline(source, position) {
|
|
2574
|
+
const i = source.indexOf('\n', position);
|
|
2575
|
+
return i === -1 ? source.slice(position) : source.slice(position, i + 1);
|
|
2571
2576
|
}
|
|
2572
2577
|
exports.firstline = firstline;
|
|
2573
2578
|
function isBlank(line) {
|
|
@@ -2607,24 +2612,36 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
2607
2612
|
exports.convert = void 0;
|
|
2608
2613
|
const parser_1 = __webpack_require__(605);
|
|
2609
2614
|
function convert(conv, parser, continuous, empty = false) {
|
|
2610
|
-
return ({
|
|
2611
|
-
source,
|
|
2612
|
-
context
|
|
2613
|
-
}) => {
|
|
2614
|
-
if (source === '') return;
|
|
2615
|
-
const src = conv(source, context);
|
|
2616
|
-
if (src === '') return empty ? [[], ''] : undefined;
|
|
2615
|
+
return (0, parser_1.failsafe)(input => {
|
|
2617
2616
|
const {
|
|
2618
|
-
backtracks
|
|
2619
|
-
} = context;
|
|
2620
|
-
context.backtracks = continuous ? backtracks : {};
|
|
2621
|
-
const result = parser({
|
|
2622
|
-
source: src,
|
|
2623
2617
|
context
|
|
2624
|
-
}
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2618
|
+
} = input;
|
|
2619
|
+
const {
|
|
2620
|
+
source,
|
|
2621
|
+
position
|
|
2622
|
+
} = context;
|
|
2623
|
+
if (position === source.length) return;
|
|
2624
|
+
const src = conv(source.slice(position), context);
|
|
2625
|
+
if (src === '') {
|
|
2626
|
+
if (!empty) return;
|
|
2627
|
+
context.position = source.length;
|
|
2628
|
+
return [[]];
|
|
2629
|
+
}
|
|
2630
|
+
if (continuous) {
|
|
2631
|
+
context.position += source.length - position - src.length;
|
|
2632
|
+
const result = parser(input);
|
|
2633
|
+
context.source = source;
|
|
2634
|
+
return result;
|
|
2635
|
+
} else {
|
|
2636
|
+
const {
|
|
2637
|
+
offset,
|
|
2638
|
+
backtracks
|
|
2639
|
+
} = context;
|
|
2640
|
+
const result = parser((0, parser_1.subinput)(src, context));
|
|
2641
|
+
context.position = context.source.length;
|
|
2642
|
+
return result;
|
|
2643
|
+
}
|
|
2644
|
+
});
|
|
2628
2645
|
}
|
|
2629
2646
|
exports.convert = convert;
|
|
2630
2647
|
|
|
@@ -2676,38 +2693,45 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
2676
2693
|
value: true
|
|
2677
2694
|
}));
|
|
2678
2695
|
exports.fence = void 0;
|
|
2696
|
+
const parser_1 = __webpack_require__(605);
|
|
2679
2697
|
const line_1 = __webpack_require__(8287);
|
|
2680
2698
|
const array_1 = __webpack_require__(6876);
|
|
2681
2699
|
function fence(opener, limit, separation = true) {
|
|
2682
|
-
return ({
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
const
|
|
2700
|
+
return (0, parser_1.failsafe)(input => {
|
|
2701
|
+
const {
|
|
2702
|
+
context
|
|
2703
|
+
} = input;
|
|
2704
|
+
const {
|
|
2705
|
+
source,
|
|
2706
|
+
position
|
|
2707
|
+
} = context;
|
|
2708
|
+
if (position === source.length) return;
|
|
2709
|
+
const matches = source.slice(position).match(opener);
|
|
2687
2710
|
if (!matches) return;
|
|
2688
2711
|
const delim = matches[1];
|
|
2689
2712
|
if (matches[0].includes(delim, delim.length)) return;
|
|
2690
|
-
|
|
2713
|
+
context.position += matches[0].length;
|
|
2691
2714
|
// Prevent annoying parsing in editing.
|
|
2692
|
-
|
|
2715
|
+
const secondline = (0, line_1.firstline)(source, context.position);
|
|
2716
|
+
if ((0, line_1.isBlank)(secondline) && (0, line_1.firstline)(source, context.position + secondline.length).trimEnd() !== delim) return;
|
|
2693
2717
|
let block = '';
|
|
2694
2718
|
let closer = '';
|
|
2695
2719
|
let overflow = '';
|
|
2696
2720
|
for (let count = 1;; ++count) {
|
|
2697
|
-
if (
|
|
2698
|
-
const line = (0, line_1.firstline)(
|
|
2721
|
+
if (context.position === source.length) break;
|
|
2722
|
+
const line = (0, line_1.firstline)(source, context.position);
|
|
2699
2723
|
if ((closer || count > limit + 1) && (0, line_1.isBlank)(line)) break;
|
|
2700
2724
|
if (closer) {
|
|
2701
2725
|
overflow += line;
|
|
2702
2726
|
}
|
|
2703
2727
|
if (!closer && count <= limit + 1 && line.slice(0, delim.length) === delim && line.trimEnd() === delim) {
|
|
2704
2728
|
closer = line;
|
|
2705
|
-
if ((0, line_1.isBlank)((0, line_1.firstline)(
|
|
2706
|
-
|
|
2729
|
+
if ((0, line_1.isBlank)((0, line_1.firstline)(source, context.position + line.length))) {
|
|
2730
|
+
context.position += line.length;
|
|
2707
2731
|
break;
|
|
2708
2732
|
}
|
|
2709
2733
|
if (!separation) {
|
|
2710
|
-
|
|
2734
|
+
context.position += line.length;
|
|
2711
2735
|
break;
|
|
2712
2736
|
}
|
|
2713
2737
|
overflow = line;
|
|
@@ -2715,10 +2739,10 @@ function fence(opener, limit, separation = true) {
|
|
|
2715
2739
|
if (!overflow) {
|
|
2716
2740
|
block += line;
|
|
2717
2741
|
}
|
|
2718
|
-
|
|
2742
|
+
context.position += line.length;
|
|
2719
2743
|
}
|
|
2720
|
-
return [(0, array_1.push)([block, overflow, closer], matches)
|
|
2721
|
-
};
|
|
2744
|
+
return [(0, array_1.push)([block, overflow, closer], matches)];
|
|
2745
|
+
});
|
|
2722
2746
|
}
|
|
2723
2747
|
exports.fence = fence;
|
|
2724
2748
|
|
|
@@ -2742,22 +2766,36 @@ const bind_1 = __webpack_require__(994);
|
|
|
2742
2766
|
const match_1 = __webpack_require__(1638);
|
|
2743
2767
|
const surround_1 = __webpack_require__(5781);
|
|
2744
2768
|
const memoize_1 = __webpack_require__(6925);
|
|
2745
|
-
function indent(opener, parser, separation = false) {
|
|
2746
|
-
if (typeof opener === 'function')
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2769
|
+
function indent(opener, parser = false, separation = false) {
|
|
2770
|
+
if (typeof opener === 'function') {
|
|
2771
|
+
separation = parser;
|
|
2772
|
+
parser = opener;
|
|
2773
|
+
opener = /^([ \t])\1*/;
|
|
2774
|
+
}
|
|
2775
|
+
return (0, parser_1.failsafe)((0, bind_1.bind)((0, block_1.block)((0, match_1.match)(opener, (0, memoize_1.memoize)(([indent]) => (0, some_1.some)((0, line_1.line)((0, surround_1.open)(indent, ({
|
|
2776
|
+
context
|
|
2777
|
+
}) => {
|
|
2778
|
+
const {
|
|
2779
|
+
source,
|
|
2780
|
+
position
|
|
2781
|
+
} = context;
|
|
2782
|
+
context.position = source.length;
|
|
2783
|
+
return [[source.slice(position)]];
|
|
2784
|
+
}))), ([indent]) => indent.length * 2 + +(indent[0] === ' '), {})), separation), (lines, context) => {
|
|
2785
|
+
const {
|
|
2786
|
+
source,
|
|
2787
|
+
position
|
|
2788
|
+
} = context;
|
|
2750
2789
|
// 影響する使用はないはず
|
|
2751
2790
|
//const { backtracks } = context;
|
|
2752
2791
|
//context.backtracks = {};
|
|
2753
|
-
const result = parser(
|
|
2754
|
-
source: trimBlockEnd(lines.join('')),
|
|
2755
|
-
context
|
|
2756
|
-
});
|
|
2792
|
+
const result = parser((0, parser_1.input)(trimBlockEnd(lines.join('')), context));
|
|
2757
2793
|
//context.backtracks = backtracks;
|
|
2758
2794
|
|
|
2759
|
-
|
|
2760
|
-
|
|
2795
|
+
context.position = position - (context.source.length - context.position);
|
|
2796
|
+
context.source = source;
|
|
2797
|
+
return result && context.position === position ? [(0, parser_1.eval)(result)] : undefined;
|
|
2798
|
+
}));
|
|
2761
2799
|
}
|
|
2762
2800
|
exports.indent = indent;
|
|
2763
2801
|
function trimBlockEnd(block) {
|
|
@@ -2797,19 +2835,22 @@ exports.match = void 0;
|
|
|
2797
2835
|
const parser_1 = __webpack_require__(605);
|
|
2798
2836
|
const combinator_1 = __webpack_require__(3484);
|
|
2799
2837
|
function match(pattern, f, cost = false) {
|
|
2800
|
-
return input => {
|
|
2838
|
+
return (0, parser_1.failsafe)(input => {
|
|
2801
2839
|
const {
|
|
2802
|
-
source,
|
|
2803
2840
|
context
|
|
2804
2841
|
} = input;
|
|
2805
|
-
|
|
2806
|
-
|
|
2842
|
+
const {
|
|
2843
|
+
source,
|
|
2844
|
+
position
|
|
2845
|
+
} = context;
|
|
2846
|
+
if (position === source.length) return;
|
|
2847
|
+
const param = source.slice(position).match(pattern);
|
|
2807
2848
|
if (!param) return;
|
|
2808
2849
|
cost && (0, combinator_1.consume)(param[0].length, context);
|
|
2809
2850
|
const result = f(param)(input);
|
|
2810
|
-
|
|
2811
|
-
return
|
|
2812
|
-
};
|
|
2851
|
+
context.position += result && context.position === position ? param[0].length : 0;
|
|
2852
|
+
return context.position > position ? result : undefined;
|
|
2853
|
+
});
|
|
2813
2854
|
}
|
|
2814
2855
|
exports.match = match;
|
|
2815
2856
|
|
|
@@ -2827,9 +2868,18 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
2827
2868
|
exports.recover = void 0;
|
|
2828
2869
|
function recover(parser, fallback) {
|
|
2829
2870
|
return input => {
|
|
2871
|
+
const {
|
|
2872
|
+
context
|
|
2873
|
+
} = input;
|
|
2874
|
+
const {
|
|
2875
|
+
source,
|
|
2876
|
+
position
|
|
2877
|
+
} = context;
|
|
2830
2878
|
try {
|
|
2831
2879
|
return parser(input);
|
|
2832
2880
|
} catch (reason) {
|
|
2881
|
+
context.source = source;
|
|
2882
|
+
context.position = position;
|
|
2833
2883
|
return fallback(input, reason);
|
|
2834
2884
|
}
|
|
2835
2885
|
};
|
|
@@ -2869,53 +2919,59 @@ exports.rewrite = exports.focus = void 0;
|
|
|
2869
2919
|
const parser_1 = __webpack_require__(605);
|
|
2870
2920
|
const combinator_1 = __webpack_require__(3484);
|
|
2871
2921
|
function focus(scope, parser, cost = true) {
|
|
2872
|
-
const match = typeof scope === 'string' ? source => source.
|
|
2873
|
-
return ({
|
|
2874
|
-
source,
|
|
2922
|
+
const match = typeof scope === 'string' ? (source, position) => source.startsWith(scope, position) ? scope : '' : (source, position) => source.slice(position).match(scope)?.[0] ?? '';
|
|
2923
|
+
return (0, parser_1.failsafe)(({
|
|
2875
2924
|
context
|
|
2876
2925
|
}) => {
|
|
2877
|
-
|
|
2878
|
-
|
|
2926
|
+
const {
|
|
2927
|
+
source,
|
|
2928
|
+
position
|
|
2929
|
+
} = context;
|
|
2930
|
+
if (position === source.length) return;
|
|
2931
|
+
const src = match(source, position);
|
|
2879
2932
|
if (src === '') return;
|
|
2880
2933
|
cost && (0, combinator_1.consume)(src.length, context);
|
|
2881
|
-
|
|
2934
|
+
context.range = src.length;
|
|
2882
2935
|
context.offset ??= 0;
|
|
2883
|
-
context.offset +=
|
|
2884
|
-
const result = parser(
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
context.offset -=
|
|
2936
|
+
context.offset += position;
|
|
2937
|
+
const result = parser((0, parser_1.input)(src, context));
|
|
2938
|
+
context.position += position;
|
|
2939
|
+
context.position += result && context.position === position ? src.length : 0;
|
|
2940
|
+
context.source = source;
|
|
2941
|
+
context.offset -= position;
|
|
2889
2942
|
if (result === undefined) return;
|
|
2890
|
-
return
|
|
2891
|
-
};
|
|
2943
|
+
return [(0, parser_1.eval)(result)];
|
|
2944
|
+
});
|
|
2892
2945
|
}
|
|
2893
2946
|
exports.focus = focus;
|
|
2894
2947
|
function rewrite(scope, parser) {
|
|
2895
|
-
return
|
|
2948
|
+
return (0, parser_1.failsafe)(({
|
|
2949
|
+
context
|
|
2950
|
+
}) => {
|
|
2896
2951
|
const {
|
|
2897
2952
|
source,
|
|
2898
|
-
|
|
2899
|
-
} =
|
|
2900
|
-
if (
|
|
2953
|
+
position
|
|
2954
|
+
} = context;
|
|
2955
|
+
if (position === source.length) return;
|
|
2901
2956
|
// 影響する使用はないはず
|
|
2902
2957
|
//const { backtracks } = context;
|
|
2903
2958
|
//context.backtracks = {};
|
|
2904
|
-
const res1 = scope(
|
|
2905
|
-
//context.backtracks = backtracks;
|
|
2906
|
-
if (res1 === undefined || (0, parser_1.exec)(res1).length >= source.length) return;
|
|
2907
|
-
const src = source.slice(0, source.length - (0, parser_1.exec)(res1).length);
|
|
2908
|
-
const offset = source.length - src.length;
|
|
2909
|
-
context.offset ??= 0;
|
|
2910
|
-
context.offset += offset;
|
|
2911
|
-
const res2 = parser({
|
|
2912
|
-
source: src,
|
|
2959
|
+
const res1 = scope({
|
|
2913
2960
|
context
|
|
2914
2961
|
});
|
|
2915
|
-
context.
|
|
2962
|
+
//context.backtracks = backtracks;
|
|
2963
|
+
if (res1 === undefined || context.position < position) return;
|
|
2964
|
+
const src = source.slice(position, context.position);
|
|
2965
|
+
context.offset ??= 0;
|
|
2966
|
+
context.offset += position;
|
|
2967
|
+
const res2 = parser((0, parser_1.input)(src, context));
|
|
2968
|
+
context.position += position;
|
|
2969
|
+
context.position += res2 && context.position === position ? src.length : 0;
|
|
2970
|
+
context.source = source;
|
|
2971
|
+
context.offset -= position;
|
|
2916
2972
|
if (res2 === undefined) return;
|
|
2917
|
-
return
|
|
2918
|
-
};
|
|
2973
|
+
return [(0, parser_1.eval)(res2)];
|
|
2974
|
+
});
|
|
2919
2975
|
}
|
|
2920
2976
|
exports.rewrite = rewrite;
|
|
2921
2977
|
|
|
@@ -2945,48 +3001,57 @@ function surround(opener, parser, closer, optional = false, f, g, backtracks = [
|
|
|
2945
3001
|
case 'object':
|
|
2946
3002
|
closer = match(closer);
|
|
2947
3003
|
}
|
|
2948
|
-
return ({
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
const
|
|
2953
|
-
|
|
3004
|
+
return (0, parser_1.failsafe)(input => {
|
|
3005
|
+
const {
|
|
3006
|
+
context
|
|
3007
|
+
} = input;
|
|
3008
|
+
const {
|
|
3009
|
+
source,
|
|
3010
|
+
position
|
|
3011
|
+
} = context;
|
|
3012
|
+
if (position === source.length) return;
|
|
2954
3013
|
const {
|
|
2955
3014
|
linebreak
|
|
2956
3015
|
} = context;
|
|
2957
3016
|
context.linebreak = 0;
|
|
2958
|
-
const
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
const resultM =
|
|
2967
|
-
|
|
2968
|
-
context
|
|
2969
|
-
}) : undefined;
|
|
3017
|
+
const resultO = opener(input);
|
|
3018
|
+
const nodesO = (0, parser_1.eval)(resultO);
|
|
3019
|
+
if (!nodesO) {
|
|
3020
|
+
return void revert(context, linebreak);
|
|
3021
|
+
}
|
|
3022
|
+
if (isBacktrack(context, backtracks, position, context.position - position || 1)) {
|
|
3023
|
+
return void revert(context, linebreak);
|
|
3024
|
+
}
|
|
3025
|
+
const resultM = context.position < source.length ? parser(input) : undefined;
|
|
3026
|
+
context.range = context.position - position;
|
|
2970
3027
|
const nodesM = (0, parser_1.eval)(resultM);
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
context
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
const
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
if (
|
|
2981
|
-
|
|
2982
|
-
|
|
3028
|
+
if (!resultM && !optional) {
|
|
3029
|
+
setBacktrack(context, backtracks, position);
|
|
3030
|
+
const result = g?.([nodesO, nodesM], context);
|
|
3031
|
+
revert(context, linebreak);
|
|
3032
|
+
return result;
|
|
3033
|
+
}
|
|
3034
|
+
const resultC = resultM || optional ? closer(input) : undefined;
|
|
3035
|
+
context.range = context.position - position;
|
|
3036
|
+
const nodesC = (0, parser_1.eval)(resultC);
|
|
3037
|
+
if (!nodesC) {
|
|
3038
|
+
setBacktrack(context, backtracks, position);
|
|
3039
|
+
const result = g?.([nodesO, nodesM], context);
|
|
3040
|
+
revert(context, linebreak);
|
|
3041
|
+
return result;
|
|
3042
|
+
}
|
|
3043
|
+
if (context.position === position) {
|
|
3044
|
+
return void revert(context, linebreak);
|
|
3045
|
+
}
|
|
3046
|
+
context.range = context.position - position;
|
|
3047
|
+
const result = f ? f([nodesO, nodesM, nodesC], context) : [(0, array_1.push)(nodesM ? (0, array_1.unshift)(nodesO, nodesM) : nodesO, nodesC)];
|
|
2983
3048
|
if (result) {
|
|
2984
3049
|
context.linebreak ||= linebreak;
|
|
2985
3050
|
} else {
|
|
2986
3051
|
revert(context, linebreak);
|
|
2987
3052
|
}
|
|
2988
3053
|
return result;
|
|
2989
|
-
};
|
|
3054
|
+
});
|
|
2990
3055
|
}
|
|
2991
3056
|
exports.surround = surround;
|
|
2992
3057
|
function open(opener, parser, optional, backtracks) {
|
|
@@ -2998,8 +3063,12 @@ function close(parser, closer, optional, backtracks) {
|
|
|
2998
3063
|
}
|
|
2999
3064
|
exports.close = close;
|
|
3000
3065
|
const statesize = 2;
|
|
3001
|
-
function isBacktrack(context, backtracks,
|
|
3002
|
-
|
|
3066
|
+
function isBacktrack(context, backtracks, position = context.position, length = 1) {
|
|
3067
|
+
const {
|
|
3068
|
+
source
|
|
3069
|
+
} = context;
|
|
3070
|
+
if (position === source.length) return false;
|
|
3071
|
+
if (length === 0) return false;
|
|
3003
3072
|
for (const backtrack of backtracks) {
|
|
3004
3073
|
if (backtrack & 1) {
|
|
3005
3074
|
const {
|
|
@@ -3007,8 +3076,9 @@ function isBacktrack(context, backtracks, source, length = 1) {
|
|
|
3007
3076
|
offset = 0
|
|
3008
3077
|
} = context;
|
|
3009
3078
|
for (let i = 0; i < length; ++i) {
|
|
3010
|
-
if (
|
|
3011
|
-
|
|
3079
|
+
if (position + i === source.length) break;
|
|
3080
|
+
if (source[position + i] !== source[position + 0]) break;
|
|
3081
|
+
const pos = position + i + offset;
|
|
3012
3082
|
if (!(pos in backtracks)) continue;
|
|
3013
3083
|
if (backtracks[pos] & 1 << size(backtrack >>> statesize)) return true;
|
|
3014
3084
|
}
|
|
@@ -3018,15 +3088,20 @@ function isBacktrack(context, backtracks, source, length = 1) {
|
|
|
3018
3088
|
}
|
|
3019
3089
|
exports.isBacktrack = isBacktrack;
|
|
3020
3090
|
function setBacktrack(context, backtracks, position, length = 1) {
|
|
3021
|
-
|
|
3091
|
+
const {
|
|
3092
|
+
source
|
|
3093
|
+
} = context;
|
|
3094
|
+
if (position === source.length) return;
|
|
3095
|
+
if (length === 0) return;
|
|
3022
3096
|
for (const backtrack of backtracks) {
|
|
3023
|
-
if (backtrack & 2
|
|
3097
|
+
if (backtrack & 2) {
|
|
3024
3098
|
const {
|
|
3025
3099
|
backtracks = {},
|
|
3026
3100
|
offset = 0
|
|
3027
3101
|
} = context;
|
|
3028
3102
|
for (let i = 0; i < length; ++i) {
|
|
3029
|
-
|
|
3103
|
+
if (position + i === source.length) break;
|
|
3104
|
+
const pos = position + i + offset;
|
|
3030
3105
|
backtracks[pos] |= 1 << size(backtrack >>> statesize);
|
|
3031
3106
|
}
|
|
3032
3107
|
}
|
|
@@ -3037,17 +3112,29 @@ function match(pattern) {
|
|
|
3037
3112
|
switch (typeof pattern) {
|
|
3038
3113
|
case 'string':
|
|
3039
3114
|
return ({
|
|
3040
|
-
|
|
3041
|
-
}) =>
|
|
3115
|
+
context
|
|
3116
|
+
}) => {
|
|
3117
|
+
const {
|
|
3118
|
+
source,
|
|
3119
|
+
position
|
|
3120
|
+
} = context;
|
|
3121
|
+
if (!source.startsWith(pattern, position)) return;
|
|
3122
|
+
context.position += pattern.length;
|
|
3123
|
+
return [[]];
|
|
3124
|
+
};
|
|
3042
3125
|
case 'object':
|
|
3043
3126
|
return ({
|
|
3044
|
-
source,
|
|
3045
3127
|
context
|
|
3046
3128
|
}) => {
|
|
3047
|
-
const
|
|
3129
|
+
const {
|
|
3130
|
+
source,
|
|
3131
|
+
position
|
|
3132
|
+
} = context;
|
|
3133
|
+
const m = source.slice(position).match(pattern);
|
|
3048
3134
|
if (m === null) return;
|
|
3049
3135
|
(0, combinator_1.consume)(m[0].length, context);
|
|
3050
|
-
|
|
3136
|
+
context.position += m[0].length;
|
|
3137
|
+
return [[]];
|
|
3051
3138
|
};
|
|
3052
3139
|
}
|
|
3053
3140
|
}
|
|
@@ -3105,19 +3192,22 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
3105
3192
|
exports.bind = void 0;
|
|
3106
3193
|
const parser_1 = __webpack_require__(605);
|
|
3107
3194
|
function bind(parser, f) {
|
|
3108
|
-
return input => {
|
|
3195
|
+
return (0, parser_1.failsafe)(input => {
|
|
3109
3196
|
const {
|
|
3110
|
-
source,
|
|
3111
3197
|
context
|
|
3112
3198
|
} = input;
|
|
3113
|
-
|
|
3199
|
+
const {
|
|
3200
|
+
source,
|
|
3201
|
+
position
|
|
3202
|
+
} = context;
|
|
3203
|
+
if (position === source.length) return;
|
|
3114
3204
|
const res1 = parser(input);
|
|
3115
3205
|
if (res1 === undefined) return;
|
|
3116
|
-
context.
|
|
3117
|
-
const res2 = f((0, parser_1.eval)(res1),
|
|
3206
|
+
context.range = context.position - position;
|
|
3207
|
+
const res2 = f((0, parser_1.eval)(res1), context);
|
|
3118
3208
|
if (res2 === undefined) return;
|
|
3119
|
-
return
|
|
3120
|
-
};
|
|
3209
|
+
return context.position > position ? res2 : undefined;
|
|
3210
|
+
});
|
|
3121
3211
|
}
|
|
3122
3212
|
exports.bind = bind;
|
|
3123
3213
|
|
|
@@ -3135,7 +3225,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
3135
3225
|
exports.fmap = void 0;
|
|
3136
3226
|
const bind_1 = __webpack_require__(994);
|
|
3137
3227
|
function fmap(parser, f) {
|
|
3138
|
-
return (0, bind_1.bind)(parser, (nodes,
|
|
3228
|
+
return (0, bind_1.bind)(parser, (nodes, context) => [f(nodes, context)]);
|
|
3139
3229
|
}
|
|
3140
3230
|
exports.fmap = fmap;
|
|
3141
3231
|
|
|
@@ -3150,19 +3240,66 @@ exports.fmap = fmap;
|
|
|
3150
3240
|
Object.defineProperty(exports, "__esModule", ({
|
|
3151
3241
|
value: true
|
|
3152
3242
|
}));
|
|
3153
|
-
exports.
|
|
3243
|
+
exports.failsafe = exports.eval = exports.clean = exports.subinput = exports.input = void 0;
|
|
3244
|
+
function input(source, context) {
|
|
3245
|
+
// @ts-expect-error
|
|
3246
|
+
context.source = source;
|
|
3247
|
+
// @ts-expect-error
|
|
3248
|
+
context.position = 0;
|
|
3249
|
+
return {
|
|
3250
|
+
source,
|
|
3251
|
+
// @ts-expect-error
|
|
3252
|
+
context
|
|
3253
|
+
};
|
|
3254
|
+
}
|
|
3255
|
+
exports.input = input;
|
|
3256
|
+
function subinput(source, context) {
|
|
3257
|
+
return {
|
|
3258
|
+
context: {
|
|
3259
|
+
...context,
|
|
3260
|
+
source,
|
|
3261
|
+
position: 0,
|
|
3262
|
+
offset: undefined,
|
|
3263
|
+
backtracks: {}
|
|
3264
|
+
}
|
|
3265
|
+
};
|
|
3266
|
+
}
|
|
3267
|
+
exports.subinput = subinput;
|
|
3268
|
+
function clean(context) {
|
|
3269
|
+
const {
|
|
3270
|
+
source,
|
|
3271
|
+
position
|
|
3272
|
+
} = context;
|
|
3273
|
+
for (const p of Object.keys(context)) {
|
|
3274
|
+
context[p] = undefined;
|
|
3275
|
+
}
|
|
3276
|
+
context.source = source;
|
|
3277
|
+
context.position = position;
|
|
3278
|
+
return context;
|
|
3279
|
+
}
|
|
3280
|
+
exports.clean = clean;
|
|
3154
3281
|
function eval_(result, default_) {
|
|
3155
3282
|
return result ? result[0] : default_;
|
|
3156
3283
|
}
|
|
3157
3284
|
exports.eval = eval_;
|
|
3158
|
-
function
|
|
3159
|
-
return
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3285
|
+
function failsafe(parser) {
|
|
3286
|
+
return input => {
|
|
3287
|
+
const {
|
|
3288
|
+
context
|
|
3289
|
+
} = input;
|
|
3290
|
+
const {
|
|
3291
|
+
source,
|
|
3292
|
+
position
|
|
3293
|
+
} = context;
|
|
3294
|
+
const result = parser(input);
|
|
3295
|
+
if (result === undefined) {
|
|
3296
|
+
context.source = source;
|
|
3297
|
+
context.position = position;
|
|
3298
|
+
}
|
|
3299
|
+
return result;
|
|
3300
|
+
};
|
|
3164
3301
|
}
|
|
3165
|
-
exports.
|
|
3302
|
+
exports.failsafe = failsafe;
|
|
3166
3303
|
|
|
3167
3304
|
/***/ },
|
|
3168
3305
|
|
|
@@ -3182,46 +3319,47 @@ function reset(base, parser) {
|
|
|
3182
3319
|
const changes = Object.entries(base);
|
|
3183
3320
|
const values = Array(changes.length);
|
|
3184
3321
|
return ({
|
|
3185
|
-
source,
|
|
3186
3322
|
context
|
|
3187
|
-
}) => apply(parser,
|
|
3323
|
+
}) => apply(parser, context, changes, values, true);
|
|
3188
3324
|
}
|
|
3189
3325
|
exports.reset = reset;
|
|
3190
3326
|
function context(base, parser) {
|
|
3191
3327
|
const changes = Object.entries(base);
|
|
3192
3328
|
const values = Array(changes.length);
|
|
3193
3329
|
return ({
|
|
3194
|
-
source,
|
|
3195
3330
|
context
|
|
3196
|
-
}) => apply(parser,
|
|
3331
|
+
}) => apply(parser, context, changes, values);
|
|
3197
3332
|
}
|
|
3198
3333
|
exports.context = context;
|
|
3199
|
-
function apply(parser,
|
|
3200
|
-
if (reset) {
|
|
3201
|
-
context.backtracks = {};
|
|
3202
|
-
}
|
|
3334
|
+
function apply(parser, context, changes, values, reset = false) {
|
|
3203
3335
|
for (let i = 0; i < changes.length; ++i) {
|
|
3204
3336
|
const change = changes[i];
|
|
3205
3337
|
const prop = change[0];
|
|
3206
3338
|
switch (prop) {
|
|
3339
|
+
case 'source':
|
|
3340
|
+
case 'position':
|
|
3341
|
+
continue;
|
|
3207
3342
|
case 'resources':
|
|
3343
|
+
values[i] = context[prop];
|
|
3208
3344
|
context[prop] ??= (0, assign_1.clone)({}, change[1]);
|
|
3209
3345
|
continue;
|
|
3346
|
+
case 'backtracks':
|
|
3347
|
+
change[1] = {};
|
|
3210
3348
|
}
|
|
3211
3349
|
values[i] = context[prop];
|
|
3212
3350
|
context[prop] = change[1];
|
|
3213
3351
|
}
|
|
3214
3352
|
const result = parser({
|
|
3215
|
-
source,
|
|
3216
3353
|
context
|
|
3217
3354
|
});
|
|
3218
3355
|
for (let i = 0; i < changes.length; ++i) {
|
|
3219
3356
|
const change = changes[i];
|
|
3220
3357
|
const prop = change[0];
|
|
3221
3358
|
switch (prop) {
|
|
3222
|
-
case '
|
|
3223
|
-
|
|
3359
|
+
case 'source':
|
|
3360
|
+
case 'position':
|
|
3224
3361
|
continue;
|
|
3362
|
+
case 'resources':
|
|
3225
3363
|
}
|
|
3226
3364
|
context[prop] = values[i];
|
|
3227
3365
|
values[i] = undefined;
|
|
@@ -3371,9 +3509,15 @@ class Delimiters {
|
|
|
3371
3509
|
case 'undefined':
|
|
3372
3510
|
return () => undefined;
|
|
3373
3511
|
case 'string':
|
|
3374
|
-
return
|
|
3512
|
+
return ({
|
|
3513
|
+
source,
|
|
3514
|
+
position
|
|
3515
|
+
}) => source.startsWith(pattern, position) || undefined;
|
|
3375
3516
|
case 'object':
|
|
3376
|
-
return
|
|
3517
|
+
return ({
|
|
3518
|
+
source,
|
|
3519
|
+
position
|
|
3520
|
+
}) => pattern.test(source.slice(position)) || undefined;
|
|
3377
3521
|
}
|
|
3378
3522
|
}
|
|
3379
3523
|
registry(signature) {
|
|
@@ -3464,17 +3608,18 @@ class Delimiters {
|
|
|
3464
3608
|
delimiters[indexes[i]].state = true;
|
|
3465
3609
|
}
|
|
3466
3610
|
}
|
|
3467
|
-
match(
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3611
|
+
match(context) {
|
|
3612
|
+
const {
|
|
3613
|
+
precedence = 0,
|
|
3614
|
+
linebreak = 0
|
|
3615
|
+
} = context;
|
|
3471
3616
|
const {
|
|
3472
3617
|
delimiters
|
|
3473
3618
|
} = this;
|
|
3474
3619
|
for (let i = delimiters.length; i--;) {
|
|
3475
3620
|
const delimiter = delimiters[i];
|
|
3476
3621
|
if (delimiter.precedence <= precedence || !delimiter.state) continue;
|
|
3477
|
-
switch (delimiter.matcher(
|
|
3622
|
+
switch (delimiter.matcher(context)) {
|
|
3478
3623
|
case true:
|
|
3479
3624
|
if (!delimiter.linebreakable && linebreak > 0) return false;
|
|
3480
3625
|
return true;
|
|
@@ -3505,25 +3650,24 @@ const parser_1 = __webpack_require__(605);
|
|
|
3505
3650
|
const array_1 = __webpack_require__(6876);
|
|
3506
3651
|
function inits(parsers, resume) {
|
|
3507
3652
|
if (parsers.length === 1) return parsers[0];
|
|
3508
|
-
return
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3653
|
+
return input => {
|
|
3654
|
+
const {
|
|
3655
|
+
context
|
|
3656
|
+
} = input;
|
|
3657
|
+
const {
|
|
3658
|
+
source,
|
|
3659
|
+
position
|
|
3660
|
+
} = context;
|
|
3513
3661
|
let nodes;
|
|
3514
3662
|
for (let len = parsers.length, i = 0; i < len; ++i) {
|
|
3515
|
-
if (
|
|
3516
|
-
if (context.delimiters?.match(
|
|
3517
|
-
const result = parsers[i](
|
|
3518
|
-
source: rest,
|
|
3519
|
-
context
|
|
3520
|
-
});
|
|
3663
|
+
if (context.position === source.length) break;
|
|
3664
|
+
if (context.delimiters?.match(context)) break;
|
|
3665
|
+
const result = parsers[i](input);
|
|
3521
3666
|
if (result === undefined) break;
|
|
3522
3667
|
nodes = nodes ? (0, array_1.push)(nodes, (0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
|
|
3523
|
-
|
|
3524
|
-
if (resume?.((0, parser_1.eval)(result), (0, parser_1.exec)(result)) === false) break;
|
|
3668
|
+
if (resume?.((0, parser_1.eval)(result)) === false) break;
|
|
3525
3669
|
}
|
|
3526
|
-
return nodes &&
|
|
3670
|
+
return nodes && context.position > position ? [nodes] : undefined;
|
|
3527
3671
|
};
|
|
3528
3672
|
}
|
|
3529
3673
|
exports.inits = inits;
|
|
@@ -3544,25 +3688,24 @@ const parser_1 = __webpack_require__(605);
|
|
|
3544
3688
|
const array_1 = __webpack_require__(6876);
|
|
3545
3689
|
function sequence(parsers, resume) {
|
|
3546
3690
|
if (parsers.length === 1) return parsers[0];
|
|
3547
|
-
return
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3691
|
+
return input => {
|
|
3692
|
+
const {
|
|
3693
|
+
context
|
|
3694
|
+
} = input;
|
|
3695
|
+
const {
|
|
3696
|
+
source,
|
|
3697
|
+
position
|
|
3698
|
+
} = context;
|
|
3552
3699
|
let nodes;
|
|
3553
3700
|
for (let len = parsers.length, i = 0; i < len; ++i) {
|
|
3554
|
-
if (
|
|
3555
|
-
if (context.delimiters?.match(
|
|
3556
|
-
const result = parsers[i](
|
|
3557
|
-
source: rest,
|
|
3558
|
-
context
|
|
3559
|
-
});
|
|
3701
|
+
if (context.position === source.length) return;
|
|
3702
|
+
if (context.delimiters?.match(context)) return;
|
|
3703
|
+
const result = parsers[i](input);
|
|
3560
3704
|
if (result === undefined) return;
|
|
3561
3705
|
nodes = nodes ? (0, array_1.push)(nodes, (0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
|
|
3562
|
-
|
|
3563
|
-
if (resume?.((0, parser_1.eval)(result), (0, parser_1.exec)(result)) === false) return;
|
|
3706
|
+
if (resume?.((0, parser_1.eval)(result)) === false) return;
|
|
3564
3707
|
}
|
|
3565
|
-
return nodes &&
|
|
3708
|
+
return nodes && context.position > position ? [nodes] : undefined;
|
|
3566
3709
|
};
|
|
3567
3710
|
}
|
|
3568
3711
|
exports.sequence = sequence;
|
|
@@ -3591,34 +3734,33 @@ function some(parser, end, delimiters = [], limit = 0) {
|
|
|
3591
3734
|
precedence,
|
|
3592
3735
|
linebreakable
|
|
3593
3736
|
}));
|
|
3594
|
-
return
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3737
|
+
return input => {
|
|
3738
|
+
const {
|
|
3739
|
+
context
|
|
3740
|
+
} = input;
|
|
3741
|
+
const {
|
|
3742
|
+
source,
|
|
3743
|
+
position
|
|
3744
|
+
} = context;
|
|
3745
|
+
//assert(context.backtracks ??= {});
|
|
3600
3746
|
let nodes;
|
|
3601
3747
|
if (delims.length > 0) {
|
|
3602
3748
|
context.delimiters ??= new delimiter_1.Delimiters();
|
|
3603
3749
|
context.delimiters.push(delims);
|
|
3604
3750
|
}
|
|
3605
3751
|
while (true) {
|
|
3606
|
-
if (
|
|
3607
|
-
if (match(
|
|
3608
|
-
if (context.delimiters?.match(
|
|
3609
|
-
const result = parser(
|
|
3610
|
-
source: rest,
|
|
3611
|
-
context
|
|
3612
|
-
});
|
|
3752
|
+
if (context.position === source.length) break;
|
|
3753
|
+
if (match(context)) break;
|
|
3754
|
+
if (context.delimiters?.match(context)) break;
|
|
3755
|
+
const result = parser(input);
|
|
3613
3756
|
if (result === undefined) break;
|
|
3614
3757
|
nodes = nodes ? nodes.length < (0, parser_1.eval)(result).length / 8 ? (0, array_1.unshift)(nodes, (0, parser_1.eval)(result)) : (0, array_1.push)(nodes, (0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
|
|
3615
|
-
|
|
3616
|
-
if (limit > 0 && source.length - rest.length > limit) break;
|
|
3758
|
+
if (limit > 0 && context.position - position > limit) break;
|
|
3617
3759
|
}
|
|
3618
3760
|
if (delims.length > 0) {
|
|
3619
3761
|
context.delimiters.pop(delims.length);
|
|
3620
3762
|
}
|
|
3621
|
-
return nodes &&
|
|
3763
|
+
return nodes && context.position > position ? [nodes] : undefined;
|
|
3622
3764
|
};
|
|
3623
3765
|
}
|
|
3624
3766
|
exports.some = some;
|
|
@@ -3851,15 +3993,9 @@ function bind(target, settings) {
|
|
|
3851
3993
|
let index = head;
|
|
3852
3994
|
for (; index < sourceSegments.length - last; ++index) {
|
|
3853
3995
|
const seg = sourceSegments[index];
|
|
3854
|
-
const es = (0, parser_1.eval)((0, header_1.header)({
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
header: index === 0
|
|
3858
|
-
}
|
|
3859
|
-
}) || (0, block_1.block)({
|
|
3860
|
-
source: seg,
|
|
3861
|
-
context
|
|
3862
|
-
}), []);
|
|
3996
|
+
const es = (0, parser_1.eval)((0, header_1.header)((0, parser_1.input)(seg, {
|
|
3997
|
+
header: index === 0
|
|
3998
|
+
})) || (0, block_1.block)((0, parser_1.input)(seg, context)), []);
|
|
3863
3999
|
blocks.splice(index, 0, [seg, es, url]);
|
|
3864
4000
|
if (es.length === 0) continue;
|
|
3865
4001
|
// All deletion processes always run after all addition processes have done.
|
|
@@ -4028,8 +4164,8 @@ exports.headers = exports.header = void 0;
|
|
|
4028
4164
|
const parser_1 = __webpack_require__(605);
|
|
4029
4165
|
const header_1 = __webpack_require__(3009);
|
|
4030
4166
|
function header(source) {
|
|
4031
|
-
const [,
|
|
4032
|
-
return source.slice(0,
|
|
4167
|
+
const [, pos = 0] = parse(source);
|
|
4168
|
+
return source.slice(0, pos);
|
|
4033
4169
|
}
|
|
4034
4170
|
exports.header = header;
|
|
4035
4171
|
function headers(source) {
|
|
@@ -4038,12 +4174,10 @@ function headers(source) {
|
|
|
4038
4174
|
}
|
|
4039
4175
|
exports.headers = headers;
|
|
4040
4176
|
function parse(source) {
|
|
4041
|
-
const
|
|
4042
|
-
|
|
4043
|
-
context: {}
|
|
4044
|
-
});
|
|
4177
|
+
const i = (0, parser_1.input)(source, {});
|
|
4178
|
+
const result = (0, header_1.header)(i);
|
|
4045
4179
|
const [el] = (0, parser_1.eval)(result, []);
|
|
4046
|
-
return el?.tagName === 'ASIDE' ? [el,
|
|
4180
|
+
return el?.tagName === 'ASIDE' ? [el, i.context.position] : [];
|
|
4047
4181
|
}
|
|
4048
4182
|
|
|
4049
4183
|
/***/ },
|
|
@@ -4075,10 +4209,7 @@ function sanitize(source) {
|
|
|
4075
4209
|
// https://en.wikipedia.org/wiki/Whitespace_character
|
|
4076
4210
|
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'];
|
|
4077
4211
|
const unreadableHTMLEntityNames = exports.invisibleHTMLEntityNames.slice(2);
|
|
4078
|
-
const unreadableEscapableCharacters = unreadableHTMLEntityNames.map(name => (0, parser_1.eval)((0, htmlentity_1.unsafehtmlentity)({
|
|
4079
|
-
source: `&${name};`,
|
|
4080
|
-
context: {}
|
|
4081
|
-
}))[0]);
|
|
4212
|
+
const unreadableEscapableCharacters = unreadableHTMLEntityNames.map(name => (0, parser_1.eval)((0, htmlentity_1.unsafehtmlentity)((0, parser_1.input)(`&${name};`, {})))[0]);
|
|
4082
4213
|
const unreadableEscapableCharacter = new RegExp(`[${[...new Set(unreadableEscapableCharacters)].join('')}]`, 'g');
|
|
4083
4214
|
// https://www.pandanoir.info/entry/2018/03/11/193000
|
|
4084
4215
|
// http://anti.rosx.net/etc/memo/002_space.html
|
|
@@ -4156,15 +4287,9 @@ function parse(source, opts = {}, context) {
|
|
|
4156
4287
|
const node = (0, dom_1.frag)();
|
|
4157
4288
|
let index = 0;
|
|
4158
4289
|
for (const seg of (0, segment_1.segment)(source)) {
|
|
4159
|
-
node.append(...(0, parser_1.eval)((0, header_1.header)({
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
header: index++ === 0
|
|
4163
|
-
}
|
|
4164
|
-
}) || (0, block_1.block)({
|
|
4165
|
-
source: seg,
|
|
4166
|
-
context
|
|
4167
|
-
}), []));
|
|
4290
|
+
node.append(...(0, parser_1.eval)((0, header_1.header)((0, parser_1.input)(seg, {
|
|
4291
|
+
header: index++ === 0
|
|
4292
|
+
})) || (0, block_1.block)((0, parser_1.input)(seg, context)), []));
|
|
4168
4293
|
}
|
|
4169
4294
|
if (opts.test) return node;
|
|
4170
4295
|
for (const _ of (0, figure_1.figure)(node, opts.notes, context));
|
|
@@ -4225,19 +4350,24 @@ const dom_1 = __webpack_require__(394);
|
|
|
4225
4350
|
exports.block = (0, combinator_1.reset)({
|
|
4226
4351
|
resources: {
|
|
4227
4352
|
// バックトラックのせいで文字数制限を受けないようにする。
|
|
4228
|
-
clock: segment_1.MAX_SEGMENT_SIZE *
|
|
4353
|
+
clock: segment_1.MAX_SEGMENT_SIZE * 1,
|
|
4229
4354
|
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 */]
|
|
4230
|
-
}
|
|
4355
|
+
},
|
|
4356
|
+
backtracks: {}
|
|
4231
4357
|
}, error((0, combinator_1.union)([source_1.emptyline, pagebreak_1.pagebreak, heading_1.heading, ulist_1.ulist, olist_1.olist, ilist_1.ilist, dlist_1.dlist, table_1.table, codeblock_1.codeblock, mathblock_1.mathblock, extension_1.extension, sidefence_1.sidefence, blockquote_1.blockquote, mediablock_1.mediablock, reply_1.reply, paragraph_1.paragraph])));
|
|
4232
4358
|
function error(parser) {
|
|
4233
4359
|
const reg = new RegExp(String.raw`^${"\u0007" /* Command.Error */}.*\n`);
|
|
4234
4360
|
return (0, combinator_1.recover)((0, combinator_1.fallback)((0, combinator_1.open)("\u0007" /* Command.Error */, ({
|
|
4235
|
-
|
|
4361
|
+
context: {
|
|
4362
|
+
source,
|
|
4363
|
+
position
|
|
4364
|
+
}
|
|
4236
4365
|
}) => {
|
|
4237
|
-
throw new Error(source.split('\n', 1)[0]);
|
|
4366
|
+
throw new Error(source.slice(position).split('\n', 1)[0]);
|
|
4238
4367
|
}), parser), ({
|
|
4239
|
-
source,
|
|
4240
4368
|
context: {
|
|
4369
|
+
source,
|
|
4370
|
+
position,
|
|
4241
4371
|
id
|
|
4242
4372
|
}
|
|
4243
4373
|
}, reason) => [[(0, dom_1.html)('h1', {
|
|
@@ -4246,7 +4376,7 @@ function error(parser) {
|
|
|
4246
4376
|
}, reason instanceof Error ? `${reason.name}: ${reason.message}` : `UnknownError: ${reason}`), (0, dom_1.html)('pre', {
|
|
4247
4377
|
class: 'error',
|
|
4248
4378
|
translate: 'no'
|
|
4249
|
-
}, source.replace(reg, '').slice(0, 1001).replace(/^(.{997}).{4}$/s, '$1...') || undefined)]
|
|
4379
|
+
}, source.slice(position).replace(reg, '').slice(0, 1001).replace(/^(.{997}).{4}$/s, '$1...') || undefined)]]);
|
|
4250
4380
|
}
|
|
4251
4381
|
|
|
4252
4382
|
/***/ },
|
|
@@ -4273,9 +4403,11 @@ const indent = (0, combinator_1.block)((0, combinator_1.open)(opener, (0, combin
|
|
|
4273
4403
|
const unindent = source => source.replace(/(?<=^|\n)>(?:[^\S\n]|(?=>*(?:$|\s)))|\n$/g, '');
|
|
4274
4404
|
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, false, 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 => [(0, dom_1.html)('pre', (0, dom_1.defrag)(ns))]), false, true))]))), ns => [(0, dom_1.html)('blockquote', ns)]));
|
|
4275
4405
|
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, false, true)), (0, combinator_1.creation)(10, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, ({
|
|
4276
|
-
source,
|
|
4277
4406
|
context
|
|
4278
4407
|
}) => {
|
|
4408
|
+
const {
|
|
4409
|
+
source
|
|
4410
|
+
} = context;
|
|
4279
4411
|
const references = (0, dom_1.html)('ol', {
|
|
4280
4412
|
class: 'references'
|
|
4281
4413
|
});
|
|
@@ -4285,7 +4417,8 @@ const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combina
|
|
|
4285
4417
|
references
|
|
4286
4418
|
}
|
|
4287
4419
|
}, context);
|
|
4288
|
-
|
|
4420
|
+
context.position = source.length;
|
|
4421
|
+
return [[(0, dom_1.html)('section', [document, (0, dom_1.html)('h2', 'References'), references])]];
|
|
4289
4422
|
}, false, true)))]))), ns => [(0, dom_1.html)('blockquote', ns)]));
|
|
4290
4423
|
|
|
4291
4424
|
/***/ },
|
|
@@ -4311,7 +4444,7 @@ exports.segment = (0, combinator_1.block)((0, combinator_1.validate)('```', (0,
|
|
|
4311
4444
|
exports.segment_ = (0, combinator_1.block)((0, combinator_1.validate)('```', (0, combinator_1.clear)((0, combinator_1.fence)(opener, 300, false))), false);
|
|
4312
4445
|
exports.codeblock = (0, combinator_1.block)((0, combinator_1.validate)('```', (0, combinator_1.fmap)((0, combinator_1.fence)(opener, 300),
|
|
4313
4446
|
// Bug: Type mismatch between outer and inner.
|
|
4314
|
-
([body, overflow, closer, opener, delim, param],
|
|
4447
|
+
([body, overflow, closer, opener, delim, param], context) => {
|
|
4315
4448
|
const params = param.match(/(?:\\.?|\S)+/g)?.reduce((params, value, i) => {
|
|
4316
4449
|
let name;
|
|
4317
4450
|
switch (true) {
|
|
@@ -4343,10 +4476,9 @@ exports.codeblock = (0, combinator_1.block)((0, combinator_1.validate)('```', (0
|
|
|
4343
4476
|
'data-lang': params.lang || undefined,
|
|
4344
4477
|
'data-line': params.line || undefined,
|
|
4345
4478
|
'data-path': params.path || undefined
|
|
4346
|
-
}, 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, parser_1.eval)((0, autolink_1.autolink)({
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
}), [])));
|
|
4479
|
+
}, 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, parser_1.eval)((0, autolink_1.autolink)((0, parser_1.input)(body.slice(0, -1), {
|
|
4480
|
+
...context
|
|
4481
|
+
})), [])));
|
|
4350
4482
|
return [el];
|
|
4351
4483
|
})));
|
|
4352
4484
|
|
|
@@ -4421,7 +4553,7 @@ const parse_1 = __webpack_require__(3662);
|
|
|
4421
4553
|
const dom_1 = __webpack_require__(394);
|
|
4422
4554
|
exports.aside = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.fmap)((0, combinator_1.fence)(/^(~{3,})aside(?!\S)([^\n]*)(?:$|\n)/, 300),
|
|
4423
4555
|
// Bug: Type mismatch between outer and inner.
|
|
4424
|
-
([body, overflow, closer, opener, delim, param],
|
|
4556
|
+
([body, overflow, closer, opener, delim, param], context) => {
|
|
4425
4557
|
if (!closer || overflow || param.trimStart()) return [(0, dom_1.html)('pre', {
|
|
4426
4558
|
class: 'invalid',
|
|
4427
4559
|
translate: 'no',
|
|
@@ -4469,7 +4601,7 @@ const dom_1 = __webpack_require__(394);
|
|
|
4469
4601
|
const opener = /^(~{3,})(?:example\/(\S+))?(?!\S)([^\n]*)(?:$|\n)/;
|
|
4470
4602
|
exports.example = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.fmap)((0, combinator_1.fence)(opener, 300),
|
|
4471
4603
|
// Bug: Type mismatch between outer and inner.
|
|
4472
|
-
([body, overflow, closer, opener, delim, type = 'markdown', param],
|
|
4604
|
+
([body, overflow, closer, opener, delim, type = 'markdown', param], context) => {
|
|
4473
4605
|
if (!closer || overflow || param.trimStart()) return [(0, dom_1.html)('pre', {
|
|
4474
4606
|
class: 'invalid',
|
|
4475
4607
|
translate: 'no',
|
|
@@ -4500,10 +4632,9 @@ exports.example = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combi
|
|
|
4500
4632
|
'data-type': 'math'
|
|
4501
4633
|
}, [(0, dom_1.html)('pre', {
|
|
4502
4634
|
translate: 'no'
|
|
4503
|
-
}, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, parser_1.eval)((0, mathblock_1.mathblock)({
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
}), [])[0]])];
|
|
4635
|
+
}, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, parser_1.eval)((0, mathblock_1.mathblock)((0, parser_1.input)(`$$\n${body}$$`, {
|
|
4636
|
+
...context
|
|
4637
|
+
})), [])[0]])];
|
|
4507
4638
|
default:
|
|
4508
4639
|
return [(0, dom_1.html)('pre', {
|
|
4509
4640
|
class: 'invalid',
|
|
@@ -4540,7 +4671,6 @@ exports.fig = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment,
|
|
|
4540
4671
|
// Bug: TypeScript
|
|
4541
4672
|
const fence = (/^[^\n]*\n!?>+\s/.test(source) && source.match(/^~{3,}(?=[^\S\n]*$)/mg) || []).reduce((max, fence) => fence > max ? fence : max, '~~') + '~';
|
|
4542
4673
|
return parser({
|
|
4543
|
-
source,
|
|
4544
4674
|
context
|
|
4545
4675
|
}) ? `${fence}figure ${source.replace(/^(.+\n.+\n)([\S\s]+?)\n?$/, '$1\n$2')}\n${fence}` : `${fence}figure ${source}\n\n${fence}`;
|
|
4546
4676
|
}, (0, combinator_1.union)([figure_1.figure]), false), ([el]) => el.tagName === 'FIGURE')));
|
|
@@ -4583,6 +4713,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
4583
4713
|
value: true
|
|
4584
4714
|
}));
|
|
4585
4715
|
exports.figure = exports.segment = void 0;
|
|
4716
|
+
const parser_1 = __webpack_require__(605);
|
|
4586
4717
|
const combinator_1 = __webpack_require__(3484);
|
|
4587
4718
|
const source_1 = __webpack_require__(8745);
|
|
4588
4719
|
const label_1 = __webpack_require__(2178);
|
|
@@ -4607,11 +4738,10 @@ exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinat
|
|
|
4607
4738
|
class: 'figindex'
|
|
4608
4739
|
}), (0, dom_1.html)('span', {
|
|
4609
4740
|
class: 'figtext'
|
|
4610
|
-
}, (0, dom_1.defrag)(caption))]), (0, dom_1.html)('div', [content])])])), (0, combinator_1.fmap)((0, combinator_1.fence)(/^(~{3,})(?:figure|\[?\$\S*)(?!\S)[^\n]*(?:$|\n)/, 300), ([body, overflow, closer, opener, delim],
|
|
4611
|
-
const violation = !closer && ['fence', `Missing the closing delimiter "${delim}"`] || overflow && ['fence', `Invalid trailing line after the closing delimiter "${delim}"`] || !(0, label_1.segment)({
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
}) && ['label', 'Invalid label'] || /^~+(?:figure[^\S\n]+)?(\[?\$\S+)[^\S\n]+\S/.test(opener) && ['argument', 'Invalid argument'] || ['content', 'Invalid content'];
|
|
4741
|
+
}, (0, dom_1.defrag)(caption))]), (0, dom_1.html)('div', [content])])])), (0, combinator_1.fmap)((0, combinator_1.fence)(/^(~{3,})(?:figure|\[?\$\S*)(?!\S)[^\n]*(?:$|\n)/, 300), ([body, overflow, closer, opener, delim], context) => {
|
|
4742
|
+
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.input)(opener.match(/^~+(?:figure[^\S\n]+)?(\[?\$\S+)/)?.[1] ?? '', {
|
|
4743
|
+
...context
|
|
4744
|
+
})) && ['label', 'Invalid label'] || /^~+(?:figure[^\S\n]+)?(\[?\$\S+)[^\S\n]+\S/.test(opener) && ['argument', 'Invalid argument'] || ['content', 'Invalid content'];
|
|
4615
4745
|
return [(0, dom_1.html)('pre', {
|
|
4616
4746
|
class: 'invalid',
|
|
4617
4747
|
translate: 'no',
|
|
@@ -4687,7 +4817,7 @@ const array_1 = __webpack_require__(6876);
|
|
|
4687
4817
|
const dom_1 = __webpack_require__(394);
|
|
4688
4818
|
exports.message = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.fmap)((0, combinator_1.fence)(/^(~{3,})message\/(\S+)([^\n]*)(?:$|\n)/, 300),
|
|
4689
4819
|
// Bug: Type mismatch between outer and inner.
|
|
4690
|
-
([body, overflow, closer, opener, delim, type, param],
|
|
4820
|
+
([body, overflow, closer, opener, delim, type, param], context) => {
|
|
4691
4821
|
if (!closer || overflow || param.trimStart()) return [(0, dom_1.html)('pre', {
|
|
4692
4822
|
class: 'invalid',
|
|
4693
4823
|
translate: 'no',
|
|
@@ -4708,10 +4838,9 @@ exports.message = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0,
|
|
|
4708
4838
|
return [(0, dom_1.html)('section', {
|
|
4709
4839
|
class: `message`,
|
|
4710
4840
|
'data-type': type
|
|
4711
|
-
}, (0, array_1.unshift)([(0, dom_1.html)('h1', title(type))], [...(0, segment_1.segment)(body)].reduce((acc, seg) => (0, array_1.push)(acc, (0, parser_1.eval)(content({
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
}), [])), [])))];
|
|
4841
|
+
}, (0, array_1.unshift)([(0, dom_1.html)('h1', title(type))], [...(0, segment_1.segment)(body)].reduce((acc, seg) => (0, array_1.push)(acc, (0, parser_1.eval)(content((0, parser_1.input)(seg, {
|
|
4842
|
+
...context
|
|
4843
|
+
})), [])), [])))];
|
|
4715
4844
|
})));
|
|
4716
4845
|
function title(type) {
|
|
4717
4846
|
switch (type) {
|
|
@@ -4776,7 +4905,7 @@ exports.segment = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0,
|
|
|
4776
4905
|
exports.segment_ = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.clear)((0, combinator_1.fence)(opener, 10000, false))), false);
|
|
4777
4906
|
exports.table = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.fmap)((0, combinator_1.fence)(opener, 10000),
|
|
4778
4907
|
// Bug: Type mismatch between outer and inner.
|
|
4779
|
-
([body, overflow, closer, opener, delim, type, param],
|
|
4908
|
+
([body, overflow, closer, opener, delim, type, param], context) => {
|
|
4780
4909
|
if (!closer || overflow || param.trimStart()) return [(0, dom_1.html)('pre', {
|
|
4781
4910
|
class: 'invalid',
|
|
4782
4911
|
translate: 'no',
|
|
@@ -4785,10 +4914,9 @@ exports.table = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, co
|
|
|
4785
4914
|
switch (type) {
|
|
4786
4915
|
case 'grid':
|
|
4787
4916
|
case undefined:
|
|
4788
|
-
return ((0, parser_1.eval)(parser({
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
})) ?? [(0, dom_1.html)('table')]).map(el => (0, dom_1.define)(el, {
|
|
4917
|
+
return ((0, parser_1.eval)(parser((0, parser_1.input)(body, {
|
|
4918
|
+
...context
|
|
4919
|
+
}))) ?? [(0, dom_1.html)('table')]).map(el => (0, dom_1.define)(el, {
|
|
4792
4920
|
'data-type': type
|
|
4793
4921
|
}));
|
|
4794
4922
|
default:
|
|
@@ -4806,7 +4934,7 @@ const align = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.uni
|
|
|
4806
4934
|
const delimiter = /^[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)|^[#:](?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=\s)/;
|
|
4807
4935
|
const head = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/^#(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=\s)/), (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)(/^[^\n]/, inline_1.medialink, /^\s*$/)), (0, combinator_1.block)((0, combinator_1.surround)(/^[^\n]/, inline_1.media, /^\s*$/)), (0, combinator_1.block)((0, combinator_1.surround)(/^[^\n]/, inline_1.shortmedia, /^\s*$/)), (0, combinator_1.open)(/^(?:\s*\n|\s)/, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))), true)])), true), ns => [(0, dom_1.html)('th', attributes(ns.shift()), (0, dom_1.defrag)(ns))]), false);
|
|
4808
4936
|
const data = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/^:(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=\s)/), (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)(/^[^\n]/, inline_1.medialink, /^\s*$/)), (0, combinator_1.block)((0, combinator_1.surround)(/^[^\n]/, inline_1.media, /^\s*$/)), (0, combinator_1.block)((0, combinator_1.surround)(/^[^\n]/, inline_1.shortmedia, /^\s*$/)), (0, combinator_1.open)(/^(?:\s*\n|\s)/, (0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, util_1.lineable)((0, combinator_1.some)(inline_1.inline)))), true)])), true), ns => [(0, dom_1.html)('td', attributes(ns.shift()), (0, dom_1.defrag)(ns))]), false);
|
|
4809
|
-
const dataline = (0, combinator_1.line)((0, combinator_1.rewrite)(source_1.contentline, (0, combinator_1.union)([(0, combinator_1.validate)(/^!+\s/, (0, combinator_1.convert)(source => `:${source}`, data,
|
|
4937
|
+
const dataline = (0, combinator_1.line)((0, combinator_1.rewrite)(source_1.contentline, (0, combinator_1.union)([(0, combinator_1.validate)(/^!+\s/, (0, combinator_1.convert)(source => `:${source}`, data, false)), (0, combinator_1.convert)(source => `: ${source}`, data, false)])));
|
|
4810
4938
|
function attributes(source) {
|
|
4811
4939
|
let [, rowspan = undefined, colspan = undefined, highlight = undefined, extension = undefined] = source.match(/^[#:](?:(\d+)?:(\d+)?)?(?:(!+)([+]?))?$/) ?? [];
|
|
4812
4940
|
rowspan === '1' ? rowspan = undefined : undefined;
|
|
@@ -5023,16 +5151,18 @@ const visibility_1 = __webpack_require__(6364);
|
|
|
5023
5151
|
const util_1 = __webpack_require__(4992);
|
|
5024
5152
|
const dom_1 = __webpack_require__(394);
|
|
5025
5153
|
exports.segment = (0, combinator_1.block)((0, combinator_1.validate)('#', (0, combinator_1.focus)(/^#+[^\S\n]+\S[^\n]*(?:\n#+(?!\S)[^\n]*)*(?:$|\n)/, (0, combinator_1.some)((0, combinator_1.line)(({
|
|
5026
|
-
|
|
5027
|
-
|
|
5154
|
+
context: {
|
|
5155
|
+
source
|
|
5156
|
+
}
|
|
5157
|
+
}) => [[source]])))));
|
|
5028
5158
|
exports.heading = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment,
|
|
5029
5159
|
// その他の表示制御は各所のCSSで行う。
|
|
5030
|
-
(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)(/^##+/), (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)]), ([h, ...ns]) => [h.length <= 6 ? (0, dom_1.html)(`h${h.length}`, {
|
|
5160
|
+
(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)(/^##+/), (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)]), ([h, ...ns], context) => [h.length <= 6 ? (0, dom_1.html)(`h${h.length}`, {
|
|
5031
5161
|
'data-index': (0, inline_1.dataindex)(ns)
|
|
5032
5162
|
}, (0, dom_1.defrag)(ns)) : (0, dom_1.html)(`h6`, {
|
|
5033
5163
|
class: 'invalid',
|
|
5034
5164
|
...(0, util_1.invalid)('heading', 'syntax', 'Heading level must be up to 6')
|
|
5035
|
-
}, (
|
|
5165
|
+
}, context.source.slice(context.position - context.range, context.position))]))))));
|
|
5036
5166
|
|
|
5037
5167
|
/***/ },
|
|
5038
5168
|
|
|
@@ -5060,13 +5190,17 @@ exports.ilist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combin
|
|
|
5060
5190
|
...(0, util_1.invalid)('list', 'syntax', 'Use "-" instead of "+" or "*"')
|
|
5061
5191
|
}, es)])));
|
|
5062
5192
|
exports.ilistitem = (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.contentline, (0, combinator_1.indent)(({
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5193
|
+
context: {
|
|
5194
|
+
source
|
|
5195
|
+
}
|
|
5196
|
+
}) => [[source]])]), ({
|
|
5197
|
+
context: {
|
|
5198
|
+
source
|
|
5199
|
+
}
|
|
5066
5200
|
}) => [['', (0, dom_1.html)('span', {
|
|
5067
5201
|
class: 'invalid',
|
|
5068
5202
|
...(0, util_1.invalid)('list', 'syntax', 'Fix the indent or the head of the list item')
|
|
5069
|
-
}, source.replace('\n', ''))]
|
|
5203
|
+
}, source.replace('\n', ''))]]);
|
|
5070
5204
|
|
|
5071
5205
|
/***/ },
|
|
5072
5206
|
|
|
@@ -5088,7 +5222,7 @@ exports.segment = (0, combinator_1.block)((0, combinator_1.validate)('$$', (0, c
|
|
|
5088
5222
|
exports.segment_ = (0, combinator_1.block)((0, combinator_1.validate)('$$', (0, combinator_1.clear)((0, combinator_1.fence)(opener, 300, false))), false);
|
|
5089
5223
|
exports.mathblock = (0, combinator_1.block)((0, combinator_1.validate)('$$', (0, combinator_1.fmap)((0, combinator_1.fence)(opener, 300),
|
|
5090
5224
|
// Bug: Type mismatch between outer and inner.
|
|
5091
|
-
([body, overflow, closer, opener, delim, param],
|
|
5225
|
+
([body, overflow, closer, opener, delim, param], {
|
|
5092
5226
|
caches: {
|
|
5093
5227
|
math: cache = undefined
|
|
5094
5228
|
} = {}
|
|
@@ -5118,11 +5252,13 @@ const inline_1 = __webpack_require__(7973);
|
|
|
5118
5252
|
const util_1 = __webpack_require__(4992);
|
|
5119
5253
|
const dom_1 = __webpack_require__(394);
|
|
5120
5254
|
exports.mediablock = (0, combinator_1.block)((0, combinator_1.validate)(['[!', '!'], (0, combinator_1.fmap)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.union)([inline_1.medialink, inline_1.media, inline_1.shortmedia])), (0, combinator_1.some)((0, combinator_1.line)((0, combinator_1.fallback)((0, combinator_1.union)([inline_1.medialink, inline_1.media, inline_1.shortmedia]), ({
|
|
5121
|
-
|
|
5255
|
+
context: {
|
|
5256
|
+
source
|
|
5257
|
+
}
|
|
5122
5258
|
}) => [[(0, dom_1.html)('span', {
|
|
5123
5259
|
class: 'invalid',
|
|
5124
5260
|
...(0, util_1.invalid)('mediablock', 'syntax', 'Not media syntax')
|
|
5125
|
-
}, source.replace('\n', ''))]
|
|
5261
|
+
}, source.replace('\n', ''))]])))]), ns => [(0, dom_1.html)('div', ns)])));
|
|
5126
5262
|
|
|
5127
5263
|
/***/ },
|
|
5128
5264
|
|
|
@@ -5156,11 +5292,15 @@ const list = (type, form) => (0, combinator_1.fmap)((0, combinator_1.some)((0, c
|
|
|
5156
5292
|
}, (0, dom_1.defrag)((0, ulist_1.fillFirstLine)(ns)))]))]))), es => [format((0, dom_1.html)('ol', es), type, form)]);
|
|
5157
5293
|
const heads = {
|
|
5158
5294
|
'.': (0, combinator_1.focus)(openers['.'], ({
|
|
5159
|
-
|
|
5160
|
-
|
|
5295
|
+
context: {
|
|
5296
|
+
source
|
|
5297
|
+
}
|
|
5298
|
+
}) => [[source.trimEnd().split('.', 1)[0] + '.']]),
|
|
5161
5299
|
'(': (0, combinator_1.focus)(openers['('], ({
|
|
5162
|
-
|
|
5163
|
-
|
|
5300
|
+
context: {
|
|
5301
|
+
source
|
|
5302
|
+
}
|
|
5303
|
+
}) => [[source.trimEnd().replace(/^\($/, '(1)').replace(/^\((\w+)$/, '($1)')]])
|
|
5164
5304
|
};
|
|
5165
5305
|
function idx(value) {
|
|
5166
5306
|
switch (value) {
|
|
@@ -5264,7 +5404,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
5264
5404
|
exports.pagebreak = void 0;
|
|
5265
5405
|
const combinator_1 = __webpack_require__(3484);
|
|
5266
5406
|
const dom_1 = __webpack_require__(394);
|
|
5267
|
-
exports.pagebreak = (0, combinator_1.block)((0, combinator_1.line)((0, combinator_1.focus)(/^={3,}[^\S\n]*(?:$|\n)/, () => [[(0, dom_1.html)('hr')]
|
|
5407
|
+
exports.pagebreak = (0, combinator_1.block)((0, combinator_1.line)((0, combinator_1.focus)(/^={3,}[^\S\n]*(?:$|\n)/, () => [[(0, dom_1.html)('hr')]])));
|
|
5268
5408
|
|
|
5269
5409
|
/***/ },
|
|
5270
5410
|
|
|
@@ -5330,18 +5470,24 @@ exports.cite = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.va
|
|
|
5330
5470
|
// Subject page representation.
|
|
5331
5471
|
// リンクの実装は後で検討
|
|
5332
5472
|
(0, combinator_1.focus)(/^>>#\S*(?=\s*$)/, ({
|
|
5333
|
-
|
|
5473
|
+
context: {
|
|
5474
|
+
source
|
|
5475
|
+
}
|
|
5334
5476
|
}) => [[(0, dom_1.html)('a', {
|
|
5335
5477
|
class: 'anchor'
|
|
5336
|
-
}, source)]
|
|
5337
|
-
|
|
5478
|
+
}, source)]]), (0, combinator_1.focus)(/^>>https?:\/\/\S+(?=\s*$)/, ({
|
|
5479
|
+
context: {
|
|
5480
|
+
source
|
|
5481
|
+
}
|
|
5338
5482
|
}) => [[(0, dom_1.html)('a', {
|
|
5339
5483
|
class: 'anchor',
|
|
5340
5484
|
href: source.slice(2).trimEnd(),
|
|
5341
5485
|
target: '_blank'
|
|
5342
|
-
}, source)]
|
|
5343
|
-
|
|
5344
|
-
|
|
5486
|
+
}, source)]]), (0, combinator_1.focus)(/^>>.+(?=\s*$)/, ({
|
|
5487
|
+
context: {
|
|
5488
|
+
source
|
|
5489
|
+
}
|
|
5490
|
+
}) => [[source]])]))), ([quotes, node]) => [(0, dom_1.html)('span', typeof node === 'object' ? {
|
|
5345
5491
|
class: 'cite'
|
|
5346
5492
|
} : {
|
|
5347
5493
|
class: 'cite invalid',
|
|
@@ -5421,16 +5567,22 @@ const array_1 = __webpack_require__(6876);
|
|
|
5421
5567
|
const dom_1 = __webpack_require__(394);
|
|
5422
5568
|
exports.table = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/^\|[^\n]*(?:\n\|[^\n]*){2}/, (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 => [(0, dom_1.html)('table', [(0, dom_1.html)('thead', [rows.shift()]), (0, dom_1.html)('tbody', format(rows))])])));
|
|
5423
5569
|
const row = (parser, optional) => (0, combinator_1.fallback)((0, combinator_1.fmap)((0, combinator_1.line)((0, combinator_1.surround)(/^(?=\|)/, (0, combinator_1.some)((0, combinator_1.union)([parser])), /^[|\\]?\s*$/, optional)), es => [(0, dom_1.html)('tr', es)]), (0, combinator_1.rewrite)(source_1.contentline, ({
|
|
5424
|
-
|
|
5570
|
+
context: {
|
|
5571
|
+
source
|
|
5572
|
+
}
|
|
5425
5573
|
}) => [[(0, dom_1.html)('tr', {
|
|
5426
5574
|
class: 'invalid',
|
|
5427
5575
|
...(0, util_1.invalid)('table-row', 'syntax', 'Missing the start symbol of the table row')
|
|
5428
|
-
}, [(0, dom_1.html)('td', source.replace('\n', ''))])]
|
|
5576
|
+
}, [(0, dom_1.html)('td', source.replace('\n', ''))])]]));
|
|
5429
5577
|
const align = (0, combinator_1.fmap)((0, combinator_1.open)('|', (0, combinator_1.union)([(0, combinator_1.focus)(/^:-+:?/, ({
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
}) => [[source
|
|
5578
|
+
context: {
|
|
5579
|
+
source
|
|
5580
|
+
}
|
|
5581
|
+
}) => [[source.at(-1) === ':' ? 'center' : 'start']], false), (0, combinator_1.focus)(/^-+:?/, ({
|
|
5582
|
+
context: {
|
|
5583
|
+
source
|
|
5584
|
+
}
|
|
5585
|
+
}) => [[source.at(-1) === ':' ? 'end' : '']], false)])), ns => [(0, dom_1.html)('td', (0, dom_1.defrag)(ns))]);
|
|
5434
5586
|
const cell = (0, combinator_1.surround)(/^\|\s*(?=\S)/, (0, combinator_1.trimStart)((0, combinator_1.union)([(0, combinator_1.close)(inline_1.medialink, /^\s*(?=\||$)/), (0, combinator_1.close)(inline_1.media, /^\s*(?=\||$)/), (0, combinator_1.close)(inline_1.shortmedia, /^\s*(?=\||$)/), (0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline, /^\|/, [[/^[|\\]?\s*$/, 9]]))])), /^[^|]*/, true);
|
|
5435
5587
|
const head = (0, combinator_1.fmap)(cell, ns => [(0, dom_1.html)('th', (0, dom_1.defrag)(ns))]);
|
|
5436
5588
|
const data = (0, combinator_1.fmap)(cell, ns => [(0, dom_1.html)('td', (0, dom_1.defrag)(ns))]);
|
|
@@ -5473,10 +5625,12 @@ exports.ulist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combin
|
|
|
5473
5625
|
'data-index': (0, inline_1.dataindex)(ns)
|
|
5474
5626
|
}, (0, dom_1.defrag)(fillFirstLine(ns)))]))])))), es => [format((0, dom_1.html)('ul', es))])));
|
|
5475
5627
|
exports.checkbox = (0, combinator_1.focus)(/^\[[xX ]\](?=$|\s)/, ({
|
|
5476
|
-
|
|
5628
|
+
context: {
|
|
5629
|
+
source
|
|
5630
|
+
}
|
|
5477
5631
|
}) => [[(0, dom_1.html)('span', {
|
|
5478
5632
|
class: 'checkbox'
|
|
5479
|
-
}, source[1].trimStart() ? '☑' : '☐')]
|
|
5633
|
+
}, source[1].trimStart() ? '☑' : '☐')]]);
|
|
5480
5634
|
function fillFirstLine(ns) {
|
|
5481
5635
|
return ns.length === 1 && typeof ns[0] === 'object' && ['UL', 'OL'].includes(ns[0].tagName) ? (0, array_1.unshift)([(0, dom_1.html)('br')], ns) : ns;
|
|
5482
5636
|
}
|
|
@@ -5507,26 +5661,45 @@ const util_1 = __webpack_require__(4992);
|
|
|
5507
5661
|
const normalize_1 = __webpack_require__(4490);
|
|
5508
5662
|
const dom_1 = __webpack_require__(394);
|
|
5509
5663
|
exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/^---+[^\S\v\f\r\n]*\r?\n[^\S\n]*(?=\S)/, (0, combinator_1.inits)([(0, combinator_1.rewrite)(({
|
|
5510
|
-
source,
|
|
5511
5664
|
context
|
|
5512
|
-
}) =>
|
|
5665
|
+
}) => {
|
|
5666
|
+
const {
|
|
5667
|
+
source
|
|
5668
|
+
} = context;
|
|
5669
|
+
if (context.header ?? true) {
|
|
5670
|
+
context.position += (0, segment_1.segment)(source).next().value.length;
|
|
5671
|
+
} else {
|
|
5672
|
+
context.position = source.length;
|
|
5673
|
+
}
|
|
5674
|
+
return [[]];
|
|
5675
|
+
}, (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(({
|
|
5513
5676
|
context
|
|
5514
5677
|
}) => context.header ?? true, (0, combinator_1.focus)(/^---[^\S\v\f\r\n]*\r?\n(?:[A-Za-z][0-9A-Za-z]*(?:-[A-Za-z][0-9A-Za-z]*)*:[ \t]+\S[^\v\f\r\n]*\r?\n){1,100}---[^\S\v\f\r\n]*(?:$|\r?\n)/, (0, combinator_1.convert)(source => (0, normalize_1.normalize)(source.slice(source.indexOf('\n') + 1, source.trimEnd().lastIndexOf('\n'))).replace(/(\S)\s+$/mg, '$1'), (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([field])), es => [(0, dom_1.html)('aside', {
|
|
5515
5678
|
class: 'header'
|
|
5516
5679
|
}, [(0, dom_1.html)('details', {
|
|
5517
5680
|
open: ''
|
|
5518
5681
|
}, (0, dom_1.defrag)([(0, dom_1.html)('summary', 'Header'), ...es]))])]), false))), ({
|
|
5519
|
-
|
|
5520
|
-
}) =>
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
}
|
|
5682
|
+
context
|
|
5683
|
+
}) => {
|
|
5684
|
+
const {
|
|
5685
|
+
source,
|
|
5686
|
+
position
|
|
5687
|
+
} = context;
|
|
5688
|
+
context.position += source.length;
|
|
5689
|
+
return [[(0, dom_1.html)('pre', {
|
|
5690
|
+
class: 'invalid',
|
|
5691
|
+
translate: 'no',
|
|
5692
|
+
...(0, util_1.invalid)('header', 'syntax', 'Invalid syntax')
|
|
5693
|
+
}, (0, normalize_1.normalize)(source.slice(position)))]];
|
|
5694
|
+
}]))), (0, combinator_1.clear)((0, source_1.str)(/^[^\S\v\f\r\n]*\r?\n/))])));
|
|
5525
5695
|
const field = (0, combinator_1.line)(({
|
|
5526
|
-
|
|
5696
|
+
context: {
|
|
5697
|
+
source,
|
|
5698
|
+
position
|
|
5699
|
+
}
|
|
5527
5700
|
}) => {
|
|
5528
|
-
const name = source.slice(
|
|
5529
|
-
const value = source.slice(name.length + 1).trim();
|
|
5701
|
+
const name = source.slice(position, source.indexOf(':', position));
|
|
5702
|
+
const value = source.slice(position + name.length + 1).trim();
|
|
5530
5703
|
return [[(0, dom_1.html)('span', {
|
|
5531
5704
|
class: 'field',
|
|
5532
5705
|
'data-name': name.toLowerCase(),
|
|
@@ -5535,7 +5708,7 @@ const field = (0, combinator_1.line)(({
|
|
|
5535
5708
|
class: 'field-name'
|
|
5536
5709
|
}, name), ': ', (0, dom_1.html)('span', {
|
|
5537
5710
|
class: 'field-value'
|
|
5538
|
-
}, value), '\n'])]
|
|
5711
|
+
}, value), '\n'])]];
|
|
5539
5712
|
});
|
|
5540
5713
|
|
|
5541
5714
|
/***/ },
|
|
@@ -5572,12 +5745,16 @@ const htmlentity_1 = __webpack_require__(470);
|
|
|
5572
5745
|
const bracket_1 = __webpack_require__(4526);
|
|
5573
5746
|
const autolink_1 = __webpack_require__(8072);
|
|
5574
5747
|
const source_1 = __webpack_require__(8745);
|
|
5748
|
+
const stars = (0, source_1.strs)('*');
|
|
5575
5749
|
exports.inline = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input => {
|
|
5576
5750
|
const {
|
|
5577
|
-
|
|
5751
|
+
context: {
|
|
5752
|
+
source,
|
|
5753
|
+
position
|
|
5754
|
+
}
|
|
5578
5755
|
} = input;
|
|
5579
|
-
if (
|
|
5580
|
-
switch (source.slice(
|
|
5756
|
+
if (position === source.length) return;
|
|
5757
|
+
switch (source.slice(position, position + 2)) {
|
|
5581
5758
|
case '((':
|
|
5582
5759
|
return (0, annotation_1.annotation)(input);
|
|
5583
5760
|
case '[[':
|
|
@@ -5602,8 +5779,10 @@ exports.inline = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input =>
|
|
|
5602
5779
|
return (0, mark_1.mark)(input);
|
|
5603
5780
|
case '//':
|
|
5604
5781
|
return (0, italic_1.italic)(input);
|
|
5782
|
+
case '**':
|
|
5783
|
+
return (0, emstrong_1.emstrong)(input) || (0, strong_1.strong)(input) || stars(input);
|
|
5605
5784
|
}
|
|
5606
|
-
switch (source[
|
|
5785
|
+
switch (source[position]) {
|
|
5607
5786
|
case '[':
|
|
5608
5787
|
return (0, link_1.textlink)(input) || (0, ruby_1.ruby)(input);
|
|
5609
5788
|
case '{':
|
|
@@ -5615,7 +5794,7 @@ exports.inline = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input =>
|
|
|
5615
5794
|
case '`':
|
|
5616
5795
|
return (0, code_1.code)(input);
|
|
5617
5796
|
case '*':
|
|
5618
|
-
return (0,
|
|
5797
|
+
return (0, emphasis_1.emphasis)(input) || stars(input);
|
|
5619
5798
|
case '&':
|
|
5620
5799
|
return (0, htmlentity_1.htmlentity)(input);
|
|
5621
5800
|
}
|
|
@@ -5679,9 +5858,9 @@ const combinator_1 = __webpack_require__(3484);
|
|
|
5679
5858
|
const inline_1 = __webpack_require__(7973);
|
|
5680
5859
|
const visibility_1 = __webpack_require__(6364);
|
|
5681
5860
|
const dom_1 = __webpack_require__(394);
|
|
5682
|
-
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, ([, ns],
|
|
5861
|
+
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, ([, ns], context) => context.linebreak === 0 ? [[(0, dom_1.html)('sup', {
|
|
5683
5862
|
class: 'annotation'
|
|
5684
|
-
}, [(0, dom_1.html)('span', (0, dom_1.defrag)((0, visibility_1.trimBlankNodeEnd)(ns)))])]
|
|
5863
|
+
}, [(0, dom_1.html)('span', (0, dom_1.defrag)((0, visibility_1.trimBlankNodeEnd)(ns)))])]] : undefined, undefined, [3 | 16 /* Backtrack.doublebracket */, 1 | 8 /* Backtrack.bracket */])));
|
|
5685
5864
|
|
|
5686
5865
|
/***/ },
|
|
5687
5866
|
|
|
@@ -5737,8 +5916,10 @@ const dom_1 = __webpack_require__(394);
|
|
|
5737
5916
|
exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)('@', (0, combinator_1.tails)([(0, source_1.str)(/^[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?)*\//i), (0, source_1.str)(/^[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*/i)])), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1).replace('/', '/@')}` : `/${source}`} }`, link_1.unsafelink, false), ([el]) => [(0, dom_1.define)(el, {
|
|
5738
5917
|
class: 'account'
|
|
5739
5918
|
})]))), ({
|
|
5740
|
-
|
|
5741
|
-
|
|
5919
|
+
context: {
|
|
5920
|
+
source
|
|
5921
|
+
}
|
|
5922
|
+
}) => [[source]]])));
|
|
5742
5923
|
|
|
5743
5924
|
/***/ },
|
|
5744
5925
|
|
|
@@ -5765,8 +5946,10 @@ const dom_1 = __webpack_require__(394);
|
|
|
5765
5946
|
exports.anchor = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('>>', (0, combinator_1.focus)(/^>>(?:[a-z][0-9a-z]*(?:-[0-9a-z]+)*\/)?[0-9a-z]+(?:-[0-9a-z]+)*(?![0-9a-z@#:])/i, (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `/@${source.slice(2).replace('/', '/timeline?at=')}` : `?at=${source.slice(2)}`} }`, link_1.unsafelink, false), ([el]) => [(0, dom_1.define)(el, {
|
|
5766
5947
|
class: 'anchor'
|
|
5767
5948
|
})]))), ({
|
|
5768
|
-
|
|
5769
|
-
|
|
5949
|
+
context: {
|
|
5950
|
+
source
|
|
5951
|
+
}
|
|
5952
|
+
}) => [[source]]]))));
|
|
5770
5953
|
|
|
5771
5954
|
/***/ },
|
|
5772
5955
|
|
|
@@ -5786,14 +5969,14 @@ const hashtag_1 = __webpack_require__(5764);
|
|
|
5786
5969
|
const util_1 = __webpack_require__(4992);
|
|
5787
5970
|
const dom_1 = __webpack_require__(394);
|
|
5788
5971
|
// https://example/@user?ch=a+b must be a user channel page or a redirect page going there.
|
|
5789
|
-
exports.channel = (0, combinator_1.validate)('@', (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.bind)((0, combinator_1.sequence)([account_1.account, (0, combinator_1.some)(hashtag_1.hashtag)]),
|
|
5972
|
+
exports.channel = (0, combinator_1.validate)('@', (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.bind)((0, combinator_1.sequence)([account_1.account, (0, combinator_1.some)(hashtag_1.hashtag)]), es => {
|
|
5790
5973
|
const source = (0, util_1.stringify)(es);
|
|
5791
5974
|
const el = es[0];
|
|
5792
5975
|
const url = `${el.getAttribute('href')}?ch=${source.slice(source.indexOf('#') + 1).replace(/#/g, '+')}`;
|
|
5793
5976
|
return [[(0, dom_1.define)(el, {
|
|
5794
5977
|
class: 'channel',
|
|
5795
5978
|
href: url
|
|
5796
|
-
}, source)]
|
|
5979
|
+
}, source)]];
|
|
5797
5980
|
})));
|
|
5798
5981
|
|
|
5799
5982
|
/***/ },
|
|
@@ -5813,13 +5996,17 @@ const source_1 = __webpack_require__(8745);
|
|
|
5813
5996
|
const dom_1 = __webpack_require__(394);
|
|
5814
5997
|
// https://html.spec.whatwg.org/multipage/input.html
|
|
5815
5998
|
exports.email = (0, combinator_1.rewrite)((0, combinator_1.surround)((0, source_1.str)(/^[0-9a-z]/i), (0, combinator_1.verify)((0, source_1.str)(/^(?:[_.+-](?=[0-9a-z])|[0-9a-z]){0,255}@[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?)*(?![0-9a-z])/i), ([source]) => source.length <= 255 - 1), '', false, undefined, undefined, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, ({
|
|
5816
|
-
|
|
5999
|
+
context: {
|
|
6000
|
+
source
|
|
6001
|
+
}
|
|
5817
6002
|
}) => [[(0, dom_1.html)('a', {
|
|
5818
6003
|
class: 'email',
|
|
5819
6004
|
href: `mailto:${source}`
|
|
5820
|
-
}, source)]
|
|
5821
|
-
|
|
5822
|
-
|
|
6005
|
+
}, source)]])), ({
|
|
6006
|
+
context: {
|
|
6007
|
+
source
|
|
6008
|
+
}
|
|
6009
|
+
}) => [[source]]]));
|
|
5823
6010
|
|
|
5824
6011
|
/***/ },
|
|
5825
6012
|
|
|
@@ -5842,8 +6029,10 @@ exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, com
|
|
|
5842
6029
|
class: 'hashnum',
|
|
5843
6030
|
href: null
|
|
5844
6031
|
})]))), ({
|
|
5845
|
-
|
|
5846
|
-
|
|
6032
|
+
context: {
|
|
6033
|
+
source
|
|
6034
|
+
}
|
|
6035
|
+
}) => [[source]]])));
|
|
5847
6036
|
|
|
5848
6037
|
/***/ },
|
|
5849
6038
|
|
|
@@ -5867,8 +6056,10 @@ exports.emoji = String.raw`\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_P
|
|
|
5867
6056
|
exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, source_1.str)(new RegExp([/^(?!['_])(?=(?:[0-9]{1,9})?(?:[^\d\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^'\p{C}\p{S}\p{P}\s]|emoji)))/u.source, /(?:[^\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^'\p{C}\p{S}\p{P}\s]|emoji))+/u.source].join('').replace(/emoji/g, exports.emoji), 'u')), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${`/hashtags/${source.slice(1)}`} }`, link_1.unsafelink, false), ([el]) => [(0, dom_1.define)(el, {
|
|
5868
6057
|
class: 'hashtag'
|
|
5869
6058
|
})]))), ({
|
|
5870
|
-
|
|
5871
|
-
|
|
6059
|
+
context: {
|
|
6060
|
+
source
|
|
6061
|
+
}
|
|
6062
|
+
}) => [[source]]])));
|
|
5872
6063
|
|
|
5873
6064
|
/***/ },
|
|
5874
6065
|
|
|
@@ -5888,12 +6079,16 @@ const source_1 = __webpack_require__(8745);
|
|
|
5888
6079
|
exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['http://', 'https://'], (0, combinator_1.rewrite)((0, combinator_1.open)(/^https?:\/\/(?=[\x21-\x7E])/, (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.verify)(bracket, ns => ns.length > 0),
|
|
5889
6080
|
// 再帰に注意
|
|
5890
6081
|
(0, combinator_1.some)(source_1.unescsource, /^[-+*=~^_/,.;:!?]{2}|^[-+*=~^_,.;:!?]?(?=[\\"`|\[\](){}<>]|[^\x21-\x7E]|$)/)]), undefined, [[/^[^\x21-\x7E]|^\$/, 9]])), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.convert)(url => `{ ${url} }`, link_1.unsafelink, false))), ({
|
|
5891
|
-
|
|
5892
|
-
|
|
6082
|
+
context: {
|
|
6083
|
+
source
|
|
6084
|
+
}
|
|
6085
|
+
}) => [[source]]]))));
|
|
5893
6086
|
exports.lineurl = (0, combinator_1.lazy)(() => (0, combinator_1.open)(source_1.linebreak, (0, combinator_1.focus)(/^!?https?:\/\/\S+(?=[^\S\n]*(?:$|\n))/, (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 */, (0, combinator_1.convert)(url => `{ ${url} }`, link_1.unsafelink, false))), ({
|
|
5894
|
-
|
|
5895
|
-
|
|
5896
|
-
|
|
6087
|
+
context: {
|
|
6088
|
+
source
|
|
6089
|
+
}
|
|
6090
|
+
}) => [[source]]])])), false, [3 | 0 /* Backtrack.autolink */]));
|
|
6091
|
+
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, undefined, () => [[]], [3 | 0 /* Backtrack.autolink */]), (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, undefined, () => [[]], [3 | 0 /* Backtrack.autolink */]), (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, undefined, () => [[]], [3 | 0 /* Backtrack.autolink */]), (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, undefined, () => [[]], [3 | 0 /* Backtrack.autolink */])]));
|
|
5897
6092
|
|
|
5898
6093
|
/***/ },
|
|
5899
6094
|
|
|
@@ -5915,41 +6110,51 @@ const array_1 = __webpack_require__(6876);
|
|
|
5915
6110
|
const dom_1 = __webpack_require__(394);
|
|
5916
6111
|
const indexA = /^[0-9A-Za-z]+(?:(?:[.-]|, )[0-9A-Za-z]+)*$/;
|
|
5917
6112
|
const indexF = new RegExp(indexA.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => String.fromCodePoint(c.codePointAt(0) + 0xFEE0)));
|
|
5918
|
-
exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(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],
|
|
5919
|
-
|
|
5920
|
-
|
|
5921
|
-
|
|
5922
|
-
}
|
|
5923
|
-
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
}, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))]
|
|
6113
|
+
exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(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], {
|
|
6114
|
+
source,
|
|
6115
|
+
position,
|
|
6116
|
+
range = 0
|
|
6117
|
+
}) => {
|
|
6118
|
+
const str = source.slice(position - range + 1, position - 1);
|
|
6119
|
+
return indexA.test(str) ? [[as[0], str, cs[0]]] : [[(0, dom_1.html)('span', {
|
|
6120
|
+
class: 'paren'
|
|
6121
|
+
}, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))]];
|
|
6122
|
+
}, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 8 /* Backtrack.bracket */]), (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], {
|
|
6123
|
+
source,
|
|
6124
|
+
position,
|
|
6125
|
+
range = 0
|
|
6126
|
+
}) => {
|
|
6127
|
+
const str = source.slice(position - range + 1, position - 1);
|
|
6128
|
+
return indexF.test(str) ? [[as[0], str, cs[0]]] : [[(0, dom_1.html)('span', {
|
|
6129
|
+
class: 'paren'
|
|
6130
|
+
}, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))]];
|
|
6131
|
+
}, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)]), (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], context) => {
|
|
5927
6132
|
if (context.state & 8 /* State.link */) {
|
|
5928
6133
|
const {
|
|
5929
|
-
|
|
6134
|
+
source,
|
|
6135
|
+
position,
|
|
6136
|
+
range = 0
|
|
5930
6137
|
} = context;
|
|
5931
|
-
const head =
|
|
5932
|
-
if (context.linebreak
|
|
6138
|
+
const head = position - range;
|
|
6139
|
+
if (context.linebreak !== 0 || source[position] !== '{') {
|
|
5933
6140
|
(0, combinator_1.setBacktrack)(context, [2 | 64 /* Backtrack.link */], head);
|
|
5934
6141
|
} else {
|
|
5935
6142
|
context.state ^= 8 /* State.link */;
|
|
5936
|
-
const result = !(0, combinator_1.isBacktrack)(context, [1 | 64 /* Backtrack.link */]
|
|
5937
|
-
source: rest,
|
|
6143
|
+
const result = !(0, combinator_1.isBacktrack)(context, [1 | 64 /* Backtrack.link */]) ? (0, link_1.textlink)({
|
|
5938
6144
|
context
|
|
5939
6145
|
}) : undefined;
|
|
6146
|
+
context.position = position;
|
|
5940
6147
|
if (!result) {
|
|
5941
6148
|
(0, combinator_1.setBacktrack)(context, [2 | 64 /* Backtrack.link */], head);
|
|
5942
6149
|
}
|
|
5943
6150
|
context.state ^= 8 /* State.link */;
|
|
5944
|
-
context.
|
|
6151
|
+
context.range = range;
|
|
5945
6152
|
}
|
|
5946
6153
|
}
|
|
5947
|
-
return [(0, array_1.push)((0, array_1.unshift)(as, bs), cs)
|
|
5948
|
-
}, ([as, bs = []]
|
|
6154
|
+
return [(0, array_1.push)((0, array_1.unshift)(as, bs), cs)];
|
|
6155
|
+
}, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 8 /* Backtrack.bracket */]), (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, undefined, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)]), (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, undefined, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 8 /* Backtrack.bracket */]), (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, undefined, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)]),
|
|
5949
6156
|
// 同一行内でしか閉じない以外括弧と同じ挙動
|
|
5950
|
-
(0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '"', [['"', 2, false]]))), (0, source_1.str)('"'), true, ([as, bs = [], cs],
|
|
5951
|
-
linebreak = 0
|
|
5952
|
-
}) => linebreak > rest.length ? [(0, array_1.unshift)(as, bs), cs[0] + rest] : [(0, array_1.push)((0, array_1.unshift)(as, bs), cs), rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], [2 | 8 /* Backtrack.bracket */])]));
|
|
6157
|
+
(0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '"', [['"', 2, false]]))), (0, source_1.str)('"'), true, ([as, bs = [], cs], context) => context.linebreak === 0 ? [(0, array_1.push)((0, array_1.unshift)(as, bs), cs)] : (context.position -= 1, [(0, array_1.unshift)(as, bs)]), ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 8 /* Backtrack.bracket */])]));
|
|
5953
6158
|
|
|
5954
6159
|
/***/ },
|
|
5955
6160
|
|
|
@@ -5964,18 +6169,16 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
5964
6169
|
}));
|
|
5965
6170
|
exports.code = void 0;
|
|
5966
6171
|
const combinator_1 = __webpack_require__(3484);
|
|
6172
|
+
const util_1 = __webpack_require__(4992);
|
|
5967
6173
|
const dom_1 = __webpack_require__(394);
|
|
5968
|
-
exports.code = (0, combinator_1.
|
|
5969
|
-
source,
|
|
5970
|
-
context
|
|
5971
|
-
}) => source[0] === '`' && !(0, combinator_1.isBacktrack)(context, [1 | 8 /* Backtrack.bracket */], source), (0, combinator_1.match)(/^(`+)(?!`)([^\n]*?)(?:((?<!`)\1(?!`))|$|\n)/, ([whole,, body, closer]) => ({
|
|
5972
|
-
source,
|
|
5973
|
-
context
|
|
5974
|
-
}) => closer ? [[(0, dom_1.html)('code', {
|
|
6174
|
+
exports.code = (0, combinator_1.open)(/^(?=`)/, (0, combinator_1.match)(/^(`+)(?!`)([^\n]*?)(?:((?<!`)\1(?!`))|(?=$|\n))/, ([whole, opener, body, closer]) => () => closer ? [[(0, dom_1.html)('code', {
|
|
5975
6175
|
'data-src': whole
|
|
5976
|
-
}, format(body))]
|
|
6176
|
+
}, format(body))]] : body ? [[(0, dom_1.html)('code', {
|
|
6177
|
+
class: 'invalid',
|
|
6178
|
+
...(0, util_1.invalid)('code', 'syntax', `Missing the closing symbol "${opener}"`)
|
|
6179
|
+
}, whole)]] : [[opener]], true), false, [3 | 8 /* Backtrack.bracket */]);
|
|
5977
6180
|
function format(text) {
|
|
5978
|
-
return
|
|
6181
|
+
return text.length > 2 && text[0] === ' ' && text[1] === '`' && text.at(-1) === ' ' ? text.slice(1, -1) : text;
|
|
5979
6182
|
}
|
|
5980
6183
|
|
|
5981
6184
|
/***/ },
|
|
@@ -5996,7 +6199,11 @@ const visibility_1 = __webpack_require__(6364);
|
|
|
5996
6199
|
const util_1 = __webpack_require__(4992);
|
|
5997
6200
|
const array_1 = __webpack_require__(6876);
|
|
5998
6201
|
const dom_1 = __webpack_require__(394);
|
|
5999
|
-
exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('~~', (0, combinator_1.precedence)(0, (0, util_1.repeat)('~~', (0, combinator_1.surround)('', (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', '~~')), (0, combinator_1.open)('\n', (0, combinator_1.some)(exports.deletion, '~'), true)]))), '~~', false, ([, bs],
|
|
6202
|
+
exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('~~', (0, combinator_1.precedence)(0, (0, util_1.repeat)('~~', (0, combinator_1.surround)('', (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', '~~')), (0, combinator_1.open)('\n', (0, combinator_1.some)(exports.deletion, '~'), true)]))), '~~', false, ([, bs], {
|
|
6203
|
+
buffer
|
|
6204
|
+
}) => [(0, array_1.push)(buffer, bs)], ([, bs], {
|
|
6205
|
+
buffer
|
|
6206
|
+
}) => bs && [(0, array_1.push)((0, array_1.push)(buffer, bs), ["\u0018" /* Command.Cancel */])]), nodes => [(0, dom_1.html)('del', (0, dom_1.defrag)(nodes))]))));
|
|
6000
6207
|
|
|
6001
6208
|
/***/ },
|
|
6002
6209
|
|
|
@@ -6018,7 +6225,7 @@ const source_1 = __webpack_require__(8745);
|
|
|
6018
6225
|
const visibility_1 = __webpack_require__(6364);
|
|
6019
6226
|
const array_1 = __webpack_require__(6876);
|
|
6020
6227
|
const dom_1 = __webpack_require__(394);
|
|
6021
|
-
exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('*', '*'), (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, '*'), (0, combinator_1.union)([emstrong_1.emstrong, strong_1.strong, exports.emphasis]))]))))), (0, source_1.str)('*'), false, ([, bs]
|
|
6228
|
+
exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('*', '*'), (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, '*'), (0, combinator_1.union)([emstrong_1.emstrong, strong_1.strong, exports.emphasis]))]))))), (0, source_1.str)('*'), false, ([, bs]) => [[(0, dom_1.html)('em', (0, dom_1.defrag)(bs))]], ([as, bs]) => bs && [(0, array_1.unshift)(as, bs)]));
|
|
6022
6229
|
|
|
6023
6230
|
/***/ },
|
|
6024
6231
|
|
|
@@ -6039,59 +6246,119 @@ const emphasis_1 = __webpack_require__(1354);
|
|
|
6039
6246
|
const source_1 = __webpack_require__(8745);
|
|
6040
6247
|
const visibility_1 = __webpack_require__(6364);
|
|
6041
6248
|
const util_1 = __webpack_require__(4992);
|
|
6042
|
-
const dom_1 = __webpack_require__(394);
|
|
6043
6249
|
const array_1 = __webpack_require__(6876);
|
|
6044
|
-
const
|
|
6250
|
+
const dom_1 = __webpack_require__(394);
|
|
6251
|
+
const substrong = (0, combinator_1.lazy)(() => (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, '*'), (0, combinator_1.union)([exports.emstrong, strong_1.strong, emphasis_1.emphasis]))])));
|
|
6045
6252
|
const subemphasis = (0, combinator_1.lazy)(() => (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, '*'), (0, combinator_1.union)([exports.emstrong, strong_1.strong, emphasis_1.emphasis]))])));
|
|
6046
6253
|
// 開閉が明示的でない構文は開閉の不明確な記号による再帰的適用を行わず
|
|
6047
6254
|
// 可能な限り早く閉じるよう解析しなければならない。
|
|
6048
6255
|
// このため終端記号の後ろを見て終端を中止し同じ構文を再帰的に適用してはならない。
|
|
6049
|
-
exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('***', (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, '*'),
|
|
6256
|
+
exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('***', (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, '*'), (0, combinator_1.union)([exports.emstrong, strong_1.strong, emphasis_1.emphasis]))])))), (0, source_1.str)(/^\*{1,3}/), false, ([, bs, cs], context) => {
|
|
6257
|
+
const {
|
|
6258
|
+
buffer
|
|
6259
|
+
} = context;
|
|
6050
6260
|
switch (cs[0]) {
|
|
6051
6261
|
case '***':
|
|
6052
|
-
return [bs
|
|
6262
|
+
return [bs];
|
|
6053
6263
|
case '**':
|
|
6054
|
-
return (0, combinator_1.bind)(subemphasis,
|
|
6055
|
-
|
|
6264
|
+
return (0, combinator_1.bind)(subemphasis, ds => {
|
|
6265
|
+
const {
|
|
6266
|
+
source
|
|
6267
|
+
} = context;
|
|
6268
|
+
if (source.startsWith('*', context.position)) {
|
|
6269
|
+
context.position += 1;
|
|
6270
|
+
return [[(0, dom_1.html)('em', (0, array_1.push)((0, array_1.push)(buffer, [(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))]), (0, dom_1.defrag)(ds))), "\u001F" /* Command.Separator */]];
|
|
6271
|
+
} else {
|
|
6272
|
+
return [prepend('*', (0, array_1.push)((0, array_1.push)((0, array_1.push)(buffer, [(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))]), (0, dom_1.defrag)(ds)), ["\u001F" /* Command.Separator */]))];
|
|
6273
|
+
}
|
|
6274
|
+
})({
|
|
6056
6275
|
context
|
|
6057
|
-
}) ?? [
|
|
6276
|
+
}) ?? [prepend('*', (0, array_1.push)((0, array_1.push)(buffer, [(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))]), ["\u001F" /* Command.Separator */]))];
|
|
6058
6277
|
case '*':
|
|
6059
|
-
return (0, combinator_1.bind)(substrong,
|
|
6060
|
-
|
|
6278
|
+
return (0, combinator_1.bind)(substrong, ds => {
|
|
6279
|
+
const {
|
|
6280
|
+
source
|
|
6281
|
+
} = context;
|
|
6282
|
+
if (source.startsWith('**', context.position)) {
|
|
6283
|
+
context.position += 2;
|
|
6284
|
+
return [[(0, dom_1.html)('strong', (0, array_1.push)((0, array_1.push)(buffer, [(0, dom_1.html)('em', (0, dom_1.defrag)(bs))]), (0, dom_1.defrag)(ds))), "\u001F" /* Command.Separator */]];
|
|
6285
|
+
} else {
|
|
6286
|
+
return [prepend('**', (0, array_1.push)((0, array_1.push)((0, array_1.push)(buffer, [(0, dom_1.html)('em', (0, dom_1.defrag)(bs))]), (0, dom_1.defrag)(ds)), ["\u001F" /* Command.Separator */]))];
|
|
6287
|
+
}
|
|
6288
|
+
})({
|
|
6061
6289
|
context
|
|
6062
|
-
}) ?? [
|
|
6290
|
+
}) ?? [prepend('**', (0, array_1.push)((0, array_1.push)(buffer, [(0, dom_1.html)('em', (0, dom_1.defrag)(bs))]), ["\u001F" /* Command.Separator */]))];
|
|
6063
6291
|
}
|
|
6064
|
-
}, ([
|
|
6292
|
+
}, ([, bs], {
|
|
6293
|
+
buffer
|
|
6294
|
+
}) => bs && [(0, array_1.push)((0, array_1.push)(buffer, bs), ["\u0018" /* Command.Cancel */])]),
|
|
6065
6295
|
// 3以上の`*`に対してemの適用を保証する
|
|
6066
|
-
nodes => [(0, dom_1.html)('em', [(0, dom_1.html)('strong', (0, dom_1.defrag)(nodes))])], (
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6296
|
+
nodes => [(0, dom_1.html)('em', [(0, dom_1.html)('strong', (0, dom_1.defrag)(nodes))])], (nodes, context, prefix, postfix, state) => {
|
|
6297
|
+
context.position += postfix;
|
|
6298
|
+
if (state) {
|
|
6299
|
+
switch (postfix) {
|
|
6300
|
+
case 0:
|
|
6301
|
+
break;
|
|
6071
6302
|
case 1:
|
|
6072
|
-
|
|
6073
|
-
i -= 1;
|
|
6303
|
+
nodes = [(0, dom_1.html)('em', (0, dom_1.defrag)(nodes))];
|
|
6074
6304
|
break;
|
|
6075
6305
|
case 2:
|
|
6076
|
-
|
|
6077
|
-
i -= 2;
|
|
6306
|
+
nodes = [(0, dom_1.html)('strong', (0, dom_1.defrag)(nodes))];
|
|
6078
6307
|
break;
|
|
6079
6308
|
default:
|
|
6080
|
-
|
|
6081
|
-
|
|
6309
|
+
}
|
|
6310
|
+
prefix -= postfix;
|
|
6311
|
+
postfix -= postfix;
|
|
6312
|
+
switch (prefix) {
|
|
6313
|
+
case 0:
|
|
6314
|
+
break;
|
|
6315
|
+
case 1:
|
|
6316
|
+
nodes = (0, combinator_1.bind)(subemphasis, ds => {
|
|
6317
|
+
const {
|
|
6318
|
+
source
|
|
6319
|
+
} = context;
|
|
6320
|
+
if (source.startsWith('*', context.position)) {
|
|
6321
|
+
context.position += 1;
|
|
6322
|
+
return [[(0, dom_1.html)('em', (0, array_1.push)(nodes, (0, dom_1.defrag)(ds)))]];
|
|
6323
|
+
} else {
|
|
6324
|
+
return [prepend('*', (0, array_1.push)(nodes, (0, dom_1.defrag)(ds)))];
|
|
6325
|
+
}
|
|
6326
|
+
})({
|
|
6327
|
+
context
|
|
6328
|
+
})?.[0] ?? prepend('*', nodes);
|
|
6329
|
+
prefix -= 1;
|
|
6330
|
+
break;
|
|
6331
|
+
case 2:
|
|
6332
|
+
nodes = (0, combinator_1.bind)(substrong, ds => {
|
|
6333
|
+
const {
|
|
6334
|
+
source
|
|
6335
|
+
} = context;
|
|
6336
|
+
if (source.startsWith('**', context.position)) {
|
|
6337
|
+
context.position += 2;
|
|
6338
|
+
return [[(0, dom_1.html)('strong', (0, array_1.push)(nodes, (0, dom_1.defrag)(ds)))]];
|
|
6339
|
+
} else {
|
|
6340
|
+
return [prepend('**', (0, array_1.push)(nodes, (0, dom_1.defrag)(ds)))];
|
|
6341
|
+
}
|
|
6342
|
+
})({
|
|
6343
|
+
context
|
|
6344
|
+
})?.[0] ?? prepend('**', nodes);
|
|
6345
|
+
prefix -= 2;
|
|
6346
|
+
break;
|
|
6082
6347
|
}
|
|
6083
6348
|
}
|
|
6084
6349
|
if (prefix > postfix) {
|
|
6085
|
-
nodes.push('*'.repeat(prefix - postfix));
|
|
6086
|
-
}
|
|
6087
|
-
for (let i = 0; i < acc.length; ++i) {
|
|
6088
|
-
nodes.push(...acc[i]);
|
|
6350
|
+
nodes = (0, array_1.push)(['*'.repeat(prefix - postfix)], nodes);
|
|
6089
6351
|
}
|
|
6090
|
-
|
|
6091
|
-
rest = rest.slice(postfix);
|
|
6092
|
-
}
|
|
6093
|
-
return [nodes, rest];
|
|
6352
|
+
return [nodes];
|
|
6094
6353
|
}))));
|
|
6354
|
+
function prepend(prefix, nodes) {
|
|
6355
|
+
if (typeof nodes[0] === 'string') {
|
|
6356
|
+
nodes[0] = prefix + nodes[0];
|
|
6357
|
+
} else {
|
|
6358
|
+
(0, array_1.unshift)([prefix], nodes);
|
|
6359
|
+
}
|
|
6360
|
+
return nodes;
|
|
6361
|
+
}
|
|
6095
6362
|
|
|
6096
6363
|
/***/ },
|
|
6097
6364
|
|
|
@@ -6123,7 +6390,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
6123
6390
|
value: true
|
|
6124
6391
|
}));
|
|
6125
6392
|
exports.dataindex = exports.signature = exports.index = void 0;
|
|
6126
|
-
const parser_1 = __webpack_require__(605);
|
|
6127
6393
|
const combinator_1 = __webpack_require__(3484);
|
|
6128
6394
|
const inline_1 = __webpack_require__(7973);
|
|
6129
6395
|
const indexee_1 = __webpack_require__(7610);
|
|
@@ -6132,16 +6398,9 @@ const source_1 = __webpack_require__(8745);
|
|
|
6132
6398
|
const visibility_1 = __webpack_require__(6364);
|
|
6133
6399
|
const array_1 = __webpack_require__(6876);
|
|
6134
6400
|
const dom_1 = __webpack_require__(394);
|
|
6135
|
-
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, ([
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
'data-index': dataindex(bs)
|
|
6139
|
-
}, (0, dom_1.defrag)(bs))], rest];
|
|
6140
|
-
}
|
|
6141
|
-
return (context.state & 251 /* State.linkers */) === 251 /* State.linkers */ ? [(0, array_1.push)((0, array_1.push)((0, array_1.unshift)(as, bs), cs), ['']), rest] : undefined;
|
|
6142
|
-
}, ([as, bs], rest, context) => {
|
|
6143
|
-
return (context.state & 251 /* State.linkers */) === 251 /* State.linkers */ ? [(0, array_1.push)((0, array_1.unshift)(as, bs), ['']), rest] : undefined;
|
|
6144
|
-
}, [3 | 8 /* Backtrack.bracket */])), ns => {
|
|
6401
|
+
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, ([, bs], context) => context.linebreak === 0 && (0, visibility_1.trimBlankNodeEnd)(bs).length > 0 ? [[(0, dom_1.html)('a', {
|
|
6402
|
+
'data-index': dataindex(bs)
|
|
6403
|
+
}, (0, dom_1.defrag)(bs))]] : undefined, undefined, [3 | 8 /* Backtrack.bracket */])), ns => {
|
|
6145
6404
|
if (ns.length === 1) {
|
|
6146
6405
|
const el = ns[0];
|
|
6147
6406
|
return [(0, dom_1.define)(el, {
|
|
@@ -6154,20 +6413,13 @@ exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(32 /*
|
|
|
6154
6413
|
return ns;
|
|
6155
6414
|
}
|
|
6156
6415
|
})));
|
|
6157
|
-
exports.signature = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('|', (0, combinator_1.surround)((0, source_1.str)(/^\|(?!\\?\s)/), (0,
|
|
6158
|
-
|
|
6159
|
-
//context.offset += rest.length;
|
|
6160
|
-
const text = (0, parser_1.eval)(sig({
|
|
6161
|
-
source: context.recent[1],
|
|
6162
|
-
context
|
|
6163
|
-
}), []).join('');
|
|
6164
|
-
//context.offset -= rest.length;
|
|
6165
|
-
const index = (0, indexee_1.identity)('index', undefined, text)?.slice(7);
|
|
6416
|
+
exports.signature = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('|', (0, combinator_1.surround)((0, source_1.str)(/^\|(?!\\?\s)/), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, (0, combinator_1.focus)(/^(?:[^\\[\](){}<>"$`\n]|\\[^\n]?)/, source_1.txt, false)]), ']'), /^(?=])/, false, ([, ns]) => {
|
|
6417
|
+
const index = (0, indexee_1.identity)('index', undefined, ns.join(''))?.slice(7);
|
|
6166
6418
|
return index ? [[(0, dom_1.html)('span', {
|
|
6167
6419
|
class: 'indexer',
|
|
6168
6420
|
'data-index': index
|
|
6169
|
-
})]
|
|
6170
|
-
}, ([as, bs]
|
|
6421
|
+
})]] : undefined;
|
|
6422
|
+
}, ([as, bs]) => bs && [(0, array_1.unshift)(as, bs)])));
|
|
6171
6423
|
function dataindex(ns) {
|
|
6172
6424
|
if (ns.length === 0) return;
|
|
6173
6425
|
for (let i = ns.length; i--;) {
|
|
@@ -6179,7 +6431,6 @@ function dataindex(ns) {
|
|
|
6179
6431
|
}
|
|
6180
6432
|
}
|
|
6181
6433
|
exports.dataindex = dataindex;
|
|
6182
|
-
const sig = (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]));
|
|
6183
6434
|
|
|
6184
6435
|
/***/ },
|
|
6185
6436
|
|
|
@@ -6196,7 +6447,7 @@ exports.text = exports.signature = exports.identity = exports.indexee = void 0;
|
|
|
6196
6447
|
const combinator_1 = __webpack_require__(3484);
|
|
6197
6448
|
const dom_1 = __webpack_require__(394);
|
|
6198
6449
|
function indexee(parser) {
|
|
6199
|
-
return (0, combinator_1.fmap)(parser, (ns,
|
|
6450
|
+
return (0, combinator_1.fmap)(parser, (ns, {
|
|
6200
6451
|
id
|
|
6201
6452
|
}) => ns.length === 1 ? [(0, dom_1.define)(ns[0], {
|
|
6202
6453
|
id: identity('index', id, ns[0]),
|
|
@@ -6341,7 +6592,7 @@ const dom_1 = __webpack_require__(394);
|
|
|
6341
6592
|
exports.indexer = (0, combinator_1.surround)(/^\s+\[(?=\|\S)/, (0, combinator_1.union)([index_1.signature, (0, combinator_1.focus)(/^\|(?=\])/, () => [[(0, dom_1.html)('span', {
|
|
6342
6593
|
class: 'indexer',
|
|
6343
6594
|
'data-index': ''
|
|
6344
|
-
})]
|
|
6595
|
+
})]])]), /^\]\s*$/);
|
|
6345
6596
|
|
|
6346
6597
|
/***/ },
|
|
6347
6598
|
|
|
@@ -6403,10 +6654,12 @@ const array_1 = __webpack_require__(6876);
|
|
|
6403
6654
|
const dom_1 = __webpack_require__(394);
|
|
6404
6655
|
// Don't use the symbols already used: !#$%@&*+~=|
|
|
6405
6656
|
// All syntax surrounded by square brackets shouldn't contain line breaks.
|
|
6406
|
-
exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.surround)(
|
|
6657
|
+
exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.surround)(
|
|
6658
|
+
// ^はabbrで使用済みだが^:などのようにして分離使用可能
|
|
6659
|
+
(0, source_1.str)(/^\[[:^|]/), (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, (_, context) => [[(0, dom_1.html)('span', {
|
|
6407
6660
|
class: 'invalid',
|
|
6408
6661
|
...(0, util_1.invalid)('extension', 'syntax', `Invalid start symbol or linebreak`)
|
|
6409
|
-
}, (
|
|
6662
|
+
}, context.source.slice(context.position - context.range, context.position))]], ([as, bs]) => bs && [(0, array_1.unshift)(as, bs)], [3 | 8 /* Backtrack.bracket */]));
|
|
6410
6663
|
|
|
6411
6664
|
/***/ },
|
|
6412
6665
|
|
|
@@ -6439,27 +6692,27 @@ Object.setPrototypeOf(attrspecs, null);
|
|
|
6439
6692
|
Object.values(attrspecs).forEach(o => Object.setPrototypeOf(o, null));
|
|
6440
6693
|
exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/^<[a-z]+(?=[^\S\n]|>)/i, (0, combinator_1.union)([(0, combinator_1.surround)(
|
|
6441
6694
|
// https://html.spec.whatwg.org/multipage/syntax.html#void-elements
|
|
6442
|
-
(0, source_1.str)(/^<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[^\S\n]|>)/i), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, combinator_1.open)((0, source_1.str)(/^[^\S\n]*/), (0, source_1.str)('>'), true), true, ([as, bs = [], cs],
|
|
6695
|
+
(0, source_1.str)(/^<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[^\S\n]|>)/i), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, combinator_1.open)((0, source_1.str)(/^[^\S\n]*/), (0, source_1.str)('>'), true), true, ([as, bs = [], cs], context) => [[elem(as[0].slice(1), false, (0, array_1.push)((0, array_1.unshift)(as, bs), cs), [], [], context)]], ([as, bs = []], context) => [[elem(as[0].slice(1), false, (0, array_1.unshift)(as, bs), [], [], context)]]), (0, combinator_1.match)(new RegExp(String.raw`^<(${TAGS.join('|')})(?=[^\S\n]|>)`), (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)(/^[^\S\n]*/), (0, source_1.str)('>'), true), true, ([as, bs = [], cs]) => [(0, array_1.push)((0, array_1.unshift)(as, bs), cs)], ([as, bs = []]) => [(0, array_1.unshift)(as, bs)]), (0, combinator_1.precedence)(3, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.subsequence)([(0, combinator_1.focus)(/^[^\S\n]*\n/, (0, combinator_1.some)(inline_1.inline)), (0, combinator_1.some)((0, combinator_1.open)(/^\n?/, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', `</${tag}>`), [[(0, visibility_1.blankWith)('\n', `</${tag}>`), 3]]), true))]))), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], context) => [[elem(tag, true, as, bs, cs, context)]], ([as, bs = []], context) => [[elem(tag, true, as, bs, [], context)]]), ([, tag]) => tag, new Map())), (0, combinator_1.surround)(
|
|
6443
6696
|
// https://html.spec.whatwg.org/multipage/syntax.html#void-elements
|
|
6444
|
-
(0, source_1.str)(/^<[a-z]{1,16}(?=[^\S\n]|>)/i), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, combinator_1.open)((0, source_1.str)(/^[^\S\n]*/), (0, source_1.str)('>'), true), true, ([as, bs = [], cs],
|
|
6697
|
+
(0, source_1.str)(/^<[a-z]{1,16}(?=[^\S\n]|>)/i), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, combinator_1.open)((0, source_1.str)(/^[^\S\n]*/), (0, source_1.str)('>'), true), true, ([as, bs = [], cs], context) => [[elem(as[0].slice(1), false, (0, array_1.push)((0, array_1.unshift)(as, bs), cs), [], [], context)]], ([as, bs = []], context) => [[elem(as[0].slice(1), false, (0, array_1.unshift)(as, bs), [], [], context)]])])));
|
|
6445
6698
|
exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[^\S\n]|>)/i), (0, source_1.str)(/^[^\S\n]+[^\s<>]+/)]);
|
|
6446
|
-
function elem(tag, content, as, bs, cs) {
|
|
6447
|
-
if (!tags.includes(tag)) return ielem('tag', `Invalid HTML tag name "${tag}"`,
|
|
6699
|
+
function elem(tag, content, as, bs, cs, context) {
|
|
6700
|
+
if (!tags.includes(tag)) return ielem('tag', `Invalid HTML tag name "${tag}"`, context);
|
|
6448
6701
|
if (content) {
|
|
6449
|
-
if (cs.length === 0) return ielem('tag', `Missing the closing HTML tag "</${tag}>"`,
|
|
6450
|
-
if (bs.length === 0) return ielem('content', `Missing the content`,
|
|
6451
|
-
if (!(0, visibility_1.isLooseNodeStart)(bs)) return ielem('content', `Missing the visible content in the same line`,
|
|
6702
|
+
if (cs.length === 0) return ielem('tag', `Missing the closing HTML tag "</${tag}>"`, context);
|
|
6703
|
+
if (bs.length === 0) return ielem('content', `Missing the content`, context);
|
|
6704
|
+
if (!(0, visibility_1.isLooseNodeStart)(bs)) return ielem('content', `Missing the visible content in the same line`, context);
|
|
6452
6705
|
}
|
|
6453
6706
|
const attrs = attributes('html', attrspecs[tag], as.slice(1, as.at(-1) === '>' ? -2 : as.length));
|
|
6454
|
-
if (/(?<!\S)invalid(?!\S)/.test(attrs['class'] ?? '')) return ielem('attribute', 'Invalid HTML attribute',
|
|
6455
|
-
if (as.at(-1) !== '>') return ielem('tag', `Missing the closing
|
|
6707
|
+
if (/(?<!\S)invalid(?!\S)/.test(attrs['class'] ?? '')) return ielem('attribute', 'Invalid HTML attribute', context);
|
|
6708
|
+
if (as.at(-1) !== '>') return ielem('tag', `Missing the closing symbol ">"`, context);
|
|
6456
6709
|
return (0, dom_1.html)(tag, attrs, (0, dom_1.defrag)(bs));
|
|
6457
6710
|
}
|
|
6458
|
-
function ielem(type, message,
|
|
6711
|
+
function ielem(type, message, context) {
|
|
6459
6712
|
return (0, dom_1.html)('span', {
|
|
6460
6713
|
class: 'invalid',
|
|
6461
6714
|
...(0, util_1.invalid)('html', type, message)
|
|
6462
|
-
}, (
|
|
6715
|
+
}, context.source.slice(context.position - context.range, context.position));
|
|
6463
6716
|
}
|
|
6464
6717
|
const requiredAttributes = (0, memoize_1.memoize)(spec => Object.entries(spec).flatMap(([k, v]) => v && Object.isFrozen(v) ? [k] : []), new WeakMap());
|
|
6465
6718
|
function attributes(syntax, spec, params) {
|
|
@@ -6501,12 +6754,18 @@ exports.htmlentity = exports.unsafehtmlentity = void 0;
|
|
|
6501
6754
|
const combinator_1 = __webpack_require__(3484);
|
|
6502
6755
|
const util_1 = __webpack_require__(4992);
|
|
6503
6756
|
const dom_1 = __webpack_require__(394);
|
|
6504
|
-
exports.unsafehtmlentity = (0, combinator_1.validate)('&', (0, combinator_1.focus)(/^&[0-9A-Za-z]
|
|
6757
|
+
exports.unsafehtmlentity = (0, combinator_1.validate)('&', (0, combinator_1.focus)(/^&(?:[0-9A-Za-z]+;?)?/,
|
|
6505
6758
|
//({ source }) => [[parser(source) ?? `${Command.Error}${source}`], '']));
|
|
6506
6759
|
({
|
|
6507
|
-
|
|
6508
|
-
}) =>
|
|
6509
|
-
|
|
6760
|
+
context
|
|
6761
|
+
}) => {
|
|
6762
|
+
const {
|
|
6763
|
+
source
|
|
6764
|
+
} = context;
|
|
6765
|
+
context.position += source.length;
|
|
6766
|
+
return source.length > 1 && source.at(-1) === ';' ? [[parser(source) ?? source]] : [[source]];
|
|
6767
|
+
}));
|
|
6768
|
+
exports.htmlentity = (0, combinator_1.fmap)((0, combinator_1.union)([exports.unsafehtmlentity]), ([text]) => [length === 1 || text.at(-1) !== ';' ? text : (0, dom_1.html)('span', {
|
|
6510
6769
|
class: 'invalid',
|
|
6511
6770
|
...(0, util_1.invalid)('htmlentity', 'syntax', 'Invalid HTML entity')
|
|
6512
6771
|
}, text)]);
|
|
@@ -6535,7 +6794,11 @@ const visibility_1 = __webpack_require__(6364);
|
|
|
6535
6794
|
const util_1 = __webpack_require__(4992);
|
|
6536
6795
|
const array_1 = __webpack_require__(6876);
|
|
6537
6796
|
const dom_1 = __webpack_require__(394);
|
|
6538
|
-
exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('++', (0, combinator_1.precedence)(0, (0, util_1.repeat)('++', (0, combinator_1.surround)('', (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', '++')), (0, combinator_1.open)('\n', (0, combinator_1.some)(exports.insertion, '+'), true)]))), '++', false, ([, bs],
|
|
6797
|
+
exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('++', (0, combinator_1.precedence)(0, (0, util_1.repeat)('++', (0, combinator_1.surround)('', (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', '++')), (0, combinator_1.open)('\n', (0, combinator_1.some)(exports.insertion, '+'), true)]))), '++', false, ([, bs], {
|
|
6798
|
+
buffer
|
|
6799
|
+
}) => [(0, array_1.push)(buffer, bs)], ([, bs], {
|
|
6800
|
+
buffer
|
|
6801
|
+
}) => bs && [(0, array_1.push)((0, array_1.push)(buffer, bs), ["\u0018" /* Command.Cancel */])]), nodes => [(0, dom_1.html)('ins', (0, dom_1.defrag)(nodes))]))));
|
|
6539
6802
|
|
|
6540
6803
|
/***/ },
|
|
6541
6804
|
|
|
@@ -6558,7 +6821,11 @@ const dom_1 = __webpack_require__(394);
|
|
|
6558
6821
|
// 可読性のため実際にはオブリーク体を指定する。
|
|
6559
6822
|
// 斜体は単語に使うとかえって見づらく読み飛ばしやすくなるため使わないべきであり
|
|
6560
6823
|
// ある程度の長さのある文に使うのが望ましい。
|
|
6561
|
-
exports.italic = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('///', (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, '/'), exports.italic)])))), '///', false, ([, bs],
|
|
6824
|
+
exports.italic = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('///', (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, '/'), exports.italic)])))), '///', false, ([, bs], {
|
|
6825
|
+
buffer
|
|
6826
|
+
}) => [(0, array_1.push)(buffer, bs)], ([, bs], {
|
|
6827
|
+
buffer
|
|
6828
|
+
}) => bs && [(0, array_1.push)((0, array_1.push)(buffer, bs), ["\u0018" /* Command.Cancel */])]), nodes => [(0, dom_1.html)('i', (0, dom_1.defrag)(nodes))]))));
|
|
6562
6829
|
|
|
6563
6830
|
/***/ },
|
|
6564
6831
|
|
|
@@ -6585,26 +6852,38 @@ const optspec = {
|
|
|
6585
6852
|
rel: ['nofollow']
|
|
6586
6853
|
};
|
|
6587
6854
|
Object.setPrototypeOf(optspec, null);
|
|
6588
|
-
exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */, (0, combinator_1.creation)(10, (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.bind)((0, combinator_1.subsequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])), ']', true, ([, ns = []],
|
|
6855
|
+
exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */, (0, combinator_1.creation)(10, (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.bind)((0, combinator_1.subsequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])), ']', true, ([, ns = []], context) => context.linebreak === 0 ? [(0, array_1.push)(ns, ["\u001F" /* Command.Separator */])] : undefined, undefined, [3 | 64 /* Backtrack.link */, 2 | 32 /* Backtrack.ruby */, 3 | 8 /* Backtrack.bracket */])),
|
|
6589
6856
|
// `{ `と`{`で個別にバックトラックが発生し+1nされる。
|
|
6590
6857
|
// 自己再帰的にパースしてもオプションの不要なパースによる計算量の増加により相殺される。
|
|
6591
|
-
(0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/, false, undefined,
|
|
6592
|
-
if (
|
|
6858
|
+
(0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/, false, undefined, ([as, bs], context) => {
|
|
6859
|
+
if (!bs) return;
|
|
6860
|
+
const head = context.position - context.range;
|
|
6861
|
+
(0, combinator_1.setBacktrack)(context, [2 | 64 /* Backtrack.link */], head);
|
|
6862
|
+
return [(0, array_1.push)((0, array_1.unshift)(as, bs), ["\u0018" /* Command.Cancel */])];
|
|
6863
|
+
}, [3 | 64 /* Backtrack.link */]))]), ([content, params], context) => {
|
|
6864
|
+
if (content.at(-1) === "\u001F" /* Command.Separator */) {
|
|
6593
6865
|
content.pop();
|
|
6594
6866
|
if (params === undefined) {
|
|
6595
|
-
const head = context.
|
|
6867
|
+
const head = context.position - context.range;
|
|
6596
6868
|
return void (0, combinator_1.setBacktrack)(context, [2 | 64 /* Backtrack.link */], head);
|
|
6597
6869
|
}
|
|
6598
6870
|
} else {
|
|
6599
6871
|
params = content;
|
|
6600
6872
|
content = [];
|
|
6601
6873
|
}
|
|
6874
|
+
if (params.at(-1) === "\u0018" /* Command.Cancel */) {
|
|
6875
|
+
params.pop();
|
|
6876
|
+
return [[(0, dom_1.html)('span', {
|
|
6877
|
+
class: 'invalid',
|
|
6878
|
+
...(0, util_1.invalid)('link', 'syntax', 'Missing the closing symbol "}"')
|
|
6879
|
+
}, context.source.slice(context.position - context.range, context.position))]];
|
|
6880
|
+
}
|
|
6602
6881
|
if (content.length !== 0 && (0, visibility_1.trimBlankNodeEnd)(content).length === 0) return;
|
|
6603
|
-
return [[parse((0, dom_1.defrag)(content), params, context)]
|
|
6882
|
+
return [[parse((0, dom_1.defrag)(content), params, context)]];
|
|
6604
6883
|
}))))));
|
|
6605
|
-
exports.medialink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */ | 4 /* State.media */, (0, combinator_1.validate)(['[', '{'], (0, combinator_1.creation)(10, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.bind)((0, combinator_1.reverse)((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)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))])), ([params, content = []],
|
|
6884
|
+
exports.medialink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */ | 4 /* State.media */, (0, combinator_1.validate)(['[', '{'], (0, combinator_1.creation)(10, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.bind)((0, combinator_1.reverse)((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)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))])), ([params, content = []], context) => [[parse((0, dom_1.defrag)(content), params, context)]]))))));
|
|
6606
6885
|
exports.linemedialink = (0, combinator_1.surround)(source_1.linebreak, (0, combinator_1.union)([exports.medialink]), /^(?=[^\S\n]*(?:$|\n))/);
|
|
6607
|
-
exports.unsafelink = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(10, (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([source_1.unescsource]), ']'), ']')), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))])), ([params, content = []],
|
|
6886
|
+
exports.unsafelink = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(10, (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([source_1.unescsource]), ']'), ']')), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))])), ([params, content = []], context) => [[parse((0, dom_1.defrag)(content), params, context)]])));
|
|
6608
6887
|
exports.uri = (0, combinator_1.union)([(0, combinator_1.open)(/^[^\S\n]+/, (0, source_1.str)(/^\S+/)), (0, source_1.str)(/^[^\s{}]+/)]);
|
|
6609
6888
|
exports.option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+nofollow(?=[^\S\n]|})/), () => [` rel="nofollow"`]), (0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[^\S\n]|})/i), (0, source_1.str)(/^[^\S\n]+[^\s{}]+/)]);
|
|
6610
6889
|
function parse(content, params, context) {
|
|
@@ -6715,14 +6994,18 @@ const visibility_1 = __webpack_require__(6364);
|
|
|
6715
6994
|
const util_1 = __webpack_require__(4992);
|
|
6716
6995
|
const array_1 = __webpack_require__(6876);
|
|
6717
6996
|
const dom_1 = __webpack_require__(394);
|
|
6718
|
-
exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(251 /* State.linkers */ & ~2 /* State.mark */, (0, combinator_1.validate)('==', (0, combinator_1.precedence)(0, (0, combinator_1.state)(2 /* State.mark */, (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, '='), exports.mark)])))), '==', false, ([, bs],
|
|
6997
|
+
exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(251 /* State.linkers */ & ~2 /* State.mark */, (0, combinator_1.validate)('==', (0, combinator_1.precedence)(0, (0, combinator_1.state)(2 /* State.mark */, (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, '='), exports.mark)])))), '==', false, ([, bs], {
|
|
6998
|
+
buffer
|
|
6999
|
+
}) => [(0, array_1.push)(buffer, bs)], ([, bs], {
|
|
7000
|
+
buffer
|
|
7001
|
+
}) => bs && [(0, array_1.push)((0, array_1.push)(buffer, bs), ["\u0018" /* Command.Cancel */])]), (nodes, {
|
|
6719
7002
|
id
|
|
6720
7003
|
}) => {
|
|
6721
7004
|
const el = (0, dom_1.html)('mark', (0, dom_1.defrag)(nodes));
|
|
6722
7005
|
(0, dom_1.define)(el, {
|
|
6723
7006
|
id: (0, indexee_1.identity)('mark', id, (0, indexee_1.signature)(el))
|
|
6724
7007
|
});
|
|
6725
|
-
return el.id ? [el,
|
|
7008
|
+
return el.id ? [el, (0, dom_1.html)('a', {
|
|
6726
7009
|
href: `#${el.id}`
|
|
6727
7010
|
})] : [el];
|
|
6728
7011
|
}))))));
|
|
@@ -6745,8 +7028,8 @@ const util_1 = __webpack_require__(4992);
|
|
|
6745
7028
|
const dom_1 = __webpack_require__(394);
|
|
6746
7029
|
const forbiddenCommand = /\\(?:begin|tiny|huge|large)(?![a-z])/i;
|
|
6747
7030
|
exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('$', (0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)(/^\$(?={)/, (0, combinator_1.precedence)(5, bracket), '$', false, undefined, undefined, [3 | 8 /* Backtrack.bracket */]), (0, combinator_1.surround)(/^\$(?![\s{}])/, (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.precedence)(5, bracket), (0, combinator_1.some)((0, combinator_1.focus)(/^(?:[ ([](?!\$)|\\[\\{}$#]?|[!%&')\x2A-\x5A\]^_\x61-\x7A|~])/, source_1.escsource, false), '://')]))), /^\$(?![0-9A-Za-z])/, false, undefined, undefined, [3 | 8 /* Backtrack.bracket */])]), ({
|
|
6748
|
-
source,
|
|
6749
7031
|
context: {
|
|
7032
|
+
source,
|
|
6750
7033
|
caches: {
|
|
6751
7034
|
math: cache
|
|
6752
7035
|
} = {}
|
|
@@ -6759,7 +7042,7 @@ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('$', (0,
|
|
|
6759
7042
|
class: 'invalid',
|
|
6760
7043
|
translate: 'no',
|
|
6761
7044
|
...(0, util_1.invalid)('math', 'content', `"${source.match(forbiddenCommand)[0]}" command is forbidden`)
|
|
6762
|
-
}, source)]
|
|
7045
|
+
}, source)]])));
|
|
6763
7046
|
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.escsource, /^[{}$#\n]/)]))), (0, source_1.str)('}'), true));
|
|
6764
7047
|
|
|
6765
7048
|
/***/ },
|
|
@@ -6774,6 +7057,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
6774
7057
|
value: true
|
|
6775
7058
|
}));
|
|
6776
7059
|
exports.linemedia = exports.media = void 0;
|
|
7060
|
+
const parser_1 = __webpack_require__(605);
|
|
6777
7061
|
const combinator_1 = __webpack_require__(3484);
|
|
6778
7062
|
const link_1 = __webpack_require__(3628);
|
|
6779
7063
|
const html_1 = __webpack_require__(5013);
|
|
@@ -6781,6 +7065,7 @@ const htmlentity_1 = __webpack_require__(470);
|
|
|
6781
7065
|
const source_1 = __webpack_require__(8745);
|
|
6782
7066
|
const util_1 = __webpack_require__(4992);
|
|
6783
7067
|
const url_1 = __webpack_require__(1904);
|
|
7068
|
+
const array_1 = __webpack_require__(6876);
|
|
6784
7069
|
const dom_1 = __webpack_require__(394);
|
|
6785
7070
|
const optspec = {
|
|
6786
7071
|
'width': [],
|
|
@@ -6789,7 +7074,19 @@ const optspec = {
|
|
|
6789
7074
|
rel: undefined
|
|
6790
7075
|
};
|
|
6791
7076
|
Object.setPrototypeOf(optspec, null);
|
|
6792
|
-
exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.creation)(10, (0, combinator_1.open)('!', (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']')), ']', true, ([, ns = []],
|
|
7077
|
+
exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.creation)(10, (0, combinator_1.open)('!', (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']')), ']', true, ([, ns = []], context) => context.linebreak === 0 ? [ns] : undefined, undefined, [3 | 4 /* Backtrack.escbracket */])), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), /^[^\S\n]*}/, false, undefined, ([as, bs], context) => {
|
|
7078
|
+
if (!bs) return;
|
|
7079
|
+
const head = context.position - context.range;
|
|
7080
|
+
(0, combinator_1.setBacktrack)(context, [2 | 64 /* Backtrack.link */], head);
|
|
7081
|
+
return [(0, array_1.push)((0, array_1.unshift)(as, bs), ["\u0018" /* Command.Cancel */])];
|
|
7082
|
+
}, [3 | 64 /* Backtrack.link */]))]), ([as, bs]) => bs ? [[as.join('').trim() || as.join('')], bs] : [[''], as]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], context) => {
|
|
7083
|
+
if (params.at(-1) === "\u0018" /* Command.Cancel */) {
|
|
7084
|
+
params.pop();
|
|
7085
|
+
return [[(0, dom_1.html)('span', {
|
|
7086
|
+
class: 'invalid',
|
|
7087
|
+
...(0, util_1.invalid)('media', 'syntax', 'Missing the closing symbol "}"')
|
|
7088
|
+
}, '!' + context.source.slice(context.position - context.range, context.position))]];
|
|
7089
|
+
}
|
|
6793
7090
|
const INSECURE_URI = params.shift();
|
|
6794
7091
|
// altが空だとエラーが見えないため埋める。
|
|
6795
7092
|
text ||= (0, link_1.decode)(INSECURE_URI);
|
|
@@ -6803,25 +7100,30 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
|
|
|
6803
7100
|
'data-src': uri?.source
|
|
6804
7101
|
});
|
|
6805
7102
|
el.setAttribute('alt', text);
|
|
6806
|
-
if (!sanitize(el, uri)) return [[el]
|
|
7103
|
+
if (!sanitize(el, uri)) return [[el]];
|
|
6807
7104
|
(0, dom_1.define)(el, (0, html_1.attributes)('media', optspec, params));
|
|
6808
7105
|
// Awaiting the generic support for attr().
|
|
6809
7106
|
if (el.hasAttribute('aspect-ratio')) {
|
|
6810
7107
|
el.style.aspectRatio = el.getAttribute('aspect-ratio');
|
|
6811
7108
|
}
|
|
6812
|
-
if (context.state & 8 /* State.link */) return [[el]
|
|
6813
|
-
if (cache && cache.tagName !== 'IMG') return [[el]
|
|
6814
|
-
|
|
6815
|
-
|
|
6816
|
-
|
|
6817
|
-
}
|
|
6818
|
-
|
|
6819
|
-
context
|
|
6820
|
-
|
|
7109
|
+
if (context.state & 8 /* State.link */) return [[el]];
|
|
7110
|
+
if (cache && cache.tagName !== 'IMG') return [[el]];
|
|
7111
|
+
const {
|
|
7112
|
+
source,
|
|
7113
|
+
position
|
|
7114
|
+
} = context;
|
|
7115
|
+
return (0, combinator_1.fmap)(link_1.unsafelink, ([link]) => {
|
|
7116
|
+
context.source = source;
|
|
7117
|
+
context.position = position;
|
|
7118
|
+
return [(0, dom_1.define)(link, {
|
|
7119
|
+
class: null,
|
|
7120
|
+
target: '_blank'
|
|
7121
|
+
}, [el])];
|
|
7122
|
+
})((0, parser_1.subinput)(`{ ${INSECURE_URI}${params.join('')} }`, context));
|
|
6821
7123
|
}))))));
|
|
6822
7124
|
exports.linemedia = (0, combinator_1.surround)(source_1.linebreak, (0, combinator_1.union)([exports.media]), /^(?=[^\S\n]*(?:$|\n))/);
|
|
6823
|
-
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')'), (0, source_1.str)(')'), true, undefined, () => [[]
|
|
6824
|
-
const option = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, combinator_1.open)(/^[^\S\n]+/, (0, source_1.str)(/^[1-9][0-9]*/)), (0, source_1.str)(/^[x:]/), (0, source_1.str)(/^[1-9][0-9]*(?=[^\S\n]|})/), false, ([[a], [b], [c]]
|
|
7125
|
+
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')'), (0, source_1.str)(')'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']'), (0, source_1.str)(']'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), '}'), (0, source_1.str)('}'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"')), (0, source_1.str)('"'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */])])));
|
|
7126
|
+
const option = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, combinator_1.open)(/^[^\S\n]+/, (0, source_1.str)(/^[1-9][0-9]*/)), (0, source_1.str)(/^[x:]/), (0, source_1.str)(/^[1-9][0-9]*(?=[^\S\n]|})/), false, ([[a], [b], [c]]) => [b === 'x' ? [`width="${a}"`, `height="${c}"`] : [`aspect-ratio="${a}/${c}"`]]), link_1.option]));
|
|
6825
7127
|
function sanitize(target, uri) {
|
|
6826
7128
|
let type;
|
|
6827
7129
|
let message;
|
|
@@ -6874,62 +7176,82 @@ const visibility_1 = __webpack_require__(6364);
|
|
|
6874
7176
|
const dom_1 = __webpack_require__(394);
|
|
6875
7177
|
const array_1 = __webpack_require__(6876);
|
|
6876
7178
|
const util_1 = __webpack_require__(4992);
|
|
6877
|
-
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, ([, ns],
|
|
6878
|
-
|
|
6879
|
-
|
|
7179
|
+
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, ([, ns], context) => {
|
|
7180
|
+
const {
|
|
7181
|
+
position,
|
|
7182
|
+
range = 0,
|
|
7183
|
+
linebreak = 0
|
|
7184
|
+
} = context;
|
|
7185
|
+
if (linebreak === 0) {
|
|
7186
|
+
return [[(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, dom_1.defrag)((0, visibility_1.trimBlankNodeEnd)(ns)))])]];
|
|
6880
7187
|
} else {
|
|
6881
|
-
const head =
|
|
7188
|
+
const head = position - range;
|
|
6882
7189
|
(0, combinator_1.setBacktrack)(context, [2 | 64 /* Backtrack.link */], head, 2);
|
|
6883
7190
|
}
|
|
6884
|
-
}, ([as, bs],
|
|
7191
|
+
}, ([as, bs], context) => {
|
|
7192
|
+
if (!bs) return;
|
|
6885
7193
|
const {
|
|
6886
|
-
|
|
7194
|
+
source,
|
|
7195
|
+
position,
|
|
7196
|
+
range = 0,
|
|
7197
|
+
linebreak = 0,
|
|
7198
|
+
state = 0
|
|
6887
7199
|
} = context;
|
|
6888
|
-
const head =
|
|
6889
|
-
if (
|
|
7200
|
+
const head = position - range;
|
|
7201
|
+
if (source[position] !== ']') {
|
|
6890
7202
|
(0, combinator_1.setBacktrack)(context, [2 | 8 /* Backtrack.bracket */], head, 2);
|
|
6891
|
-
} else if (
|
|
7203
|
+
} else if (linebreak !== 0) {
|
|
6892
7204
|
(0, combinator_1.setBacktrack)(context, [2 | 64 /* Backtrack.link */], head, 2);
|
|
6893
7205
|
} else {
|
|
6894
|
-
if (
|
|
6895
|
-
(0, array_1.push)(bs, [
|
|
7206
|
+
if (state & 128 /* State.annotation */) {
|
|
7207
|
+
(0, array_1.push)(bs, [source[position]]);
|
|
6896
7208
|
}
|
|
6897
|
-
|
|
7209
|
+
context.position += 1;
|
|
6898
7210
|
let result;
|
|
6899
|
-
if (source[
|
|
6900
|
-
(0, combinator_1.setBacktrack)(context, [2 | 64 /* Backtrack.link */], head
|
|
6901
|
-
result = [[]
|
|
7211
|
+
if (source[context.position] !== '{') {
|
|
7212
|
+
(0, combinator_1.setBacktrack)(context, [2 | 64 /* Backtrack.link */], head + 1);
|
|
7213
|
+
result = [[]];
|
|
6902
7214
|
} else {
|
|
6903
|
-
result = !(0, combinator_1.isBacktrack)(context, [1 | 64 /* Backtrack.link */]
|
|
6904
|
-
source,
|
|
7215
|
+
result = !(0, combinator_1.isBacktrack)(context, [1 | 64 /* Backtrack.link */]) ? (0, link_1.textlink)({
|
|
6905
7216
|
context
|
|
6906
7217
|
}) : undefined;
|
|
6907
|
-
context.
|
|
7218
|
+
context.range = range;
|
|
6908
7219
|
if (!result) {
|
|
6909
|
-
(0, combinator_1.setBacktrack)(context, [2 | 64 /* Backtrack.link */], head
|
|
6910
|
-
result = [[]
|
|
7220
|
+
(0, combinator_1.setBacktrack)(context, [2 | 64 /* Backtrack.link */], head + 1);
|
|
7221
|
+
result = [[]];
|
|
6911
7222
|
}
|
|
6912
7223
|
}
|
|
6913
|
-
if (
|
|
7224
|
+
if (context.position === source.length) {
|
|
6914
7225
|
(0, combinator_1.setBacktrack)(context, [2 | 64 /* Backtrack.link */], head);
|
|
6915
7226
|
} else {
|
|
6916
|
-
const next = (0, combinator_1.surround)('', (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]), (0, source_1.str)(']'), true, ([, cs = [], ds]
|
|
7227
|
+
const next = (0, combinator_1.surround)('', (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]), (0, source_1.str)(']'), true, ([, cs = [], ds]) => [(0, array_1.push)(cs, ds)], ([, cs = []]) => {
|
|
6917
7228
|
(0, combinator_1.setBacktrack)(context, [2 | 64 /* Backtrack.link */], head);
|
|
6918
|
-
return [cs
|
|
7229
|
+
return [cs];
|
|
6919
7230
|
})({
|
|
6920
|
-
source: (0, parser_1.exec)(result),
|
|
6921
7231
|
context
|
|
6922
7232
|
});
|
|
6923
|
-
if (
|
|
6924
|
-
(0, array_1.push)((0, array_1.push)(bs, (0, parser_1.eval)(result)), (0, parser_1.eval)(next));
|
|
6925
|
-
rest = (0, parser_1.exec)(next);
|
|
7233
|
+
if (state & 128 /* State.annotation */ && next) {
|
|
7234
|
+
return [(0, array_1.push)((0, array_1.push)((0, array_1.unshift)(as, bs), (0, parser_1.eval)(result)), (0, parser_1.eval)(next))];
|
|
6926
7235
|
}
|
|
6927
7236
|
}
|
|
7237
|
+
context.position = position;
|
|
6928
7238
|
}
|
|
6929
|
-
return
|
|
7239
|
+
return state & 128 /* State.annotation */ ? [(0, array_1.unshift)(as, bs)] : undefined;
|
|
6930
7240
|
}, [3 | 16 /* Backtrack.doublebracket */, 1 | 8 /* Backtrack.bracket */])));
|
|
6931
7241
|
// Chicago-Style
|
|
6932
|
-
const abbr = (0, combinator_1.surround)('^', (0, combinator_1.union)([(0, source_1.str)(/^(?=[A-Z])(?:[0-9A-Za-z]'?|(?:[-.:]|\.?\??,? ?)(?!['\-.:?, ]))+/)]), /^\|?(?=]])
|
|
7242
|
+
const abbr = (0, combinator_1.surround)((0, source_1.str)('^'), (0, combinator_1.union)([(0, source_1.str)(/^(?=[A-Z])(?:[0-9A-Za-z]'?|(?:[-.:]|\.?\??,? ?)(?!['\-.:?, ]))+/)]), /^\|?(?=]])|^\|/, true, ([, ns], context) => {
|
|
7243
|
+
const {
|
|
7244
|
+
source,
|
|
7245
|
+
position,
|
|
7246
|
+
range = 0
|
|
7247
|
+
} = context;
|
|
7248
|
+
if (!ns) return [['', source.slice(position - range, source[position - 1] === '|' ? position - 1 : position)]];
|
|
7249
|
+
context.position += source.slice(position).match(visibility_1.blank.start)?.[0].length ?? 0;
|
|
7250
|
+
return [["\u001F" /* Command.Separator */, ns[0].trimEnd()]];
|
|
7251
|
+
}, (_, context) => {
|
|
7252
|
+
context.position -= context.range;
|
|
7253
|
+
return [['']];
|
|
7254
|
+
});
|
|
6933
7255
|
function attributes(ns) {
|
|
6934
7256
|
switch (ns[0]) {
|
|
6935
7257
|
case '':
|
|
@@ -6937,7 +7259,7 @@ function attributes(ns) {
|
|
|
6937
7259
|
class: 'invalid',
|
|
6938
7260
|
...(0, util_1.invalid)('reference', 'syntax', 'Invalid abbreviation')
|
|
6939
7261
|
};
|
|
6940
|
-
case "\
|
|
7262
|
+
case "\u001F" /* Command.Separator */:
|
|
6941
7263
|
const abbr = ns[1];
|
|
6942
7264
|
ns[0] = ns[1] = '';
|
|
6943
7265
|
return {
|
|
@@ -6969,11 +7291,11 @@ const source_1 = __webpack_require__(8745);
|
|
|
6969
7291
|
const memoize_1 = __webpack_require__(6925);
|
|
6970
7292
|
const array_1 = __webpack_require__(6876);
|
|
6971
7293
|
const dom_1 = __webpack_require__(394);
|
|
6972
|
-
exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.match)(/^\[(%+)\s/, (0, memoize_1.memoize)(([, fence]) => (0, combinator_1.surround)((0, source_1.str)(`[${fence}`), (0, combinator_1.precedence)(4, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), new RegExp(String.raw`^\s+${fence}\]`), [[new RegExp(String.raw`^\s+${fence}\]`), 4]]))), (0, combinator_1.close)((0, combinator_1.some)(source_1.text, '%'), (0, source_1.str)(`${fence}]`)), true, ([as, bs = [], cs]
|
|
7294
|
+
exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.match)(/^\[(%+)\s/, (0, memoize_1.memoize)(([, fence]) => (0, combinator_1.surround)((0, source_1.str)(`[${fence}`), (0, combinator_1.precedence)(4, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), new RegExp(String.raw`^\s+${fence}\]`), [[new RegExp(String.raw`^\s+${fence}\]`), 4]]))), (0, combinator_1.close)((0, combinator_1.some)(source_1.text, '%'), (0, source_1.str)(`${fence}]`)), true, ([as, bs = [], cs]) => [[(0, dom_1.html)('span', {
|
|
6973
7295
|
class: 'remark'
|
|
6974
7296
|
}, [(0, dom_1.html)('input', {
|
|
6975
7297
|
type: 'checkbox'
|
|
6976
|
-
}), (0, dom_1.html)('span', (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))])]
|
|
7298
|
+
}), (0, dom_1.html)('span', (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))])]], ([as, bs]) => bs && [(0, array_1.unshift)(as, bs)]), ([, fence]) => fence.length, {})));
|
|
6977
7299
|
|
|
6978
7300
|
/***/ },
|
|
6979
7301
|
|
|
@@ -6994,66 +7316,59 @@ const source_1 = __webpack_require__(8745);
|
|
|
6994
7316
|
const visibility_1 = __webpack_require__(6364);
|
|
6995
7317
|
const array_1 = __webpack_require__(6876);
|
|
6996
7318
|
const dom_1 = __webpack_require__(394);
|
|
6997
|
-
exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combinator_1.inits)([(0, combinator_1.dup)((0, combinator_1.surround)('[',
|
|
7319
|
+
exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combinator_1.inits)([(0, combinator_1.dup)((0, combinator_1.surround)('[', text, ']', false, ([, ns]) => {
|
|
6998
7320
|
ns && ns.at(-1) === '' && ns.pop();
|
|
6999
|
-
return (0, visibility_1.isTightNodeStart)(ns) ? [ns
|
|
7000
|
-
}, undefined, [3 | 32 /* Backtrack.ruby */, 1 | 8 /* Backtrack.bracket */])), (0, combinator_1.dup)((0, combinator_1.surround)('(',
|
|
7321
|
+
return (0, visibility_1.isTightNodeStart)(ns) ? [ns] : undefined;
|
|
7322
|
+
}, undefined, [3 | 32 /* Backtrack.ruby */, 1 | 8 /* Backtrack.bracket */])), (0, combinator_1.dup)((0, combinator_1.surround)('(', text, ')', false, undefined, undefined, [3 | 32 /* Backtrack.ruby */, 1 | 8 /* Backtrack.bracket */]))]), ([texts, rubies], context) => {
|
|
7001
7323
|
if (rubies === undefined) {
|
|
7002
|
-
const head = context.
|
|
7324
|
+
const head = context.position - context.range;
|
|
7003
7325
|
return void (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.ruby */], head);
|
|
7004
7326
|
}
|
|
7005
7327
|
switch (true) {
|
|
7006
7328
|
case rubies.length <= texts.length:
|
|
7007
|
-
return [[(0, dom_1.html)('ruby', (0, dom_1.defrag)(texts.reduce((acc, _, i) => (0, array_1.push)(acc, (0, array_1.unshift)([texts[i]], i < rubies.length && rubies[i] ? [(0, dom_1.html)('rp', '('), (0, dom_1.html)('rt', rubies[i]), (0, dom_1.html)('rp', ')')] : [(0, dom_1.html)('rt')])), [])))]
|
|
7329
|
+
return [[(0, dom_1.html)('ruby', (0, dom_1.defrag)(texts.reduce((acc, _, i) => (0, array_1.push)(acc, (0, array_1.unshift)([texts[i]], i < rubies.length && rubies[i] ? [(0, dom_1.html)('rp', '('), (0, dom_1.html)('rt', rubies[i]), (0, dom_1.html)('rp', ')')] : [(0, dom_1.html)('rt')])), [])))]];
|
|
7008
7330
|
case texts.length === 1 && [...texts[0]].length >= rubies.length:
|
|
7009
|
-
return [[(0, dom_1.html)('ruby', (0, dom_1.defrag)([...texts[0]].reduce((acc, _, i, texts) => (0, array_1.push)(acc, (0, array_1.unshift)([texts[i]], i < rubies.length && rubies[i] ? [(0, dom_1.html)('rp', '('), (0, dom_1.html)('rt', rubies[i]), (0, dom_1.html)('rp', ')')] : [(0, dom_1.html)('rt')])), [])))]
|
|
7331
|
+
return [[(0, dom_1.html)('ruby', (0, dom_1.defrag)([...texts[0]].reduce((acc, _, i, texts) => (0, array_1.push)(acc, (0, array_1.unshift)([texts[i]], i < rubies.length && rubies[i] ? [(0, dom_1.html)('rp', '('), (0, dom_1.html)('rt', rubies[i]), (0, dom_1.html)('rp', ')')] : [(0, dom_1.html)('rt')])), [])))]];
|
|
7010
7332
|
default:
|
|
7011
|
-
return [[(0, dom_1.html)('ruby', (0, dom_1.defrag)((0, array_1.unshift)([texts.join(' ')], [(0, dom_1.html)('rp', '('), (0, dom_1.html)('rt', rubies.join(' ').trim()), (0, dom_1.html)('rp', ')')])))]
|
|
7333
|
+
return [[(0, dom_1.html)('ruby', (0, dom_1.defrag)((0, array_1.unshift)([texts.join(' ')], [(0, dom_1.html)('rp', '('), (0, dom_1.html)('rt', rubies.join(' ').trim()), (0, dom_1.html)('rp', ')')])))]];
|
|
7012
7334
|
}
|
|
7013
7335
|
}));
|
|
7014
|
-
const
|
|
7015
|
-
|
|
7016
|
-
|
|
7017
|
-
}
|
|
7336
|
+
const text = input => {
|
|
7337
|
+
const {
|
|
7338
|
+
context
|
|
7339
|
+
} = input;
|
|
7340
|
+
const {
|
|
7341
|
+
source
|
|
7342
|
+
} = context;
|
|
7018
7343
|
const acc = [''];
|
|
7019
7344
|
let state = false;
|
|
7020
|
-
|
|
7021
|
-
|
|
7022
|
-
|
|
7023
|
-
|
|
7345
|
+
for (let {
|
|
7346
|
+
position
|
|
7347
|
+
} = context; position < source.length; position = context.position) {
|
|
7348
|
+
if (!/^(?:\\[^\n]|[^\\[\](){}<>"`$#:^|\n])/.test(source.slice(position, position + 2))) break;
|
|
7349
|
+
switch (source[position]) {
|
|
7024
7350
|
case '&':
|
|
7025
7351
|
{
|
|
7026
|
-
const result = (0, htmlentity_1.unsafehtmlentity)(
|
|
7027
|
-
|
|
7028
|
-
|
|
7029
|
-
});
|
|
7030
|
-
if (result) {
|
|
7031
|
-
acc[acc.length - 1] += (0, parser_1.eval)(result)[0];
|
|
7032
|
-
source = (0, parser_1.exec)(result) ?? source.slice(1);
|
|
7033
|
-
state ||= acc.at(-1).trimStart() !== '';
|
|
7034
|
-
continue;
|
|
7035
|
-
}
|
|
7036
|
-
// fallthrough
|
|
7352
|
+
const result = (0, htmlentity_1.unsafehtmlentity)(input) ?? (0, source_1.txt)(input);
|
|
7353
|
+
acc[acc.length - 1] += (0, parser_1.eval)(result)[0];
|
|
7354
|
+
continue;
|
|
7037
7355
|
}
|
|
7038
7356
|
default:
|
|
7039
7357
|
{
|
|
7040
|
-
if (source[
|
|
7358
|
+
if (source[position].trimStart() === '') {
|
|
7359
|
+
state ||= acc.at(-1).trimStart() !== '';
|
|
7041
7360
|
acc.push('');
|
|
7042
|
-
|
|
7361
|
+
context.position += 1;
|
|
7043
7362
|
continue;
|
|
7044
7363
|
}
|
|
7045
|
-
const result = (0, source_1.
|
|
7046
|
-
|
|
7047
|
-
context
|
|
7048
|
-
});
|
|
7049
|
-
acc[acc.length - 1] += (0, parser_1.eval)(result)[0] ?? source.slice(0, source.length - (0, parser_1.exec)(result).length);
|
|
7050
|
-
source = (0, parser_1.exec)(result);
|
|
7051
|
-
state ||= acc.at(-1).trimStart() !== '';
|
|
7364
|
+
const result = (0, source_1.txt)(input);
|
|
7365
|
+
acc[acc.length - 1] += (0, parser_1.eval)(result)[0] ?? source.slice(position, context.position);
|
|
7052
7366
|
continue;
|
|
7053
7367
|
}
|
|
7054
7368
|
}
|
|
7055
7369
|
}
|
|
7056
|
-
|
|
7370
|
+
state ||= acc.at(-1).trimStart() !== '';
|
|
7371
|
+
return state ? [acc] : undefined;
|
|
7057
7372
|
};
|
|
7058
7373
|
//function attributes(texts: string[], rubies: string[]): Record<string, string> {
|
|
7059
7374
|
// let attrs: Record<string, string> | undefined;
|
|
@@ -7104,11 +7419,12 @@ exports.strong = void 0;
|
|
|
7104
7419
|
const combinator_1 = __webpack_require__(3484);
|
|
7105
7420
|
const inline_1 = __webpack_require__(7973);
|
|
7106
7421
|
const emstrong_1 = __webpack_require__(365);
|
|
7422
|
+
const emphasis_1 = __webpack_require__(1354);
|
|
7107
7423
|
const source_1 = __webpack_require__(8745);
|
|
7108
7424
|
const visibility_1 = __webpack_require__(6364);
|
|
7109
7425
|
const array_1 = __webpack_require__(6876);
|
|
7110
7426
|
const dom_1 = __webpack_require__(394);
|
|
7111
|
-
exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('**', '*'), (0, combinator_1.precedence)(0, (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)('
|
|
7427
|
+
exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('**', '*'), (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, '*'), (0, combinator_1.union)([emstrong_1.emstrong, exports.strong, emphasis_1.emphasis]))]))))), (0, source_1.str)('**'), false, ([, bs]) => [[(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))]], ([as, bs]) => bs && [(0, array_1.unshift)(as, bs)]));
|
|
7112
7428
|
|
|
7113
7429
|
/***/ },
|
|
7114
7430
|
|
|
@@ -7124,14 +7440,16 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
7124
7440
|
exports.template = void 0;
|
|
7125
7441
|
const combinator_1 = __webpack_require__(3484);
|
|
7126
7442
|
const source_1 = __webpack_require__(8745);
|
|
7443
|
+
const util_1 = __webpack_require__(4992);
|
|
7127
7444
|
const array_1 = __webpack_require__(6876);
|
|
7128
7445
|
const dom_1 = __webpack_require__(394);
|
|
7129
|
-
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 = [], cs]
|
|
7446
|
+
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 = [], cs]) => [[(0, dom_1.html)('span', {
|
|
7130
7447
|
class: 'template'
|
|
7131
|
-
}, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))],
|
|
7132
|
-
|
|
7133
|
-
|
|
7134
|
-
}
|
|
7448
|
+
}, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))]], ([, bs], context) => bs && [[(0, dom_1.html)('span', {
|
|
7449
|
+
class: 'invalid',
|
|
7450
|
+
...(0, util_1.invalid)('template', 'syntax', `Missing the closing symbol "}}"`)
|
|
7451
|
+
}, context.source.slice(context.position - context.range, context.position))]], [3 | 16 /* Backtrack.doublebracket */, 3 | 4 /* Backtrack.escbracket */]));
|
|
7452
|
+
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.escsource]), ')')), (0, source_1.str)(')'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (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.escsource]), ']')), (0, source_1.str)(']'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (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.escsource]), '}')), (0, source_1.str)('}'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (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.escsource, '"', [['"', 2, false]]))), (0, source_1.str)('"'), true, ([as, bs = [], cs], context) => context.linebreak === 0 ? [(0, array_1.push)((0, array_1.unshift)(as, bs), cs)] : (context.position -= 1, [(0, array_1.unshift)(as, bs)]), ([as, bs]) => bs && [(0, array_1.unshift)(as, bs)], [3 | 4 /* Backtrack.escbracket */])]));
|
|
7135
7453
|
|
|
7136
7454
|
/***/ },
|
|
7137
7455
|
|
|
@@ -7464,18 +7782,24 @@ exports.MAX_INPUT_SIZE = exports.MAX_SEGMENT_SIZE * 10;
|
|
|
7464
7782
|
const parser = (0, combinator_1.union)([heading_1.segment, codeblock_1.segment, mathblock_1.segment, extension_1.segment, (0, combinator_1.some)(source_1.contentline, exports.MAX_SEGMENT_SIZE + 1), (0, combinator_1.some)(source_1.emptyline, exports.MAX_SEGMENT_SIZE + 1)]);
|
|
7465
7783
|
function* segment(source) {
|
|
7466
7784
|
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)}`;
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
|
|
7470
|
-
|
|
7471
|
-
|
|
7472
|
-
|
|
7473
|
-
|
|
7785
|
+
const context = {
|
|
7786
|
+
source,
|
|
7787
|
+
position: 0
|
|
7788
|
+
};
|
|
7789
|
+
const input = {
|
|
7790
|
+
context
|
|
7791
|
+
};
|
|
7792
|
+
while (context.position < source.length) {
|
|
7793
|
+
const {
|
|
7794
|
+
position
|
|
7795
|
+
} = context;
|
|
7796
|
+
const result = parser(input);
|
|
7797
|
+
const segs = (0, parser_1.eval)(result).length ? (0, parser_1.eval)(result) : [source.slice(position, context.position)];
|
|
7474
7798
|
for (let i = 0; i < segs.length; ++i) {
|
|
7475
7799
|
const seg = segs[i];
|
|
7476
7800
|
validate(seg, exports.MAX_SEGMENT_SIZE) ? yield seg : yield `${"\u0007" /* Command.Error */}Too large segment over ${exports.MAX_SEGMENT_SIZE.toLocaleString('en')} bytes.\n${seg}`;
|
|
7477
7801
|
}
|
|
7478
|
-
|
|
7802
|
+
(0, parser_1.clean)(context);
|
|
7479
7803
|
}
|
|
7480
7804
|
}
|
|
7481
7805
|
exports.segment = segment;
|
|
@@ -7495,7 +7819,7 @@ exports.validate = validate;
|
|
|
7495
7819
|
Object.defineProperty(exports, "__esModule", ({
|
|
7496
7820
|
value: true
|
|
7497
7821
|
}));
|
|
7498
|
-
exports.anyline = exports.emptyline = exports.contentline = exports.str = exports.unescsource = exports.escsource = exports.linebreak = exports.txt = exports.text = void 0;
|
|
7822
|
+
exports.anyline = exports.emptyline = exports.contentline = exports.strs = exports.str = exports.unescsource = exports.escsource = exports.linebreak = exports.txt = exports.text = void 0;
|
|
7499
7823
|
var text_1 = __webpack_require__(5655);
|
|
7500
7824
|
Object.defineProperty(exports, "text", ({
|
|
7501
7825
|
enumerable: true,
|
|
@@ -7536,6 +7860,12 @@ Object.defineProperty(exports, "str", ({
|
|
|
7536
7860
|
return str_1.str;
|
|
7537
7861
|
}
|
|
7538
7862
|
}));
|
|
7863
|
+
Object.defineProperty(exports, "strs", ({
|
|
7864
|
+
enumerable: true,
|
|
7865
|
+
get: function () {
|
|
7866
|
+
return str_1.strs;
|
|
7867
|
+
}
|
|
7868
|
+
}));
|
|
7539
7869
|
var line_1 = __webpack_require__(702);
|
|
7540
7870
|
Object.defineProperty(exports, "contentline", ({
|
|
7541
7871
|
enumerable: true,
|
|
@@ -7569,50 +7899,41 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
7569
7899
|
}));
|
|
7570
7900
|
exports.escsource = void 0;
|
|
7571
7901
|
const combinator_1 = __webpack_require__(3484);
|
|
7572
|
-
const text_1 = __webpack_require__(5655);
|
|
7573
7902
|
const dom_1 = __webpack_require__(394);
|
|
7574
|
-
const delimiter = /[\s\x00-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]/;
|
|
7575
7903
|
const escsource = ({
|
|
7576
|
-
source,
|
|
7577
7904
|
context
|
|
7578
7905
|
}) => {
|
|
7579
|
-
|
|
7580
|
-
|
|
7581
|
-
|
|
7582
|
-
|
|
7583
|
-
|
|
7584
|
-
|
|
7585
|
-
|
|
7906
|
+
const {
|
|
7907
|
+
source,
|
|
7908
|
+
position
|
|
7909
|
+
} = context;
|
|
7910
|
+
if (position === source.length) return;
|
|
7911
|
+
(0, combinator_1.consume)(1, context);
|
|
7912
|
+
context.position += 1;
|
|
7913
|
+
switch (source[position]) {
|
|
7914
|
+
case '\r':
|
|
7915
|
+
(0, combinator_1.consume)(-1, context);
|
|
7916
|
+
return [[]];
|
|
7917
|
+
case "\u001B" /* Command.Escape */:
|
|
7586
7918
|
(0, combinator_1.consume)(1, context);
|
|
7587
|
-
|
|
7588
|
-
|
|
7589
|
-
|
|
7590
|
-
|
|
7591
|
-
case
|
|
7592
|
-
|
|
7593
|
-
return [[source.slice(1, 2)], source.slice(2)];
|
|
7594
|
-
case '\\':
|
|
7595
|
-
switch (source[1]) {
|
|
7596
|
-
case undefined:
|
|
7597
|
-
return [[source[0]], ''];
|
|
7598
|
-
case '\n':
|
|
7599
|
-
return [[source[0]], source.slice(1)];
|
|
7600
|
-
default:
|
|
7601
|
-
(0, combinator_1.consume)(1, context);
|
|
7602
|
-
return [[source.slice(0, 2)], source.slice(2)];
|
|
7603
|
-
}
|
|
7919
|
+
context.position += 1;
|
|
7920
|
+
return [[source.slice(position + 1, position + 2)]];
|
|
7921
|
+
case '\\':
|
|
7922
|
+
switch (source[position + 1]) {
|
|
7923
|
+
case undefined:
|
|
7924
|
+
return [[source[position]]];
|
|
7604
7925
|
case '\n':
|
|
7605
|
-
|
|
7606
|
-
return [[(0, dom_1.html)('br')], source.slice(1)];
|
|
7926
|
+
return [[source[position]]];
|
|
7607
7927
|
default:
|
|
7608
|
-
|
|
7609
|
-
|
|
7610
|
-
|
|
7611
|
-
return [[source.slice(0, i - +b || 1)], source.slice(i - +b || 1)];
|
|
7928
|
+
(0, combinator_1.consume)(1, context);
|
|
7929
|
+
context.position += 1;
|
|
7930
|
+
return [[source.slice(position, position + 2)]];
|
|
7612
7931
|
}
|
|
7932
|
+
case '\n':
|
|
7933
|
+
context.linebreak ||= source.length - position;
|
|
7934
|
+
return [[(0, dom_1.html)('br')]];
|
|
7613
7935
|
default:
|
|
7614
|
-
|
|
7615
|
-
return [[source.slice(0, i)], source.slice(i)];
|
|
7936
|
+
return [[source[position]]];
|
|
7616
7937
|
}
|
|
7617
7938
|
};
|
|
7618
7939
|
exports.escsource = escsource;
|
|
@@ -7630,9 +7951,17 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
7630
7951
|
}));
|
|
7631
7952
|
exports.contentline = exports.emptyline = exports.anyline = void 0;
|
|
7632
7953
|
const combinator_1 = __webpack_require__(3484);
|
|
7633
|
-
exports.anyline = (0, combinator_1.line)(() => [[]
|
|
7634
|
-
exports.emptyline = (0, combinator_1.line)(
|
|
7635
|
-
|
|
7954
|
+
exports.anyline = (0, combinator_1.line)(() => [[]]);
|
|
7955
|
+
exports.emptyline = (0, combinator_1.line)(({
|
|
7956
|
+
context: {
|
|
7957
|
+
source
|
|
7958
|
+
}
|
|
7959
|
+
}) => (0, combinator_1.isBlank)(source) ? [[]] : undefined);
|
|
7960
|
+
exports.contentline = (0, combinator_1.line)(({
|
|
7961
|
+
context: {
|
|
7962
|
+
source
|
|
7963
|
+
}
|
|
7964
|
+
}) => !(0, combinator_1.isBlank)(source) ? [[]] : undefined);
|
|
7636
7965
|
|
|
7637
7966
|
/***/ },
|
|
7638
7967
|
|
|
@@ -7645,29 +7974,55 @@ exports.contentline = (0, combinator_1.line)(i => !(0, combinator_1.isBlank)(i.s
|
|
|
7645
7974
|
Object.defineProperty(exports, "__esModule", ({
|
|
7646
7975
|
value: true
|
|
7647
7976
|
}));
|
|
7648
|
-
exports.str = void 0;
|
|
7977
|
+
exports.strs = exports.str = void 0;
|
|
7649
7978
|
const combinator_1 = __webpack_require__(3484);
|
|
7650
7979
|
function str(pattern, not) {
|
|
7651
7980
|
const count = typeof pattern === 'object' ? /[^^\\*+][*+]/.test(pattern.source) : false;
|
|
7652
7981
|
return typeof pattern === 'string' ? ({
|
|
7653
|
-
|
|
7982
|
+
context
|
|
7654
7983
|
}) => {
|
|
7655
|
-
|
|
7656
|
-
|
|
7657
|
-
|
|
7984
|
+
const {
|
|
7985
|
+
source,
|
|
7986
|
+
position
|
|
7987
|
+
} = context;
|
|
7988
|
+
if (position === source.length) return;
|
|
7989
|
+
if (!source.startsWith(pattern, position)) return;
|
|
7990
|
+
if (not && source.startsWith(not, position + pattern.length)) return;
|
|
7991
|
+
context.position += pattern.length;
|
|
7992
|
+
return [[pattern]];
|
|
7658
7993
|
} : ({
|
|
7659
|
-
source,
|
|
7660
7994
|
context
|
|
7661
7995
|
}) => {
|
|
7662
|
-
|
|
7663
|
-
|
|
7996
|
+
const {
|
|
7997
|
+
source,
|
|
7998
|
+
position
|
|
7999
|
+
} = context;
|
|
8000
|
+
if (position === source.length) return;
|
|
8001
|
+
const m = source.slice(position).match(pattern);
|
|
7664
8002
|
if (m === null) return;
|
|
7665
8003
|
count && (0, combinator_1.consume)(m[0].length, context);
|
|
7666
|
-
if (not && source.slice(m[0].length, m[0].length + not.length) === not) return;
|
|
7667
|
-
|
|
8004
|
+
if (not && source.slice(position + m[0].length, position + m[0].length + not.length) === not) return;
|
|
8005
|
+
context.position += m[0].length;
|
|
8006
|
+
return [[m[0]]];
|
|
7668
8007
|
};
|
|
7669
8008
|
}
|
|
7670
8009
|
exports.str = str;
|
|
8010
|
+
function strs(pattern) {
|
|
8011
|
+
return ({
|
|
8012
|
+
context
|
|
8013
|
+
}) => {
|
|
8014
|
+
const {
|
|
8015
|
+
source
|
|
8016
|
+
} = context;
|
|
8017
|
+
let acc = '';
|
|
8018
|
+
while (context.position < source.length && source.startsWith(pattern, context.position)) {
|
|
8019
|
+
acc += pattern;
|
|
8020
|
+
context.position += pattern.length;
|
|
8021
|
+
}
|
|
8022
|
+
return [[acc]];
|
|
8023
|
+
};
|
|
8024
|
+
}
|
|
8025
|
+
exports.strs = strs;
|
|
7671
8026
|
|
|
7672
8027
|
/***/ },
|
|
7673
8028
|
|
|
@@ -7680,59 +8035,41 @@ exports.str = str;
|
|
|
7680
8035
|
Object.defineProperty(exports, "__esModule", ({
|
|
7681
8036
|
value: true
|
|
7682
8037
|
}));
|
|
7683
|
-
exports.isAlphanumeric = exports.linebreak = exports.txt = exports.text =
|
|
8038
|
+
exports.isAlphanumeric = exports.linebreak = exports.txt = exports.text = void 0;
|
|
7684
8039
|
const combinator_1 = __webpack_require__(3484);
|
|
7685
|
-
const str_1 = __webpack_require__(4017);
|
|
7686
8040
|
const dom_1 = __webpack_require__(394);
|
|
7687
|
-
|
|
7688
|
-
|
|
7689
|
-
|
|
7690
|
-
|
|
7691
|
-
const
|
|
7692
|
-
|
|
7693
|
-
|
|
7694
|
-
}
|
|
7695
|
-
if (
|
|
7696
|
-
|
|
7697
|
-
|
|
7698
|
-
|
|
7699
|
-
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
|
|
7703
|
-
|
|
7704
|
-
|
|
7705
|
-
|
|
7706
|
-
return [[]
|
|
7707
|
-
case "\u001B" /* Command.Escape */:
|
|
7708
|
-
case '\\':
|
|
7709
|
-
switch (source[1]) {
|
|
7710
|
-
case undefined:
|
|
7711
|
-
return [[], ''];
|
|
7712
|
-
case '\n':
|
|
7713
|
-
return [[], source.slice(1)];
|
|
7714
|
-
default:
|
|
7715
|
-
(0, combinator_1.consume)(1, context);
|
|
7716
|
-
return [[source.slice(1, 2)], source.slice(2)];
|
|
7717
|
-
}
|
|
8041
|
+
const text = input => {
|
|
8042
|
+
const {
|
|
8043
|
+
context
|
|
8044
|
+
} = input;
|
|
8045
|
+
const {
|
|
8046
|
+
source,
|
|
8047
|
+
position
|
|
8048
|
+
} = context;
|
|
8049
|
+
if (position === source.length) return;
|
|
8050
|
+
(0, combinator_1.consume)(1, context);
|
|
8051
|
+
context.position += 1;
|
|
8052
|
+
switch (source[position]) {
|
|
8053
|
+
case '\r':
|
|
8054
|
+
(0, combinator_1.consume)(-1, context);
|
|
8055
|
+
return [[]];
|
|
8056
|
+
case "\u001B" /* Command.Escape */:
|
|
8057
|
+
case '\\':
|
|
8058
|
+
switch (source[position + 1]) {
|
|
8059
|
+
case undefined:
|
|
8060
|
+
return [[]];
|
|
7718
8061
|
case '\n':
|
|
7719
|
-
|
|
7720
|
-
return [[(0, dom_1.html)('br')], source.slice(1)];
|
|
7721
|
-
case '*':
|
|
7722
|
-
case '`':
|
|
7723
|
-
return source[1] === source[0] ? repeat({
|
|
7724
|
-
source,
|
|
7725
|
-
context
|
|
7726
|
-
}) : [[source[0]], source.slice(1)];
|
|
8062
|
+
return [[]];
|
|
7727
8063
|
default:
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
return b && i === source.length || b && source[i] === '\n' || b && source[i] === '\\' && source[i + 1] === '\n' ? [[], source.slice(i)] : [[source.slice(0, i - +b || 1)], source.slice(i - +b || 1)];
|
|
8064
|
+
(0, combinator_1.consume)(1, context);
|
|
8065
|
+
context.position += 1;
|
|
8066
|
+
return [[source.slice(position + 1, position + 2)]];
|
|
7732
8067
|
}
|
|
8068
|
+
case '\n':
|
|
8069
|
+
context.linebreak ||= source.length - position;
|
|
8070
|
+
return [[(0, dom_1.html)('br')]];
|
|
7733
8071
|
default:
|
|
7734
|
-
|
|
7735
|
-
return [[source.slice(0, i)], source.slice(i)];
|
|
8072
|
+
return [[source[position]]];
|
|
7736
8073
|
}
|
|
7737
8074
|
};
|
|
7738
8075
|
exports.text = text;
|
|
@@ -7757,41 +8094,30 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
7757
8094
|
}));
|
|
7758
8095
|
exports.unescsource = void 0;
|
|
7759
8096
|
const combinator_1 = __webpack_require__(3484);
|
|
7760
|
-
const text_1 = __webpack_require__(5655);
|
|
7761
8097
|
const dom_1 = __webpack_require__(394);
|
|
7762
8098
|
const unescsource = ({
|
|
7763
|
-
source,
|
|
7764
8099
|
context
|
|
7765
8100
|
}) => {
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
|
|
7780
|
-
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
|
|
7784
|
-
return [[(0, dom_1.html)('br')], source.slice(1)];
|
|
7785
|
-
default:
|
|
7786
|
-
const b = source[0].trimStart() === '';
|
|
7787
|
-
const i = b || (0, text_1.isAlphanumeric)(source[0]) ? source.search(b ? text_1.nonWhitespace : text_1.nonAlphanumeric) || 1 : 1;
|
|
7788
|
-
(0, combinator_1.consume)(i - 1, context);
|
|
7789
|
-
return [[source.slice(0, i - +b || 1)], source.slice(i - +b || 1)];
|
|
7790
|
-
}
|
|
7791
|
-
}
|
|
8101
|
+
const {
|
|
8102
|
+
source,
|
|
8103
|
+
position
|
|
8104
|
+
} = context;
|
|
8105
|
+
if (position === source.length) return;
|
|
8106
|
+
(0, combinator_1.consume)(1, context);
|
|
8107
|
+
context.position += 1;
|
|
8108
|
+
switch (source[position]) {
|
|
8109
|
+
case '\r':
|
|
8110
|
+
(0, combinator_1.consume)(-1, context);
|
|
8111
|
+
return [[]];
|
|
8112
|
+
case "\u001B" /* Command.Escape */:
|
|
8113
|
+
(0, combinator_1.consume)(1, context);
|
|
8114
|
+
context.position += 1;
|
|
8115
|
+
return [[source.slice(position + 1, position + 2)]];
|
|
8116
|
+
case '\n':
|
|
8117
|
+
context.linebreak ||= source.length - position;
|
|
8118
|
+
return [[(0, dom_1.html)('br')]];
|
|
7792
8119
|
default:
|
|
7793
|
-
|
|
7794
|
-
return [[source.slice(0, i)], source.slice(i)];
|
|
8120
|
+
return [[source[position]]];
|
|
7795
8121
|
}
|
|
7796
8122
|
};
|
|
7797
8123
|
exports.unescsource = unescsource;
|
|
@@ -7816,46 +8142,49 @@ function lineable(parser, trim = -1) {
|
|
|
7816
8142
|
return (0, combinator_1.convert)(source => `\r${trim === 0 ? source : trim > 0 ? source.at(-1) === '\n' ? source : source + '\n' : source.at(-1) === '\n' ? source.slice(0, -1) : source}`, parser, trim === 0);
|
|
7817
8143
|
}
|
|
7818
8144
|
exports.lineable = lineable;
|
|
7819
|
-
function repeat(symbol, parser, cons, termination = (
|
|
7820
|
-
const
|
|
8145
|
+
function repeat(symbol, parser, cons, termination = (nodes, context, prefix, postfix) => {
|
|
8146
|
+
const acc = [];
|
|
7821
8147
|
if (prefix > 0) {
|
|
7822
|
-
|
|
7823
|
-
}
|
|
7824
|
-
for (let i = 0; i < acc.length; ++i) {
|
|
7825
|
-
nodes.push(...acc[i]);
|
|
8148
|
+
acc.push(symbol[0].repeat(prefix));
|
|
7826
8149
|
}
|
|
8150
|
+
acc.push(...nodes);
|
|
7827
8151
|
if (postfix > 0) {
|
|
7828
|
-
|
|
7829
|
-
|
|
8152
|
+
const {
|
|
8153
|
+
source,
|
|
8154
|
+
position
|
|
8155
|
+
} = context;
|
|
8156
|
+
acc.push(source.slice(position, position + postfix));
|
|
8157
|
+
context.position += postfix;
|
|
7830
8158
|
}
|
|
7831
|
-
return [
|
|
8159
|
+
return [acc];
|
|
7832
8160
|
}) {
|
|
7833
|
-
return input => {
|
|
8161
|
+
return (0, parser_1.failsafe)(input => {
|
|
7834
8162
|
const {
|
|
7835
|
-
source,
|
|
7836
8163
|
context
|
|
7837
8164
|
} = input;
|
|
7838
|
-
|
|
8165
|
+
const {
|
|
8166
|
+
source,
|
|
8167
|
+
position
|
|
8168
|
+
} = context;
|
|
8169
|
+
let nodes = [];
|
|
7839
8170
|
let i = symbol.length;
|
|
7840
|
-
while (source[i] === source[
|
|
7841
|
-
|
|
8171
|
+
while (source[context.position + i] === source[context.position]) ++i;
|
|
8172
|
+
context.position += i;
|
|
7842
8173
|
let state = false;
|
|
7843
8174
|
for (; i >= symbol.length; i -= symbol.length) {
|
|
7844
|
-
if (
|
|
7845
|
-
|
|
7846
|
-
|
|
8175
|
+
if (nodes.length > 0 && source.startsWith(symbol, context.position)) {
|
|
8176
|
+
nodes = cons(nodes, context);
|
|
8177
|
+
context.position += symbol.length;
|
|
7847
8178
|
continue;
|
|
7848
8179
|
}
|
|
7849
|
-
const
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
8180
|
+
const buf = context.buffer;
|
|
8181
|
+
context.buffer = nodes;
|
|
8182
|
+
const result = parser(input);
|
|
8183
|
+
context.buffer = buf;
|
|
7853
8184
|
if (result === undefined) break;
|
|
7854
|
-
|
|
7855
|
-
rest = (0, parser_1.exec)(result);
|
|
7856
|
-
acc.push(nodes);
|
|
8185
|
+
nodes = (0, parser_1.eval)(result);
|
|
7857
8186
|
switch (nodes.at(-1)) {
|
|
7858
|
-
case "\
|
|
8187
|
+
case "\u0018" /* Command.Cancel */:
|
|
7859
8188
|
nodes.pop();
|
|
7860
8189
|
state = false;
|
|
7861
8190
|
break;
|
|
@@ -7864,21 +8193,22 @@ function repeat(symbol, parser, cons, termination = (acc, rest, prefix, postfix)
|
|
|
7864
8193
|
state = true;
|
|
7865
8194
|
continue;
|
|
7866
8195
|
default:
|
|
7867
|
-
|
|
8196
|
+
nodes = cons(nodes, context);
|
|
7868
8197
|
state = true;
|
|
7869
8198
|
continue;
|
|
7870
8199
|
}
|
|
7871
8200
|
break;
|
|
7872
8201
|
}
|
|
7873
|
-
if (
|
|
8202
|
+
if (nodes.length === 0) return;
|
|
7874
8203
|
const prefix = i;
|
|
7875
8204
|
i = 0;
|
|
7876
|
-
for (let len = (0, alias_1.min)(prefix,
|
|
8205
|
+
for (let len = (0, alias_1.min)(prefix, source.length - context.position); i < len && source[context.position + i] === symbol[0];) {
|
|
7877
8206
|
++i;
|
|
7878
8207
|
}
|
|
7879
8208
|
const postfix = i;
|
|
7880
|
-
|
|
7881
|
-
|
|
8209
|
+
context.range = context.position - position;
|
|
8210
|
+
return termination(nodes, context, prefix, postfix, state);
|
|
8211
|
+
});
|
|
7882
8212
|
}
|
|
7883
8213
|
exports.repeat = repeat;
|
|
7884
8214
|
function invalid(syntax, type, message) {
|
|
@@ -7946,7 +8276,10 @@ var blank;
|
|
|
7946
8276
|
blank.start = new RegExp(/^(?:\\?[^\S\r\n]|&IHN;|<wbr[^\S\n]*>)+/.source.replace('IHN', `(?:${normalize_1.invisibleHTMLEntityNames.join('|')})`));
|
|
7947
8277
|
})(blank || (exports.blank = blank = {}));
|
|
7948
8278
|
function visualize(parser) {
|
|
7949
|
-
return (0, combinator_1.union)([(0, combinator_1.convert)(source => source.replace(blank.line, line => line.replace(/[\\&<]/g, `${"\u001B" /* Command.Escape */}$&`)), (0, combinator_1.verify)(parser, (ns,
|
|
8279
|
+
return (0, combinator_1.union)([(0, combinator_1.convert)(source => source.replace(blank.line, line => line.replace(/[\\&<]/g, `${"\u001B" /* Command.Escape */}$&`)), (0, combinator_1.verify)(parser, (ns, {
|
|
8280
|
+
source,
|
|
8281
|
+
position
|
|
8282
|
+
}) => position === source.length && hasVisible(ns)), false), (0, combinator_1.some)((0, combinator_1.union)([source_1.linebreak, source_1.unescsource]))]);
|
|
7950
8283
|
}
|
|
7951
8284
|
exports.visualize = visualize;
|
|
7952
8285
|
function hasVisible(nodes) {
|
|
@@ -7956,6 +8289,7 @@ function hasVisible(nodes) {
|
|
|
7956
8289
|
if (node && node.trimStart()) return true;
|
|
7957
8290
|
} else {
|
|
7958
8291
|
if (node.innerText.trimStart()) return true;
|
|
8292
|
+
if (node.classList.contains('reference')) return true;
|
|
7959
8293
|
//if (state & State.media ^ State.media &&
|
|
7960
8294
|
// (node.classList.contains('media') || node.getElementsByClassName('media')[0])) return true;
|
|
7961
8295
|
}
|
|
@@ -7976,32 +8310,38 @@ function tightStart(parser, except) {
|
|
|
7976
8310
|
exports.tightStart = tightStart;
|
|
7977
8311
|
function isTightStart(input, except) {
|
|
7978
8312
|
const {
|
|
7979
|
-
|
|
8313
|
+
context
|
|
7980
8314
|
} = input;
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
8315
|
+
const {
|
|
8316
|
+
source,
|
|
8317
|
+
position
|
|
8318
|
+
} = context;
|
|
8319
|
+
if (position === source.length) return true;
|
|
8320
|
+
if (except && source.startsWith(except, position)) return false;
|
|
8321
|
+
switch (source[position]) {
|
|
7984
8322
|
case ' ':
|
|
7985
8323
|
case ' ':
|
|
7986
8324
|
case '\t':
|
|
7987
8325
|
case '\n':
|
|
7988
8326
|
return false;
|
|
7989
8327
|
case '\\':
|
|
7990
|
-
return source[1]?.trimStart() !== '';
|
|
8328
|
+
return source[position + 1]?.trimStart() !== '';
|
|
7991
8329
|
case '&':
|
|
7992
8330
|
switch (true) {
|
|
7993
|
-
case source.length > 2 && source[1] !== ' ' && (0, parser_1.eval)((0, htmlentity_1.unsafehtmlentity)(input))?.[0]?.trimStart() === '':
|
|
8331
|
+
case source.length - position > 2 && source[position + 1] !== ' ' && (0, parser_1.eval)((0, htmlentity_1.unsafehtmlentity)(input))?.[0]?.trimStart() === '':
|
|
8332
|
+
context.position = position;
|
|
7994
8333
|
return false;
|
|
7995
8334
|
}
|
|
8335
|
+
context.position = position;
|
|
7996
8336
|
return true;
|
|
7997
8337
|
case '<':
|
|
7998
8338
|
switch (true) {
|
|
7999
|
-
case source.length >= 5 && source.
|
|
8339
|
+
case source.length - position >= 5 && source.startsWith('<wbr', position) && (source[position + 5] === '>' || /^<wbr[^\S\n]*>/.test(source.slice(position))):
|
|
8000
8340
|
return false;
|
|
8001
8341
|
}
|
|
8002
8342
|
return true;
|
|
8003
8343
|
default:
|
|
8004
|
-
return source[
|
|
8344
|
+
return source[position].trimStart() !== '';
|
|
8005
8345
|
}
|
|
8006
8346
|
}
|
|
8007
8347
|
function isLooseNodeStart(nodes) {
|
|
@@ -8081,9 +8421,9 @@ function trimBlankNodeEnd(nodes) {
|
|
|
8081
8421
|
const skip = nodes.length > 0 && typeof nodes.at(-1) === 'object' && nodes.at(-1)['className'] === 'indexer' ? [nodes.pop()] : [];
|
|
8082
8422
|
for (let node = nodes[0]; nodes.length > 0 && !isVisible(node = nodes.at(-1), -1);) {
|
|
8083
8423
|
if (typeof node === 'string') {
|
|
8084
|
-
const
|
|
8085
|
-
if (
|
|
8086
|
-
nodes[nodes.length - 1] =
|
|
8424
|
+
const str = node.trimEnd();
|
|
8425
|
+
if (str.length > 0) {
|
|
8426
|
+
nodes[nodes.length - 1] = str;
|
|
8087
8427
|
break;
|
|
8088
8428
|
}
|
|
8089
8429
|
}
|
|
@@ -8557,10 +8897,11 @@ exports.quote = void 0;
|
|
|
8557
8897
|
const parser_1 = __webpack_require__(605);
|
|
8558
8898
|
const cite_1 = __webpack_require__(1200);
|
|
8559
8899
|
function quote(anchor, range) {
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
|
|
8563
|
-
|
|
8900
|
+
const {
|
|
8901
|
+
context
|
|
8902
|
+
} = (0, parser_1.input)('', {});
|
|
8903
|
+
(0, cite_1.cite)((0, parser_1.input)(`>>${anchor}`, context));
|
|
8904
|
+
if (context.position !== context.source.length) throw new Error(`Invalid anchor: ${anchor}`);
|
|
8564
8905
|
fit(range);
|
|
8565
8906
|
const node = trim(range.cloneContents());
|
|
8566
8907
|
if (!node.firstChild) return '';
|