securemark 0.232.1 → 0.233.1
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 +12 -0
- package/design.md +4 -0
- package/dist/securemark.js +81 -108
- package/markdown.d.ts +13 -22
- package/package-lock.json +259 -245
- package/package.json +5 -5
- package/src/combinator/control/manipulation/indent.test.ts +12 -12
- package/src/combinator/control/manipulation/surround.ts +4 -3
- package/src/parser/api/parse.test.ts +6 -6
- package/src/parser/block/blockquote.test.ts +1 -1
- package/src/parser/block/extension/aside.test.ts +1 -1
- package/src/parser/block/extension/aside.ts +3 -3
- package/src/parser/block/extension/example.test.ts +2 -2
- package/src/parser/block/extension/table.ts +3 -3
- package/src/parser/block/paragraph.test.ts +7 -6
- package/src/parser/block/reply/cite.ts +1 -1
- package/src/parser/inline/annotation.test.ts +2 -4
- package/src/parser/inline/comment.test.ts +39 -38
- package/src/parser/inline/comment.ts +21 -28
- package/src/parser/inline/deletion.test.ts +1 -2
- package/src/parser/inline/emphasis.test.ts +0 -3
- package/src/parser/inline/extension/index.test.ts +4 -3
- package/src/parser/inline/extension/index.ts +2 -2
- package/src/parser/inline/extension/indexee.ts +22 -19
- package/src/parser/inline/extension/placeholder.test.ts +7 -7
- package/src/parser/inline/insertion.test.ts +1 -2
- package/src/parser/inline/link.test.ts +0 -1
- package/src/parser/inline/mark.test.ts +1 -4
- package/src/parser/inline/media.ts +9 -9
- package/src/parser/inline/reference.test.ts +19 -21
- package/src/parser/inline/reference.ts +1 -1
- package/src/parser/inline/strong.test.ts +0 -3
- package/src/parser/inline/template.test.ts +1 -1
- package/src/parser/inline.ts +3 -3
- package/src/parser/processor/figure.test.ts +25 -25
- package/src/parser/processor/figure.ts +1 -1
- package/src/parser/processor/footnote.ts +3 -2
- package/src/parser/util.ts +2 -17
- package/src/parser/util.test.ts +0 -14
package/CHANGELOG.md
CHANGED
package/design.md
CHANGED
|
@@ -293,3 +293,7 @@ MarkdownはGFMのように最初から高機能で完成度の高い拡張不要
|
|
|
293
293
|
### トランスクルージョン
|
|
294
294
|
|
|
295
295
|
分散的に管理される情報のトランスクルージョンは権利関係の不明瞭さおよびリンク先の消失によりリンク元の情報に欠損が生じるなどの脆さから壊れやすいウェブ上の情報を扱う方法として既存の方法より劣っておりWikipediaのように中央集権的管理を実施できる場合にのみ有用となる。
|
|
296
|
+
|
|
297
|
+
### Data URI
|
|
298
|
+
|
|
299
|
+
Data URIは保存および転送容量削減ならびに集約的管理のためサポートしない。
|
package/dist/securemark.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.
|
|
1
|
+
/*! securemark v0.233.1 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED */
|
|
2
2
|
require = function () {
|
|
3
3
|
function r(e, n, t) {
|
|
4
4
|
function o(i, f) {
|
|
@@ -427,7 +427,7 @@ require = function () {
|
|
|
427
427
|
this.indexes = {
|
|
428
428
|
LRU: new invlist_1.List(),
|
|
429
429
|
LFU: new invlist_1.List(),
|
|
430
|
-
|
|
430
|
+
OVL: new invlist_1.List()
|
|
431
431
|
};
|
|
432
432
|
this.stats = {
|
|
433
433
|
LRU: (0, tuple_1.tuple)(0, 0),
|
|
@@ -470,7 +470,7 @@ require = function () {
|
|
|
470
470
|
callback && (callback = !!this.settings.disposer);
|
|
471
471
|
record = callback ? record !== null && record !== void 0 ? record : this.memory.get(index.key) : record;
|
|
472
472
|
node.delete();
|
|
473
|
-
(_a = node.value.
|
|
473
|
+
(_a = node.value.overlap) === null || _a === void 0 ? void 0 : _a.delete();
|
|
474
474
|
this.memory.delete(index.key);
|
|
475
475
|
this.SIZE -= index.size;
|
|
476
476
|
callback && ((_c = (_b = this.settings).disposer) === null || _c === void 0 ? void 0 : _c.call(_b, record.value, index.key));
|
|
@@ -484,25 +484,30 @@ require = function () {
|
|
|
484
484
|
let size = (_a = skip === null || skip === void 0 ? void 0 : skip.value.size) !== null && _a !== void 0 ? _a : 0;
|
|
485
485
|
if (margin - size <= 0)
|
|
486
486
|
return;
|
|
487
|
-
const {LRU, LFU,
|
|
487
|
+
const {LRU, LFU, OVL} = this.indexes;
|
|
488
488
|
while (this.length === this.capacity || this.size + margin - size > this.space) {
|
|
489
|
-
const lastNode = (_b =
|
|
489
|
+
const lastNode = (_b = OVL.last) !== null && _b !== void 0 ? _b : LFU.last;
|
|
490
490
|
const lastIndex = lastNode === null || lastNode === void 0 ? void 0 : lastNode.value;
|
|
491
491
|
let target;
|
|
492
492
|
switch (true) {
|
|
493
493
|
case lastIndex && lastIndex.clock < this.clock - this.life:
|
|
494
494
|
case lastIndex && lastIndex.expiry !== global_1.Infinity && lastIndex.expiry < (0, clock_1.now)():
|
|
495
|
-
target = lastNode.list ===
|
|
495
|
+
target = lastNode.list === OVL ? lastNode.value.node : lastNode;
|
|
496
496
|
break;
|
|
497
497
|
case LRU.length === 0:
|
|
498
498
|
target = LFU.last !== skip ? LFU.last : LFU.last.prev;
|
|
499
499
|
break;
|
|
500
500
|
case LFU.length > this.capacity * this.ratio / 100:
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
501
|
+
target = LFU.last !== skip ? LFU.last : LFU.length >= 2 ? LFU.last.prev : skip;
|
|
502
|
+
if (target !== skip) {
|
|
503
|
+
if (this.ratio > 50)
|
|
504
|
+
break;
|
|
505
|
+
LRU.unshiftNode(target);
|
|
506
|
+
LRU.head.value.node = LRU.head;
|
|
507
|
+
LRU.head.value.overlap = OVL.unshift(LRU.head.value);
|
|
508
|
+
}
|
|
504
509
|
default:
|
|
505
|
-
target = LRU.last !== skip ? LRU.last : LRU.
|
|
510
|
+
target = LRU.last !== skip ? LRU.last : LRU.length >= 2 ? LRU.last.prev : LFU.last;
|
|
506
511
|
}
|
|
507
512
|
this.evict(target, void 0, true);
|
|
508
513
|
skip = (skip === null || skip === void 0 ? void 0 : skip.list) && skip;
|
|
@@ -593,7 +598,7 @@ require = function () {
|
|
|
593
598
|
this.stats.clear();
|
|
594
599
|
this.indexes.LRU.clear();
|
|
595
600
|
this.indexes.LFU.clear();
|
|
596
|
-
this.indexes.
|
|
601
|
+
this.indexes.OVL.clear();
|
|
597
602
|
if (!this.settings.disposer || !this.settings.capture.clear)
|
|
598
603
|
return void this.memory.clear();
|
|
599
604
|
const memory = this.memory;
|
|
@@ -620,7 +625,7 @@ require = function () {
|
|
|
620
625
|
return;
|
|
621
626
|
const lenR = indexes.LRU.length;
|
|
622
627
|
const lenF = indexes.LFU.length;
|
|
623
|
-
const lenV = indexes.
|
|
628
|
+
const lenV = indexes.OVL.length;
|
|
624
629
|
const r = (lenF + lenV) * 1000 / (lenR + lenF) | 0;
|
|
625
630
|
const rateR0 = rate(window, LRU[0], LRU[0] + LFU[0], LRU[1], LRU[1] + LFU[1], 0) * (1 + r);
|
|
626
631
|
const rateF0 = rate(window, LFU[0], LRU[0] + LFU[0], LFU[1], LRU[1] + LFU[1], 0) * (1001 - r);
|
|
@@ -643,14 +648,14 @@ require = function () {
|
|
|
643
648
|
const index = node.value;
|
|
644
649
|
const {LRU, LFU} = this.indexes;
|
|
645
650
|
++this.stats[index.region][0];
|
|
646
|
-
if (!index.
|
|
651
|
+
if (!index.overlap && index.clock >= this.clockR - LRU.length / 3 && this.capacity > 3) {
|
|
647
652
|
index.clock = ++this.clockR;
|
|
648
653
|
node.moveToHead();
|
|
649
654
|
return true;
|
|
650
655
|
}
|
|
651
656
|
index.clock = ++this.clock;
|
|
652
657
|
index.region = 'LFU';
|
|
653
|
-
(_a = index.
|
|
658
|
+
(_a = index.overlap) === null || _a === void 0 ? void 0 : _a.delete();
|
|
654
659
|
LFU.unshiftNode(node);
|
|
655
660
|
return true;
|
|
656
661
|
}
|
|
@@ -3651,6 +3656,7 @@ require = function () {
|
|
|
3651
3656
|
const global_1 = _dereq_('spica/global');
|
|
3652
3657
|
const parser_1 = _dereq_('../../data/parser');
|
|
3653
3658
|
const fmap_1 = _dereq_('../monad/fmap');
|
|
3659
|
+
const resource_1 = _dereq_('./resource');
|
|
3654
3660
|
const array_1 = _dereq_('spica/array');
|
|
3655
3661
|
function surround(opener, parser, closer, optional = false, f, g) {
|
|
3656
3662
|
switch (typeof opener) {
|
|
@@ -3698,18 +3704,18 @@ require = function () {
|
|
|
3698
3704
|
function match(pattern) {
|
|
3699
3705
|
switch (typeof pattern) {
|
|
3700
3706
|
case 'string':
|
|
3701
|
-
return source => source.slice(0, pattern.length) === pattern ? [
|
|
3707
|
+
return (0, resource_1.creator)(source => source.slice(0, pattern.length) === pattern ? [
|
|
3702
3708
|
[],
|
|
3703
3709
|
source.slice(pattern.length)
|
|
3704
|
-
] : global_1.undefined;
|
|
3710
|
+
] : global_1.undefined);
|
|
3705
3711
|
case 'object':
|
|
3706
|
-
return source => {
|
|
3712
|
+
return (0, resource_1.creator)(source => {
|
|
3707
3713
|
const m = source.match(pattern);
|
|
3708
3714
|
return m ? [
|
|
3709
3715
|
[],
|
|
3710
3716
|
source.slice(m[0].length)
|
|
3711
3717
|
] : global_1.undefined;
|
|
3712
|
-
};
|
|
3718
|
+
});
|
|
3713
3719
|
}
|
|
3714
3720
|
}
|
|
3715
3721
|
function open(opener, parser, optional = false) {
|
|
@@ -3728,6 +3734,7 @@ require = function () {
|
|
|
3728
3734
|
{
|
|
3729
3735
|
'../../data/parser': 47,
|
|
3730
3736
|
'../monad/fmap': 46,
|
|
3737
|
+
'./resource': 40,
|
|
3731
3738
|
'spica/array': 6,
|
|
3732
3739
|
'spica/global': 15
|
|
3733
3740
|
}
|
|
@@ -4854,7 +4861,7 @@ require = function () {
|
|
|
4854
4861
|
'data-invalid-description': 'Missing the title at the first line.'
|
|
4855
4862
|
}, `${ opener }${ body }${ closer }`)];
|
|
4856
4863
|
return [(0, typed_dom_1.html)('aside', {
|
|
4857
|
-
id: (0, indexee_1.identity)(heading),
|
|
4864
|
+
id: (0, indexee_1.identity)((0, indexee_1.text)(heading)),
|
|
4858
4865
|
class: 'aside'
|
|
4859
4866
|
}, [
|
|
4860
4867
|
document,
|
|
@@ -5300,9 +5307,9 @@ require = function () {
|
|
|
5300
5307
|
let [, rowspan = global_1.undefined, colspan = global_1.undefined, highlight = global_1.undefined] = (_a = source.match(/^.(?:(\d+)?:(\d+)?)?(!+)?$/)) !== null && _a !== void 0 ? _a : [];
|
|
5301
5308
|
rowspan === '1' ? rowspan = global_1.undefined : global_1.undefined;
|
|
5302
5309
|
colspan === '1' ? colspan = global_1.undefined : global_1.undefined;
|
|
5303
|
-
rowspan && (rowspan = (0, alias_1.max)(0, (0, alias_1.min)(+rowspan, 65534))
|
|
5304
|
-
colspan && (colspan = (0, alias_1.max)(0, (0, alias_1.min)(+colspan, 1000))
|
|
5305
|
-
highlight && (highlight = highlight.length > 0 ? highlight.length
|
|
5310
|
+
rowspan && (rowspan = `${ (0, alias_1.max)(0, (0, alias_1.min)(+rowspan, 65534)) }`);
|
|
5311
|
+
colspan && (colspan = `${ (0, alias_1.max)(0, (0, alias_1.min)(+colspan, 1000)) }`);
|
|
5312
|
+
highlight && (highlight = highlight.length > 0 ? `${ highlight.length }` : global_1.undefined);
|
|
5306
5313
|
const valid = !highlight || source[0] === '#' && +highlight <= 1 || source[0] === ':' && +highlight <= 6;
|
|
5307
5314
|
return {
|
|
5308
5315
|
class: valid ? highlight && 'highlight' : 'invalid',
|
|
@@ -5844,7 +5851,7 @@ require = function () {
|
|
|
5844
5851
|
(0, combinator_1.validate)(new RegExp(`${ anchor_1.syntax.source }[^\S\n]*(?:$|\n)`), anchor_1.anchor)
|
|
5845
5852
|
]))), ([el, quotes = '']) => [
|
|
5846
5853
|
(0, typed_dom_1.html)('span', { class: 'cite' }, (0, typed_dom_1.defrag)([
|
|
5847
|
-
quotes
|
|
5854
|
+
`${ quotes }>`,
|
|
5848
5855
|
(0, typed_dom_1.define)(el, { 'data-depth': `${ quotes.length + 1 }` }, el.innerText.slice(1))
|
|
5849
5856
|
])),
|
|
5850
5857
|
(0, typed_dom_1.html)('br')
|
|
@@ -6139,11 +6146,11 @@ require = function () {
|
|
|
6139
6146
|
const annotation_1 = _dereq_('./inline/annotation');
|
|
6140
6147
|
const reference_1 = _dereq_('./inline/reference');
|
|
6141
6148
|
const template_1 = _dereq_('./inline/template');
|
|
6149
|
+
const comment_1 = _dereq_('./inline/comment');
|
|
6142
6150
|
const extension_1 = _dereq_('./inline/extension');
|
|
6143
6151
|
const ruby_1 = _dereq_('./inline/ruby');
|
|
6144
6152
|
const link_1 = _dereq_('./inline/link');
|
|
6145
6153
|
const html_1 = _dereq_('./inline/html');
|
|
6146
|
-
const comment_1 = _dereq_('./inline/comment');
|
|
6147
6154
|
const insertion_1 = _dereq_('./inline/insertion');
|
|
6148
6155
|
const deletion_1 = _dereq_('./inline/deletion');
|
|
6149
6156
|
const mark_1 = _dereq_('./inline/mark');
|
|
@@ -6163,12 +6170,12 @@ require = function () {
|
|
|
6163
6170
|
annotation_1.annotation,
|
|
6164
6171
|
reference_1.reference,
|
|
6165
6172
|
template_1.template,
|
|
6173
|
+
comment_1.comment,
|
|
6166
6174
|
extension_1.extension,
|
|
6167
6175
|
ruby_1.ruby,
|
|
6168
6176
|
link_1.link,
|
|
6169
6177
|
media_1.media,
|
|
6170
6178
|
html_1.html,
|
|
6171
|
-
comment_1.comment,
|
|
6172
6179
|
insertion_1.insertion,
|
|
6173
6180
|
deletion_1.deletion,
|
|
6174
6181
|
mark_1.mark,
|
|
@@ -6599,52 +6606,28 @@ require = function () {
|
|
|
6599
6606
|
'use strict';
|
|
6600
6607
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
6601
6608
|
exports.comment = void 0;
|
|
6602
|
-
const combinator_1 = _dereq_('../../combinator');
|
|
6603
6609
|
const parser_1 = _dereq_('../../combinator/data/parser');
|
|
6604
|
-
const
|
|
6610
|
+
const combinator_1 = _dereq_('../../combinator');
|
|
6611
|
+
const inline_1 = _dereq_('../inline');
|
|
6605
6612
|
const source_1 = _dereq_('../source');
|
|
6606
6613
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
}, whole)],
|
|
6617
|
-
rest
|
|
6618
|
-
];
|
|
6619
|
-
const title = (0, parser_1.eval)((0, combinator_1.some)(text)(body, context), []).join('').trim();
|
|
6620
|
-
if (title.includes('\0'))
|
|
6621
|
-
return [
|
|
6622
|
-
[(0, typed_dom_1.html)('sup', {
|
|
6623
|
-
class: 'comment invalid',
|
|
6624
|
-
'data-invalid-syntax': 'comment',
|
|
6625
|
-
'data-invalid-type': 'content',
|
|
6626
|
-
'data-invalid-description': `Invalid HTML entitiy "${ title.match(/\0&[0-9A-Za-z]+;/)[0].slice(1) }".`
|
|
6627
|
-
}, whole)],
|
|
6628
|
-
rest
|
|
6629
|
-
];
|
|
6630
|
-
return [
|
|
6631
|
-
[(0, typed_dom_1.html)('sup', {
|
|
6632
|
-
class: 'comment',
|
|
6633
|
-
title
|
|
6634
|
-
})],
|
|
6635
|
-
rest
|
|
6636
|
-
];
|
|
6637
|
-
})));
|
|
6638
|
-
const text = (0, combinator_1.union)([
|
|
6639
|
-
htmlentity_1.unsafehtmlentity,
|
|
6640
|
-
source_1.unescsource
|
|
6641
|
-
]);
|
|
6614
|
+
const memoize_1 = _dereq_('spica/memoize');
|
|
6615
|
+
const array_1 = _dereq_('spica/array');
|
|
6616
|
+
exports.comment = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('[#', (0, combinator_1.match)(/^(?=\[(#+)\s)/, (0, memoize_1.memoize)(([, fence], closer = new RegExp(String.raw`^\s+${ fence }\]`)) => (0, combinator_1.surround)((0, source_1.str)(/^\[(\S+)\s+(?!\1\])/), (0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, closer)]), (0, source_1.str)(closer), true, ([, bs = []], rest) => [
|
|
6617
|
+
[(0, typed_dom_1.html)('span', { class: 'comment' }, (0, typed_dom_1.defrag)((0, array_1.push)((0, array_1.unshift)([`[${ fence } `], bs), [` ${ fence }]`])))],
|
|
6618
|
+
rest
|
|
6619
|
+
], ([as, bs = []], rest, context) => [
|
|
6620
|
+
(0, array_1.unshift)((0, array_1.pop)((0, parser_1.eval)((0, combinator_1.some)(source_1.text)(`${ as[0] }!`, context)))[0], bs),
|
|
6621
|
+
rest
|
|
6622
|
+
]), ([, fence]) => fence)))));
|
|
6642
6623
|
},
|
|
6643
6624
|
{
|
|
6644
6625
|
'../../combinator': 27,
|
|
6645
6626
|
'../../combinator/data/parser': 47,
|
|
6627
|
+
'../inline': 88,
|
|
6646
6628
|
'../source': 128,
|
|
6647
|
-
'
|
|
6629
|
+
'spica/array': 6,
|
|
6630
|
+
'spica/memoize': 18,
|
|
6648
6631
|
'typed-dom': 26
|
|
6649
6632
|
}
|
|
6650
6633
|
],
|
|
@@ -6883,7 +6866,7 @@ require = function () {
|
|
|
6883
6866
|
source_1.txt
|
|
6884
6867
|
]), ']', /^\\?\n/))), ns => [(0, typed_dom_1.html)('span', {
|
|
6885
6868
|
class: 'indexer',
|
|
6886
|
-
'data-index': (0, indexee_1.
|
|
6869
|
+
'data-index': (0, indexee_1.identity)((0, array_1.join)(ns)).slice(6)
|
|
6887
6870
|
})])));
|
|
6888
6871
|
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.union)([
|
|
6889
6872
|
(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([
|
|
@@ -6916,45 +6899,51 @@ require = function () {
|
|
|
6916
6899
|
function (_dereq_, module, exports) {
|
|
6917
6900
|
'use strict';
|
|
6918
6901
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
6919
|
-
exports.
|
|
6902
|
+
exports.text = exports.identity = exports.indexee = void 0;
|
|
6920
6903
|
const global_1 = _dereq_('spica/global');
|
|
6921
6904
|
const combinator_1 = _dereq_('../../../combinator');
|
|
6922
6905
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
6923
6906
|
function indexee(parser) {
|
|
6924
|
-
return (0, combinator_1.fmap)(parser, ([el], _, {id}) => [(0, typed_dom_1.define)(el, { id: id !== '' && identity(el) || global_1.undefined })]);
|
|
6907
|
+
return (0, combinator_1.fmap)(parser, ([el], _, {id}) => [(0, typed_dom_1.define)(el, { id: id !== '' && identity(text(el)) || global_1.undefined })]);
|
|
6925
6908
|
}
|
|
6926
6909
|
exports.indexee = indexee;
|
|
6927
|
-
function identity(
|
|
6928
|
-
|
|
6910
|
+
function identity(text) {
|
|
6911
|
+
text && (text = text.trim());
|
|
6912
|
+
return text && `index:${ text.replace(/\s+/g, '_').slice(0, 101).replace(/^(.{97}).{4}$/, '$1...') }`;
|
|
6929
6913
|
}
|
|
6930
6914
|
exports.identity = identity;
|
|
6931
6915
|
function text(source) {
|
|
6916
|
+
var _a;
|
|
6932
6917
|
const indexer = source.querySelector('.indexer');
|
|
6933
6918
|
if (indexer)
|
|
6934
6919
|
return indexer.getAttribute('data-index');
|
|
6935
6920
|
const target = source.cloneNode(true);
|
|
6936
|
-
for (let es = target.querySelectorAll('code[data-src], .math[data-src], rt, rp, .reference'), i = 0, len = es.length; i < len; ++i) {
|
|
6921
|
+
for (let es = target.querySelectorAll('code[data-src], .math[data-src], .comment, rt, rp, .reference'), i = 0, len = es.length; i < len; ++i) {
|
|
6937
6922
|
const el = es[i];
|
|
6938
6923
|
switch (el.tagName) {
|
|
6924
|
+
case 'CODE':
|
|
6925
|
+
(0, typed_dom_1.define)(el, el.getAttribute('data-src'));
|
|
6926
|
+
continue;
|
|
6939
6927
|
case 'RT':
|
|
6940
6928
|
case 'RP':
|
|
6941
6929
|
el.remove();
|
|
6942
6930
|
continue;
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
default:
|
|
6931
|
+
}
|
|
6932
|
+
switch (el.className) {
|
|
6933
|
+
case 'math':
|
|
6947
6934
|
(0, typed_dom_1.define)(el, el.getAttribute('data-src'));
|
|
6948
6935
|
continue;
|
|
6936
|
+
case 'comment':
|
|
6937
|
+
el.remove();
|
|
6938
|
+
continue;
|
|
6939
|
+
case 'reference':
|
|
6940
|
+
el.firstChild.remove();
|
|
6941
|
+
continue;
|
|
6949
6942
|
}
|
|
6950
6943
|
}
|
|
6951
6944
|
return target.textContent;
|
|
6952
6945
|
}
|
|
6953
6946
|
exports.text = text;
|
|
6954
|
-
function identify(index) {
|
|
6955
|
-
return index ? `index:${ index.replace(/\s+/g, '_').slice(0, 101).replace(/^(.{97}).{4}$/, '$1...') }` : '';
|
|
6956
|
-
}
|
|
6957
|
-
exports.identify = identify;
|
|
6958
6947
|
},
|
|
6959
6948
|
{
|
|
6960
6949
|
'../../../combinator': 27,
|
|
@@ -7607,6 +7596,15 @@ require = function () {
|
|
|
7607
7596
|
switch (uri.protocol) {
|
|
7608
7597
|
case 'http:':
|
|
7609
7598
|
case 'https:':
|
|
7599
|
+
if (/\/\.\.?(?:\/|$)/.test('/' + uri.source.slice(0, uri.source.search(/[?#]|$/)))) {
|
|
7600
|
+
(0, typed_dom_1.define)(target, {
|
|
7601
|
+
class: void target.classList.add('invalid'),
|
|
7602
|
+
'data-invalid-syntax': 'media',
|
|
7603
|
+
'data-invalid-type': 'argument',
|
|
7604
|
+
'data-invalid-description': 'Dot-segments cannot be used in media paths; use subresource paths instead.'
|
|
7605
|
+
});
|
|
7606
|
+
return false;
|
|
7607
|
+
}
|
|
7610
7608
|
break;
|
|
7611
7609
|
default:
|
|
7612
7610
|
(0, typed_dom_1.define)(target, {
|
|
@@ -7617,15 +7615,6 @@ require = function () {
|
|
|
7617
7615
|
});
|
|
7618
7616
|
return false;
|
|
7619
7617
|
}
|
|
7620
|
-
if (/\/\.\.?(?:\/|$)/.test('/' + uri.source.slice(0, uri.source.search(/[?#]|$/)))) {
|
|
7621
|
-
(0, typed_dom_1.define)(target, {
|
|
7622
|
-
class: void target.classList.add('invalid'),
|
|
7623
|
-
'data-invalid-syntax': 'media',
|
|
7624
|
-
'data-invalid-type': 'argument',
|
|
7625
|
-
'data-invalid-description': 'Dot-segments cannot be used in media paths; use subresource paths instead.'
|
|
7626
|
-
});
|
|
7627
|
-
return false;
|
|
7628
|
-
}
|
|
7629
7618
|
if (alt.includes('\0')) {
|
|
7630
7619
|
(0, typed_dom_1.define)(target, {
|
|
7631
7620
|
class: void target.classList.add('invalid'),
|
|
@@ -7692,7 +7681,7 @@ require = function () {
|
|
|
7692
7681
|
class: 'reference',
|
|
7693
7682
|
'data-abbr': (0, util_1.stringify)([ns.shift()]).trimEnd()
|
|
7694
7683
|
} : ns[0] === '' ? {
|
|
7695
|
-
class: '
|
|
7684
|
+
class: 'invalid',
|
|
7696
7685
|
'data-invalid-syntax': 'reference',
|
|
7697
7686
|
'data-invalid-type': 'syntax',
|
|
7698
7687
|
'data-invalid-description': 'Invalid abbr.'
|
|
@@ -8075,7 +8064,7 @@ require = function () {
|
|
|
8075
8064
|
!(0, label_1.isFixed)(label) && numbers.set(group, number);
|
|
8076
8065
|
opts.id !== '' && def.setAttribute('id', `label:${ opts.id ? `${ opts.id }:` : '' }${ label }`);
|
|
8077
8066
|
const figindex = group === '$' ? `(${ number })` : `${ capitalize(group) }${ group === 'fig' ? '.' : '' } ${ number }`;
|
|
8078
|
-
(0, typed_dom_1.define)(def.querySelector(':scope > .figindex'), group === '$' ? figindex : `${ figindex }
|
|
8067
|
+
(0, typed_dom_1.define)(def.querySelector(':scope > .figindex'), group === '$' ? figindex : `${ figindex }. `);
|
|
8079
8068
|
for (const ref of refs.take(label, global_1.Infinity)) {
|
|
8080
8069
|
if (ref.hash.slice(1) === def.id && ref.innerText === figindex)
|
|
8081
8070
|
continue;
|
|
@@ -8171,7 +8160,7 @@ require = function () {
|
|
|
8171
8160
|
} else {
|
|
8172
8161
|
(_b = ref.lastChild) === null || _b === void 0 ? void 0 : _b.remove();
|
|
8173
8162
|
}
|
|
8174
|
-
const title = global_1.undefined || titles.get(identifier) || +identifier[0] && ref.title || (0, indexee_1.text)(content).trim() || global_1.undefined;
|
|
8163
|
+
const title = global_1.undefined || titles.get(identifier) || +identifier[0] && ref.title || (0, indexee_1.text)(content).trim() || content.textContent.trim() || global_1.undefined;
|
|
8175
8164
|
title ? !titles.has(identifier) && titles.set(identifier, title) : buffer.set(identifier, ref);
|
|
8176
8165
|
const blank = !!abbr && !content.firstChild;
|
|
8177
8166
|
const refIndex = i + 1;
|
|
@@ -8651,7 +8640,6 @@ require = function () {
|
|
|
8651
8640
|
const global_1 = _dereq_('spica/global');
|
|
8652
8641
|
const parser_1 = _dereq_('../combinator/data/parser');
|
|
8653
8642
|
const combinator_1 = _dereq_('../combinator');
|
|
8654
|
-
const comment_1 = _dereq_('./inline/comment');
|
|
8655
8643
|
const htmlentity_1 = _dereq_('./inline/htmlentity');
|
|
8656
8644
|
const source_1 = _dereq_('./source');
|
|
8657
8645
|
const array_1 = _dereq_('spica/array');
|
|
@@ -8689,10 +8677,10 @@ require = function () {
|
|
|
8689
8677
|
'InvisibleComma',
|
|
8690
8678
|
'ic'
|
|
8691
8679
|
];
|
|
8692
|
-
const blankline = new RegExp(String.raw`^(?!$)(?:\\$|\\?[^\S\n]|&(?:${ invisibleHTMLEntityNames.join('|') });|<wbr
|
|
8680
|
+
const blankline = new RegExp(String.raw`^(?!$)(?:\\$|\\?[^\S\n]|&(?:${ invisibleHTMLEntityNames.join('|') });|<wbr>)+$`, 'gm');
|
|
8693
8681
|
function visualize(parser) {
|
|
8694
8682
|
return (0, combinator_1.union)([
|
|
8695
|
-
(0, combinator_1.convert)(source => source.replace(blankline,
|
|
8683
|
+
(0, combinator_1.convert)(source => source.replace(blankline, line => line.replace(/[\\&<]/g, '\x1B$&')), (0, combinator_1.verify)(parser, (ns, rest, context) => !rest && hasVisible(ns, context))),
|
|
8696
8684
|
(0, combinator_1.some)((0, combinator_1.union)([
|
|
8697
8685
|
source_1.linebreak,
|
|
8698
8686
|
source_1.unescsource
|
|
@@ -8738,7 +8726,7 @@ require = function () {
|
|
|
8738
8726
|
}
|
|
8739
8727
|
exports.startTight = startTight;
|
|
8740
8728
|
function isStartTight(source, context) {
|
|
8741
|
-
var _a, _b, _c
|
|
8729
|
+
var _a, _b, _c;
|
|
8742
8730
|
if (source === '')
|
|
8743
8731
|
return true;
|
|
8744
8732
|
switch (source[0]) {
|
|
@@ -8762,12 +8750,6 @@ require = function () {
|
|
|
8762
8750
|
return false;
|
|
8763
8751
|
}
|
|
8764
8752
|
return true;
|
|
8765
|
-
case '[':
|
|
8766
|
-
switch (true) {
|
|
8767
|
-
case source.length >= 7 && source[1] === '#' && ((_d = (0, parser_1.eval)((0, comment_1.comment)(source, context))) === null || _d === void 0 ? void 0 : _d[0].className) === 'comment':
|
|
8768
|
-
return false;
|
|
8769
|
-
}
|
|
8770
|
-
return true;
|
|
8771
8753
|
default:
|
|
8772
8754
|
return source[0].trimStart() !== '';
|
|
8773
8755
|
}
|
|
@@ -8783,8 +8765,6 @@ require = function () {
|
|
|
8783
8765
|
return true;
|
|
8784
8766
|
for (let i = nodes.length; i--;) {
|
|
8785
8767
|
const node = nodes[i];
|
|
8786
|
-
if (typeof node === 'object' && node.className === 'comment')
|
|
8787
|
-
continue;
|
|
8788
8768
|
return isVisible(node, -1);
|
|
8789
8769
|
}
|
|
8790
8770
|
return false;
|
|
@@ -8810,8 +8790,6 @@ require = function () {
|
|
|
8810
8790
|
return false;
|
|
8811
8791
|
case 'SPAN':
|
|
8812
8792
|
return node.className !== 'linebreak';
|
|
8813
|
-
case 'SUP':
|
|
8814
|
-
return node.className !== 'comment';
|
|
8815
8793
|
default:
|
|
8816
8794
|
return true;
|
|
8817
8795
|
}
|
|
@@ -8825,8 +8803,6 @@ require = function () {
|
|
|
8825
8803
|
for (let node = nodes[0]; nodes.length > 0 && !isVisible(node = nodes[0], 0);) {
|
|
8826
8804
|
if (nodes.length === 1 && typeof node === 'object' && node.className === 'indexer')
|
|
8827
8805
|
break;
|
|
8828
|
-
if (typeof node === 'object' && node.className === 'comment')
|
|
8829
|
-
break;
|
|
8830
8806
|
if (typeof node === 'string') {
|
|
8831
8807
|
const pos = node.length - node.trimStart().length;
|
|
8832
8808
|
if (pos > 0) {
|
|
@@ -8841,8 +8817,6 @@ require = function () {
|
|
|
8841
8817
|
function trimNodeEnd(nodes) {
|
|
8842
8818
|
const skip = nodes.length > 0 && typeof nodes[nodes.length - 1] === 'object' && nodes[nodes.length - 1]['className'] === 'indexer' ? [nodes.pop()] : [];
|
|
8843
8819
|
for (let node = nodes[0]; nodes.length > 0 && !isVisible(node = nodes[nodes.length - 1], -1);) {
|
|
8844
|
-
if (typeof node === 'object' && node.className === 'comment')
|
|
8845
|
-
break;
|
|
8846
8820
|
if (typeof node === 'string') {
|
|
8847
8821
|
const pos = node.trimEnd().length;
|
|
8848
8822
|
if (pos > 0) {
|
|
@@ -8879,7 +8853,6 @@ require = function () {
|
|
|
8879
8853
|
{
|
|
8880
8854
|
'../combinator': 27,
|
|
8881
8855
|
'../combinator/data/parser': 47,
|
|
8882
|
-
'./inline/comment': 100,
|
|
8883
8856
|
'./inline/htmlentity': 112,
|
|
8884
8857
|
'./source': 128,
|
|
8885
8858
|
'spica/array': 6,
|
package/markdown.d.ts
CHANGED
|
@@ -557,11 +557,11 @@ export namespace MarkdownParser {
|
|
|
557
557
|
// abc
|
|
558
558
|
Block<'reply'>,
|
|
559
559
|
Parser<HTMLParagraphElement, Context, [
|
|
560
|
-
Parser<
|
|
560
|
+
Parser<HTMLElement, Context, [
|
|
561
561
|
ReplyParser.CiteParser,
|
|
562
562
|
ReplyParser.QuoteParser,
|
|
563
563
|
]>,
|
|
564
|
-
Parser<
|
|
564
|
+
Parser<HTMLElement | string, Context, [
|
|
565
565
|
ReplyParser.QuoteParser,
|
|
566
566
|
InlineParser,
|
|
567
567
|
]>,
|
|
@@ -619,12 +619,12 @@ export namespace MarkdownParser {
|
|
|
619
619
|
InlineParser.AnnotationParser,
|
|
620
620
|
InlineParser.ReferenceParser,
|
|
621
621
|
InlineParser.TemplateParser,
|
|
622
|
+
InlineParser.CommentParser,
|
|
622
623
|
InlineParser.ExtensionParser,
|
|
623
624
|
InlineParser.RubyParser,
|
|
624
625
|
InlineParser.LinkParser,
|
|
625
626
|
InlineParser.MediaParser,
|
|
626
627
|
InlineParser.HTMLParser,
|
|
627
|
-
InlineParser.CommentParser,
|
|
628
628
|
InlineParser.InsertionParser,
|
|
629
629
|
InlineParser.DeletionParser,
|
|
630
630
|
InlineParser.MarkParser,
|
|
@@ -709,6 +709,13 @@ export namespace MarkdownParser {
|
|
|
709
709
|
]> {
|
|
710
710
|
}
|
|
711
711
|
}
|
|
712
|
+
export interface CommentParser extends
|
|
713
|
+
// [# comment #]
|
|
714
|
+
Inline<'comment'>,
|
|
715
|
+
Parser<HTMLElement | string, Context, [
|
|
716
|
+
InlineParser,
|
|
717
|
+
]> {
|
|
718
|
+
}
|
|
712
719
|
export interface ExtensionParser extends
|
|
713
720
|
// [#abc]
|
|
714
721
|
Inline<'extension'>,
|
|
@@ -941,22 +948,6 @@ export namespace MarkdownParser {
|
|
|
941
948
|
}
|
|
942
949
|
}
|
|
943
950
|
}
|
|
944
|
-
export interface CommentParser extends
|
|
945
|
-
// [# comment #]
|
|
946
|
-
Inline<'comment'>,
|
|
947
|
-
Parser<HTMLElement, Context, [
|
|
948
|
-
CommentParser.TextParser,
|
|
949
|
-
]> {
|
|
950
|
-
}
|
|
951
|
-
export namespace CommentParser {
|
|
952
|
-
export interface TextParser extends
|
|
953
|
-
Inline<'comment/text'>,
|
|
954
|
-
Parser<string, Context, [
|
|
955
|
-
UnsafeHTMLEntityParser,
|
|
956
|
-
SourceParser.UnescapableSourceParser,
|
|
957
|
-
]> {
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
951
|
export interface InsertionParser extends
|
|
961
952
|
// ++abc++
|
|
962
953
|
Inline<'insertion'>,
|
|
@@ -1030,7 +1021,7 @@ export namespace MarkdownParser {
|
|
|
1030
1021
|
export interface HTMLEntityParser extends
|
|
1031
1022
|
// ©
|
|
1032
1023
|
Inline<'htmlentity'>,
|
|
1033
|
-
Parser<
|
|
1024
|
+
Parser<string | HTMLSpanElement, Context, [
|
|
1034
1025
|
UnsafeHTMLEntityParser,
|
|
1035
1026
|
]> {
|
|
1036
1027
|
}
|
|
@@ -1153,7 +1144,7 @@ export namespace MarkdownParser {
|
|
|
1153
1144
|
}
|
|
1154
1145
|
export interface AutolinkParser extends
|
|
1155
1146
|
Markdown<'autolink'>,
|
|
1156
|
-
Parser<
|
|
1147
|
+
Parser<string | HTMLElement, Context, [
|
|
1157
1148
|
InlineParser.AutolinkParser,
|
|
1158
1149
|
SourceParser.LinebreakParser,
|
|
1159
1150
|
SourceParser.UnescapableSourceParser,
|
|
@@ -1164,7 +1155,7 @@ export namespace MarkdownParser {
|
|
|
1164
1155
|
export interface TextParser extends
|
|
1165
1156
|
// abc
|
|
1166
1157
|
Source<'text'>,
|
|
1167
|
-
Parser<
|
|
1158
|
+
Parser<string | HTMLBRElement | HTMLSpanElement, Context, []> {
|
|
1168
1159
|
}
|
|
1169
1160
|
export interface TxtParser extends
|
|
1170
1161
|
// abc
|