securemark 0.290.1 → 0.291.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 +48 -2
- package/dist/index.js +220 -126
- package/markdown.d.ts +6 -17
- package/package.json +1 -1
- package/src/combinator/control/manipulation/surround.ts +17 -13
- package/src/combinator/data/parser/context/delimiter.ts +2 -2
- package/src/combinator/data/parser/context.ts +4 -3
- package/src/combinator/data/parser/some.ts +3 -3
- package/src/combinator/data/parser.ts +5 -3
- package/src/parser/api/parse.test.ts +34 -30
- package/src/parser/block/dlist.ts +1 -1
- package/src/parser/block/heading.ts +2 -2
- package/src/parser/block/mediablock.ts +2 -2
- package/src/parser/block/pagebreak.ts +1 -1
- package/src/parser/block/reply.ts +1 -1
- package/src/parser/block.ts +3 -1
- package/src/parser/header.ts +1 -1
- package/src/parser/inline/annotation.ts +4 -5
- package/src/parser/inline/autolink/account.ts +1 -1
- package/src/parser/inline/autolink/anchor.ts +1 -1
- package/src/parser/inline/autolink/channel.ts +1 -1
- package/src/parser/inline/autolink/email.ts +1 -1
- package/src/parser/inline/autolink/hashnum.ts +1 -1
- package/src/parser/inline/autolink/hashtag.ts +1 -1
- package/src/parser/inline/autolink/url.test.ts +8 -2
- package/src/parser/inline/autolink/url.ts +5 -6
- package/src/parser/inline/bracket.ts +25 -3
- package/src/parser/inline/code.ts +2 -2
- package/src/parser/inline/extension/index.ts +45 -27
- package/src/parser/inline/extension/indexee.ts +6 -3
- package/src/parser/inline/extension/label.ts +1 -1
- package/src/parser/inline/html.test.ts +22 -19
- package/src/parser/inline/html.ts +82 -78
- package/src/parser/inline/link.ts +13 -11
- package/src/parser/inline/mark.ts +1 -1
- package/src/parser/inline/math.test.ts +1 -0
- package/src/parser/inline/math.ts +18 -9
- package/src/parser/inline/media.test.ts +3 -3
- package/src/parser/inline/media.ts +16 -8
- package/src/parser/inline/reference.ts +67 -10
- package/src/parser/inline/ruby.ts +6 -5
- package/src/parser/inline/shortmedia.ts +1 -1
- package/src/parser/inline.ts +4 -19
- package/src/parser/segment.test.ts +3 -2
- package/src/parser/segment.ts +2 -2
- package/src/parser/source/escapable.ts +1 -1
- package/src/parser/source/text.ts +2 -2
- package/src/parser/source/unescapable.ts +1 -1
- package/src/parser/util.ts +14 -4
- package/src/parser/visibility.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.
|
|
1
|
+
/*! securemark v0.291.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"));
|
|
@@ -2930,8 +2930,9 @@ exports.rewrite = rewrite;
|
|
|
2930
2930
|
Object.defineProperty(exports, "__esModule", ({
|
|
2931
2931
|
value: true
|
|
2932
2932
|
}));
|
|
2933
|
-
exports.setBacktrack = exports.
|
|
2933
|
+
exports.setBacktrack = exports.isBacktrack = exports.close = exports.open = exports.surround = void 0;
|
|
2934
2934
|
const parser_1 = __webpack_require__(605);
|
|
2935
|
+
const combinator_1 = __webpack_require__(3484);
|
|
2935
2936
|
const array_1 = __webpack_require__(6876);
|
|
2936
2937
|
function surround(opener, parser, closer, optional = false, f, g, backtracks = []) {
|
|
2937
2938
|
switch (typeof opener) {
|
|
@@ -2953,7 +2954,7 @@ function surround(opener, parser, closer, optional = false, f, g, backtracks = [
|
|
|
2953
2954
|
const {
|
|
2954
2955
|
linebreak
|
|
2955
2956
|
} = context;
|
|
2956
|
-
context.linebreak =
|
|
2957
|
+
context.linebreak = 0;
|
|
2957
2958
|
const resultS = opener({
|
|
2958
2959
|
source: sme_,
|
|
2959
2960
|
context
|
|
@@ -2961,26 +2962,26 @@ function surround(opener, parser, closer, optional = false, f, g, backtracks = [
|
|
|
2961
2962
|
if (resultS === undefined) return void revert(context, linebreak);
|
|
2962
2963
|
const nodesS = (0, parser_1.eval)(resultS);
|
|
2963
2964
|
const me_ = (0, parser_1.exec)(resultS);
|
|
2964
|
-
if (
|
|
2965
|
+
if (isBacktrack(context, backtracks, sme_, sme_.length - me_.length)) return void revert(context, linebreak);
|
|
2965
2966
|
const resultM = me_ !== '' ? parser({
|
|
2966
2967
|
source: me_,
|
|
2967
2968
|
context
|
|
2968
2969
|
}) : undefined;
|
|
2969
2970
|
const nodesM = (0, parser_1.eval)(resultM);
|
|
2970
|
-
const e_ = (0, parser_1.exec)(resultM
|
|
2971
|
+
const e_ = (0, parser_1.exec)(resultM) ?? me_;
|
|
2971
2972
|
const resultE = nodesM || optional ? closer({
|
|
2972
2973
|
source: e_,
|
|
2973
2974
|
context
|
|
2974
2975
|
}) : undefined;
|
|
2975
2976
|
const nodesE = (0, parser_1.eval)(resultE);
|
|
2976
|
-
const rest = (0, parser_1.exec)(resultE
|
|
2977
|
+
const rest = (0, parser_1.exec)(resultE) ?? e_;
|
|
2977
2978
|
nodesE || setBacktrack(context, backtracks, sme_.length);
|
|
2978
2979
|
if (!nodesM && !optional) return void revert(context, linebreak);
|
|
2979
2980
|
if (rest.length === sme_.length) return void revert(context, linebreak);
|
|
2980
2981
|
context.recent = [sme_.slice(0, sme_.length - me_.length), me_.slice(0, me_.length - e_.length), e_.slice(0, e_.length - rest.length)];
|
|
2981
2982
|
const result = nodesE ? f ? f([nodesS, nodesM, nodesE], rest, context) : [(0, array_1.push)((0, array_1.unshift)(nodesS, nodesM ?? []), nodesE), rest] : g ? g([nodesS, nodesM, me_], rest, context) : undefined;
|
|
2982
2983
|
if (result) {
|
|
2983
|
-
context.linebreak
|
|
2984
|
+
context.linebreak ||= linebreak;
|
|
2984
2985
|
} else {
|
|
2985
2986
|
revert(context, linebreak);
|
|
2986
2987
|
}
|
|
@@ -2997,8 +2998,9 @@ function close(parser, closer, optional, backtracks) {
|
|
|
2997
2998
|
}
|
|
2998
2999
|
exports.close = close;
|
|
2999
3000
|
const statesize = 2;
|
|
3000
|
-
function
|
|
3001
|
-
if (length
|
|
3001
|
+
function isBacktrack(context, backtracks, source, length = 1) {
|
|
3002
|
+
if (length === 0 || source.length === 0) return false;
|
|
3003
|
+
for (const backtrack of backtracks) {
|
|
3002
3004
|
if (backtrack & 1) {
|
|
3003
3005
|
const {
|
|
3004
3006
|
backtracks = {},
|
|
@@ -3014,10 +3016,11 @@ function getBacktrack(context, backtracks, source, length = 1) {
|
|
|
3014
3016
|
}
|
|
3015
3017
|
return false;
|
|
3016
3018
|
}
|
|
3017
|
-
exports.
|
|
3019
|
+
exports.isBacktrack = isBacktrack;
|
|
3018
3020
|
function setBacktrack(context, backtracks, position, length = 1) {
|
|
3019
|
-
if (length
|
|
3020
|
-
|
|
3021
|
+
if (length === 0 || position === 0) return;
|
|
3022
|
+
for (const backtrack of backtracks) {
|
|
3023
|
+
if (backtrack & 2 && position !== 0) {
|
|
3021
3024
|
const {
|
|
3022
3025
|
backtracks = {},
|
|
3023
3026
|
offset = 0
|
|
@@ -3038,10 +3041,13 @@ function match(pattern) {
|
|
|
3038
3041
|
}) => source.slice(0, pattern.length) === pattern ? [[], source.slice(pattern.length)] : undefined;
|
|
3039
3042
|
case 'object':
|
|
3040
3043
|
return ({
|
|
3041
|
-
source
|
|
3044
|
+
source,
|
|
3045
|
+
context
|
|
3042
3046
|
}) => {
|
|
3043
3047
|
const m = source.match(pattern);
|
|
3044
|
-
|
|
3048
|
+
if (m === null) return;
|
|
3049
|
+
(0, combinator_1.consume)(m[0].length, context);
|
|
3050
|
+
return [[], source.slice(m[0].length)];
|
|
3045
3051
|
};
|
|
3046
3052
|
}
|
|
3047
3053
|
}
|
|
@@ -3214,7 +3220,8 @@ function apply(parser, source, context, changes, values, reset = false) {
|
|
|
3214
3220
|
const prop = change[0];
|
|
3215
3221
|
switch (prop) {
|
|
3216
3222
|
case 'resources':
|
|
3217
|
-
|
|
3223
|
+
// プロトタイプに戻ることで戻す
|
|
3224
|
+
continue;
|
|
3218
3225
|
}
|
|
3219
3226
|
context[prop] = values[i];
|
|
3220
3227
|
values[i] = undefined;
|
|
@@ -3307,10 +3314,11 @@ function state(state, positive, parser) {
|
|
|
3307
3314
|
};
|
|
3308
3315
|
}
|
|
3309
3316
|
exports.state = state;
|
|
3317
|
+
//export function constraint<P extends Parser<unknown>>(state: number, positive: boolean, parser: P): P;
|
|
3310
3318
|
function constraint(state, positive, parser) {
|
|
3311
3319
|
if (typeof positive === 'function') {
|
|
3312
3320
|
parser = positive;
|
|
3313
|
-
positive =
|
|
3321
|
+
positive = false;
|
|
3314
3322
|
}
|
|
3315
3323
|
return input => {
|
|
3316
3324
|
const {
|
|
@@ -3336,7 +3344,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
3336
3344
|
exports.Delimiters = void 0;
|
|
3337
3345
|
class Delimiters {
|
|
3338
3346
|
constructor() {
|
|
3339
|
-
this.
|
|
3347
|
+
this.tree = {};
|
|
3340
3348
|
this.map = new Map();
|
|
3341
3349
|
this.delimiters = [];
|
|
3342
3350
|
this.stack = [];
|
|
@@ -3370,7 +3378,7 @@ class Delimiters {
|
|
|
3370
3378
|
}
|
|
3371
3379
|
registry(signature) {
|
|
3372
3380
|
if (typeof signature === 'number') {
|
|
3373
|
-
return this.
|
|
3381
|
+
return this.tree[signature] ??= [];
|
|
3374
3382
|
} else {
|
|
3375
3383
|
const ds = this.map.get(signature);
|
|
3376
3384
|
if (ds) return ds;
|
|
@@ -3574,7 +3582,7 @@ exports.some = void 0;
|
|
|
3574
3582
|
const parser_1 = __webpack_require__(605);
|
|
3575
3583
|
const delimiter_1 = __webpack_require__(5691);
|
|
3576
3584
|
const array_1 = __webpack_require__(6876);
|
|
3577
|
-
function some(parser, end, delimiters = [], limit =
|
|
3585
|
+
function some(parser, end, delimiters = [], limit = 0) {
|
|
3578
3586
|
if (typeof end === 'number') return some(parser, undefined, delimiters, end);
|
|
3579
3587
|
const match = delimiter_1.Delimiters.matcher(end);
|
|
3580
3588
|
const delims = delimiters.map(([delimiter, precedence, linebreakable = true]) => ({
|
|
@@ -3605,7 +3613,7 @@ function some(parser, end, delimiters = [], limit = -1) {
|
|
|
3605
3613
|
if (result === undefined) break;
|
|
3606
3614
|
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);
|
|
3607
3615
|
rest = (0, parser_1.exec)(result);
|
|
3608
|
-
if (limit
|
|
3616
|
+
if (limit > 0 && source.length - rest.length > limit) break;
|
|
3609
3617
|
}
|
|
3610
3618
|
if (delims.length > 0) {
|
|
3611
3619
|
context.delimiters.pop(delims.length);
|
|
@@ -4195,6 +4203,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
4195
4203
|
}));
|
|
4196
4204
|
exports.block = void 0;
|
|
4197
4205
|
const combinator_1 = __webpack_require__(3484);
|
|
4206
|
+
const segment_1 = __webpack_require__(3967);
|
|
4198
4207
|
const source_1 = __webpack_require__(8745);
|
|
4199
4208
|
const pagebreak_1 = __webpack_require__(2946);
|
|
4200
4209
|
const heading_1 = __webpack_require__(2778);
|
|
@@ -4215,7 +4224,8 @@ const random_1 = __webpack_require__(3158);
|
|
|
4215
4224
|
const dom_1 = __webpack_require__(394);
|
|
4216
4225
|
exports.block = (0, combinator_1.reset)({
|
|
4217
4226
|
resources: {
|
|
4218
|
-
|
|
4227
|
+
// バックトラックのせいで文字数制限を受けないようにする。
|
|
4228
|
+
clock: segment_1.MAX_SEGMENT_SIZE * 11 + 1,
|
|
4219
4229
|
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 */]
|
|
4220
4230
|
}
|
|
4221
4231
|
}, 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])));
|
|
@@ -4359,7 +4369,7 @@ const util_1 = __webpack_require__(4992);
|
|
|
4359
4369
|
const visibility_1 = __webpack_require__(6364);
|
|
4360
4370
|
const array_1 = __webpack_require__(6876);
|
|
4361
4371
|
const dom_1 = __webpack_require__(394);
|
|
4362
|
-
exports.dlist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/^~[^\S\n]+(?=\S)/, (0, combinator_1.some)((0, combinator_1.inits)([(0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */ | 32 /* State.index */ | 16 /* State.label */ | 8 /* State.link
|
|
4372
|
+
exports.dlist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/^~[^\S\n]+(?=\S)/, (0, combinator_1.some)((0, combinator_1.inits)([(0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */ | 32 /* State.index */ | 16 /* State.label */ | 8 /* State.link */, (0, combinator_1.some)(term)), (0, combinator_1.some)(desc)]))), es => [(0, dom_1.html)('dl', fillTrailingDescription(es))])));
|
|
4363
4373
|
const term = (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.open)(/^~[^\S\n]+(?=\S)/, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))), true), ns => [(0, dom_1.html)('dt', {
|
|
4364
4374
|
'data-index': (0, inline_1.dataindex)(ns)
|
|
4365
4375
|
}, (0, dom_1.defrag)(ns))])));
|
|
@@ -5014,10 +5024,10 @@ const util_1 = __webpack_require__(4992);
|
|
|
5014
5024
|
const dom_1 = __webpack_require__(394);
|
|
5015
5025
|
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)(({
|
|
5016
5026
|
source
|
|
5017
|
-
}) => [[source], '']))
|
|
5027
|
+
}) => [[source], ''])))));
|
|
5018
5028
|
exports.heading = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment,
|
|
5019
5029
|
// その他の表示制御は各所のCSSで行う。
|
|
5020
|
-
(0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */ | 32 /* State.index */ | 16 /* State.label */ | 8 /* State.link
|
|
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}`, {
|
|
5021
5031
|
'data-index': (0, inline_1.dataindex)(ns)
|
|
5022
5032
|
}, (0, dom_1.defrag)(ns)) : (0, dom_1.html)(`h6`, {
|
|
5023
5033
|
class: 'invalid',
|
|
@@ -5109,10 +5119,10 @@ const util_1 = __webpack_require__(4992);
|
|
|
5109
5119
|
const dom_1 = __webpack_require__(394);
|
|
5110
5120
|
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]), ({
|
|
5111
5121
|
source
|
|
5112
|
-
}) => [[(0, dom_1.html)('
|
|
5122
|
+
}) => [[(0, dom_1.html)('span', {
|
|
5113
5123
|
class: 'invalid',
|
|
5114
5124
|
...(0, util_1.invalid)('mediablock', 'syntax', 'Not media syntax')
|
|
5115
|
-
}, source.replace('\n', ''))]
|
|
5125
|
+
}, source.replace('\n', ''))], ''])))]), ns => [(0, dom_1.html)('div', ns)])));
|
|
5116
5126
|
|
|
5117
5127
|
/***/ },
|
|
5118
5128
|
|
|
@@ -5254,7 +5264,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
5254
5264
|
exports.pagebreak = void 0;
|
|
5255
5265
|
const combinator_1 = __webpack_require__(3484);
|
|
5256
5266
|
const dom_1 = __webpack_require__(394);
|
|
5257
|
-
exports.pagebreak = (0, combinator_1.block)((0, combinator_1.line)((0, combinator_1.focus)(/^={3,}[^\S\n]*(?:$|\n)/, () => [[(0, dom_1.html)('hr')], '']
|
|
5267
|
+
exports.pagebreak = (0, combinator_1.block)((0, combinator_1.line)((0, combinator_1.focus)(/^={3,}[^\S\n]*(?:$|\n)/, () => [[(0, dom_1.html)('hr')], ''])));
|
|
5258
5268
|
|
|
5259
5269
|
/***/ },
|
|
5260
5270
|
|
|
@@ -5296,7 +5306,7 @@ const util_1 = __webpack_require__(4992);
|
|
|
5296
5306
|
const visibility_1 = __webpack_require__(6364);
|
|
5297
5307
|
const dom_1 = __webpack_require__(394);
|
|
5298
5308
|
const delimiter = new RegExp(`${cite_1.syntax.source}|${quote_1.syntax.source}`);
|
|
5299
|
-
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, util_1.lineable)((0, combinator_1.some)(inline_1.inline),
|
|
5309
|
+
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, util_1.lineable)((0, combinator_1.some)(inline_1.inline), 1)))])), ns => [(0, dom_1.html)('p', (0, visibility_1.trimBlankNodeEnd)((0, dom_1.defrag)(ns)))])));
|
|
5300
5310
|
|
|
5301
5311
|
/***/ },
|
|
5302
5312
|
|
|
@@ -5505,7 +5515,7 @@ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/^---+[
|
|
|
5505
5515
|
class: 'header'
|
|
5506
5516
|
}, [(0, dom_1.html)('details', {
|
|
5507
5517
|
open: ''
|
|
5508
|
-
}, (0, dom_1.defrag)([(0, dom_1.html)('summary', 'Header'), ...es]))])]), false)
|
|
5518
|
+
}, (0, dom_1.defrag)([(0, dom_1.html)('summary', 'Header'), ...es]))])]), false))), ({
|
|
5509
5519
|
source
|
|
5510
5520
|
}) => [[(0, dom_1.html)('pre', {
|
|
5511
5521
|
class: 'invalid',
|
|
@@ -5562,14 +5572,11 @@ const htmlentity_1 = __webpack_require__(470);
|
|
|
5562
5572
|
const bracket_1 = __webpack_require__(4526);
|
|
5563
5573
|
const autolink_1 = __webpack_require__(8072);
|
|
5564
5574
|
const source_1 = __webpack_require__(8745);
|
|
5565
|
-
exports.inline = (0, combinator_1.lazy)(() => (0, combinator_1.
|
|
5575
|
+
exports.inline = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input => {
|
|
5566
5576
|
const {
|
|
5567
|
-
source
|
|
5568
|
-
context
|
|
5577
|
+
source
|
|
5569
5578
|
} = input;
|
|
5570
5579
|
if (source === '') return;
|
|
5571
|
-
context.depth ??= 0;
|
|
5572
|
-
++context.depth;
|
|
5573
5580
|
switch (source.slice(0, 2)) {
|
|
5574
5581
|
case '((':
|
|
5575
5582
|
return (0, annotation_1.annotation)(input);
|
|
@@ -5612,19 +5619,7 @@ exports.inline = (0, combinator_1.lazy)(() => (0, combinator_1.verify)((0, combi
|
|
|
5612
5619
|
case '&':
|
|
5613
5620
|
return (0, htmlentity_1.htmlentity)(input);
|
|
5614
5621
|
}
|
|
5615
|
-
}, bracket_1.bracket, autolink_1.autolink, source_1.text])
|
|
5616
|
-
--context.depth;
|
|
5617
|
-
// ヒープを効率的に削除可能な場合は削除する。
|
|
5618
|
-
// ヒープサイズは括弧類など特定の構文が完成しなかった場合にしか増加しないため
|
|
5619
|
-
// ブロックごとに平均数ノード以下となることから削除せずとも平均的にはあまり影響はない。
|
|
5620
|
-
//if (context.depth === 0) {
|
|
5621
|
-
// const { backtracks } = context;
|
|
5622
|
-
// while (backtracks.peek()?.key! > rest.length) {
|
|
5623
|
-
// backtracks.extract();
|
|
5624
|
-
// }
|
|
5625
|
-
//}
|
|
5626
|
-
return true;
|
|
5627
|
-
}));
|
|
5622
|
+
}, bracket_1.bracket, autolink_1.autolink, source_1.text]));
|
|
5628
5623
|
var indexee_1 = __webpack_require__(7610);
|
|
5629
5624
|
Object.defineProperty(exports, "indexee", ({
|
|
5630
5625
|
enumerable: true,
|
|
@@ -5684,9 +5679,9 @@ const combinator_1 = __webpack_require__(3484);
|
|
|
5684
5679
|
const inline_1 = __webpack_require__(7973);
|
|
5685
5680
|
const visibility_1 = __webpack_require__(6364);
|
|
5686
5681
|
const dom_1 = __webpack_require__(394);
|
|
5687
|
-
exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(128 /* State.annotation */,
|
|
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], rest, context) => context.linebreak === 0 ? [[(0, dom_1.html)('sup', {
|
|
5688
5683
|
class: 'annotation'
|
|
5689
|
-
}, [(0, dom_1.html)('span', (0, dom_1.defrag)(ns))])], rest] : undefined, undefined, [3 | 16 /* Backtrack.doublebracket */, 1 | 8 /* Backtrack.bracket */])));
|
|
5684
|
+
}, [(0, dom_1.html)('span', (0, dom_1.defrag)((0, visibility_1.trimBlankNodeEnd)(ns)))])], rest] : undefined, undefined, [3 | 16 /* Backtrack.doublebracket */, 1 | 8 /* Backtrack.bracket */])));
|
|
5690
5685
|
|
|
5691
5686
|
/***/ },
|
|
5692
5687
|
|
|
@@ -5739,7 +5734,7 @@ const link_1 = __webpack_require__(3628);
|
|
|
5739
5734
|
const source_1 = __webpack_require__(8745);
|
|
5740
5735
|
const dom_1 = __webpack_require__(394);
|
|
5741
5736
|
// https://example/@user must be a user page or a redirect page going there.
|
|
5742
|
-
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 */,
|
|
5737
|
+
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, {
|
|
5743
5738
|
class: 'account'
|
|
5744
5739
|
})]))), ({
|
|
5745
5740
|
source
|
|
@@ -5767,7 +5762,7 @@ const dom_1 = __webpack_require__(394);
|
|
|
5767
5762
|
// cid: YYYY-MMDD-HHMM-SSmmm
|
|
5768
5763
|
// 内部表現はUnixTimeに統一する(時系列順)
|
|
5769
5764
|
// 外部表現は投稿ごとに投稿者の投稿時のタイムゾーンに統一する(非時系列順)
|
|
5770
|
-
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 */,
|
|
5765
|
+
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, {
|
|
5771
5766
|
class: 'anchor'
|
|
5772
5767
|
})]))), ({
|
|
5773
5768
|
source
|
|
@@ -5791,7 +5786,7 @@ const hashtag_1 = __webpack_require__(5764);
|
|
|
5791
5786
|
const util_1 = __webpack_require__(4992);
|
|
5792
5787
|
const dom_1 = __webpack_require__(394);
|
|
5793
5788
|
// https://example/@user?ch=a+b must be a user channel page or a redirect page going there.
|
|
5794
|
-
exports.channel = (0, combinator_1.validate)('@', (0, combinator_1.constraint)(1 /* State.autolink */,
|
|
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)]), (es, rest) => {
|
|
5795
5790
|
const source = (0, util_1.stringify)(es);
|
|
5796
5791
|
const el = es[0];
|
|
5797
5792
|
const url = `${el.getAttribute('href')}?ch=${source.slice(source.indexOf('#') + 1).replace(/#/g, '+')}`;
|
|
@@ -5817,7 +5812,7 @@ const combinator_1 = __webpack_require__(3484);
|
|
|
5817
5812
|
const source_1 = __webpack_require__(8745);
|
|
5818
5813
|
const dom_1 = __webpack_require__(394);
|
|
5819
5814
|
// https://html.spec.whatwg.org/multipage/input.html
|
|
5820
|
-
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 */,
|
|
5815
|
+
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 */, ({
|
|
5821
5816
|
source
|
|
5822
5817
|
}) => [[(0, dom_1.html)('a', {
|
|
5823
5818
|
class: 'email',
|
|
@@ -5843,7 +5838,7 @@ const link_1 = __webpack_require__(3628);
|
|
|
5843
5838
|
const hashtag_1 = __webpack_require__(5764);
|
|
5844
5839
|
const source_1 = __webpack_require__(8745);
|
|
5845
5840
|
const dom_1 = __webpack_require__(394);
|
|
5846
|
-
exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, source_1.str)(new RegExp([/^[0-9]{1,9}(?![^\p{C}\p{S}\p{P}\s]|emoji)/u.source].join('').replace(/emoji/, hashtag_1.emoji), 'u'))), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */,
|
|
5841
|
+
exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, source_1.str)(new RegExp([/^[0-9]{1,9}(?![^\p{C}\p{S}\p{P}\s]|emoji)/u.source].join('').replace(/emoji/, hashtag_1.emoji), 'u'))), (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.slice(1)} }`, link_1.unsafelink, false), ([el]) => [(0, dom_1.define)(el, {
|
|
5847
5842
|
class: 'hashnum',
|
|
5848
5843
|
href: null
|
|
5849
5844
|
})]))), ({
|
|
@@ -5869,7 +5864,7 @@ const dom_1 = __webpack_require__(394);
|
|
|
5869
5864
|
// https://example/hashtags/a must be a hashtag page or a redirect page going there.
|
|
5870
5865
|
// https://github.com/tc39/proposal-regexp-unicode-property-escapes#matching-emoji
|
|
5871
5866
|
exports.emoji = String.raw`\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F`;
|
|
5872
|
-
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 */,
|
|
5867
|
+
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, {
|
|
5873
5868
|
class: 'hashtag'
|
|
5874
5869
|
})]))), ({
|
|
5875
5870
|
source
|
|
@@ -5890,11 +5885,12 @@ exports.lineurl = exports.url = void 0;
|
|
|
5890
5885
|
const combinator_1 = __webpack_require__(3484);
|
|
5891
5886
|
const link_1 = __webpack_require__(3628);
|
|
5892
5887
|
const source_1 = __webpack_require__(8745);
|
|
5893
|
-
|
|
5894
|
-
|
|
5888
|
+
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
|
+
// 再帰に注意
|
|
5890
|
+
(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))), ({
|
|
5895
5891
|
source
|
|
5896
5892
|
}) => [[source], '']]))));
|
|
5897
|
-
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 */,
|
|
5893
|
+
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))), ({
|
|
5898
5894
|
source
|
|
5899
5895
|
}) => [[source], '']])])), false, [3 | 0 /* Backtrack.autolink */]));
|
|
5900
5896
|
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 */])]));
|
|
@@ -5913,6 +5909,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
5913
5909
|
exports.bracket = void 0;
|
|
5914
5910
|
const combinator_1 = __webpack_require__(3484);
|
|
5915
5911
|
const inline_1 = __webpack_require__(7973);
|
|
5912
|
+
const link_1 = __webpack_require__(3628);
|
|
5916
5913
|
const source_1 = __webpack_require__(8745);
|
|
5917
5914
|
const array_1 = __webpack_require__(6876);
|
|
5918
5915
|
const dom_1 = __webpack_require__(394);
|
|
@@ -5926,7 +5923,29 @@ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, comb
|
|
|
5926
5923
|
recent = []
|
|
5927
5924
|
}) => [indexF.test(recent[1]) ? recent : [(0, dom_1.html)('span', {
|
|
5928
5925
|
class: 'paren'
|
|
5929
|
-
}, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (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,
|
|
5926
|
+
}, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (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], rest, context) => {
|
|
5927
|
+
if (context.state & 8 /* State.link */) {
|
|
5928
|
+
const {
|
|
5929
|
+
recent
|
|
5930
|
+
} = context;
|
|
5931
|
+
const head = recent.reduce((a, b) => a + b.length, rest.length);
|
|
5932
|
+
if (context.linebreak > 0 || rest[0] !== '{') {
|
|
5933
|
+
(0, combinator_1.setBacktrack)(context, [2 | 64 /* Backtrack.link */], head);
|
|
5934
|
+
} else {
|
|
5935
|
+
context.state ^= 8 /* State.link */;
|
|
5936
|
+
const result = !(0, combinator_1.isBacktrack)(context, [1 | 64 /* Backtrack.link */], rest) ? (0, link_1.textlink)({
|
|
5937
|
+
source: rest,
|
|
5938
|
+
context
|
|
5939
|
+
}) : undefined;
|
|
5940
|
+
if (!result) {
|
|
5941
|
+
(0, combinator_1.setBacktrack)(context, [2 | 64 /* Backtrack.link */], head);
|
|
5942
|
+
}
|
|
5943
|
+
context.state ^= 8 /* State.link */;
|
|
5944
|
+
context.recent = recent;
|
|
5945
|
+
}
|
|
5946
|
+
}
|
|
5947
|
+
return [(0, array_1.push)((0, array_1.unshift)(as, bs), cs), rest];
|
|
5948
|
+
}, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], [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 = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (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 = []], rest) => [(0, array_1.unshift)(as, bs), rest], [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 = []], rest) => [(0, array_1.unshift)(as, bs), rest]),
|
|
5930
5949
|
// 同一行内でしか閉じない以外括弧と同じ挙動
|
|
5931
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], rest, {
|
|
5932
5951
|
linebreak = 0
|
|
@@ -5949,7 +5968,7 @@ const dom_1 = __webpack_require__(394);
|
|
|
5949
5968
|
exports.code = (0, combinator_1.validate)(({
|
|
5950
5969
|
source,
|
|
5951
5970
|
context
|
|
5952
|
-
}) => source[0] === '`' && !(0, combinator_1.
|
|
5971
|
+
}) => source[0] === '`' && !(0, combinator_1.isBacktrack)(context, [1 | 8 /* Backtrack.bracket */], source), (0, combinator_1.match)(/^(`+)(?!`)([^\n]*?)(?:((?<!`)\1(?!`))|$|\n)/, ([whole,, body, closer]) => ({
|
|
5953
5972
|
source,
|
|
5954
5973
|
context
|
|
5955
5974
|
}) => closer ? [[(0, dom_1.html)('code', {
|
|
@@ -6113,30 +6132,45 @@ const source_1 = __webpack_require__(8745);
|
|
|
6113
6132
|
const visibility_1 = __webpack_require__(6364);
|
|
6114
6133
|
const array_1 = __webpack_require__(6876);
|
|
6115
6134
|
const dom_1 = __webpack_require__(394);
|
|
6116
|
-
exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(32 /* State.index */,
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
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, ([as, bs, cs], rest, context) => {
|
|
6136
|
+
if (context.linebreak === 0 && (0, visibility_1.trimBlankNodeEnd)(bs).length > 0) {
|
|
6137
|
+
return [[(0, dom_1.html)('a', {
|
|
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 => {
|
|
6145
|
+
if (ns.length === 1) {
|
|
6146
|
+
const el = ns[0];
|
|
6147
|
+
return [(0, dom_1.define)(el, {
|
|
6148
|
+
id: el.id ? null : undefined,
|
|
6149
|
+
class: 'index',
|
|
6150
|
+
href: el.id ? `#${el.id}` : undefined
|
|
6151
|
+
})];
|
|
6152
|
+
} else {
|
|
6153
|
+
ns.pop();
|
|
6154
|
+
return ns;
|
|
6155
|
+
}
|
|
6156
|
+
})));
|
|
6157
|
+
exports.signature = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('|', (0, combinator_1.surround)((0, source_1.str)(/^\|(?!\\?\s)/), (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])), /^(?=])/, false, (_, rest, context) => {
|
|
6124
6158
|
//context.offset ??= 0;
|
|
6125
6159
|
//context.offset += rest.length;
|
|
6126
|
-
const
|
|
6160
|
+
const text = (0, parser_1.eval)(sig({
|
|
6127
6161
|
source: context.recent[1],
|
|
6128
6162
|
context
|
|
6129
6163
|
}), []).join('');
|
|
6130
6164
|
//context.offset -= rest.length;
|
|
6131
|
-
const index = (0, indexee_1.identity)('index', undefined,
|
|
6132
|
-
return [[(0, dom_1.html)('span', {
|
|
6165
|
+
const index = (0, indexee_1.identity)('index', undefined, text)?.slice(7);
|
|
6166
|
+
return index ? [[(0, dom_1.html)('span', {
|
|
6133
6167
|
class: 'indexer',
|
|
6134
6168
|
'data-index': index
|
|
6135
|
-
})], rest];
|
|
6169
|
+
})], rest] : undefined;
|
|
6136
6170
|
}, ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest])));
|
|
6137
6171
|
function dataindex(ns) {
|
|
6138
6172
|
if (ns.length === 0) return;
|
|
6139
|
-
for (let i = ns.length
|
|
6173
|
+
for (let i = ns.length; i--;) {
|
|
6140
6174
|
const node = ns[i];
|
|
6141
6175
|
if (typeof node === 'string') return;
|
|
6142
6176
|
if (i === ns.length - 1 && ['UL', 'OL'].includes(node.tagName)) continue;
|
|
@@ -6145,7 +6179,7 @@ function dataindex(ns) {
|
|
|
6145
6179
|
}
|
|
6146
6180
|
}
|
|
6147
6181
|
exports.dataindex = dataindex;
|
|
6148
|
-
const
|
|
6182
|
+
const sig = (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]));
|
|
6149
6183
|
|
|
6150
6184
|
/***/ },
|
|
6151
6185
|
|
|
@@ -6162,12 +6196,12 @@ exports.text = exports.signature = exports.identity = exports.indexee = void 0;
|
|
|
6162
6196
|
const combinator_1 = __webpack_require__(3484);
|
|
6163
6197
|
const dom_1 = __webpack_require__(394);
|
|
6164
6198
|
function indexee(parser) {
|
|
6165
|
-
return (0, combinator_1.fmap)(parser, (
|
|
6199
|
+
return (0, combinator_1.fmap)(parser, (ns, _, {
|
|
6166
6200
|
id
|
|
6167
|
-
}) => [(0, dom_1.define)(
|
|
6168
|
-
id: identity('index', id,
|
|
6201
|
+
}) => ns.length === 1 ? [(0, dom_1.define)(ns[0], {
|
|
6202
|
+
id: identity('index', id, ns[0]),
|
|
6169
6203
|
'data-index': null
|
|
6170
|
-
})]);
|
|
6204
|
+
})] : ns);
|
|
6171
6205
|
}
|
|
6172
6206
|
exports.indexee = indexee;
|
|
6173
6207
|
const MAX = 60;
|
|
@@ -6241,8 +6275,8 @@ function signature(source) {
|
|
|
6241
6275
|
case 'label':
|
|
6242
6276
|
el.replaceWith(`[$${el.getAttribute('data-label').replace('$', '')}]`);
|
|
6243
6277
|
continue;
|
|
6244
|
-
case 'remark':
|
|
6245
6278
|
case 'checkbox':
|
|
6279
|
+
case 'remark':
|
|
6246
6280
|
case 'annotation':
|
|
6247
6281
|
case 'reference':
|
|
6248
6282
|
el.remove();
|
|
@@ -6272,8 +6306,8 @@ function text(source) {
|
|
|
6272
6306
|
case 'math':
|
|
6273
6307
|
el.replaceWith(el.getAttribute('data-src'));
|
|
6274
6308
|
continue;
|
|
6275
|
-
case 'remark':
|
|
6276
6309
|
case 'checkbox':
|
|
6310
|
+
case 'remark':
|
|
6277
6311
|
case 'annotation':
|
|
6278
6312
|
case 'reference':
|
|
6279
6313
|
el.remove();
|
|
@@ -6326,7 +6360,7 @@ const source_1 = __webpack_require__(8745);
|
|
|
6326
6360
|
const dom_1 = __webpack_require__(394);
|
|
6327
6361
|
const body = (0, source_1.str)(/^\$[A-Za-z]*(?:(?:-[A-Za-z][0-9A-Za-z]*)+|-(?:(?:0|[1-9][0-9]*)\.)*(?:0|[1-9][0-9]*)(?![0-9A-Za-z]))/);
|
|
6328
6362
|
exports.segment = (0, combinator_1.clear)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body]));
|
|
6329
|
-
exports.label = (0, combinator_1.constraint)(16 /* State.label */,
|
|
6363
|
+
exports.label = (0, combinator_1.constraint)(16 /* State.label */, (0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']', false, undefined, undefined, [1 | 8 /* Backtrack.bracket */, 1]), body]), ([text]) => [(0, dom_1.html)('a', {
|
|
6330
6364
|
class: 'label',
|
|
6331
6365
|
'data-label': text.slice(text[1] === '-' ? 0 : 1).toLowerCase()
|
|
6332
6366
|
}, text)]));
|
|
@@ -6394,8 +6428,9 @@ const util_1 = __webpack_require__(4992);
|
|
|
6394
6428
|
const memoize_1 = __webpack_require__(6925);
|
|
6395
6429
|
const array_1 = __webpack_require__(6876);
|
|
6396
6430
|
const dom_1 = __webpack_require__(394);
|
|
6397
|
-
const tags = Object.freeze(['bdo', 'bdi']);
|
|
6431
|
+
const tags = Object.freeze(['wbr', 'bdo', 'bdi']);
|
|
6398
6432
|
const attrspecs = {
|
|
6433
|
+
wbr: {},
|
|
6399
6434
|
bdo: {
|
|
6400
6435
|
dir: Object.freeze(['ltr', 'rtl'])
|
|
6401
6436
|
}
|
|
@@ -6404,20 +6439,21 @@ Object.setPrototypeOf(attrspecs, null);
|
|
|
6404
6439
|
Object.values(attrspecs).forEach(o => Object.setPrototypeOf(o, null));
|
|
6405
6440
|
exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/^<[a-z]+(?=[^\S\n]|>)/i, (0, combinator_1.union)([(0, combinator_1.surround)(
|
|
6406
6441
|
// https://html.spec.whatwg.org/multipage/syntax.html#void-elements
|
|
6407
|
-
(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, source_1.str)(/^[^\S\n]
|
|
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], rest) => [[elem(as[0].slice(1), false, (0, array_1.push)((0, array_1.unshift)(as, bs), cs), [], [])], rest], ([as, bs = []], rest) => [[elem(as[0].slice(1), false, (0, array_1.unshift)(as, bs), [], [])], rest]), (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], rest) => [(0, array_1.push)((0, array_1.unshift)(as, bs), cs), rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (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], rest) => [[elem(tag, true, as, bs, cs)], rest], ([as, bs = []], rest) => [[elem(tag, true, as, bs, [])], rest]), ([, tag]) => tag, new Map())), (0, combinator_1.surround)(
|
|
6408
6443
|
// https://html.spec.whatwg.org/multipage/syntax.html#void-elements
|
|
6409
|
-
(0, source_1.str)(/^<[a-z]
|
|
6410
|
-
exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="[
|
|
6411
|
-
|
|
6412
|
-
// [...document.querySelectorAll('tbody > tr > td:first-child')].map(el => el.textContent.slice(1, -1))
|
|
6413
|
-
const TAGS = Object.freeze(["html", "base", "head", "link", "meta", "style", "title", "body", "address", "article", "aside", "footer", "header", "h1", "h2", "h3", "h4", "h5", "h6", "hgroup", "main", "nav", "section", "blockquote", "dd", "div", "dl", "dt", "figcaption", "figure", "hr", "li", "menu", "ol", "p", "pre", "ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn", "em", "i", "kbd", "mark", "q", "rp", "rt", "ruby", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "area", "audio", "img", "map", "track", "video", "embed", "iframe", "object", "picture", "portal", "source", "svg", "math", "canvas", "noscript", "script", "del", "ins", "caption", "col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "button", "datalist", "fieldset", "form", "input", "label", "legend", "meter", "optgroup", "option", "output", "progress", "select", "textarea", "details", "dialog", "summary", "slot", "template", "acronym", "applet", "bgsound", "big", "blink", "center", "content", "dir", "font", "frame", "frameset", "image", "keygen", "marquee", "menuitem", "nobr", "noembed", "noframes", "param", "plaintext", "rb", "rtc", "shadow", "spacer", "strike", "tt", "xmp"]);
|
|
6414
|
-
function elem(tag, as, bs, cs) {
|
|
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], rest) => [[elem(as[0].slice(1), false, (0, array_1.push)((0, array_1.unshift)(as, bs), cs), [], [])], rest], ([as, bs = []], rest) => [[elem(as[0].slice(1), false, (0, array_1.unshift)(as, bs), [], [])], rest])])));
|
|
6445
|
+
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) {
|
|
6415
6447
|
if (!tags.includes(tag)) return ielem('tag', `Invalid HTML tag name "${tag}"`, as, bs, cs);
|
|
6416
|
-
if (
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
|
|
6448
|
+
if (content) {
|
|
6449
|
+
if (cs.length === 0) return ielem('tag', `Missing the closing HTML tag "</${tag}>"`, as, bs, cs);
|
|
6450
|
+
if (bs.length === 0) return ielem('content', `Missing the content`, as, bs, cs);
|
|
6451
|
+
if (!(0, visibility_1.isLooseNodeStart)(bs)) return ielem('content', `Missing the visible content in the same line`, as, bs, cs);
|
|
6452
|
+
}
|
|
6453
|
+
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', as, bs, cs);
|
|
6455
|
+
if (as.at(-1) !== '>') return ielem('tag', `Missing the closing bracket ">"`, as, bs, cs);
|
|
6456
|
+
return (0, dom_1.html)(tag, attrs, (0, dom_1.defrag)(bs));
|
|
6421
6457
|
}
|
|
6422
6458
|
function ielem(type, message, as, bs, cs) {
|
|
6423
6459
|
return (0, dom_1.html)('span', {
|
|
@@ -6426,11 +6462,11 @@ function ielem(type, message, as, bs, cs) {
|
|
|
6426
6462
|
}, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)));
|
|
6427
6463
|
}
|
|
6428
6464
|
const requiredAttributes = (0, memoize_1.memoize)(spec => Object.entries(spec).flatMap(([k, v]) => v && Object.isFrozen(v) ? [k] : []), new WeakMap());
|
|
6429
|
-
function attributes(syntax,
|
|
6465
|
+
function attributes(syntax, spec, params) {
|
|
6430
6466
|
let invalidation = false;
|
|
6431
6467
|
const attrs = {};
|
|
6432
6468
|
for (let i = 0; i < params.length; ++i) {
|
|
6433
|
-
const param = params[i].
|
|
6469
|
+
const param = params[i].trimStart();
|
|
6434
6470
|
const name = param.split('=', 1)[0];
|
|
6435
6471
|
const value = param !== name ? param.slice(name.length + 2, -1).replace(/\\(.?)/g, '$1') : undefined;
|
|
6436
6472
|
invalidation ||= !spec || name in attrs;
|
|
@@ -6440,12 +6476,15 @@ function attributes(syntax, classes, spec, params) {
|
|
|
6440
6476
|
}
|
|
6441
6477
|
invalidation ||= !!spec && !requiredAttributes(spec).every(name => name in attrs);
|
|
6442
6478
|
if (invalidation) {
|
|
6443
|
-
attrs['class'] =
|
|
6479
|
+
attrs['class'] = 'invalid';
|
|
6444
6480
|
Object.assign(attrs, (0, util_1.invalid)(syntax, 'argument', 'Invalid argument'));
|
|
6445
6481
|
}
|
|
6446
6482
|
return attrs;
|
|
6447
6483
|
}
|
|
6448
6484
|
exports.attributes = attributes;
|
|
6485
|
+
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element
|
|
6486
|
+
// [...document.querySelectorAll('tbody > tr > td:first-child')].map(el => el.textContent.slice(1, -1))
|
|
6487
|
+
const TAGS = Object.freeze(["html", "base", "head", "link", "meta", "style", "title", "body", "address", "article", "aside", "footer", "header", "h1", "h2", "h3", "h4", "h5", "h6", "hgroup", "main", "nav", "section", "blockquote", "dd", "div", "dl", "dt", "figcaption", "figure", "hr", "li", "menu", "ol", "p", "pre", "ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn", "em", "i", "kbd", "mark", "q", "rp", "rt", "ruby", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "area", "audio", "img", "map", "track", "video", "embed", "iframe", "object", "picture", "portal", "source", "svg", "math", "canvas", "noscript", "script", "del", "ins", "caption", "col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "button", "datalist", "fieldset", "form", "input", "label", "legend", "meter", "optgroup", "option", "output", "progress", "select", "textarea", "details", "dialog", "summary", "slot", "template", "acronym", "applet", "bgsound", "big", "blink", "center", "content", "dir", "font", "frame", "frameset", "image", "keygen", "marquee", "menuitem", "nobr", "noembed", "noframes", "param", "plaintext", "rb", "rtc", "shadow", "spacer", "strike", "tt", "xmp"]);
|
|
6449
6488
|
|
|
6450
6489
|
/***/ },
|
|
6451
6490
|
|
|
@@ -6532,7 +6571,7 @@ exports.italic = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('///',
|
|
|
6532
6571
|
Object.defineProperty(exports, "__esModule", ({
|
|
6533
6572
|
value: true
|
|
6534
6573
|
}));
|
|
6535
|
-
exports.resolve = exports.option = exports.uri = exports.unsafelink = exports.linemedialink = exports.medialink = exports.textlink = void 0;
|
|
6574
|
+
exports.decode = exports.resolve = exports.option = exports.uri = exports.unsafelink = exports.linemedialink = exports.medialink = exports.textlink = void 0;
|
|
6536
6575
|
const combinator_1 = __webpack_require__(3484);
|
|
6537
6576
|
const inline_1 = __webpack_require__(7973);
|
|
6538
6577
|
const html_1 = __webpack_require__(5013);
|
|
@@ -6546,11 +6585,15 @@ const optspec = {
|
|
|
6546
6585
|
rel: ['nofollow']
|
|
6547
6586
|
};
|
|
6548
6587
|
Object.setPrototypeOf(optspec, null);
|
|
6549
|
-
exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */,
|
|
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 = []], rest, context) => context.linebreak === 0 ? [(0, array_1.push)(ns, ["\u001B" /* Command.Escape */]), rest] : undefined, undefined, [3 | 64 /* Backtrack.link */, 2 | 32 /* Backtrack.ruby */, 3 | 8 /* Backtrack.bracket */])),
|
|
6589
|
+
// `{ `と`{`で個別にバックトラックが発生し+1nされる。
|
|
6590
|
+
// 自己再帰的にパースしてもオプションの不要なパースによる計算量の増加により相殺される。
|
|
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, undefined, [3 | 64 /* Backtrack.link */]))]), ([content, params], rest, context) => {
|
|
6550
6592
|
if (content.at(-1) === "\u001B" /* Command.Escape */) {
|
|
6551
6593
|
content.pop();
|
|
6552
6594
|
if (params === undefined) {
|
|
6553
|
-
|
|
6595
|
+
const head = context.recent.reduce((a, b) => a + b.length, rest.length);
|
|
6596
|
+
return void (0, combinator_1.setBacktrack)(context, [2 | 64 /* Backtrack.link */], head);
|
|
6554
6597
|
}
|
|
6555
6598
|
} else {
|
|
6556
6599
|
params = content;
|
|
@@ -6559,11 +6602,11 @@ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /
|
|
|
6559
6602
|
if (content.length !== 0 && (0, visibility_1.trimBlankNodeEnd)(content).length === 0) return;
|
|
6560
6603
|
return [[parse((0, dom_1.defrag)(content), params, context)], rest];
|
|
6561
6604
|
}))))));
|
|
6562
|
-
exports.medialink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */ | 4 /* State.media */,
|
|
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 = []], rest, context) => [[parse((0, dom_1.defrag)(content), params, context)], rest]))))));
|
|
6563
6606
|
exports.linemedialink = (0, combinator_1.surround)(source_1.linebreak, (0, combinator_1.union)([exports.medialink]), /^(?=[^\S\n]*(?:$|\n))/);
|
|
6564
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 = []], rest, context) => [[parse((0, dom_1.defrag)(content), params, context)], rest])));
|
|
6565
6608
|
exports.uri = (0, combinator_1.union)([(0, combinator_1.open)(/^[^\S\n]+/, (0, source_1.str)(/^\S+/)), (0, source_1.str)(/^[^\s{}]+/)]);
|
|
6566
|
-
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]|})/), (0,
|
|
6609
|
+
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{}]+/)]);
|
|
6567
6610
|
function parse(content, params, context) {
|
|
6568
6611
|
const INSECURE_URI = params.shift();
|
|
6569
6612
|
let uri;
|
|
@@ -6571,7 +6614,7 @@ function parse(content, params, context) {
|
|
|
6571
6614
|
uri = new url_1.ReadonlyURL(resolve(INSECURE_URI, context.host ?? location, context.url ?? context.host ?? location), context.host?.href || location.href);
|
|
6572
6615
|
} catch {}
|
|
6573
6616
|
const el = elem(INSECURE_URI, content, uri, context.host?.origin || location.origin);
|
|
6574
|
-
return el.classList.contains('invalid') ? el : (0, dom_1.define)(el, (0, html_1.attributes)('link',
|
|
6617
|
+
return el.classList.contains('invalid') ? el : (0, dom_1.define)(el, (0, html_1.attributes)('link', optspec, params));
|
|
6575
6618
|
}
|
|
6576
6619
|
function elem(INSECURE_URI, content, uri, origin) {
|
|
6577
6620
|
let type;
|
|
@@ -6640,7 +6683,6 @@ function resolve(uri, host, source) {
|
|
|
6640
6683
|
}
|
|
6641
6684
|
exports.resolve = resolve;
|
|
6642
6685
|
function decode(uri) {
|
|
6643
|
-
if (!uri.includes('%')) return uri;
|
|
6644
6686
|
const origin = uri.match(/^[a-z](?:[-.](?=[0-9a-z])|[0-9a-z])*:(?:\/{0,2}[^/?#\s]+|\/\/(?=[/]))/i)?.[0] ?? '';
|
|
6645
6687
|
try {
|
|
6646
6688
|
let path = decodeURI(uri.slice(origin.length));
|
|
@@ -6652,6 +6694,7 @@ function decode(uri) {
|
|
|
6652
6694
|
return uri.replace(/\s+/g, encodeURI);
|
|
6653
6695
|
}
|
|
6654
6696
|
}
|
|
6697
|
+
exports.decode = decode;
|
|
6655
6698
|
|
|
6656
6699
|
/***/ },
|
|
6657
6700
|
|
|
@@ -6672,7 +6715,7 @@ const visibility_1 = __webpack_require__(6364);
|
|
|
6672
6715
|
const util_1 = __webpack_require__(4992);
|
|
6673
6716
|
const array_1 = __webpack_require__(6876);
|
|
6674
6717
|
const dom_1 = __webpack_require__(394);
|
|
6675
|
-
exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(251 /* State.linkers */ & ~2 /* State.mark */,
|
|
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], rest) => [bs, rest], ([, bs], rest) => [(0, array_1.push)(bs, ["\u001B" /* Command.Escape */]), rest]), (nodes, {
|
|
6676
6719
|
id
|
|
6677
6720
|
}) => {
|
|
6678
6721
|
const el = (0, dom_1.html)('mark', (0, dom_1.defrag)(nodes));
|
|
@@ -6701,7 +6744,7 @@ const source_1 = __webpack_require__(8745);
|
|
|
6701
6744
|
const util_1 = __webpack_require__(4992);
|
|
6702
6745
|
const dom_1 = __webpack_require__(394);
|
|
6703
6746
|
const forbiddenCommand = /\\(?:begin|tiny|huge|large)(?![a-z])/i;
|
|
6704
|
-
exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('$', (0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)(
|
|
6747
|
+
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 */])]), ({
|
|
6705
6748
|
source,
|
|
6706
6749
|
context: {
|
|
6707
6750
|
caches: {
|
|
@@ -6717,7 +6760,7 @@ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('$', (0,
|
|
|
6717
6760
|
translate: 'no',
|
|
6718
6761
|
...(0, util_1.invalid)('math', 'content', `"${source.match(forbiddenCommand)[0]}" command is forbidden`)
|
|
6719
6762
|
}, source)], ''])));
|
|
6720
|
-
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, /^[{}
|
|
6763
|
+
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));
|
|
6721
6764
|
|
|
6722
6765
|
/***/ },
|
|
6723
6766
|
|
|
@@ -6738,7 +6781,6 @@ const htmlentity_1 = __webpack_require__(470);
|
|
|
6738
6781
|
const source_1 = __webpack_require__(8745);
|
|
6739
6782
|
const util_1 = __webpack_require__(4992);
|
|
6740
6783
|
const url_1 = __webpack_require__(1904);
|
|
6741
|
-
const array_1 = __webpack_require__(6876);
|
|
6742
6784
|
const dom_1 = __webpack_require__(394);
|
|
6743
6785
|
const optspec = {
|
|
6744
6786
|
'width': [],
|
|
@@ -6747,10 +6789,10 @@ const optspec = {
|
|
|
6747
6789
|
rel: undefined
|
|
6748
6790
|
};
|
|
6749
6791
|
Object.setPrototypeOf(optspec, null);
|
|
6750
|
-
exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* State.media */,
|
|
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 = []], rest, context) => context.linebreak === 0 ? [ns, rest] : 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, undefined, [3 | 64 /* Backtrack.link */]))]), ([as, bs]) => bs ? [[as.join('').trim() || as.join('')], bs] : [[''], as]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], rest, context) => {
|
|
6751
6793
|
const INSECURE_URI = params.shift();
|
|
6752
6794
|
// altが空だとエラーが見えないため埋める。
|
|
6753
|
-
text ||= INSECURE_URI;
|
|
6795
|
+
text ||= (0, link_1.decode)(INSECURE_URI);
|
|
6754
6796
|
let uri;
|
|
6755
6797
|
try {
|
|
6756
6798
|
uri = new url_1.ReadonlyURL((0, link_1.resolve)(INSECURE_URI, context.host ?? location, context.url ?? context.host ?? location), context.host?.href || location.href);
|
|
@@ -6762,7 +6804,7 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
|
|
|
6762
6804
|
});
|
|
6763
6805
|
el.setAttribute('alt', text);
|
|
6764
6806
|
if (!sanitize(el, uri)) return [[el], rest];
|
|
6765
|
-
(0, dom_1.define)(el, (0, html_1.attributes)('media',
|
|
6807
|
+
(0, dom_1.define)(el, (0, html_1.attributes)('media', optspec, params));
|
|
6766
6808
|
// Awaiting the generic support for attr().
|
|
6767
6809
|
if (el.hasAttribute('aspect-ratio')) {
|
|
6768
6810
|
el.style.aspectRatio = el.getAttribute('aspect-ratio');
|
|
@@ -6779,7 +6821,7 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
|
|
|
6779
6821
|
}))))));
|
|
6780
6822
|
exports.linemedia = (0, combinator_1.surround)(source_1.linebreak, (0, combinator_1.union)([exports.media]), /^(?=[^\S\n]*(?:$|\n))/);
|
|
6781
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, () => [[], ''], [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 */])])));
|
|
6782
|
-
const option = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.
|
|
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]], rest) => [b === 'x' ? [`width="${a}"`, `height="${c}"`] : [`aspect-ratio="${a}/${c}"`], rest]), link_1.option]));
|
|
6783
6825
|
function sanitize(target, uri) {
|
|
6784
6826
|
let type;
|
|
6785
6827
|
let message;
|
|
@@ -6823,16 +6865,66 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
6823
6865
|
value: true
|
|
6824
6866
|
}));
|
|
6825
6867
|
exports.reference = void 0;
|
|
6868
|
+
const parser_1 = __webpack_require__(605);
|
|
6826
6869
|
const combinator_1 = __webpack_require__(3484);
|
|
6827
6870
|
const inline_1 = __webpack_require__(7973);
|
|
6871
|
+
const link_1 = __webpack_require__(3628);
|
|
6828
6872
|
const source_1 = __webpack_require__(8745);
|
|
6829
6873
|
const visibility_1 = __webpack_require__(6364);
|
|
6830
6874
|
const dom_1 = __webpack_require__(394);
|
|
6831
6875
|
const array_1 = __webpack_require__(6876);
|
|
6832
6876
|
const util_1 = __webpack_require__(4992);
|
|
6833
|
-
exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64 /* State.reference */,
|
|
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], rest, context) => {
|
|
6878
|
+
if (context.linebreak === 0) {
|
|
6879
|
+
return [[(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, dom_1.defrag)((0, visibility_1.trimBlankNodeEnd)(ns)))])], rest];
|
|
6880
|
+
} else {
|
|
6881
|
+
const head = context.recent.reduce((a, b) => a + b.length, rest.length);
|
|
6882
|
+
(0, combinator_1.setBacktrack)(context, [2 | 64 /* Backtrack.link */], head, 2);
|
|
6883
|
+
}
|
|
6884
|
+
}, ([as, bs], rest, context) => {
|
|
6885
|
+
const {
|
|
6886
|
+
recent
|
|
6887
|
+
} = context;
|
|
6888
|
+
const head = recent.reduce((a, b) => a + b.length, rest.length);
|
|
6834
6889
|
if (rest[0] !== ']') {
|
|
6835
|
-
(0, combinator_1.setBacktrack)(context, [2 | 8 /* Backtrack.bracket */],
|
|
6890
|
+
(0, combinator_1.setBacktrack)(context, [2 | 8 /* Backtrack.bracket */], head, 2);
|
|
6891
|
+
} else if (context.linebreak > 0) {
|
|
6892
|
+
(0, combinator_1.setBacktrack)(context, [2 | 64 /* Backtrack.link */], head, 2);
|
|
6893
|
+
} else {
|
|
6894
|
+
if (context.state & 128 /* State.annotation */) {
|
|
6895
|
+
(0, array_1.push)(bs, [rest[0]]);
|
|
6896
|
+
}
|
|
6897
|
+
const source = rest.slice(1);
|
|
6898
|
+
let result;
|
|
6899
|
+
if (source[0] !== '{') {
|
|
6900
|
+
(0, combinator_1.setBacktrack)(context, [2 | 64 /* Backtrack.link */], head - 1);
|
|
6901
|
+
result = [[], source];
|
|
6902
|
+
} else {
|
|
6903
|
+
result = !(0, combinator_1.isBacktrack)(context, [1 | 64 /* Backtrack.link */], source) ? (0, link_1.textlink)({
|
|
6904
|
+
source,
|
|
6905
|
+
context
|
|
6906
|
+
}) : undefined;
|
|
6907
|
+
context.recent = recent;
|
|
6908
|
+
if (!result) {
|
|
6909
|
+
(0, combinator_1.setBacktrack)(context, [2 | 64 /* Backtrack.link */], head - 1);
|
|
6910
|
+
result = [[], source];
|
|
6911
|
+
}
|
|
6912
|
+
}
|
|
6913
|
+
if ((0, parser_1.exec)(result) === '') {
|
|
6914
|
+
(0, combinator_1.setBacktrack)(context, [2 | 64 /* Backtrack.link */], head);
|
|
6915
|
+
} else {
|
|
6916
|
+
const next = (0, combinator_1.surround)('', (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]), (0, source_1.str)(']'), true, ([, cs = [], ds], rest) => [(0, array_1.push)(cs, ds), rest], ([, cs = []], rest) => {
|
|
6917
|
+
(0, combinator_1.setBacktrack)(context, [2 | 64 /* Backtrack.link */], head);
|
|
6918
|
+
return [cs, rest];
|
|
6919
|
+
})({
|
|
6920
|
+
source: (0, parser_1.exec)(result),
|
|
6921
|
+
context
|
|
6922
|
+
});
|
|
6923
|
+
if (context.state & 128 /* State.annotation */ && next) {
|
|
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);
|
|
6926
|
+
}
|
|
6927
|
+
}
|
|
6836
6928
|
}
|
|
6837
6929
|
return context.state & 128 /* State.annotation */ ? [(0, array_1.unshift)(as, bs), rest] : undefined;
|
|
6838
6930
|
}, [3 | 16 /* Backtrack.doublebracket */, 1 | 8 /* Backtrack.bracket */])));
|
|
@@ -6905,9 +6997,10 @@ const dom_1 = __webpack_require__(394);
|
|
|
6905
6997
|
exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combinator_1.inits)([(0, combinator_1.dup)((0, combinator_1.surround)('[', rtext, ']', false, ([, ns], rest) => {
|
|
6906
6998
|
ns && ns.at(-1) === '' && ns.pop();
|
|
6907
6999
|
return (0, visibility_1.isTightNodeStart)(ns) ? [ns, rest] : undefined;
|
|
6908
|
-
}, undefined, [3 | 32 /* Backtrack.ruby
|
|
7000
|
+
}, undefined, [3 | 32 /* Backtrack.ruby */, 1 | 8 /* Backtrack.bracket */])), (0, combinator_1.dup)((0, combinator_1.surround)('(', rtext, ')', false, undefined, undefined, [3 | 32 /* Backtrack.ruby */, 1 | 8 /* Backtrack.bracket */]))]), ([texts, rubies], rest, context) => {
|
|
6909
7001
|
if (rubies === undefined) {
|
|
6910
|
-
|
|
7002
|
+
const head = context.recent.reduce((a, b) => a + b.length, rest.length);
|
|
7003
|
+
return void (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.ruby */], head);
|
|
6911
7004
|
}
|
|
6912
7005
|
switch (true) {
|
|
6913
7006
|
case rubies.length <= texts.length:
|
|
@@ -6925,7 +7018,7 @@ const rtext = ({
|
|
|
6925
7018
|
const acc = [''];
|
|
6926
7019
|
let state = false;
|
|
6927
7020
|
while (source !== '') {
|
|
6928
|
-
if (!/^(?:\\[^\n]|[^\\[\](){}<>"
|
|
7021
|
+
if (!/^(?:\\[^\n]|[^\\[\](){}<>"$#\n])/.test(source)) break;
|
|
6929
7022
|
switch (source[0]) {
|
|
6930
7023
|
// @ts-expect-error
|
|
6931
7024
|
case '&':
|
|
@@ -6936,7 +7029,7 @@ const rtext = ({
|
|
|
6936
7029
|
});
|
|
6937
7030
|
if (result) {
|
|
6938
7031
|
acc[acc.length - 1] += (0, parser_1.eval)(result)[0];
|
|
6939
|
-
source = (0, parser_1.exec)(result
|
|
7032
|
+
source = (0, parser_1.exec)(result) ?? source.slice(1);
|
|
6940
7033
|
state ||= acc.at(-1).trimStart() !== '';
|
|
6941
7034
|
continue;
|
|
6942
7035
|
}
|
|
@@ -6993,7 +7086,7 @@ const combinator_1 = __webpack_require__(3484);
|
|
|
6993
7086
|
const url_1 = __webpack_require__(2129);
|
|
6994
7087
|
const media_1 = __webpack_require__(7478);
|
|
6995
7088
|
const source_1 = __webpack_require__(8745);
|
|
6996
|
-
exports.shortmedia = (0, combinator_1.constraint)(4 /* State.media */,
|
|
7089
|
+
exports.shortmedia = (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.rewrite)((0, combinator_1.open)('!', url_1.url), (0, combinator_1.convert)(source => `!{ ${source.slice(1)} }`, (0, combinator_1.union)([media_1.media]), false)));
|
|
6997
7090
|
exports.lineshortmedia = (0, combinator_1.open)(source_1.linebreak, (0, combinator_1.focus)(/^!https?:\/\/\S+(?=[^\S\n]*(?:$|\n))/, (0, combinator_1.convert)(source => `!{ ${source.slice(1)} }`, (0, combinator_1.union)([media_1.media]), false)));
|
|
6998
7091
|
|
|
6999
7092
|
/***/ },
|
|
@@ -7368,7 +7461,7 @@ const extension_1 = __webpack_require__(6193);
|
|
|
7368
7461
|
const source_1 = __webpack_require__(8745);
|
|
7369
7462
|
exports.MAX_SEGMENT_SIZE = 100_000; // 100,000 bytes (Max value size of FDB)
|
|
7370
7463
|
exports.MAX_INPUT_SIZE = exports.MAX_SEGMENT_SIZE * 10;
|
|
7371
|
-
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
|
|
7464
|
+
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)]);
|
|
7372
7465
|
function* segment(source) {
|
|
7373
7466
|
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)}`;
|
|
7374
7467
|
while (source !== '') {
|
|
@@ -7509,7 +7602,7 @@ const escsource = ({
|
|
|
7509
7602
|
return [[source.slice(0, 2)], source.slice(2)];
|
|
7510
7603
|
}
|
|
7511
7604
|
case '\n':
|
|
7512
|
-
context.linebreak
|
|
7605
|
+
context.linebreak ||= source.length;
|
|
7513
7606
|
return [[(0, dom_1.html)('br')], source.slice(1)];
|
|
7514
7607
|
default:
|
|
7515
7608
|
const b = source[0].trimStart() === '';
|
|
@@ -7591,7 +7684,7 @@ exports.isAlphanumeric = exports.linebreak = exports.txt = exports.text = export
|
|
|
7591
7684
|
const combinator_1 = __webpack_require__(3484);
|
|
7592
7685
|
const str_1 = __webpack_require__(4017);
|
|
7593
7686
|
const dom_1 = __webpack_require__(394);
|
|
7594
|
-
exports.delimiter = /[\s\x00-\x7F
|
|
7687
|
+
exports.delimiter = /[\s\x00-\x7F()[]{}]|\S#|[0-9A-Za-z]>/u;
|
|
7595
7688
|
exports.nonWhitespace = /[\S\n]|$/u;
|
|
7596
7689
|
exports.nonAlphanumeric = /[^0-9A-Za-z]|\S#|[0-9A-Za-z]>|$/u;
|
|
7597
7690
|
const repeat = (0, str_1.str)(/^(.)\1*/);
|
|
@@ -7623,7 +7716,7 @@ const text = ({
|
|
|
7623
7716
|
return [[source.slice(1, 2)], source.slice(2)];
|
|
7624
7717
|
}
|
|
7625
7718
|
case '\n':
|
|
7626
|
-
context.linebreak
|
|
7719
|
+
context.linebreak ||= source.length;
|
|
7627
7720
|
return [[(0, dom_1.html)('br')], source.slice(1)];
|
|
7628
7721
|
case '*':
|
|
7629
7722
|
case '`':
|
|
@@ -7687,7 +7780,7 @@ const unescsource = ({
|
|
|
7687
7780
|
(0, combinator_1.consume)(1, context);
|
|
7688
7781
|
return [[source.slice(1, 2)], source.slice(2)];
|
|
7689
7782
|
case '\n':
|
|
7690
|
-
context.linebreak
|
|
7783
|
+
context.linebreak ||= source.length;
|
|
7691
7784
|
return [[(0, dom_1.html)('br')], source.slice(1)];
|
|
7692
7785
|
default:
|
|
7693
7786
|
const b = source[0].trimStart() === '';
|
|
@@ -7719,8 +7812,8 @@ const alias_1 = __webpack_require__(5413);
|
|
|
7719
7812
|
const parser_1 = __webpack_require__(605);
|
|
7720
7813
|
const combinator_1 = __webpack_require__(3484);
|
|
7721
7814
|
const dom_1 = __webpack_require__(394);
|
|
7722
|
-
function lineable(parser,
|
|
7723
|
-
return (0, combinator_1.convert)(source => `\r${source
|
|
7815
|
+
function lineable(parser, trim = -1) {
|
|
7816
|
+
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);
|
|
7724
7817
|
}
|
|
7725
7818
|
exports.lineable = lineable;
|
|
7726
7819
|
function repeat(symbol, parser, cons, termination = (acc, rest, prefix, postfix) => {
|
|
@@ -7873,6 +7966,7 @@ function blankWith(starts, delimiter) {
|
|
|
7873
7966
|
if (delimiter === undefined) return blankWith('', starts);
|
|
7874
7967
|
return new RegExp(String.raw`^(?:(?=${starts})(?:\\?\s|&(?:${normalize_1.invisibleHTMLEntityNames.join('|')});|<wbr[^\S\n]*>)${
|
|
7875
7968
|
// 空行除去
|
|
7969
|
+
// 完全な空行はエスケープ済みなので再帰的バックトラックにはならない。
|
|
7876
7970
|
starts && '+'})?${typeof delimiter === 'string' ? delimiter.replace(/[*+()\[\]]/g, '\\$&') : delimiter.source}`);
|
|
7877
7971
|
}
|
|
7878
7972
|
exports.blankWith = blankWith;
|