securemark 0.300.4 → 0.300.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/index.js +207 -148
- package/markdown.d.ts +36 -36
- package/package.json +1 -1
- package/src/api/bind.ts +5 -2
- package/src/api/header.ts +1 -1
- package/src/api/parse.ts +8 -2
- package/src/combinator/effect/backtrack.ts +19 -7
- package/src/combinator/parser/list.ts +13 -15
- package/src/combinator/parser.ts +3 -5
- package/src/debug.test.ts +3 -0
- package/src/parser/autolink.ts +2 -2
- package/src/parser/block/blockquote.test.ts +4 -4
- package/src/parser/block/blockquote.ts +2 -1
- package/src/parser/block/extension/aside.test.ts +3 -3
- package/src/parser/block/extension/aside.ts +2 -1
- package/src/parser/block/extension/example.test.ts +3 -3
- package/src/parser/block/extension/example.ts +3 -1
- package/src/parser/{header.test.ts → block/header.test.ts} +3 -3
- package/src/parser/{header.ts → block/header.ts} +7 -7
- package/src/parser/block/reply/cite.ts +2 -3
- package/src/parser/block/reply/quote.ts +1 -2
- package/src/parser/block/reply.ts +1 -2
- package/src/parser/block.ts +6 -5
- package/src/parser/context.ts +3 -1
- package/src/parser/document.ts +22 -11
- package/src/parser/inline/annotation.ts +11 -5
- package/src/parser/inline/extension/index.ts +1 -2
- package/src/parser/inline/extension/indexee.ts +1 -2
- package/src/parser/inline/extension/label.ts +10 -6
- package/src/parser/inline/html.ts +1 -2
- package/src/parser/inline/htmlentity.ts +5 -4
- package/src/parser/inline/media.ts +2 -3
- package/src/parser/inline/reference.ts +3 -3
- package/src/parser/inline.ts +2 -2
- package/src/parser/node.ts +0 -5
- package/src/parser/segment.ts +2 -2
- package/src/parser/source/escapable.ts +5 -6
- package/src/parser/source/str.ts +3 -2
- package/src/parser/source/text.ts +3 -4
- package/src/parser/source/unescapable.ts +3 -4
- package/src/parser/source.ts +2 -2
- package/src/parser/util.ts +9 -0
- package/src/parser/visibility.ts +4 -5
- package/src/processor/figure.test.ts +35 -24
- package/src/processor/figure.ts +8 -23
- package/src/processor/note.test.ts +71 -25
- package/src/processor/note.ts +28 -24
- package/src/util/toc.ts +2 -3
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.300.
|
|
1
|
+
/*! securemark v0.300.5 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"));
|
|
@@ -2526,7 +2526,7 @@ function bind(target, settings) {
|
|
|
2526
2526
|
if (rev !== revision) return yield {
|
|
2527
2527
|
type: 'cancel'
|
|
2528
2528
|
};
|
|
2529
|
-
for (const el of (0, figure_1.figure)(next(0)?.parentNode ?? target, settings.notes, options)) {
|
|
2529
|
+
for (const el of (0, figure_1.figure)(next(0)?.parentNode ?? target, output.labels.pop(), settings.notes, options)) {
|
|
2530
2530
|
el ? yield {
|
|
2531
2531
|
type: 'figure'
|
|
2532
2532
|
} : yield {
|
|
@@ -2537,7 +2537,10 @@ function bind(target, settings) {
|
|
|
2537
2537
|
type: 'cancel'
|
|
2538
2538
|
};
|
|
2539
2539
|
}
|
|
2540
|
-
for (const el of (0, note_1.note)(next(0)?.parentNode ?? target,
|
|
2540
|
+
for (const el of (0, note_1.note)(next(0)?.parentNode ?? target, {
|
|
2541
|
+
annotations: output.annotations.pop(),
|
|
2542
|
+
references: output.references.pop()
|
|
2543
|
+
}, settings.notes, options, bottom)) {
|
|
2541
2544
|
el ? yield {
|
|
2542
2545
|
type: 'note',
|
|
2543
2546
|
value: el
|
|
@@ -2647,7 +2650,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
2647
2650
|
exports.headers = exports.header = void 0;
|
|
2648
2651
|
const context_1 = __webpack_require__(8669);
|
|
2649
2652
|
const parser_1 = __webpack_require__(3360);
|
|
2650
|
-
const header_1 = __webpack_require__(
|
|
2653
|
+
const header_1 = __webpack_require__(2855);
|
|
2651
2654
|
function header(source) {
|
|
2652
2655
|
const [, pos = 0] = parse(source);
|
|
2653
2656
|
return source.slice(0, pos);
|
|
@@ -3353,6 +3356,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
3353
3356
|
}));
|
|
3354
3357
|
exports.backtrack = exports.Backtrack = void 0;
|
|
3355
3358
|
const state_1 = __webpack_require__(9440);
|
|
3359
|
+
const parser_1 = __webpack_require__(3360);
|
|
3356
3360
|
class Backtrack {
|
|
3357
3361
|
constructor(scope) {
|
|
3358
3362
|
this.scope = scope;
|
|
@@ -3377,8 +3381,8 @@ class Backtrack {
|
|
|
3377
3381
|
input.range = range;
|
|
3378
3382
|
input.linebreak = linebreak;
|
|
3379
3383
|
}
|
|
3380
|
-
handle(
|
|
3381
|
-
state ? this.unmemory() : this.backtrack();
|
|
3384
|
+
handle(output) {
|
|
3385
|
+
output.state ? this.unmemory() : this.backtrack();
|
|
3382
3386
|
}
|
|
3383
3387
|
}
|
|
3384
3388
|
exports.Backtrack = Backtrack;
|
|
@@ -3398,12 +3402,25 @@ function backtrack(parser) {
|
|
|
3398
3402
|
linebreak
|
|
3399
3403
|
});
|
|
3400
3404
|
output.push();
|
|
3405
|
+
output.labels.push(new parser_1.List());
|
|
3406
|
+
output.annotations.push(new parser_1.List());
|
|
3407
|
+
output.references.push(new parser_1.List());
|
|
3401
3408
|
return output.context;
|
|
3402
3409
|
}, parser, ({
|
|
3403
3410
|
backtrack
|
|
3404
3411
|
}, output) => {
|
|
3405
|
-
|
|
3406
|
-
|
|
3412
|
+
backtrack.handle(output);
|
|
3413
|
+
if (output.state) {
|
|
3414
|
+
output.import(output.pop());
|
|
3415
|
+
output.labels.at(-2).import(output.labels.pop());
|
|
3416
|
+
output.annotations.at(-2).import(output.annotations.pop());
|
|
3417
|
+
output.references.at(-2).import(output.references.pop());
|
|
3418
|
+
} else {
|
|
3419
|
+
output.pop();
|
|
3420
|
+
output.labels.pop();
|
|
3421
|
+
output.annotations.pop();
|
|
3422
|
+
output.references.pop();
|
|
3423
|
+
}
|
|
3407
3424
|
return output.context;
|
|
3408
3425
|
}]);
|
|
3409
3426
|
}
|
|
@@ -3765,6 +3782,9 @@ class Output {
|
|
|
3765
3782
|
this.state = true;
|
|
3766
3783
|
this.context = Result.succ;
|
|
3767
3784
|
this.error = undefined;
|
|
3785
|
+
this.labels = [new list_1.List()];
|
|
3786
|
+
this.annotations = [new list_1.List()];
|
|
3787
|
+
this.references = [new list_1.List()];
|
|
3768
3788
|
}
|
|
3769
3789
|
peek() {
|
|
3770
3790
|
return this.data.at(-1);
|
|
@@ -3785,10 +3805,6 @@ class Output {
|
|
|
3785
3805
|
this.data[this.data.length - 1] = list;
|
|
3786
3806
|
return Result.succ;
|
|
3787
3807
|
}
|
|
3788
|
-
flat() {
|
|
3789
|
-
this.import(this.data.pop());
|
|
3790
|
-
return Result.succ;
|
|
3791
|
-
}
|
|
3792
3808
|
push(list = new list_1.List()) {
|
|
3793
3809
|
this.data.push(list);
|
|
3794
3810
|
}
|
|
@@ -3935,6 +3951,9 @@ class List {
|
|
|
3935
3951
|
this.push(nodes[i]);
|
|
3936
3952
|
}
|
|
3937
3953
|
}
|
|
3954
|
+
isEmpty() {
|
|
3955
|
+
return this.head === undefined;
|
|
3956
|
+
}
|
|
3938
3957
|
get tail() {
|
|
3939
3958
|
return this.head?.next;
|
|
3940
3959
|
}
|
|
@@ -4007,16 +4026,6 @@ class List {
|
|
|
4007
4026
|
list.clear();
|
|
4008
4027
|
return this;
|
|
4009
4028
|
}
|
|
4010
|
-
truncateBefore(node) {
|
|
4011
|
-
if (node.prev === undefined) return;
|
|
4012
|
-
this.delete(node.prev);
|
|
4013
|
-
this.head = node;
|
|
4014
|
-
}
|
|
4015
|
-
truncateAfter(node) {
|
|
4016
|
-
if (node.next === undefined) return;
|
|
4017
|
-
this.delete(node.next);
|
|
4018
|
-
this.last = node;
|
|
4019
|
-
}
|
|
4020
4029
|
clear() {
|
|
4021
4030
|
this.length = 0;
|
|
4022
4031
|
this.head = this.last = undefined;
|
|
@@ -4063,8 +4072,9 @@ class List {
|
|
|
4063
4072
|
}
|
|
4064
4073
|
exports.List = List;
|
|
4065
4074
|
class Node {
|
|
4066
|
-
constructor(value, flags = 0) {
|
|
4075
|
+
constructor(value, position = 0, flags = 0) {
|
|
4067
4076
|
this.value = value;
|
|
4077
|
+
this.position = position;
|
|
4068
4078
|
this.flags = flags;
|
|
4069
4079
|
this.next = undefined;
|
|
4070
4080
|
this.prev = undefined;
|
|
@@ -4809,15 +4819,15 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
4809
4819
|
exports.block = void 0;
|
|
4810
4820
|
const parser_1 = __webpack_require__(3360);
|
|
4811
4821
|
const combinator_1 = __webpack_require__(3484);
|
|
4812
|
-
const header_1 = __webpack_require__(
|
|
4822
|
+
const header_1 = __webpack_require__(2855);
|
|
4813
4823
|
const source_1 = __webpack_require__(8745);
|
|
4814
|
-
const pagebreak_1 = __webpack_require__(2946);
|
|
4815
4824
|
const heading_1 = __webpack_require__(2778);
|
|
4816
4825
|
const ulist_1 = __webpack_require__(7595);
|
|
4817
4826
|
const olist_1 = __webpack_require__(7697);
|
|
4818
4827
|
const ilist_1 = __webpack_require__(4223);
|
|
4819
4828
|
const dlist_1 = __webpack_require__(636);
|
|
4820
4829
|
const table_1 = __webpack_require__(2752);
|
|
4830
|
+
const pagebreak_1 = __webpack_require__(2946);
|
|
4821
4831
|
const codeblock_1 = __webpack_require__(9194);
|
|
4822
4832
|
const mathblock_1 = __webpack_require__(4903);
|
|
4823
4833
|
const extension_1 = __webpack_require__(6193);
|
|
@@ -4957,7 +4967,9 @@ const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combina
|
|
|
4957
4967
|
}, output) => {
|
|
4958
4968
|
const doc = output.pop().head.value;
|
|
4959
4969
|
if (!doc.firstChild) return output.context;
|
|
4960
|
-
return output.append(new parser_1.Node((0, dom_1.html)('section', [
|
|
4970
|
+
return output.append(new parser_1.Node((0, dom_1.html)('section', [
|
|
4971
|
+
// DocumentFragmentを追加すると異常に重くなるので避ける
|
|
4972
|
+
...doc.children, (0, dom_1.html)('h2', 'References'), notes.references])));
|
|
4961
4973
|
}]), true))]))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
|
|
4962
4974
|
|
|
4963
4975
|
/***/ },
|
|
@@ -5152,7 +5164,9 @@ exports.aside = (0, combinator_1.block)((0, combinator_1.recursion)(1 /* Recursi
|
|
|
5152
5164
|
return output.append(new parser_1.Node((0, dom_1.html)('aside', {
|
|
5153
5165
|
id: (0, indexee_1.identity)('index', input.id, heading),
|
|
5154
5166
|
class: 'aside'
|
|
5155
|
-
}, [
|
|
5167
|
+
}, [
|
|
5168
|
+
// DocumentFragmentを追加すると異常に重くなるので避ける
|
|
5169
|
+
...doc.children, (0, dom_1.html)('h2', 'References'), notes.references])));
|
|
5156
5170
|
}])));
|
|
5157
5171
|
|
|
5158
5172
|
/***/ },
|
|
@@ -5217,12 +5231,15 @@ const contMD = [(input, output) => {
|
|
|
5217
5231
|
notes
|
|
5218
5232
|
} = input;
|
|
5219
5233
|
input = input.scope.pop();
|
|
5234
|
+
const doc = output.pop().head.value;
|
|
5220
5235
|
return output.append(new parser_1.Node((0, dom_1.html)('aside', {
|
|
5221
5236
|
class: 'example',
|
|
5222
5237
|
'data-type': 'markdown'
|
|
5223
5238
|
}, [(0, dom_1.html)('pre', {
|
|
5224
5239
|
translate: 'no'
|
|
5225
|
-
}, input.memory.body.slice(0, input.memory.body.at(-2) === '\r' ? -2 : -1)), (0, dom_1.html)('hr'), (0, dom_1.html)('section', [
|
|
5240
|
+
}, input.memory.body.slice(0, input.memory.body.at(-2) === '\r' ? -2 : -1)), (0, dom_1.html)('hr'), (0, dom_1.html)('section', [
|
|
5241
|
+
// DocumentFragmentを追加すると異常に重くなるので避ける
|
|
5242
|
+
...doc.children, (0, dom_1.html)('h2', 'References'), notes.references])])));
|
|
5226
5243
|
}];
|
|
5227
5244
|
const contMath = [(input, output) => {
|
|
5228
5245
|
input.scope.push(`$$\n${input.memory.body}$$`);
|
|
@@ -5766,6 +5783,64 @@ function format(rows) {
|
|
|
5766
5783
|
|
|
5767
5784
|
/***/ },
|
|
5768
5785
|
|
|
5786
|
+
/***/ 2855
|
|
5787
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
5788
|
+
|
|
5789
|
+
"use strict";
|
|
5790
|
+
|
|
5791
|
+
|
|
5792
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
5793
|
+
value: true
|
|
5794
|
+
}));
|
|
5795
|
+
exports.header = void 0;
|
|
5796
|
+
const parser_1 = __webpack_require__(3360);
|
|
5797
|
+
const combinator_1 = __webpack_require__(3484);
|
|
5798
|
+
const source_1 = __webpack_require__(8745);
|
|
5799
|
+
const util_1 = __webpack_require__(4992);
|
|
5800
|
+
const url_1 = __webpack_require__(1904);
|
|
5801
|
+
const dom_1 = __webpack_require__(394);
|
|
5802
|
+
exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^\S\r\n]*\r?\n(?=\S)/y, (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(input => input.header, (0, combinator_1.focus)(/(---+)[^\S\r\n]*\r?\n(?:[a-z][0-9a-z]*(?:-[0-9a-z]+)*:[ \t]+\S[^\r\n]*\r?\n){1,32}\1[^\S\r\n]*(?:$|\r?\n)/yi, (0, combinator_1.scope)(({
|
|
5803
|
+
source
|
|
5804
|
+
}) => source.slice(source.indexOf('\n') + 1, source.trimEnd().lastIndexOf('\n')), (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([field])), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('aside', {
|
|
5805
|
+
class: 'header'
|
|
5806
|
+
}, [(0, dom_1.html)('details', {
|
|
5807
|
+
open: ''
|
|
5808
|
+
}, (0, dom_1.defrag)((0, util_1.unwrap)(ns.unshift(new parser_1.Node((0, dom_1.html)('summary', 'Header'))))))]))])), false))), (input, output) => {
|
|
5809
|
+
const {
|
|
5810
|
+
source,
|
|
5811
|
+
position
|
|
5812
|
+
} = input;
|
|
5813
|
+
input.position += source.length;
|
|
5814
|
+
return output.append(new parser_1.Node((0, dom_1.html)('pre', {
|
|
5815
|
+
class: 'invalid',
|
|
5816
|
+
translate: 'no',
|
|
5817
|
+
...(0, util_1.invalid)('header', 'syntax', 'Invalid syntax')
|
|
5818
|
+
}, source.slice(position))));
|
|
5819
|
+
}])), (0, combinator_1.clear)((0, source_1.str)(/[^\S\r\n]*\r?\n/y))])));
|
|
5820
|
+
const field = (0, combinator_1.line)((input, output) => {
|
|
5821
|
+
const {
|
|
5822
|
+
source,
|
|
5823
|
+
position
|
|
5824
|
+
} = input;
|
|
5825
|
+
const name = source.slice(position, source.indexOf(':', position));
|
|
5826
|
+
const value = source.slice(position + name.length + 1).trim();
|
|
5827
|
+
if (name.toLowerCase() === 'url') {
|
|
5828
|
+
// @ts-expect-error
|
|
5829
|
+
input.url = new url_1.ReadonlyURL(value);
|
|
5830
|
+
}
|
|
5831
|
+
return output.append(new parser_1.Node((0, dom_1.html)('div', {
|
|
5832
|
+
class: 'field',
|
|
5833
|
+
'data-name': name.toLowerCase(),
|
|
5834
|
+
'data-value': value
|
|
5835
|
+
}, [(0, dom_1.html)('span', {
|
|
5836
|
+
class: 'field-name'
|
|
5837
|
+
}, name), ': ', (0, dom_1.html)('span', {
|
|
5838
|
+
class: 'field-value'
|
|
5839
|
+
}, value)])));
|
|
5840
|
+
});
|
|
5841
|
+
|
|
5842
|
+
/***/ },
|
|
5843
|
+
|
|
5769
5844
|
/***/ 2778
|
|
5770
5845
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
5771
5846
|
|
|
@@ -6096,7 +6171,7 @@ const delimiter = new RegExp(`${cite_1.syntax.source}|${quote_1.syntax.source}`,
|
|
|
6096
6171
|
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, {
|
|
6097
6172
|
source,
|
|
6098
6173
|
position
|
|
6099
|
-
}) => source[position - 1] === '\n' ? ns : ns.push(new parser_1.Node((0, dom_1.html)('br'), 1 /* Flag.blank */)))))])), 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)))))]))));
|
|
6174
|
+
}) => source[position - 1] === '\n' ? ns : ns.push(new parser_1.Node((0, dom_1.html)('br'), position, 1 /* Node.Flag.blank */)))))])), 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)))))]))));
|
|
6100
6175
|
|
|
6101
6176
|
/***/ },
|
|
6102
6177
|
|
|
@@ -6132,7 +6207,9 @@ exports.cite = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.op
|
|
|
6132
6207
|
target: '_blank'
|
|
6133
6208
|
}, source)))), (0, combinator_1.focus)(/>>\S+(?=\s*$)/y, ({
|
|
6134
6209
|
source
|
|
6135
|
-
}, output) => output.append(new parser_1.Node(source)))])), nodes
|
|
6210
|
+
}, output) => output.append(new parser_1.Node(source)))])), (nodes, {
|
|
6211
|
+
position
|
|
6212
|
+
}) => {
|
|
6136
6213
|
const quotes = nodes.head.value;
|
|
6137
6214
|
const node = nodes.last.value;
|
|
6138
6215
|
return new parser_1.List([new parser_1.Node((0, dom_1.html)('span', typeof node === 'object' ? {
|
|
@@ -6142,7 +6219,7 @@ exports.cite = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.op
|
|
|
6142
6219
|
...(0, util_1.invalid)('cite', 'syntax', 'Invalid syntax')
|
|
6143
6220
|
}, (0, dom_1.defrag)([`${quotes}>`, typeof node === 'object' ? (0, dom_1.define)(node, {
|
|
6144
6221
|
'data-depth': `${quotes.length + 1}`
|
|
6145
|
-
}, node.innerText.slice(1)) : node.slice(1)]))), new parser_1.Node((0, dom_1.html)('br'), 1 /* Flag.blank */)]);
|
|
6222
|
+
}, node.innerText.slice(1)) : node.slice(1)]))), new parser_1.Node((0, dom_1.html)('br'), position, 1 /* Node.Flag.blank */)]);
|
|
6146
6223
|
}));
|
|
6147
6224
|
|
|
6148
6225
|
/***/ },
|
|
@@ -6172,7 +6249,7 @@ exports.quote = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.
|
|
|
6172
6249
|
math_1.math, autolink_1.autolink, source_1.unescsource])), true)), (ns, {
|
|
6173
6250
|
source,
|
|
6174
6251
|
position
|
|
6175
|
-
}) => 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', {
|
|
6252
|
+
}) => new parser_1.List([new parser_1.Node(source[position - 1] === '\n' ? ns.pop().value : (0, dom_1.html)('br'), position, 1 /* Node.Flag.blank */), new parser_1.Node((0, dom_1.html)('span', {
|
|
6176
6253
|
class: 'quote'
|
|
6177
6254
|
}, (0, dom_1.defrag)((0, util_1.unwrap)(ns))))].reverse())), false);
|
|
6178
6255
|
|
|
@@ -6354,7 +6431,10 @@ class Input extends parser_1.Input {
|
|
|
6354
6431
|
this.resources ??= {
|
|
6355
6432
|
clock: -1,
|
|
6356
6433
|
interval: 200,
|
|
6357
|
-
recursions: [
|
|
6434
|
+
recursions: [
|
|
6435
|
+
// DOMの垂直的追加の繰り返しが加速的に異常に重くなる。
|
|
6436
|
+
// ブラウザの問題でありアルゴリズムの計算量は問題ない。
|
|
6437
|
+
10 || 0 /* Recursion.document */, 100 || 0 /* Recursion.block */, 100 || 0 /* Recursion.inline */, 100 || 0 /* Recursion.bracket */]
|
|
6358
6438
|
};
|
|
6359
6439
|
this.segment = segment ?? 0 /* Segment.unknown */;
|
|
6360
6440
|
this.header = header ?? true;
|
|
@@ -6409,7 +6489,7 @@ const figure_1 = __webpack_require__(5815);
|
|
|
6409
6489
|
const note_1 = __webpack_require__(8119);
|
|
6410
6490
|
const dom_1 = __webpack_require__(394);
|
|
6411
6491
|
exports.document = (() => {
|
|
6412
|
-
const
|
|
6492
|
+
const document = (0, parser_2.build)(segment_1.parser, block_1.block);
|
|
6413
6493
|
return (0, combinator_1.always)([(input, output) => {
|
|
6414
6494
|
input.id = input.id === '' ? '' : input.local ? (0, util_1.randomID)() : input.id;
|
|
6415
6495
|
input.memory = {
|
|
@@ -6419,18 +6499,29 @@ exports.document = (() => {
|
|
|
6419
6499
|
})
|
|
6420
6500
|
};
|
|
6421
6501
|
output.push();
|
|
6502
|
+
output.labels.push(new parser_1.List());
|
|
6503
|
+
output.annotations.push(new parser_1.List());
|
|
6504
|
+
output.references.push(new parser_1.List());
|
|
6422
6505
|
return output.context;
|
|
6423
|
-
}, (0, combinator_1.recursion)(0 /* Recursion.document */, (0, combinator_1.force)(() =>
|
|
6506
|
+
}, (0, combinator_1.recursion)(0 /* Recursion.document */, (0, combinator_1.force)(() => document)), (input, output) => {
|
|
6424
6507
|
const {
|
|
6425
6508
|
memory
|
|
6426
6509
|
} = input;
|
|
6427
6510
|
const doc = memory.doc = (0, dom_1.frag)((0, util_1.unwrap)(output.pop()));
|
|
6428
6511
|
output.append(new parser_1.Node(doc));
|
|
6429
|
-
if (input.test && !input.local)
|
|
6512
|
+
if (input.test && !input.local) {
|
|
6513
|
+
output.labels.at(-2).import(output.labels.pop());
|
|
6514
|
+
output.annotations.at(-2).import(output.annotations.pop());
|
|
6515
|
+
output.references.at(-2).import(output.references.pop());
|
|
6516
|
+
return parser_1.Result.skip;
|
|
6517
|
+
}
|
|
6430
6518
|
memory.orphan = !memory.references.parentNode;
|
|
6431
6519
|
memory.orphan && doc.appendChild(memory.references);
|
|
6432
6520
|
return output.context;
|
|
6433
|
-
}, input => conv((0, figure_1.figure)(input.memory.doc, input.memory, input)), input => conv((0, note_1.note)(input.memory.doc,
|
|
6521
|
+
}, (input, output) => conv((0, figure_1.figure)(input.memory.doc, output.labels.pop(), input.memory, input)), (input, output) => conv((0, note_1.note)(input.memory.doc, {
|
|
6522
|
+
annotations: output.annotations.pop(),
|
|
6523
|
+
references: output.references.pop()
|
|
6524
|
+
}, input.memory, input)), (input, output) => {
|
|
6434
6525
|
const {
|
|
6435
6526
|
memory
|
|
6436
6527
|
} = input;
|
|
@@ -6446,64 +6537,6 @@ function conv(iterable) {
|
|
|
6446
6537
|
|
|
6447
6538
|
/***/ },
|
|
6448
6539
|
|
|
6449
|
-
/***/ 3009
|
|
6450
|
-
(__unused_webpack_module, exports, __webpack_require__) {
|
|
6451
|
-
|
|
6452
|
-
"use strict";
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
Object.defineProperty(exports, "__esModule", ({
|
|
6456
|
-
value: true
|
|
6457
|
-
}));
|
|
6458
|
-
exports.header = void 0;
|
|
6459
|
-
const parser_1 = __webpack_require__(3360);
|
|
6460
|
-
const combinator_1 = __webpack_require__(3484);
|
|
6461
|
-
const source_1 = __webpack_require__(8745);
|
|
6462
|
-
const util_1 = __webpack_require__(4992);
|
|
6463
|
-
const url_1 = __webpack_require__(1904);
|
|
6464
|
-
const dom_1 = __webpack_require__(394);
|
|
6465
|
-
exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^\S\r\n]*\r?\n(?=\S)/y, (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(input => input.header, (0, combinator_1.focus)(/(---+)[^\S\r\n]*\r?\n(?:[a-z][0-9a-z]*(?:-[0-9a-z]+)*:[ \t]+\S[^\r\n]*\r?\n){1,32}\1[^\S\r\n]*(?:$|\r?\n)/yi, (0, combinator_1.scope)(({
|
|
6466
|
-
source
|
|
6467
|
-
}) => source.slice(source.indexOf('\n') + 1, source.trimEnd().lastIndexOf('\n')), (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([field])), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('aside', {
|
|
6468
|
-
class: 'header'
|
|
6469
|
-
}, [(0, dom_1.html)('details', {
|
|
6470
|
-
open: ''
|
|
6471
|
-
}, (0, dom_1.defrag)((0, util_1.unwrap)(ns.unshift(new parser_1.Node((0, dom_1.html)('summary', 'Header'))))))]))])), false))), (input, output) => {
|
|
6472
|
-
const {
|
|
6473
|
-
source,
|
|
6474
|
-
position
|
|
6475
|
-
} = input;
|
|
6476
|
-
input.position += source.length;
|
|
6477
|
-
return output.append(new parser_1.Node((0, dom_1.html)('pre', {
|
|
6478
|
-
class: 'invalid',
|
|
6479
|
-
translate: 'no',
|
|
6480
|
-
...(0, util_1.invalid)('header', 'syntax', 'Invalid syntax')
|
|
6481
|
-
}, source.slice(position))));
|
|
6482
|
-
}])), (0, combinator_1.clear)((0, source_1.str)(/[^\S\r\n]*\r?\n/y))])));
|
|
6483
|
-
const field = (0, combinator_1.line)((input, output) => {
|
|
6484
|
-
const {
|
|
6485
|
-
source,
|
|
6486
|
-
position
|
|
6487
|
-
} = input;
|
|
6488
|
-
const name = source.slice(position, source.indexOf(':', position));
|
|
6489
|
-
const value = source.slice(position + name.length + 1).trim();
|
|
6490
|
-
if (name.toLowerCase() === 'url') {
|
|
6491
|
-
// @ts-expect-error
|
|
6492
|
-
input.url = new url_1.ReadonlyURL(value);
|
|
6493
|
-
}
|
|
6494
|
-
return output.append(new parser_1.Node((0, dom_1.html)('div', {
|
|
6495
|
-
class: 'field',
|
|
6496
|
-
'data-name': name.toLowerCase(),
|
|
6497
|
-
'data-value': value
|
|
6498
|
-
}, [(0, dom_1.html)('span', {
|
|
6499
|
-
class: 'field-name'
|
|
6500
|
-
}, name), ': ', (0, dom_1.html)('span', {
|
|
6501
|
-
class: 'field-value'
|
|
6502
|
-
}, value)])));
|
|
6503
|
-
});
|
|
6504
|
-
|
|
6505
|
-
/***/ },
|
|
6506
|
-
|
|
6507
6540
|
/***/ 7973
|
|
6508
6541
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
6509
6542
|
|
|
@@ -6694,7 +6727,9 @@ const dom_1 = __webpack_require__(394);
|
|
|
6694
6727
|
// 常に非常に非効率な処理を行い常時低速化するより三重以上の注釈を禁止して効率性を維持するのが妥当である。
|
|
6695
6728
|
exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(128 /* State.annotation */, (0, repeat_1.repeat)('(', visibility_1.beforeNonblank, ')', 2 /* Recursion.inline */, (0, combinator_1.precedence)(1, (0, combinator_1.backtrack)((0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[')', 1]]), ')', false, [], ([, bs], _, output) => output.import(bs), ([, bs], _, output) => bs && output.import(bs.push(new parser_1.Node("\u0018" /* Command.Cancel */)))))), (nodes, input, output, lead, follow) => {
|
|
6696
6729
|
const {
|
|
6730
|
+
position,
|
|
6697
6731
|
linebreak,
|
|
6732
|
+
range,
|
|
6698
6733
|
recursion,
|
|
6699
6734
|
resources
|
|
6700
6735
|
} = input;
|
|
@@ -6707,9 +6742,15 @@ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1
|
|
|
6707
6742
|
}
|
|
6708
6743
|
output.error ??= recursion.add(resources?.recursions[2 /* Recursion.inline */] ?? resources?.recursions.at(-1));
|
|
6709
6744
|
input.position += 1;
|
|
6710
|
-
|
|
6745
|
+
const el = (0, dom_1.html)('sup', {
|
|
6711
6746
|
class: 'annotation'
|
|
6712
|
-
}, [(0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(nodes))))])
|
|
6747
|
+
}, [(0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(nodes))))]);
|
|
6748
|
+
for (let list = output.annotations.at(-1), node = list.last, pos = position - range, i = 0;; node = node.prev, ++i) {
|
|
6749
|
+
if (node && node.position > pos) continue;
|
|
6750
|
+
i === list.length ? list.unshift(new parser_1.Node(el, pos)) : list.insert(new parser_1.Node(el, pos), node?.next);
|
|
6751
|
+
break;
|
|
6752
|
+
}
|
|
6753
|
+
return new parser_1.List([new parser_1.Node(el)]);
|
|
6713
6754
|
}, (nodes, input, output, prefix, postfix) => {
|
|
6714
6755
|
for (let i = 0; i < prefix; ++i) {
|
|
6715
6756
|
nodes.unshift(new parser_1.Node('('));
|
|
@@ -7352,7 +7393,7 @@ exports.signature = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('|',
|
|
|
7352
7393
|
const index = (0, indexee_1.identity)('index', undefined, ns.foldl((acc, {
|
|
7353
7394
|
value
|
|
7354
7395
|
}) => acc + value, ''))?.slice(7);
|
|
7355
|
-
if (linebreak !== 0 || ns.head.flags & 1 /* Flag.blank */ || !index) {
|
|
7396
|
+
if (linebreak !== 0 || ns.head.flags & 1 /* Node.Flag.blank */ || !index) {
|
|
7356
7397
|
return void (0, combinator_1.setBacktrack)(input, 2 | 16 /* Backtrack.escapable */, head);
|
|
7357
7398
|
}
|
|
7358
7399
|
return output.append(new parser_1.Node((0, dom_1.html)('span', {
|
|
@@ -7391,11 +7432,9 @@ const combinator_1 = __webpack_require__(3484);
|
|
|
7391
7432
|
const dom_1 = __webpack_require__(394);
|
|
7392
7433
|
function indexee(parser) {
|
|
7393
7434
|
return (0, combinator_1.fmap)(parser, (ns, {
|
|
7394
|
-
id
|
|
7395
|
-
local
|
|
7435
|
+
id
|
|
7396
7436
|
}) => ns.length === 1 ? new parser_1.List([new parser_1.Node((0, dom_1.define)(ns.head.value, {
|
|
7397
7437
|
id: identity('index', id, ns.head.value),
|
|
7398
|
-
class: local ? `${ns.head.value.className} local`.trimStart() : undefined,
|
|
7399
7438
|
'data-index': null
|
|
7400
7439
|
}))]) : ns);
|
|
7401
7440
|
}
|
|
@@ -7581,10 +7620,14 @@ exports.test = test;
|
|
|
7581
7620
|
exports.segment = (0, combinator_1.clear)((0, combinator_1.union)([(0, combinator_1.backtrack)((0, combinator_1.surround)('[', body, ']')), body]));
|
|
7582
7621
|
exports.label = (0, combinator_1.constraint)(16 /* State.label */, (0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.backtrack)((0, combinator_1.surround)('[', body, ']', false, [1 | 4 /* Backtrack.common */])), body]), ([{
|
|
7583
7622
|
value
|
|
7584
|
-
}]
|
|
7585
|
-
|
|
7586
|
-
|
|
7587
|
-
|
|
7623
|
+
}], _, output) => {
|
|
7624
|
+
const label = (0, dom_1.html)('a', {
|
|
7625
|
+
class: 'label',
|
|
7626
|
+
'data-label': value.slice(value[1] === '-' ? 0 : 1).toLowerCase()
|
|
7627
|
+
}, value);
|
|
7628
|
+
output.labels.at(-1).push(new parser_1.Node(label));
|
|
7629
|
+
return new parser_1.List([new parser_1.Node(label)]);
|
|
7630
|
+
}));
|
|
7588
7631
|
function number(label, base) {
|
|
7589
7632
|
return isFixed(label) ? label.slice(label.lastIndexOf('-') + 1) : increment(base, base.split('.').length);
|
|
7590
7633
|
}
|
|
@@ -7662,7 +7705,7 @@ Object.setPrototypeOf(attrspecs, null);
|
|
|
7662
7705
|
Object.values(attrspecs).forEach(o => Object.setPrototypeOf(o, null));
|
|
7663
7706
|
exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)(
|
|
7664
7707
|
// https://html.spec.whatwg.org/multipage/syntax.html#void-elements
|
|
7665
|
-
(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], input, output) => output.append(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(), input), as.head.value === '<wbr' ? 1 /* Flag.blank */ : 0 /* Flag.none */)), ([as, bs = new parser_1.List()], input, output) => output.append(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(), input)))), (0, combinator_1.match)(new RegExp(String.raw`<(${exports.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], _, output) => output.import(as.import(bs).import(cs)), ([as, bs = new parser_1.List()], _, output) => output.import(as.import(bs))),
|
|
7708
|
+
(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], input, output) => output.append(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(), input), as.head.position, as.head.value === '<wbr' ? 1 /* Node.Flag.blank */ : 0 /* Node.Flag.none */)), ([as, bs = new parser_1.List()], input, output) => output.append(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(), input)))), (0, combinator_1.match)(new RegExp(String.raw`<(${exports.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], _, output) => output.import(as.import(bs).import(cs)), ([as, bs = new parser_1.List()], _, output) => output.import(as.import(bs))),
|
|
7666
7709
|
// 不可視のHTML構造が可視構造を変化させるべきでない。
|
|
7667
7710
|
// 可視のHTMLは優先度変更を検討する。
|
|
7668
7711
|
// このため`<>`記号は将来的に共通構造を変化させる可能性があり
|
|
@@ -7742,11 +7785,12 @@ const combinator_1 = __webpack_require__(3484);
|
|
|
7742
7785
|
const source_1 = __webpack_require__(8745);
|
|
7743
7786
|
const util_1 = __webpack_require__(4992);
|
|
7744
7787
|
const dom_1 = __webpack_require__(394);
|
|
7745
|
-
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], _, output) => output.append(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], _, output) => output.append(new parser_1.Node(as.head.value + (bs?.head?.value ?? ''))));
|
|
7788
|
+
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], _, output) => output.append(new parser_1.Node(parser(as.head.value + bs.head.value + cs.head.value), as.head.position, (0, node_1.isBlankHTMLEntityName)(bs.head.value) ? 1 /* Node.Flag.blank */ : 0 /* Node.Flag.none */)), ([as, bs], _, output) => output.append(new parser_1.Node(as.head.value + (bs?.head?.value ?? ''))));
|
|
7746
7789
|
exports.htmlentity = (0, combinator_1.fmap)((0, combinator_1.union)([exports.unsafehtmlentity]), ([{
|
|
7747
7790
|
value,
|
|
7791
|
+
position,
|
|
7748
7792
|
flags
|
|
7749
|
-
}]) => new parser_1.List([value.length === 1 || value.at(-1) !== ';' ? new parser_1.Node(value, flags) : new parser_1.Node((0, dom_1.html)('span', {
|
|
7793
|
+
}]) => new parser_1.List([value.length === 1 || value.at(-1) !== ';' ? new parser_1.Node(value, position, flags) : new parser_1.Node((0, dom_1.html)('span', {
|
|
7750
7794
|
class: 'invalid',
|
|
7751
7795
|
...(0, util_1.invalid)('htmlentity', 'syntax', 'Invalid HTML entity')
|
|
7752
7796
|
}, value))]));
|
|
@@ -8053,14 +8097,14 @@ const optspec = {
|
|
|
8053
8097
|
};
|
|
8054
8098
|
Object.setPrototypeOf(optspec, null);
|
|
8055
8099
|
exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.backtrack)((0, combinator_1.open)('!', (0, combinator_1.bind)((0, combinator_1.fmap)((0, combinator_1.tails)([(0, combinator_1.backtrack)((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, [3 | 16 /* Backtrack.escapable */, 2 | 32 /* Backtrack.ruby */], ([, ns = new parser_1.List()], input, output) => {
|
|
8056
|
-
if (input.linebreak !== 0 || ns.head?.flags & 1 /* Flag.blank */ || ns.head?.value?.[0].trimStart() === '') {
|
|
8100
|
+
if (input.linebreak !== 0 || ns.head?.flags & 1 /* Node.Flag.blank */ || ns.head?.value?.[0].trimStart() === '') {
|
|
8057
8101
|
const head = input.position - input.range;
|
|
8058
8102
|
return void (0, combinator_1.setBacktrack)(input, 2 | 16 /* Backtrack.escapable */ | 32 /* Backtrack.ruby */, head);
|
|
8059
8103
|
}
|
|
8060
8104
|
return output.import(ns);
|
|
8061
8105
|
}))), (0, combinator_1.backtrack)((0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), / ?}/y, false, [], undefined, ([as, bs], _, output) => bs && output.import(as.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */))))))]), nodes => nodes.length === 1 ? new parser_1.List([new parser_1.Node(new parser_1.List([new parser_1.Node('')])), nodes.delete(nodes.head)]) : new parser_1.List([new parser_1.Node(new parser_1.List([new parser_1.Node(nodes.head.value.foldl((acc, {
|
|
8062
8106
|
value
|
|
8063
|
-
}) => acc + value, '').trimEnd(), nodes.head.value.head?.flags)])), nodes.delete(nodes.last)])), ([{
|
|
8107
|
+
}) => acc + value, '').trimEnd(), nodes.head.position, nodes.head.value.head?.flags)])), nodes.delete(nodes.last)])), ([{
|
|
8064
8108
|
value: [{
|
|
8065
8109
|
value: text
|
|
8066
8110
|
}]
|
|
@@ -8166,7 +8210,9 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64
|
|
|
8166
8210
|
(0, combinator_1.setBacktrack)(input, 2 | 64 /* Backtrack.link */, head, 2);
|
|
8167
8211
|
return;
|
|
8168
8212
|
}
|
|
8169
|
-
|
|
8213
|
+
const el = (0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(ns))))]);
|
|
8214
|
+
output.references.at(-1).push(new parser_1.Node(el));
|
|
8215
|
+
return output.import(new parser_1.List([new parser_1.Node(el)]));
|
|
8170
8216
|
}, (_, input) => {
|
|
8171
8217
|
const {
|
|
8172
8218
|
source,
|
|
@@ -8883,29 +8929,29 @@ const escsource = (input, output) => {
|
|
|
8883
8929
|
case "\u001B" /* Command.Escape */:
|
|
8884
8930
|
(0, combinator_1.spend)(input, output, 1);
|
|
8885
8931
|
input.position += 1;
|
|
8886
|
-
return output.append(new parser_1.Node(source.slice(position + 1, position + 2)));
|
|
8932
|
+
return output.append(new parser_1.Node(source.slice(position + 1, position + 2), position));
|
|
8887
8933
|
case '\\':
|
|
8888
8934
|
switch (source[position + 1]) {
|
|
8889
8935
|
case undefined:
|
|
8890
8936
|
case '\r':
|
|
8891
8937
|
case '\n':
|
|
8892
|
-
return output.append(new parser_1.Node(char));
|
|
8938
|
+
return output.append(new parser_1.Node(char, position));
|
|
8893
8939
|
default:
|
|
8894
8940
|
(0, combinator_1.spend)(input, output, 1);
|
|
8895
8941
|
input.position += 1;
|
|
8896
|
-
return output.append(new parser_1.Node(source.slice(position, position + 2)));
|
|
8942
|
+
return output.append(new parser_1.Node(source.slice(position, position + 2), position));
|
|
8897
8943
|
}
|
|
8898
8944
|
case '\r':
|
|
8899
8945
|
return parser_1.Result.succ;
|
|
8900
8946
|
case '\n':
|
|
8901
8947
|
input.linebreak ||= source.length - position;
|
|
8902
|
-
return output.append(new parser_1.Node((0, dom_1.html)('br'), 1 /* Flag.blank */));
|
|
8948
|
+
return output.append(new parser_1.Node((0, dom_1.html)('br'), position, 1 /* Node.Flag.blank */));
|
|
8903
8949
|
default:
|
|
8904
8950
|
let i = seek(source, position);
|
|
8905
8951
|
i -= position;
|
|
8906
8952
|
(0, combinator_1.spend)(input, output, i - 1);
|
|
8907
8953
|
input.position += i - 1;
|
|
8908
|
-
return output.append(new parser_1.Node(source.slice(position, input.position)));
|
|
8954
|
+
return output.append(new parser_1.Node(source.slice(position, input.position), position));
|
|
8909
8955
|
}
|
|
8910
8956
|
};
|
|
8911
8957
|
exports.escsource = escsource;
|
|
@@ -9030,9 +9076,12 @@ const delimiter_1 = __webpack_require__(5486);
|
|
|
9030
9076
|
function str(pattern, after) {
|
|
9031
9077
|
const match = (0, delimiter_1.matcher)(pattern, true, after ? (0, delimiter_1.tester)(after, false) : undefined);
|
|
9032
9078
|
return (input, output) => {
|
|
9079
|
+
const {
|
|
9080
|
+
position
|
|
9081
|
+
} = input;
|
|
9033
9082
|
const src = match(input, output);
|
|
9034
9083
|
if (src === undefined) return;
|
|
9035
|
-
return output.append(new parser_1.Node(src));
|
|
9084
|
+
return output.append(new parser_1.Node(src, position));
|
|
9036
9085
|
};
|
|
9037
9086
|
}
|
|
9038
9087
|
exports.str = str;
|
|
@@ -9050,7 +9099,7 @@ function strs(char, min = 1, max = -1) {
|
|
|
9050
9099
|
}
|
|
9051
9100
|
if (cnt < min) return;
|
|
9052
9101
|
input.position = pos;
|
|
9053
|
-
return output.append(new parser_1.Node(source.slice(position, input.position)));
|
|
9102
|
+
return output.append(new parser_1.Node(source.slice(position, input.position), position));
|
|
9054
9103
|
};
|
|
9055
9104
|
}
|
|
9056
9105
|
exports.strs = strs;
|
|
@@ -9094,13 +9143,13 @@ const text = (input, output) => {
|
|
|
9094
9143
|
default:
|
|
9095
9144
|
(0, combinator_1.spend)(input, output, 1);
|
|
9096
9145
|
input.position += 1;
|
|
9097
|
-
return output.append(new parser_1.Node(source.slice(position + 1, input.position)));
|
|
9146
|
+
return output.append(new parser_1.Node(source.slice(position + 1, input.position), position));
|
|
9098
9147
|
}
|
|
9099
9148
|
case '\r':
|
|
9100
9149
|
return parser_1.Result.succ;
|
|
9101
9150
|
case '\n':
|
|
9102
9151
|
input.linebreak ||= source.length - position;
|
|
9103
|
-
return output.append(new parser_1.Node((0, dom_1.html)('br'), 1 /* Flag.blank */));
|
|
9152
|
+
return output.append(new parser_1.Node((0, dom_1.html)('br'), position, 1 /* Node.Flag.blank */));
|
|
9104
9153
|
default:
|
|
9105
9154
|
exports.nonWhitespace.lastIndex = position + 1;
|
|
9106
9155
|
const s = canSkip(source, position);
|
|
@@ -9112,7 +9161,7 @@ const text = (input, output) => {
|
|
|
9112
9161
|
input.position += i - 1;
|
|
9113
9162
|
const linestart = position === 0 || source[position - 1] === '\n';
|
|
9114
9163
|
if (position === input.position || s && !linestart || lineend) return parser_1.Result.succ;
|
|
9115
|
-
return output.append(new parser_1.Node(source.slice(position, input.position)));
|
|
9164
|
+
return output.append(new parser_1.Node(source.slice(position, input.position), position));
|
|
9116
9165
|
}
|
|
9117
9166
|
};
|
|
9118
9167
|
exports.text = text;
|
|
@@ -9287,19 +9336,19 @@ const unescsource = (input, output) => {
|
|
|
9287
9336
|
case "\u001B" /* Command.Escape */:
|
|
9288
9337
|
(0, combinator_1.spend)(input, output, 1);
|
|
9289
9338
|
input.position += 1;
|
|
9290
|
-
return output.append(new parser_1.Node(source.slice(position + 1, position + 2)));
|
|
9339
|
+
return output.append(new parser_1.Node(source.slice(position + 1, position + 2), position));
|
|
9291
9340
|
case '\r':
|
|
9292
9341
|
return parser_1.Result.succ;
|
|
9293
9342
|
case '\n':
|
|
9294
9343
|
input.linebreak ||= source.length - position;
|
|
9295
|
-
return output.append(new parser_1.Node((0, dom_1.html)('br'), 1 /* Flag.blank */));
|
|
9344
|
+
return output.append(new parser_1.Node((0, dom_1.html)('br'), position, 1 /* Node.Flag.blank */));
|
|
9296
9345
|
default:
|
|
9297
9346
|
text_1.nonWhitespace.lastIndex = position + 1;
|
|
9298
9347
|
let i = (0, text_1.canSkip)(source, position) ? text_1.nonWhitespace.test(source) ? text_1.nonWhitespace.lastIndex - 1 : source.length : next(source, position, state);
|
|
9299
9348
|
i -= position;
|
|
9300
9349
|
(0, combinator_1.spend)(input, output, i - 1);
|
|
9301
9350
|
input.position += i - 1;
|
|
9302
|
-
return output.append(new parser_1.Node(source.slice(position, input.position)));
|
|
9351
|
+
return output.append(new parser_1.Node(source.slice(position, input.position), position));
|
|
9303
9352
|
}
|
|
9304
9353
|
};
|
|
9305
9354
|
exports.unescsource = unescsource;
|
|
@@ -9438,7 +9487,7 @@ exports.isWhitespace = isWhitespace;
|
|
|
9438
9487
|
Object.defineProperty(exports, "__esModule", ({
|
|
9439
9488
|
value: true
|
|
9440
9489
|
}));
|
|
9441
|
-
exports.randomID = exports.stringify = exports.unmarkInvalid = exports.markInvalid = exports.invalid = exports.unwrap = void 0;
|
|
9490
|
+
exports.collect = exports.randomID = exports.stringify = exports.unmarkInvalid = exports.markInvalid = exports.invalid = exports.unwrap = void 0;
|
|
9442
9491
|
const random_1 = __webpack_require__(3158);
|
|
9443
9492
|
const dom_1 = __webpack_require__(394);
|
|
9444
9493
|
function* unwrap(nodes) {
|
|
@@ -9491,6 +9540,15 @@ function randomID() {
|
|
|
9491
9540
|
return `random-${(0, random_1.rnd0Z)(6)}`;
|
|
9492
9541
|
}
|
|
9493
9542
|
exports.randomID = randomID;
|
|
9543
|
+
function collect(target, selector) {
|
|
9544
|
+
const acc = [];
|
|
9545
|
+
for (let el = target.firstElementChild; el; el = el?.nextElementSibling) {
|
|
9546
|
+
if (!el.matches(selector)) continue;
|
|
9547
|
+
acc.push(el);
|
|
9548
|
+
}
|
|
9549
|
+
return acc;
|
|
9550
|
+
}
|
|
9551
|
+
exports.collect = collect;
|
|
9494
9552
|
|
|
9495
9553
|
/***/ },
|
|
9496
9554
|
|
|
@@ -9556,7 +9614,7 @@ function isNonblankFirstLine(nodes) {
|
|
|
9556
9614
|
if (nodes.length === 0) return true;
|
|
9557
9615
|
for (const node of nodes) {
|
|
9558
9616
|
if (isNonblank(node)) return true;
|
|
9559
|
-
if (node.flags & 1 /* Flag.blank */ && typeof node.value === 'object' && node.value.tagName === 'BR') break;
|
|
9617
|
+
if (node.flags & 1 /* Node.Flag.blank */ && typeof node.value === 'object' && node.value.tagName === 'BR') break;
|
|
9560
9618
|
}
|
|
9561
9619
|
return false;
|
|
9562
9620
|
}
|
|
@@ -9570,7 +9628,7 @@ function isNonblank({
|
|
|
9570
9628
|
value: node,
|
|
9571
9629
|
flags
|
|
9572
9630
|
}, strpos) {
|
|
9573
|
-
if (flags & 1 /* Flag.blank */) return false;
|
|
9631
|
+
if (flags & 1 /* Node.Flag.blank */) return false;
|
|
9574
9632
|
if (typeof node !== 'string') return true;
|
|
9575
9633
|
const str = node && strpos !== undefined ? node[strpos >= 0 ? strpos : node.length + strpos] : node;
|
|
9576
9634
|
switch (str) {
|
|
@@ -9607,9 +9665,9 @@ function trimBlankEnd(parser) {
|
|
|
9607
9665
|
}
|
|
9608
9666
|
exports.trimBlankEnd = trimBlankEnd;
|
|
9609
9667
|
function trimBlankNodeEnd(nodes) {
|
|
9610
|
-
const skip = nodes.last && ~nodes.last.flags & 1 /* Flag.blank */ && typeof nodes.last.value === 'object' ? nodes.last.value.className === 'indexer' : false;
|
|
9668
|
+
const skip = nodes.last && ~nodes.last.flags & 1 /* Node.Flag.blank */ && typeof nodes.last.value === 'object' ? nodes.last.value.className === 'indexer' : false;
|
|
9611
9669
|
for (let node = skip ? nodes.last?.prev : nodes.last; node;) {
|
|
9612
|
-
if (~node.flags & 1 /* Flag.blank */) {
|
|
9670
|
+
if (~node.flags & 1 /* Node.Flag.blank */) {
|
|
9613
9671
|
if (typeof node.value === 'string') {
|
|
9614
9672
|
const str = node.value.trimEnd();
|
|
9615
9673
|
if (str.length > 0) {
|
|
@@ -9643,16 +9701,16 @@ exports.figure = void 0;
|
|
|
9643
9701
|
const label_1 = __webpack_require__(2178);
|
|
9644
9702
|
const util_1 = __webpack_require__(4992);
|
|
9645
9703
|
const queue_1 = __webpack_require__(4110);
|
|
9646
|
-
const array_1 = __webpack_require__(6876);
|
|
9647
9704
|
const dom_1 = __webpack_require__(394);
|
|
9648
|
-
function* figure(target, notes, opts = {}) {
|
|
9649
|
-
const
|
|
9650
|
-
|
|
9705
|
+
function* figure(target, list, notes, opts = {}) {
|
|
9706
|
+
const refs = new queue_1.MultiQueue(list.foldl((acc, {
|
|
9707
|
+
value: el
|
|
9708
|
+
}) => (acc.push([el.getAttribute('data-label'), el]), acc), []));
|
|
9651
9709
|
const labels = new Set();
|
|
9652
9710
|
const numbers = new Map();
|
|
9653
9711
|
let base = '0';
|
|
9654
9712
|
let bases = base.split('.');
|
|
9655
|
-
for (let defs =
|
|
9713
|
+
for (let defs = (0, util_1.collect)(target, 'figure[data-label], h1, h2'), len = defs.length, i = 0; i < len; ++i) {
|
|
9656
9714
|
if (~i << 32 - 8 === 0) yield;
|
|
9657
9715
|
const def = defs[i];
|
|
9658
9716
|
const {
|
|
@@ -9727,7 +9785,6 @@ function* figure(target, notes, opts = {}) {
|
|
|
9727
9785
|
}
|
|
9728
9786
|
if (ref.hash.slice(1) === def.id && ref.innerText === figindex) continue;
|
|
9729
9787
|
(0, dom_1.define)(ref, {
|
|
9730
|
-
class: opts.local ? `${ref.className} local` : undefined,
|
|
9731
9788
|
href: opts.id !== '' ? `#${def.id}` : undefined
|
|
9732
9789
|
}, figindex);
|
|
9733
9790
|
}
|
|
@@ -9777,7 +9834,7 @@ const indexee_1 = __webpack_require__(7610);
|
|
|
9777
9834
|
const util_1 = __webpack_require__(4992);
|
|
9778
9835
|
const memoize_1 = __webpack_require__(6925);
|
|
9779
9836
|
const dom_1 = __webpack_require__(394);
|
|
9780
|
-
function* note(target, notes, opts = {}, bottom = null) {
|
|
9837
|
+
function* note(target, lists, notes, opts = {}, bottom = null) {
|
|
9781
9838
|
const referenceRefMemory = referenceRefsMemoryCaller(target);
|
|
9782
9839
|
const annotationRefMemory = annotationRefsMemoryCaller(target);
|
|
9783
9840
|
for (const memory of [referenceRefMemory, annotationRefMemory]) {
|
|
@@ -9788,17 +9845,21 @@ function* note(target, notes, opts = {}, bottom = null) {
|
|
|
9788
9845
|
}
|
|
9789
9846
|
memory.clear();
|
|
9790
9847
|
}
|
|
9791
|
-
yield* reference(referenceRefMemory, target,
|
|
9792
|
-
|
|
9848
|
+
yield* reference(referenceRefMemory, target, lists.references.foldl((acc, {
|
|
9849
|
+
value: el
|
|
9850
|
+
}) => (acc.push(el), acc), []), notes?.references, opts, bottom);
|
|
9851
|
+
yield* annotation(annotationRefMemory, target, lists.annotations.foldl((acc, {
|
|
9852
|
+
value: el
|
|
9853
|
+
}) => (acc.push(el), acc), []), notes?.annotations, opts, bottom);
|
|
9793
9854
|
}
|
|
9794
9855
|
exports.note = note;
|
|
9795
9856
|
const annotationRefsMemoryCaller = (0, memoize_1.memoize)(target => new Map() ?? target, new WeakMap());
|
|
9796
9857
|
const referenceRefsMemoryCaller = (0, memoize_1.memoize)(target => new Map() ?? target, new WeakMap());
|
|
9797
|
-
const annotation = build('annotation', 'annotations',
|
|
9798
|
-
const reference = build('reference', 'references',
|
|
9799
|
-
function build(syntax, list,
|
|
9858
|
+
const annotation = build('annotation', 'annotations', n => `*${n}`, 'h1, h2, h3, h4, h5, h6, aside.aside, hr, .references');
|
|
9859
|
+
const reference = build('reference', 'references', (n, abbr) => `[${abbr || n}]`);
|
|
9860
|
+
function build(syntax, list, marker, splitter = '') {
|
|
9800
9861
|
splitter &&= `${splitter}, .${list}`;
|
|
9801
|
-
return function* (memory, target, note, opts = {}, bottom = null) {
|
|
9862
|
+
return function* (memory, target, refs, note, opts = {}, bottom = null) {
|
|
9802
9863
|
const refInfoCaller = (0, memoize_1.memoize)(ref => {
|
|
9803
9864
|
const content = ref.firstElementChild;
|
|
9804
9865
|
const abbr = ref.getAttribute('data-abbr') ?? '';
|
|
@@ -9813,7 +9874,6 @@ function build(syntax, list, selector, marker, splitter = '') {
|
|
|
9813
9874
|
};
|
|
9814
9875
|
}, memory);
|
|
9815
9876
|
const defs = new Map();
|
|
9816
|
-
const refs = target.querySelectorAll(selector);
|
|
9817
9877
|
const identifierInfoCaller = (0, memoize_1.memoize)(identifier => ({
|
|
9818
9878
|
defIndex: 0,
|
|
9819
9879
|
defSubindex: 0,
|
|
@@ -9821,7 +9881,7 @@ function build(syntax, list, selector, marker, splitter = '') {
|
|
|
9821
9881
|
title: '' && 0,
|
|
9822
9882
|
queue: []
|
|
9823
9883
|
}));
|
|
9824
|
-
const splitters = splitter ?
|
|
9884
|
+
const splitters = splitter ? (0, util_1.collect)(target, `${splitter}, .${list}`) : [];
|
|
9825
9885
|
let iSplitters = 0;
|
|
9826
9886
|
let total = 0;
|
|
9827
9887
|
let format;
|
|
@@ -9831,7 +9891,7 @@ function build(syntax, list, selector, marker, splitter = '') {
|
|
|
9831
9891
|
const ref = refs[i];
|
|
9832
9892
|
if (splitter) for (let splitter; splitter = splitters[iSplitters]; ++iSplitters) {
|
|
9833
9893
|
const pos = splitter?.compareDocumentPosition(ref) ?? 0;
|
|
9834
|
-
if (pos & (Node.DOCUMENT_POSITION_PRECEDING | Node.DOCUMENT_POSITION_DISCONNECTED)) break;
|
|
9894
|
+
if (pos & (__webpack_require__.g.Node.DOCUMENT_POSITION_PRECEDING | __webpack_require__.g.Node.DOCUMENT_POSITION_DISCONNECTED)) break;
|
|
9835
9895
|
if (~iSplitters << 32 - 8 === 0) yield;
|
|
9836
9896
|
if (splitter.classList.contains(list) && splitter.nextElementSibling !== splitters[iSplitters + 1]) {
|
|
9837
9897
|
const note = splitter;
|
|
@@ -9873,7 +9933,6 @@ function build(syntax, list, selector, marker, splitter = '') {
|
|
|
9873
9933
|
const title = info.title ||= text;
|
|
9874
9934
|
(0, dom_1.define)(ref, {
|
|
9875
9935
|
id: refId,
|
|
9876
|
-
class: opts.local ? `${ref.className} local` : undefined,
|
|
9877
9936
|
title
|
|
9878
9937
|
}, []);
|
|
9879
9938
|
if (title && info.queue.length > 0) {
|
|
@@ -10523,12 +10582,12 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
10523
10582
|
value: true
|
|
10524
10583
|
}));
|
|
10525
10584
|
exports.toc = void 0;
|
|
10585
|
+
const util_1 = __webpack_require__(4992);
|
|
10526
10586
|
const array_1 = __webpack_require__(6876);
|
|
10527
10587
|
const dom_1 = __webpack_require__(394);
|
|
10528
|
-
const selector = ':is(h1, h2, h3, h4, h5, h6, aside.aside)[id]:not(.local)';
|
|
10529
10588
|
function toc(source) {
|
|
10530
10589
|
const hs = [];
|
|
10531
|
-
for (let es = source.
|
|
10590
|
+
for (let es = (0, util_1.collect)(source, ':is(h1, h2, h3, h4, h5, h6, aside.aside)[id]'), len = es.length, i = 0; i < len; ++i) {
|
|
10532
10591
|
const el = es[i];
|
|
10533
10592
|
switch (el.tagName) {
|
|
10534
10593
|
case 'ASIDE':
|