securemark 0.296.0 → 0.296.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -1
- package/dist/index.js +196 -187
- package/package.json +1 -1
- package/src/combinator/control/constraint/block.ts +2 -2
- package/src/combinator/control/constraint/contract.ts +4 -3
- package/src/combinator/control/constraint/line.ts +5 -5
- package/src/combinator/control/manipulation/fence.ts +4 -4
- package/src/combinator/control/manipulation/scope.ts +1 -1
- package/src/combinator/control/manipulation/surround.ts +31 -15
- package/src/combinator/data/delimiter.ts +82 -6
- package/src/combinator/data/parser/context.ts +1 -34
- package/src/parser/api/normalize.ts +5 -1
- package/src/parser/block/reply/cite.ts +1 -1
- package/src/parser/block/reply/quote.ts +1 -1
- package/src/parser/block/reply.ts +1 -1
- package/src/parser/inline/annotation.ts +3 -3
- package/src/parser/inline/deletion.ts +1 -1
- package/src/parser/inline/emphasis.ts +4 -4
- package/src/parser/inline/emstrong.test.ts +1 -0
- package/src/parser/inline/emstrong.ts +3 -3
- package/src/parser/inline/extension/index.ts +2 -3
- package/src/parser/inline/extension/placeholder.ts +2 -2
- package/src/parser/inline/html.ts +3 -3
- package/src/parser/inline/htmlentity.ts +2 -2
- package/src/parser/inline/insertion.ts +1 -1
- package/src/parser/inline/italic.test.ts +1 -0
- package/src/parser/inline/italic.ts +2 -2
- package/src/parser/inline/link.test.ts +0 -1
- package/src/parser/inline/link.ts +3 -3
- package/src/parser/inline/mark.test.ts +1 -0
- package/src/parser/inline/mark.ts +4 -4
- package/src/parser/inline/media.test.ts +0 -1
- package/src/parser/inline/media.ts +1 -1
- package/src/parser/inline/reference.ts +3 -3
- package/src/parser/inline/ruby.test.ts +5 -0
- package/src/parser/inline/ruby.ts +2 -2
- package/src/parser/inline/strong.ts +4 -4
- package/src/parser/node.ts +4 -4
- package/src/parser/source/escapable.ts +2 -1
- package/src/parser/source/str.ts +4 -4
- package/src/parser/source/text.ts +1 -1
- package/src/parser/source/unescapable.ts +2 -1
- package/src/parser/util.ts +7 -4
- package/src/parser/visibility.ts +41 -89
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.296.
|
|
1
|
+
/*! securemark v0.296.2 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
|
|
2
2
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
3
3
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
4
4
|
module.exports = factory(require("Prism"), require("DOMPurify"));
|
|
@@ -2585,7 +2585,7 @@ function block(parser, separation = true) {
|
|
|
2585
2585
|
if (position === source.length) return;
|
|
2586
2586
|
const result = parser(input);
|
|
2587
2587
|
if (result === undefined) return;
|
|
2588
|
-
if (separation && !(0, line_1.
|
|
2588
|
+
if (separation && !(0, line_1.isEmptyline)(source, context.position)) return;
|
|
2589
2589
|
return context.position === source.length || source[context.position - 1] === '\n' ? result : undefined;
|
|
2590
2590
|
});
|
|
2591
2591
|
}
|
|
@@ -2603,18 +2603,19 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
2603
2603
|
value: true
|
|
2604
2604
|
}));
|
|
2605
2605
|
exports.verify = exports.validate = void 0;
|
|
2606
|
-
const
|
|
2606
|
+
const delimiter_1 = __webpack_require__(385);
|
|
2607
|
+
const bind_1 = __webpack_require__(994);
|
|
2607
2608
|
function validate(pattern, parser) {
|
|
2608
2609
|
if (typeof pattern === 'function') return guard(pattern, parser);
|
|
2609
|
-
const
|
|
2610
|
-
return input =>
|
|
2610
|
+
const test = (0, delimiter_1.tester)(pattern, false);
|
|
2611
|
+
return input => test(input) && parser(input);
|
|
2611
2612
|
}
|
|
2612
2613
|
exports.validate = validate;
|
|
2613
2614
|
function guard(f, parser) {
|
|
2614
2615
|
return input => f(input) ? parser(input) : undefined;
|
|
2615
2616
|
}
|
|
2616
2617
|
function verify(parser, cond) {
|
|
2617
|
-
return (0,
|
|
2618
|
+
return (0, bind_1.bind)(parser, (nodes, context) => cond(nodes, context) ? nodes : undefined);
|
|
2618
2619
|
}
|
|
2619
2620
|
exports.verify = verify;
|
|
2620
2621
|
|
|
@@ -2629,7 +2630,7 @@ exports.verify = verify;
|
|
|
2629
2630
|
Object.defineProperty(exports, "__esModule", ({
|
|
2630
2631
|
value: true
|
|
2631
2632
|
}));
|
|
2632
|
-
exports.
|
|
2633
|
+
exports.isEmptyline = exports.firstline = exports.line = void 0;
|
|
2633
2634
|
const parser_1 = __webpack_require__(605);
|
|
2634
2635
|
function line(parser) {
|
|
2635
2636
|
return (0, parser_1.failsafe)(({
|
|
@@ -2648,7 +2649,7 @@ function line(parser) {
|
|
|
2648
2649
|
context.source = source;
|
|
2649
2650
|
context.offset -= position;
|
|
2650
2651
|
if (result === undefined) return;
|
|
2651
|
-
if (context.position < position + line.length && !
|
|
2652
|
+
if (context.position < position + line.length && !isEmptyline(source, context.position)) return;
|
|
2652
2653
|
context.position = position + line.length;
|
|
2653
2654
|
return result;
|
|
2654
2655
|
});
|
|
@@ -2659,12 +2660,12 @@ function firstline(source, position) {
|
|
|
2659
2660
|
return i === -1 ? source.slice(position) : source.slice(position, i + 1);
|
|
2660
2661
|
}
|
|
2661
2662
|
exports.firstline = firstline;
|
|
2662
|
-
const
|
|
2663
|
-
function
|
|
2664
|
-
|
|
2665
|
-
return source.length === position || source[position] === '\n' ||
|
|
2663
|
+
const emptyline = /[^\S\n]*(?:$|\n)/y;
|
|
2664
|
+
function isEmptyline(source, position) {
|
|
2665
|
+
emptyline.lastIndex = position;
|
|
2666
|
+
return source.length === position || source[position] === '\n' || emptyline.test(source);
|
|
2666
2667
|
}
|
|
2667
|
-
exports.
|
|
2668
|
+
exports.isEmptyline = isEmptyline;
|
|
2668
2669
|
|
|
2669
2670
|
/***/ },
|
|
2670
2671
|
|
|
@@ -2796,20 +2797,20 @@ function fence(opener, limit, separation = true) {
|
|
|
2796
2797
|
context.position += matches[0].length;
|
|
2797
2798
|
// Prevent annoying parsing in editing.
|
|
2798
2799
|
const secondline = (0, line_1.firstline)(source, context.position);
|
|
2799
|
-
if ((0, line_1.
|
|
2800
|
+
if ((0, line_1.isEmptyline)(secondline, 0) && (0, line_1.firstline)(source, context.position + secondline.length).trimEnd() !== delim) return;
|
|
2800
2801
|
let block = '';
|
|
2801
2802
|
let closer = '';
|
|
2802
2803
|
let overflow = '';
|
|
2803
2804
|
for (let count = 1;; ++count) {
|
|
2804
2805
|
if (context.position === source.length) break;
|
|
2805
2806
|
const line = (0, line_1.firstline)(source, context.position);
|
|
2806
|
-
if ((closer || count > limit + 1) && (0, line_1.
|
|
2807
|
+
if ((closer || count > limit + 1) && (0, line_1.isEmptyline)(line, 0)) break;
|
|
2807
2808
|
if (closer) {
|
|
2808
2809
|
overflow += line;
|
|
2809
2810
|
}
|
|
2810
2811
|
if (!closer && count <= limit + 1 && line.slice(0, delim.length) === delim && line.trimEnd() === delim) {
|
|
2811
2812
|
closer = line;
|
|
2812
|
-
if ((0, line_1.
|
|
2813
|
+
if ((0, line_1.isEmptyline)(source, context.position + line.length)) {
|
|
2813
2814
|
context.position += line.length;
|
|
2814
2815
|
break;
|
|
2815
2816
|
}
|
|
@@ -2989,9 +2990,9 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
2989
2990
|
}));
|
|
2990
2991
|
exports.rewrite = exports.focus = void 0;
|
|
2991
2992
|
const parser_1 = __webpack_require__(605);
|
|
2992
|
-
const
|
|
2993
|
+
const delimiter_1 = __webpack_require__(385);
|
|
2993
2994
|
function focus(scope, parser, slice = true) {
|
|
2994
|
-
const match = (0,
|
|
2995
|
+
const match = (0, delimiter_1.matcher)(scope, false);
|
|
2995
2996
|
return (0, parser_1.failsafe)(arg => {
|
|
2996
2997
|
const {
|
|
2997
2998
|
context
|
|
@@ -3067,22 +3068,22 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
3067
3068
|
}));
|
|
3068
3069
|
exports.setBacktrack = exports.isBacktrack = exports.close = exports.open = exports.surround = void 0;
|
|
3069
3070
|
const parser_1 = __webpack_require__(605);
|
|
3070
|
-
const
|
|
3071
|
+
const delimiter_1 = __webpack_require__(385);
|
|
3071
3072
|
function surround(opener, parser, closer, optional = false, backtracks = [], f, g) {
|
|
3072
3073
|
switch (typeof opener) {
|
|
3073
3074
|
case 'string':
|
|
3074
3075
|
case 'object':
|
|
3075
|
-
opener = (0,
|
|
3076
|
+
opener = (0, delimiter_1.tester)(opener, true);
|
|
3076
3077
|
}
|
|
3077
3078
|
switch (typeof parser) {
|
|
3078
3079
|
case 'string':
|
|
3079
3080
|
case 'object':
|
|
3080
|
-
parser = (0,
|
|
3081
|
+
parser = (0, delimiter_1.tester)(parser, true);
|
|
3081
3082
|
}
|
|
3082
3083
|
switch (typeof closer) {
|
|
3083
3084
|
case 'string':
|
|
3084
3085
|
case 'object':
|
|
3085
|
-
closer = (0,
|
|
3086
|
+
closer = (0, delimiter_1.tester)(closer, true);
|
|
3086
3087
|
}
|
|
3087
3088
|
const [blen, rbs, wbs] = reduce(backtracks);
|
|
3088
3089
|
return (0, parser_1.failsafe)(input => {
|
|
@@ -3099,7 +3100,7 @@ function surround(opener, parser, closer, optional = false, backtracks = [], f,
|
|
|
3099
3100
|
} = context;
|
|
3100
3101
|
context.linebreak = 0;
|
|
3101
3102
|
const nodesO = opener(input);
|
|
3102
|
-
if (
|
|
3103
|
+
if (nodesO === undefined) {
|
|
3103
3104
|
return void revert(context, linebreak);
|
|
3104
3105
|
}
|
|
3105
3106
|
if (rbs && isBacktrack(context, rbs, position, blen)) {
|
|
@@ -3107,14 +3108,14 @@ function surround(opener, parser, closer, optional = false, backtracks = [], f,
|
|
|
3107
3108
|
}
|
|
3108
3109
|
const nodesM = context.position < source.length ? parser(input) : undefined;
|
|
3109
3110
|
context.range = context.position - position;
|
|
3110
|
-
if (
|
|
3111
|
+
if (nodesM === undefined && !optional) {
|
|
3111
3112
|
wbs && setBacktrack(context, wbs, position);
|
|
3112
3113
|
const result = g?.([nodesO, nodesM], context);
|
|
3113
3114
|
return result || void revert(context, linebreak);
|
|
3114
3115
|
}
|
|
3115
3116
|
const nodesC = nodesM || optional ? closer(input) : undefined;
|
|
3116
3117
|
context.range = context.position - position;
|
|
3117
|
-
if (
|
|
3118
|
+
if (nodesC === undefined) {
|
|
3118
3119
|
wbs && setBacktrack(context, wbs, position);
|
|
3119
3120
|
const result = g?.([nodesO, nodesM], context);
|
|
3120
3121
|
return result || void revert(context, linebreak);
|
|
@@ -3123,7 +3124,7 @@ function surround(opener, parser, closer, optional = false, backtracks = [], f,
|
|
|
3123
3124
|
return void revert(context, linebreak);
|
|
3124
3125
|
}
|
|
3125
3126
|
context.range = context.position - position;
|
|
3126
|
-
const result = f ? f([nodesO, nodesM, nodesC], context) : nodesO.import(nodesM
|
|
3127
|
+
const result = f ? f([nodesO, nodesM, nodesC], context) : nodesM ? nodesO.import(nodesM).import(nodesC) : nodesO.import(nodesC);
|
|
3127
3128
|
if (result) {
|
|
3128
3129
|
context.linebreak ||= linebreak;
|
|
3129
3130
|
}
|
|
@@ -3245,8 +3246,9 @@ exports.fmap = fmap;
|
|
|
3245
3246
|
Object.defineProperty(exports, "__esModule", ({
|
|
3246
3247
|
value: true
|
|
3247
3248
|
}));
|
|
3248
|
-
exports.Delimiters = void 0;
|
|
3249
|
-
const
|
|
3249
|
+
exports.tester = exports.matcher = exports.Delimiters = void 0;
|
|
3250
|
+
const parser_1 = __webpack_require__(605);
|
|
3251
|
+
const context_1 = __webpack_require__(5745);
|
|
3250
3252
|
class Delimiters {
|
|
3251
3253
|
constructor() {
|
|
3252
3254
|
this.tree = {};
|
|
@@ -3276,9 +3278,9 @@ class Delimiters {
|
|
|
3276
3278
|
return () => undefined;
|
|
3277
3279
|
case 'string':
|
|
3278
3280
|
case 'object':
|
|
3279
|
-
const
|
|
3280
|
-
const verify = after ? (
|
|
3281
|
-
return verify ? input =>
|
|
3281
|
+
const test = tester(pattern, false);
|
|
3282
|
+
const verify = after ? tester(after, false) : undefined;
|
|
3283
|
+
return verify ? input => test(input) !== undefined && verify(input) !== undefined || undefined : input => test(input) !== undefined || undefined;
|
|
3282
3284
|
}
|
|
3283
3285
|
}
|
|
3284
3286
|
registry(signature) {
|
|
@@ -3390,6 +3392,90 @@ class Delimiters {
|
|
|
3390
3392
|
}
|
|
3391
3393
|
}
|
|
3392
3394
|
exports.Delimiters = Delimiters;
|
|
3395
|
+
function matcher(pattern, advance, after) {
|
|
3396
|
+
const count = typeof pattern === 'object' ? /[^^\\*+][*+]/.test(pattern.source) : false;
|
|
3397
|
+
switch (typeof pattern) {
|
|
3398
|
+
case 'string':
|
|
3399
|
+
if (pattern === '') return () => new parser_1.List([new parser_1.Node(pattern)]);
|
|
3400
|
+
return input => {
|
|
3401
|
+
const {
|
|
3402
|
+
context
|
|
3403
|
+
} = input;
|
|
3404
|
+
const {
|
|
3405
|
+
source,
|
|
3406
|
+
position
|
|
3407
|
+
} = context;
|
|
3408
|
+
if (!source.startsWith(pattern, position)) return;
|
|
3409
|
+
if (advance) {
|
|
3410
|
+
context.position += pattern.length;
|
|
3411
|
+
}
|
|
3412
|
+
const next = after?.(input);
|
|
3413
|
+
return after ? next && new parser_1.List([new parser_1.Node(pattern)]).import(next) : new parser_1.List([new parser_1.Node(pattern)]);
|
|
3414
|
+
};
|
|
3415
|
+
case 'object':
|
|
3416
|
+
return input => {
|
|
3417
|
+
const {
|
|
3418
|
+
context
|
|
3419
|
+
} = input;
|
|
3420
|
+
const {
|
|
3421
|
+
source,
|
|
3422
|
+
position
|
|
3423
|
+
} = context;
|
|
3424
|
+
pattern.lastIndex = position;
|
|
3425
|
+
if (!pattern.test(source)) return;
|
|
3426
|
+
const src = source.slice(position, pattern.lastIndex);
|
|
3427
|
+
count && (0, context_1.consume)(src.length, context);
|
|
3428
|
+
if (advance) {
|
|
3429
|
+
context.position += src.length;
|
|
3430
|
+
}
|
|
3431
|
+
const next = after?.(input);
|
|
3432
|
+
return after ? next && new parser_1.List([new parser_1.Node(src)]).import(next) : new parser_1.List([new parser_1.Node(src)]);
|
|
3433
|
+
};
|
|
3434
|
+
}
|
|
3435
|
+
}
|
|
3436
|
+
exports.matcher = matcher;
|
|
3437
|
+
function tester(pattern, advance, after) {
|
|
3438
|
+
const count = typeof pattern === 'object' ? /[^^\\*+][*+]/.test(pattern.source) : false;
|
|
3439
|
+
switch (typeof pattern) {
|
|
3440
|
+
case 'string':
|
|
3441
|
+
if (pattern === '') return () => new parser_1.List();
|
|
3442
|
+
return input => {
|
|
3443
|
+
const {
|
|
3444
|
+
context
|
|
3445
|
+
} = input;
|
|
3446
|
+
const {
|
|
3447
|
+
source,
|
|
3448
|
+
position
|
|
3449
|
+
} = context;
|
|
3450
|
+
if (!source.startsWith(pattern, position)) return;
|
|
3451
|
+
if (advance) {
|
|
3452
|
+
context.position += pattern.length;
|
|
3453
|
+
}
|
|
3454
|
+
if (after && after(input) === undefined) return;
|
|
3455
|
+
return new parser_1.List();
|
|
3456
|
+
};
|
|
3457
|
+
case 'object':
|
|
3458
|
+
return input => {
|
|
3459
|
+
const {
|
|
3460
|
+
context
|
|
3461
|
+
} = input;
|
|
3462
|
+
const {
|
|
3463
|
+
source,
|
|
3464
|
+
position
|
|
3465
|
+
} = context;
|
|
3466
|
+
pattern.lastIndex = position;
|
|
3467
|
+
if (!pattern.test(source)) return;
|
|
3468
|
+
const len = pattern.lastIndex - position;
|
|
3469
|
+
count && (0, context_1.consume)(len, context);
|
|
3470
|
+
if (advance) {
|
|
3471
|
+
context.position += len;
|
|
3472
|
+
}
|
|
3473
|
+
if (after && after(input) === undefined) return;
|
|
3474
|
+
return new parser_1.List();
|
|
3475
|
+
};
|
|
3476
|
+
}
|
|
3477
|
+
}
|
|
3478
|
+
exports.tester = tester;
|
|
3393
3479
|
|
|
3394
3480
|
/***/ },
|
|
3395
3481
|
|
|
@@ -3630,8 +3716,7 @@ exports.failsafe = failsafe;
|
|
|
3630
3716
|
Object.defineProperty(exports, "__esModule", ({
|
|
3631
3717
|
value: true
|
|
3632
3718
|
}));
|
|
3633
|
-
exports.
|
|
3634
|
-
const parser_1 = __webpack_require__(605);
|
|
3719
|
+
exports.constraint = exports.state = exports.precedence = exports.recursion = exports.consume = exports.creation = exports.context = exports.reset = void 0;
|
|
3635
3720
|
const alias_1 = __webpack_require__(5413);
|
|
3636
3721
|
const assign_1 = __webpack_require__(9888);
|
|
3637
3722
|
function reset(base, parser) {
|
|
@@ -3790,45 +3875,6 @@ function constraint(state, positive, parser) {
|
|
|
3790
3875
|
};
|
|
3791
3876
|
}
|
|
3792
3877
|
exports.constraint = constraint;
|
|
3793
|
-
function matcher(pattern, advance, verify) {
|
|
3794
|
-
const count = typeof pattern === 'object' ? /[^^\\*+][*+]/.test(pattern.source) : false;
|
|
3795
|
-
switch (typeof pattern) {
|
|
3796
|
-
case 'string':
|
|
3797
|
-
return ({
|
|
3798
|
-
context
|
|
3799
|
-
}) => {
|
|
3800
|
-
const {
|
|
3801
|
-
source,
|
|
3802
|
-
position
|
|
3803
|
-
} = context;
|
|
3804
|
-
if (!source.startsWith(pattern, position)) return;
|
|
3805
|
-
if (verify?.(source, position, pattern.length) === false) return;
|
|
3806
|
-
if (advance) {
|
|
3807
|
-
context.position += pattern.length;
|
|
3808
|
-
}
|
|
3809
|
-
return new parser_1.List([new parser_1.Node(pattern)]);
|
|
3810
|
-
};
|
|
3811
|
-
case 'object':
|
|
3812
|
-
return ({
|
|
3813
|
-
context
|
|
3814
|
-
}) => {
|
|
3815
|
-
const {
|
|
3816
|
-
source,
|
|
3817
|
-
position
|
|
3818
|
-
} = context;
|
|
3819
|
-
pattern.lastIndex = position;
|
|
3820
|
-
if (!pattern.test(source)) return;
|
|
3821
|
-
const src = source.slice(position, pattern.lastIndex);
|
|
3822
|
-
count && consume(src.length, context);
|
|
3823
|
-
if (verify?.(source, position, src.length) === false) return;
|
|
3824
|
-
if (advance) {
|
|
3825
|
-
context.position += src.length;
|
|
3826
|
-
}
|
|
3827
|
-
return new parser_1.List([new parser_1.Node(src)]);
|
|
3828
|
-
};
|
|
3829
|
-
}
|
|
3830
|
-
}
|
|
3831
|
-
exports.matcher = matcher;
|
|
3832
3878
|
|
|
3833
3879
|
/***/ },
|
|
3834
3880
|
|
|
@@ -4386,7 +4432,7 @@ function parse(source) {
|
|
|
4386
4432
|
Object.defineProperty(exports, "__esModule", ({
|
|
4387
4433
|
value: true
|
|
4388
4434
|
}));
|
|
4389
|
-
exports.escape = exports.
|
|
4435
|
+
exports.escape = exports.invisibleGraphHTMLEntityNames = exports.invisibleBlankHTMLEntityNames = exports.normalize = void 0;
|
|
4390
4436
|
const dom_1 = __webpack_require__(394);
|
|
4391
4437
|
const UNICODE_REPLACEMENT_CHARACTER = '\uFFFD';
|
|
4392
4438
|
function normalize(source) {
|
|
@@ -4406,13 +4452,15 @@ function sanitize(source) {
|
|
|
4406
4452
|
}
|
|
4407
4453
|
// https://dev.w3.org/html5/html-author/charref
|
|
4408
4454
|
// https://en.wikipedia.org/wiki/Whitespace_character
|
|
4409
|
-
|
|
4455
|
+
const 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'];
|
|
4410
4456
|
const parser = (el => entity => {
|
|
4411
4457
|
if (entity === '
') return entity;
|
|
4412
4458
|
el.innerHTML = entity;
|
|
4413
4459
|
return el.textContent;
|
|
4414
4460
|
})((0, dom_1.html)('span'));
|
|
4415
|
-
|
|
4461
|
+
exports.invisibleBlankHTMLEntityNames = invisibleHTMLEntityNames.filter(name => parser(`&${name};`).trimStart() === '');
|
|
4462
|
+
exports.invisibleGraphHTMLEntityNames = invisibleHTMLEntityNames.filter(name => parser(`&${name};`).trimStart() !== '');
|
|
4463
|
+
const unreadableEscapeHTMLEntityNames = invisibleHTMLEntityNames.filter(name => !['Tab', 'NewLine', 'NonBreakingSpace', 'nbsp', 'zwj', 'zwnj'].includes(name));
|
|
4416
4464
|
const unreadableEscapeCharacters = unreadableEscapeHTMLEntityNames.map(name => parser(`&${name};`));
|
|
4417
4465
|
const unreadableEscapeCharacter = new RegExp(`[${unreadableEscapeCharacters.join('')}]`, 'g');
|
|
4418
4466
|
// https://www.pandanoir.info/entry/2018/03/11/193000
|
|
@@ -5759,7 +5807,7 @@ const delimiter = new RegExp(`${cite_1.syntax.source}|${quote_1.syntax.source}`,
|
|
|
5759
5807
|
exports.reply = (0, combinator_1.block)((0, combinator_1.validate)(cite_1.syntax, (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([cite_1.cite, quote_1.quote, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, delimiter), (0, visibility_1.visualize)((0, combinator_1.fmap)((0, combinator_1.some)(inline_1.inline), (ns, {
|
|
5760
5808
|
source,
|
|
5761
5809
|
position
|
|
5762
|
-
}) => source[position - 1] === '\n' ? ns : ns.push(new parser_1.Node((0, dom_1.html)('br'), 1 /* Flag.
|
|
5810
|
+
}) => source[position - 1] === '\n' ? ns : ns.push(new parser_1.Node((0, dom_1.html)('br'), 1 /* Flag.blank */)) && ns)))])), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('p', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(ns)))))]))));
|
|
5763
5811
|
|
|
5764
5812
|
/***/ },
|
|
5765
5813
|
|
|
@@ -5811,7 +5859,7 @@ exports.cite = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.op
|
|
|
5811
5859
|
...(0, util_1.invalid)('cite', 'syntax', 'Invalid syntax')
|
|
5812
5860
|
}, (0, dom_1.defrag)([`${quotes}>`, typeof node === 'object' ? (0, dom_1.define)(node, {
|
|
5813
5861
|
'data-depth': `${quotes.length + 1}`
|
|
5814
|
-
}, node.innerText.slice(1)) : node.slice(1)]))), new parser_1.Node((0, dom_1.html)('br'), 1 /* Flag.
|
|
5862
|
+
}, node.innerText.slice(1)) : node.slice(1)]))), new parser_1.Node((0, dom_1.html)('br'), 1 /* Flag.blank */)]);
|
|
5815
5863
|
}));
|
|
5816
5864
|
|
|
5817
5865
|
/***/ },
|
|
@@ -5839,7 +5887,7 @@ exports.quote = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combina
|
|
|
5839
5887
|
math_1.math, autolink_1.autolink, source_1.unescsource])))), (ns, {
|
|
5840
5888
|
source,
|
|
5841
5889
|
position
|
|
5842
|
-
}) => new parser_1.List([new parser_1.Node(source[position - 1] === '\n' ? ns.pop().value : (0, dom_1.html)('br'), 1 /* Flag.
|
|
5890
|
+
}) => new parser_1.List([new parser_1.Node(source[position - 1] === '\n' ? ns.pop().value : (0, dom_1.html)('br'), 1 /* Flag.blank */), new parser_1.Node((0, dom_1.html)('span', {
|
|
5843
5891
|
class: 'quote'
|
|
5844
5892
|
}, (0, dom_1.defrag)((0, util_1.unwrap)(ns))))].reverse())), false));
|
|
5845
5893
|
|
|
@@ -6241,7 +6289,7 @@ const inline_1 = __webpack_require__(7973);
|
|
|
6241
6289
|
const visibility_1 = __webpack_require__(6364);
|
|
6242
6290
|
const util_1 = __webpack_require__(4992);
|
|
6243
6291
|
const dom_1 = __webpack_require__(394);
|
|
6244
|
-
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,
|
|
6292
|
+
exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(128 /* State.annotation */, (0, combinator_1.surround)((0, combinator_1.close)('((', visibility_1.beforeNonblank), (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[')', 1]]))), '))', false, [2, 1 | 4 /* Backtrack.common */, 3 | 128 /* Backtrack.doublebracket */], ([, ns], context) => context.linebreak === 0 ? new parser_1.List([new parser_1.Node((0, dom_1.html)('sup', {
|
|
6245
6293
|
class: 'annotation'
|
|
6246
6294
|
}, [(0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(ns))))]))]) : undefined, (_, context) => {
|
|
6247
6295
|
const {
|
|
@@ -6681,7 +6729,7 @@ const inline_1 = __webpack_require__(7973);
|
|
|
6681
6729
|
const visibility_1 = __webpack_require__(6364);
|
|
6682
6730
|
const util_1 = __webpack_require__(4992);
|
|
6683
6731
|
const dom_1 = __webpack_require__(394);
|
|
6684
|
-
exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, util_1.repeat)('~~', (0, combinator_1.surround)('', (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)(inline_1.inline, '~'), true)])), '~~', false, [], ([, bs], {
|
|
6732
|
+
exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, util_1.repeat)('~~', '', (0, combinator_1.surround)('', (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)(inline_1.inline, '~'), true)])), '~~', false, [], ([, bs], {
|
|
6685
6733
|
buffer
|
|
6686
6734
|
}) => buffer.import(bs), ([, bs], {
|
|
6687
6735
|
buffer
|
|
@@ -6707,7 +6755,7 @@ const source_1 = __webpack_require__(8745);
|
|
|
6707
6755
|
const visibility_1 = __webpack_require__(6364);
|
|
6708
6756
|
const util_1 = __webpack_require__(4992);
|
|
6709
6757
|
const dom_1 = __webpack_require__(394);
|
|
6710
|
-
exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('*', (
|
|
6758
|
+
exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('*', (0, visibility_1.beforeNonblankWith)(/(?!\*)/)), (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, '*', visibility_1.afterNonblank), strong_1.strong])))), (0, source_1.str)('*'), false, [], ([, bs]) => new parser_1.List([new parser_1.Node((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]), ([as, bs]) => bs && as.import(bs)));
|
|
6711
6759
|
|
|
6712
6760
|
/***/ },
|
|
6713
6761
|
|
|
@@ -6735,13 +6783,13 @@ const subemphasis = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, comb
|
|
|
6735
6783
|
// 開閉が明示的でない構文は開閉の不明確な記号による再帰的適用を行わず
|
|
6736
6784
|
// 可能な限り早く閉じるよう解析しなければならない。
|
|
6737
6785
|
// このため終端記号の後ろを見て終端を中止し同じ構文を再帰的に適用してはならない。
|
|
6738
|
-
exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, util_1.repeat)('***', (0, combinator_1.surround)('', (0,
|
|
6786
|
+
exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, util_1.repeat)('***', visibility_1.beforeNonblank, (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, '*', visibility_1.afterNonblank)])), (0, source_1.strs)('*', 3), false, [], ([, bs, cs], context) => {
|
|
6739
6787
|
const {
|
|
6740
6788
|
buffer
|
|
6741
6789
|
} = context;
|
|
6742
6790
|
switch (cs.head.value) {
|
|
6743
6791
|
case '***':
|
|
6744
|
-
return bs;
|
|
6792
|
+
return buffer.import(bs);
|
|
6745
6793
|
case '**':
|
|
6746
6794
|
return (0, combinator_1.bind)(subemphasis, ds => {
|
|
6747
6795
|
const {
|
|
@@ -6891,7 +6939,7 @@ const source_1 = __webpack_require__(8745);
|
|
|
6891
6939
|
const visibility_1 = __webpack_require__(6364);
|
|
6892
6940
|
const util_1 = __webpack_require__(4992);
|
|
6893
6941
|
const dom_1 = __webpack_require__(394);
|
|
6894
|
-
exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(32 /* State.index */, (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)((0, source_1.str)('[#'), (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0,
|
|
6942
|
+
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)('[#', visibility_1.beforeNonblank), (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.some)((0, combinator_1.inits)([inline_1.inline, exports.signature]), ']', [[']', 1]]))), (0, source_1.str)(']'), false, [3 | 4 /* Backtrack.common */], ([, bs], context) => context.linebreak === 0 && (0, visibility_1.trimBlankNodeEnd)(bs).length > 0 ? new parser_1.List([new parser_1.Node((0, dom_1.html)('a', {
|
|
6895
6943
|
'data-index': dataindex(bs)
|
|
6896
6944
|
}, (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]) : undefined, undefined)), ns => {
|
|
6897
6945
|
const el = ns.head.value;
|
|
@@ -7153,7 +7201,7 @@ const dom_1 = __webpack_require__(394);
|
|
|
7153
7201
|
// All syntax surrounded by square brackets shouldn't contain line breaks.
|
|
7154
7202
|
exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.surround)(
|
|
7155
7203
|
// ^はabbrで使用済みだが^:などのようにして分離使用可能
|
|
7156
|
-
(0, source_1.str)(/\[[:^|]/y), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0,
|
|
7204
|
+
(0, source_1.str)(/\[[:^|]/y, visibility_1.beforeNonblank), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]]))), (0, source_1.str)(']'), false, [3 | 4 /* Backtrack.common */], (_, context) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
7157
7205
|
class: 'invalid',
|
|
7158
7206
|
...(0, util_1.invalid)('extension', 'syntax', `Invalid start symbol or linebreak`)
|
|
7159
7207
|
}, context.source.slice(context.position - context.range, context.position)))]), ([as, bs]) => bs && as.import(bs)));
|
|
@@ -7189,7 +7237,7 @@ Object.setPrototypeOf(attrspecs, null);
|
|
|
7189
7237
|
Object.values(attrspecs).forEach(o => Object.setPrototypeOf(o, null));
|
|
7190
7238
|
exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/<[a-z]+(?=[ >])/yi, (0, combinator_1.union)([(0, combinator_1.surround)(
|
|
7191
7239
|
// https://html.spec.whatwg.org/multipage/syntax.html#void-elements
|
|
7192
|
-
(0, source_1.str)(/<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[ >])/y), (0, combinator_1.precedence)(9, (0, combinator_1.some)((0, combinator_1.union)([exports.attribute]))), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Node(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs).import(cs))], new parser_1.List(), new parser_1.List(), context), as.head.value === '<wbr' ? 1 /* Flag.
|
|
7240
|
+
(0, source_1.str)(/<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[ >])/y), (0, combinator_1.precedence)(9, (0, combinator_1.some)((0, combinator_1.union)([exports.attribute]))), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Node(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs).import(cs))], new parser_1.List(), new parser_1.List(), context), as.head.value === '<wbr' ? 1 /* Flag.blank */ : 0 /* Flag.none */)]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Node(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs))], new parser_1.List(), new parser_1.List(), context))])), (0, combinator_1.match)(new RegExp(String.raw`<(${TAGS.join('|')})(?=[ >])`, 'y'), (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.precedence)(9, (0, combinator_1.some)(exports.attribute)), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, [], ([as, bs = new parser_1.List(), cs]) => as.import(bs).import(cs), ([as, bs = new parser_1.List()]) => as.import(bs)),
|
|
7193
7241
|
// 不可視のHTML構造が可視構造を変化させるべきでない。
|
|
7194
7242
|
// 可視のHTMLは優先度変更を検討する。
|
|
7195
7243
|
// このため`<>`記号は将来的に共通構造を変化させる可能性があり
|
|
@@ -7203,7 +7251,7 @@ function elem(tag, content, as, bs, cs, context) {
|
|
|
7203
7251
|
if (content) {
|
|
7204
7252
|
if (cs.length === 0) return ielem('tag', `Missing the closing HTML tag "</${tag}>"`, context);
|
|
7205
7253
|
if (bs.length === 0) return ielem('content', `Missing the content`, context);
|
|
7206
|
-
if (!(0, visibility_1.
|
|
7254
|
+
if (!(0, visibility_1.isNonblankFirstLine)(bs)) return ielem('content', `Missing the visible content in the same line`, context);
|
|
7207
7255
|
}
|
|
7208
7256
|
const [attrs] = attributes('html', attrspecs[tag], as.slice(1, as.at(-1) === '>' ? -1 : as.length));
|
|
7209
7257
|
if (/(?<!\S)invalid(?!\S)/.test(attrs['class'] ?? '')) return ielem('attribute', 'Invalid HTML attribute', context);
|
|
@@ -7268,7 +7316,7 @@ const combinator_1 = __webpack_require__(3484);
|
|
|
7268
7316
|
const source_1 = __webpack_require__(8745);
|
|
7269
7317
|
const util_1 = __webpack_require__(4992);
|
|
7270
7318
|
const dom_1 = __webpack_require__(394);
|
|
7271
|
-
exports.unsafehtmlentity = (0, combinator_1.surround)((0, source_1.str)('&'), (0, source_1.str)(/[0-9A-Za-z]+/y), (0, source_1.str)(';'), false, [3 | 8 /* Backtrack.unescapable */], ([as, bs, cs]) => new parser_1.List([new parser_1.Node(parser(as.head.value + bs.head.value + cs.head.value), (0, node_1.
|
|
7319
|
+
exports.unsafehtmlentity = (0, combinator_1.surround)((0, source_1.str)('&'), (0, source_1.str)(/[0-9A-Za-z]+/y), (0, source_1.str)(';'), false, [3 | 8 /* Backtrack.unescapable */], ([as, bs, cs]) => new parser_1.List([new parser_1.Node(parser(as.head.value + bs.head.value + cs.head.value), (0, node_1.isBlankHTMLEntityName)(bs.head.value) ? 1 /* Flag.blank */ : 0 /* Flag.none */)]), ([as, bs]) => new parser_1.List([new parser_1.Node(as.head.value + (bs?.head?.value ?? ''))]));
|
|
7272
7320
|
exports.htmlentity = (0, combinator_1.fmap)((0, combinator_1.union)([exports.unsafehtmlentity]), ([{
|
|
7273
7321
|
value,
|
|
7274
7322
|
flags
|
|
@@ -7300,7 +7348,7 @@ const inline_1 = __webpack_require__(7973);
|
|
|
7300
7348
|
const visibility_1 = __webpack_require__(6364);
|
|
7301
7349
|
const util_1 = __webpack_require__(4992);
|
|
7302
7350
|
const dom_1 = __webpack_require__(394);
|
|
7303
|
-
exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, util_1.repeat)('++', (0, combinator_1.surround)('', (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)(inline_1.inline, '+'), true)])), '++', false, [], ([, bs], {
|
|
7351
|
+
exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, util_1.repeat)('++', '', (0, combinator_1.surround)('', (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)(inline_1.inline, '+'), true)])), '++', false, [], ([, bs], {
|
|
7304
7352
|
buffer
|
|
7305
7353
|
}) => buffer.import(bs), ([, bs], {
|
|
7306
7354
|
buffer
|
|
@@ -7327,7 +7375,7 @@ const dom_1 = __webpack_require__(394);
|
|
|
7327
7375
|
// 可読性のため実際にはオブリーク体を指定する。
|
|
7328
7376
|
// 斜体は単語に使うとかえって見づらく読み飛ばしやすくなるため使わないべきであり
|
|
7329
7377
|
// ある程度の長さのある文に使うのが望ましい。
|
|
7330
|
-
exports.italic = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, util_1.repeat)('///', (0, combinator_1.surround)('', (0,
|
|
7378
|
+
exports.italic = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, util_1.repeat)('///', visibility_1.beforeNonblank, (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), '///', visibility_1.afterNonblank), '///', false, [], ([, bs], {
|
|
7331
7379
|
buffer
|
|
7332
7380
|
}) => buffer.import(bs), ([, bs], {
|
|
7333
7381
|
buffer
|
|
@@ -7358,7 +7406,7 @@ const optspec = {
|
|
|
7358
7406
|
rel: ['nofollow']
|
|
7359
7407
|
};
|
|
7360
7408
|
Object.setPrototypeOf(optspec, null);
|
|
7361
|
-
exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combinator_1.subsequence)([(0, combinator_1.constraint)(8 /* State.link */, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.precedence)(1, (0,
|
|
7409
|
+
exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combinator_1.subsequence)([(0, combinator_1.constraint)(8 /* State.link */, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.dup)((0, combinator_1.surround)((0, combinator_1.close)('[', visibility_1.beforeNonblank), (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])), ']', true, [3 | 4 /* Backtrack.common */ | 64 /* Backtrack.link */, 2 | 32 /* Backtrack.ruby */], ([, ns = new parser_1.List()], context) => {
|
|
7362
7410
|
if (context.linebreak !== 0) {
|
|
7363
7411
|
const head = context.position - context.range;
|
|
7364
7412
|
return void (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */ | 32 /* Backtrack.ruby */, head);
|
|
@@ -7508,16 +7556,16 @@ const indexee_1 = __webpack_require__(7610);
|
|
|
7508
7556
|
const visibility_1 = __webpack_require__(6364);
|
|
7509
7557
|
const util_1 = __webpack_require__(4992);
|
|
7510
7558
|
const dom_1 = __webpack_require__(394);
|
|
7511
|
-
exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, util_1.repeat)('==', (0, combinator_1.surround)('', (0,
|
|
7559
|
+
exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, util_1.repeat)('==', visibility_1.beforeNonblank, (0, combinator_1.surround)('', (0, combinator_1.state)(2 /* State.mark */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), '==', visibility_1.afterNonblank)), '==', false, [], ([, bs], {
|
|
7512
7560
|
buffer
|
|
7513
7561
|
}) => buffer.import(bs), ([, bs], {
|
|
7514
7562
|
buffer
|
|
7515
7563
|
}) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer), (nodes, {
|
|
7516
7564
|
id,
|
|
7517
7565
|
state
|
|
7518
|
-
}) => {
|
|
7566
|
+
}, nest) => {
|
|
7519
7567
|
const el = (0, dom_1.html)('mark', (0, dom_1.defrag)((0, util_1.unwrap)(nodes)));
|
|
7520
|
-
if (state & 251 /* State.linkers */) return new parser_1.List([new parser_1.Node(el)]);
|
|
7568
|
+
if (state & 251 /* State.linkers */ || nest) return new parser_1.List([new parser_1.Node(el)]);
|
|
7521
7569
|
(0, dom_1.define)(el, {
|
|
7522
7570
|
id: (0, indexee_1.identity)('mark', id, (0, indexee_1.signature)(el))
|
|
7523
7571
|
});
|
|
@@ -7606,7 +7654,7 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
|
|
|
7606
7654
|
}, {
|
|
7607
7655
|
value: params
|
|
7608
7656
|
}], context) => {
|
|
7609
|
-
if (flags & 1 /* Flag.
|
|
7657
|
+
if (flags & 1 /* Flag.blank */) return;
|
|
7610
7658
|
if (text) {
|
|
7611
7659
|
const tmp = text;
|
|
7612
7660
|
text = text.trim();
|
|
@@ -7701,7 +7749,7 @@ const source_1 = __webpack_require__(8745);
|
|
|
7701
7749
|
const visibility_1 = __webpack_require__(6364);
|
|
7702
7750
|
const util_1 = __webpack_require__(4992);
|
|
7703
7751
|
const dom_1 = __webpack_require__(394);
|
|
7704
|
-
exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64 /* State.reference */, (0, combinator_1.surround)(
|
|
7752
|
+
exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64 /* State.reference */, (0, combinator_1.surround)('[[', (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */, (0, combinator_1.subsequence)([abbr, (0, combinator_1.open)(visibility_1.beforeNonblank, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))]))), ']]', false, [2, 1 | 4 /* Backtrack.common */, 3 | 128 /* Backtrack.doublebracket */], ([, ns], context) => {
|
|
7705
7753
|
const {
|
|
7706
7754
|
position,
|
|
7707
7755
|
range,
|
|
@@ -7825,7 +7873,7 @@ const util_1 = __webpack_require__(4992);
|
|
|
7825
7873
|
const dom_1 = __webpack_require__(394);
|
|
7826
7874
|
exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combinator_1.inits)([(0, combinator_1.dup)((0, combinator_1.surround)('[', text, ']', false, [1 | 4 /* Backtrack.common */, 3 | 32 /* Backtrack.ruby */], ([, ns]) => {
|
|
7827
7875
|
ns && ns.last?.value === '' && ns.pop();
|
|
7828
|
-
return (0, visibility_1.
|
|
7876
|
+
return (0, visibility_1.isNonblankNodeStart)(ns) ? ns : undefined;
|
|
7829
7877
|
})), (0, combinator_1.dup)((0, combinator_1.surround)('(', text, ')', false, [3 | 32 /* Backtrack.ruby */]))]), ([{
|
|
7830
7878
|
value: texts
|
|
7831
7879
|
}, {
|
|
@@ -7946,7 +7994,7 @@ const source_1 = __webpack_require__(8745);
|
|
|
7946
7994
|
const visibility_1 = __webpack_require__(6364);
|
|
7947
7995
|
const util_1 = __webpack_require__(4992);
|
|
7948
7996
|
const dom_1 = __webpack_require__(394);
|
|
7949
|
-
exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('**', (
|
|
7997
|
+
exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('**', (0, visibility_1.beforeNonblankWith)(/(?!\*)/)), (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, '*', visibility_1.afterNonblank), emphasis_1.emphasis])))), (0, source_1.str)('**'), false, [], ([, bs]) => new parser_1.List([new parser_1.Node((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]), ([as, bs]) => bs && as.import(bs)));
|
|
7950
7998
|
|
|
7951
7999
|
/***/ },
|
|
7952
8000
|
|
|
@@ -7984,9 +8032,9 @@ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combin
|
|
|
7984
8032
|
Object.defineProperty(exports, "__esModule", ({
|
|
7985
8033
|
value: true
|
|
7986
8034
|
}));
|
|
7987
|
-
exports.
|
|
8035
|
+
exports.isBlankHTMLEntityName = void 0;
|
|
7988
8036
|
const normalize_1 = __webpack_require__(4490);
|
|
7989
|
-
exports.
|
|
8037
|
+
exports.isBlankHTMLEntityName = eval(['name => {', 'switch(name){', normalize_1.invisibleBlankHTMLEntityNames.map(name => `case '${name}':`).join(''), 'return true;', 'default:', 'return false;', '}', '}'].join(''));
|
|
7990
8038
|
|
|
7991
8039
|
/***/ },
|
|
7992
8040
|
|
|
@@ -8491,7 +8539,7 @@ const escsource = ({
|
|
|
8491
8539
|
return new parser_1.List();
|
|
8492
8540
|
case '\n':
|
|
8493
8541
|
context.linebreak ||= source.length - position;
|
|
8494
|
-
return new parser_1.List([new parser_1.Node((0, dom_1.html)('br'))]);
|
|
8542
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('br'), 1 /* Flag.blank */)]);
|
|
8495
8543
|
default:
|
|
8496
8544
|
if (context.sequential) return new parser_1.List([new parser_1.Node(char)]);
|
|
8497
8545
|
let i = (0, text_1.next)(source, position, state, delimiter);
|
|
@@ -8581,9 +8629,9 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
8581
8629
|
}));
|
|
8582
8630
|
exports.strs = exports.str = void 0;
|
|
8583
8631
|
const parser_1 = __webpack_require__(605);
|
|
8584
|
-
const
|
|
8585
|
-
function str(pattern,
|
|
8586
|
-
return (0,
|
|
8632
|
+
const delimiter_1 = __webpack_require__(385);
|
|
8633
|
+
function str(pattern, after) {
|
|
8634
|
+
return (0, delimiter_1.matcher)(pattern, true, after ? (0, delimiter_1.tester)(after, false) : undefined);
|
|
8587
8635
|
}
|
|
8588
8636
|
exports.str = str;
|
|
8589
8637
|
function strs(pattern, limit = -1) {
|
|
@@ -8650,7 +8698,7 @@ const text = input => {
|
|
|
8650
8698
|
return new parser_1.List();
|
|
8651
8699
|
case '\n':
|
|
8652
8700
|
context.linebreak ||= source.length - position;
|
|
8653
|
-
return new parser_1.List([new parser_1.Node((0, dom_1.html)('br'), 1 /* Flag.
|
|
8701
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('br'), 1 /* Flag.blank */)]);
|
|
8654
8702
|
default:
|
|
8655
8703
|
if (context.sequential) return new parser_1.List([new parser_1.Node(char)]);
|
|
8656
8704
|
exports.nonWhitespace.lastIndex = position + 1;
|
|
@@ -8880,7 +8928,7 @@ const unescsource = ({
|
|
|
8880
8928
|
return new parser_1.List();
|
|
8881
8929
|
case '\n':
|
|
8882
8930
|
context.linebreak ||= source.length - position;
|
|
8883
|
-
return new parser_1.List([new parser_1.Node((0, dom_1.html)('br'))]);
|
|
8931
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('br'), 1 /* Flag.blank */)]);
|
|
8884
8932
|
default:
|
|
8885
8933
|
if (context.sequential) return new parser_1.List([new parser_1.Node(char)]);
|
|
8886
8934
|
text_1.nonWhitespace.lastIndex = position + 1;
|
|
@@ -8906,6 +8954,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
8906
8954
|
}));
|
|
8907
8955
|
exports.stringify = exports.unmarkInvalid = exports.markInvalid = exports.invalid = exports.repeat = exports.unwrap = void 0;
|
|
8908
8956
|
const parser_1 = __webpack_require__(605);
|
|
8957
|
+
const delimiter_1 = __webpack_require__(385);
|
|
8909
8958
|
const alias_1 = __webpack_require__(5413);
|
|
8910
8959
|
const dom_1 = __webpack_require__(394);
|
|
8911
8960
|
function* unwrap(nodes) {
|
|
@@ -8915,7 +8964,7 @@ function* unwrap(nodes) {
|
|
|
8915
8964
|
}
|
|
8916
8965
|
}
|
|
8917
8966
|
exports.unwrap = unwrap;
|
|
8918
|
-
function repeat(symbol, parser, cons, termination = (nodes, context, prefix, postfix) => {
|
|
8967
|
+
function repeat(symbol, after, parser, cons, termination = (nodes, context, prefix, postfix) => {
|
|
8919
8968
|
const acc = new parser_1.List();
|
|
8920
8969
|
if (prefix > 0) {
|
|
8921
8970
|
acc.push(new parser_1.Node(symbol[0].repeat(prefix)));
|
|
@@ -8931,6 +8980,7 @@ function repeat(symbol, parser, cons, termination = (nodes, context, prefix, pos
|
|
|
8931
8980
|
}
|
|
8932
8981
|
return acc;
|
|
8933
8982
|
}) {
|
|
8983
|
+
const test = (0, delimiter_1.tester)(after, false);
|
|
8934
8984
|
return (0, parser_1.failsafe)(input => {
|
|
8935
8985
|
const {
|
|
8936
8986
|
context
|
|
@@ -8944,10 +8994,11 @@ function repeat(symbol, parser, cons, termination = (nodes, context, prefix, pos
|
|
|
8944
8994
|
let i = symbol.length;
|
|
8945
8995
|
for (; source[context.position + i] === source[context.position];) ++i;
|
|
8946
8996
|
context.position += i;
|
|
8997
|
+
if (test(input) === undefined) return;
|
|
8947
8998
|
let state = false;
|
|
8948
8999
|
for (; i >= symbol.length; i -= symbol.length) {
|
|
8949
9000
|
if (nodes.length > 0 && source.startsWith(symbol, context.position)) {
|
|
8950
|
-
nodes = cons(nodes, context);
|
|
9001
|
+
nodes = cons(nodes, context, i > symbol.length);
|
|
8951
9002
|
context.position += symbol.length;
|
|
8952
9003
|
continue;
|
|
8953
9004
|
}
|
|
@@ -8967,7 +9018,7 @@ function repeat(symbol, parser, cons, termination = (nodes, context, prefix, pos
|
|
|
8967
9018
|
state = true;
|
|
8968
9019
|
continue;
|
|
8969
9020
|
default:
|
|
8970
|
-
nodes = cons(nodes, context);
|
|
9021
|
+
nodes = cons(nodes, context, i > symbol.length);
|
|
8971
9022
|
state = true;
|
|
8972
9023
|
continue;
|
|
8973
9024
|
}
|
|
@@ -9036,79 +9087,55 @@ exports.stringify = stringify;
|
|
|
9036
9087
|
Object.defineProperty(exports, "__esModule", ({
|
|
9037
9088
|
value: true
|
|
9038
9089
|
}));
|
|
9039
|
-
exports.trimBlankNodeEnd = exports.trimBlankEnd = exports.trimBlank = exports.
|
|
9090
|
+
exports.trimBlankNodeEnd = exports.trimBlankEnd = exports.trimBlank = exports.isNonblankNodeStart = exports.isNonblankFirstLine = exports.beforeNonblankWith = exports.blankWith = exports.afterNonblank = exports.beforeNonblank = exports.visualize = void 0;
|
|
9040
9091
|
const parser_1 = __webpack_require__(605);
|
|
9041
9092
|
const combinator_1 = __webpack_require__(3484);
|
|
9042
9093
|
const normalize_1 = __webpack_require__(4490);
|
|
9043
|
-
var
|
|
9044
|
-
(function (
|
|
9045
|
-
|
|
9046
|
-
|
|
9047
|
-
|
|
9048
|
-
})(
|
|
9094
|
+
var blank;
|
|
9095
|
+
(function (blank) {
|
|
9096
|
+
blank.line = new RegExp(/((?:^|\n)[^\S\n]*(?=\S))((?:[^\S\n]|\\(?=$|\s)|&IBHN;|<wbr ?>)+(?=$|\n))/g.source.replace('IBHN', `(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')})`), 'g');
|
|
9097
|
+
blank.start = new RegExp(/(?:[^\S\n]|\\(?=$|\s)|&IBHN;|<wbr ?>)+/y.source.replace('IBHN', `(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')})`), 'y');
|
|
9098
|
+
blank.unit = new RegExp(/(?:[^\S\n]|\\(?=$|\s)|&IBHN;|<wbr ?>)/y.source.replace('IBHN', `(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')})`), 'y');
|
|
9099
|
+
})(blank || (blank = {}));
|
|
9049
9100
|
function visualize(parser) {
|
|
9050
|
-
return (0, combinator_1.convert)(source => source.replace(
|
|
9101
|
+
return (0, combinator_1.convert)(source => source.replace(blank.line, `$1${"\u001B" /* Command.Escape */}$2`), parser);
|
|
9051
9102
|
}
|
|
9052
9103
|
exports.visualize = visualize;
|
|
9053
|
-
exports.
|
|
9104
|
+
exports.beforeNonblank = beforeNonblankWith('');
|
|
9105
|
+
exports.afterNonblank = afterNonblankWith('');
|
|
9054
9106
|
function blankWith(starts, delimiter) {
|
|
9055
9107
|
return new RegExp([
|
|
9056
9108
|
// 空行除去
|
|
9057
9109
|
// 完全な空行はエスケープ済みなので再帰的バックトラックにはならない。
|
|
9058
|
-
String.raw`(?:${starts}(?:\\?\s|&(?:${normalize_1.
|
|
9110
|
+
String.raw`(?:${starts}(?:\\?\s|&(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')});|<wbr ?>)*)?`, typeof delimiter === 'string' ? delimiter.replace(/[*+()\[\]]/g, '\\$&') : delimiter.source].join(''), 'y');
|
|
9059
9111
|
}
|
|
9060
9112
|
exports.blankWith = blankWith;
|
|
9061
|
-
function
|
|
9062
|
-
return new RegExp([
|
|
9063
|
-
}
|
|
9064
|
-
function beforeNonblank(parser) {
|
|
9065
|
-
return input => isTightStart(input) ? parser(input) : undefined;
|
|
9113
|
+
function beforeNonblankWith(delimiter) {
|
|
9114
|
+
return new RegExp([typeof delimiter === 'string' ? delimiter.replace(/[*+()\[\]]/g, '\\$&') : delimiter.source, String.raw`(?!\\?\s|&(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')});|<wbr ?>)`].join(''), 'y');
|
|
9066
9115
|
}
|
|
9067
|
-
exports.
|
|
9068
|
-
function
|
|
9069
|
-
|
|
9070
|
-
context
|
|
9071
|
-
} = input;
|
|
9072
|
-
const {
|
|
9073
|
-
source,
|
|
9074
|
-
position
|
|
9075
|
-
} = context;
|
|
9076
|
-
if (position === source.length) return true;
|
|
9077
|
-
switch (source[position]) {
|
|
9078
|
-
case ' ':
|
|
9079
|
-
case ' ':
|
|
9080
|
-
case '\t':
|
|
9081
|
-
case '\n':
|
|
9082
|
-
return false;
|
|
9083
|
-
default:
|
|
9084
|
-
const reg = invisible.unit;
|
|
9085
|
-
reg.lastIndex = position;
|
|
9086
|
-
return !reg.test(source);
|
|
9087
|
-
}
|
|
9116
|
+
exports.beforeNonblankWith = beforeNonblankWith;
|
|
9117
|
+
function afterNonblankWith(delimiter) {
|
|
9118
|
+
return new RegExp([String.raw`(?<!\s|&(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')});|<wbr ?>)`, typeof delimiter === 'string' ? delimiter.replace(/[*+()\[\]]/g, '\\$&') : delimiter.source].join(''), 'y');
|
|
9088
9119
|
}
|
|
9089
|
-
function
|
|
9120
|
+
function isNonblankFirstLine(nodes) {
|
|
9090
9121
|
if (nodes.length === 0) return true;
|
|
9091
9122
|
for (const node of nodes) {
|
|
9092
|
-
if (
|
|
9093
|
-
if (typeof node.value === 'object' && node.value.tagName === 'BR') break;
|
|
9123
|
+
if (isNonblank(node)) return true;
|
|
9124
|
+
if (node.flags & 1 /* Flag.blank */ && typeof node.value === 'object' && node.value.tagName === 'BR') break;
|
|
9094
9125
|
}
|
|
9095
9126
|
return false;
|
|
9096
9127
|
}
|
|
9097
|
-
exports.
|
|
9098
|
-
function
|
|
9128
|
+
exports.isNonblankFirstLine = isNonblankFirstLine;
|
|
9129
|
+
function isNonblankNodeStart(nodes) {
|
|
9099
9130
|
if (nodes.length === 0) return true;
|
|
9100
|
-
return
|
|
9101
|
-
}
|
|
9102
|
-
exports.
|
|
9103
|
-
|
|
9104
|
-
// if (nodes.length === 0) return true;
|
|
9105
|
-
// return isVisible(nodes.at(-1)!, -1);
|
|
9106
|
-
//}
|
|
9107
|
-
function isVisible({
|
|
9131
|
+
return isNonblank(nodes.head, 0);
|
|
9132
|
+
}
|
|
9133
|
+
exports.isNonblankNodeStart = isNonblankNodeStart;
|
|
9134
|
+
function isNonblank({
|
|
9108
9135
|
value: node,
|
|
9109
9136
|
flags
|
|
9110
9137
|
}, strpos) {
|
|
9111
|
-
if (flags & 1 /* Flag.
|
|
9138
|
+
if (flags & 1 /* Flag.blank */) return false;
|
|
9112
9139
|
if (typeof node !== 'string') return true;
|
|
9113
9140
|
const str = node && strpos !== undefined ? node[strpos >= 0 ? strpos : node.length + strpos] : node;
|
|
9114
9141
|
switch (str) {
|
|
@@ -9135,7 +9162,7 @@ function trimBlankStart(parser) {
|
|
|
9135
9162
|
position
|
|
9136
9163
|
} = context;
|
|
9137
9164
|
if (position === source.length) return;
|
|
9138
|
-
const reg =
|
|
9165
|
+
const reg = blank.start;
|
|
9139
9166
|
reg.lastIndex = position;
|
|
9140
9167
|
reg.test(source);
|
|
9141
9168
|
context.position = reg.lastIndex || position;
|
|
@@ -9146,37 +9173,19 @@ function trimBlankEnd(parser) {
|
|
|
9146
9173
|
return (0, combinator_1.fmap)(parser, trimBlankNodeEnd);
|
|
9147
9174
|
}
|
|
9148
9175
|
exports.trimBlankEnd = trimBlankEnd;
|
|
9149
|
-
//export function trimBlankNode<N extends HTMLElement | string>(nodes: N[]): N[] {
|
|
9150
|
-
// return trimBlankNodeStart(trimBlankNodeEnd(nodes));
|
|
9151
|
-
//}
|
|
9152
|
-
//function trimBlankNodeStart<N extends HTMLElement | string>(nodes: N[]): N[] {
|
|
9153
|
-
// for (let node = nodes[0]; nodes.length > 0 && !isVisible(node = nodes[0], 0);) {
|
|
9154
|
-
// if (typeof node === 'string') {
|
|
9155
|
-
// const pos = node.trimStart().length;
|
|
9156
|
-
// if (pos > 0) {
|
|
9157
|
-
// nodes[0] = node.slice(-pos) as N;
|
|
9158
|
-
// break;
|
|
9159
|
-
// }
|
|
9160
|
-
// }
|
|
9161
|
-
// else if (nodes.length === 1 && node.className === 'indexer') {
|
|
9162
|
-
// break;
|
|
9163
|
-
// }
|
|
9164
|
-
// nodes.shift();
|
|
9165
|
-
// }
|
|
9166
|
-
// return nodes;
|
|
9167
|
-
//}
|
|
9168
9176
|
function trimBlankNodeEnd(nodes) {
|
|
9169
|
-
const skip = nodes.last && ~nodes.last.flags & 1 /* Flag.
|
|
9177
|
+
const skip = nodes.last && ~nodes.last.flags & 1 /* Flag.blank */ && typeof nodes.last.value === 'object' ? nodes.last.value.className === 'indexer' : false;
|
|
9170
9178
|
for (let node = skip ? nodes.last?.prev : nodes.last; node;) {
|
|
9171
|
-
|
|
9172
|
-
|
|
9173
|
-
|
|
9174
|
-
|
|
9175
|
-
|
|
9179
|
+
if (~node.flags & 1 /* Flag.blank */) {
|
|
9180
|
+
if (typeof node.value === 'string') {
|
|
9181
|
+
const str = node.value.trimEnd();
|
|
9182
|
+
if (str.length > 0) {
|
|
9183
|
+
node.value = str;
|
|
9184
|
+
break;
|
|
9185
|
+
}
|
|
9186
|
+
} else {
|
|
9176
9187
|
break;
|
|
9177
9188
|
}
|
|
9178
|
-
} else if (visible) {
|
|
9179
|
-
break;
|
|
9180
9189
|
}
|
|
9181
9190
|
const target = node;
|
|
9182
9191
|
node = node.prev;
|