securemark 0.238.0 → 0.239.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 +4 -0
- package/dist/securemark.js +32 -28
- package/markdown.d.ts +2 -0
- package/package-lock.json +44 -44
- package/package.json +1 -1
- package/src/combinator/data/parser/subsequence.ts +5 -9
- package/src/combinator/data/parser/tails.ts +1 -1
- package/src/combinator/data/parser/union.ts +1 -1
- package/src/parser/block/olist.test.ts +2 -0
- package/src/parser/block/ulist.test.ts +2 -0
- package/src/parser/inline/extension/indexee.ts +7 -3
- package/src/parser/inline/extension/indexer.test.ts +2 -1
- package/src/parser/inline/extension/indexer.ts +6 -3
- package/src/parser/processor/figure.ts +12 -6
package/CHANGELOG.md
CHANGED
package/dist/securemark.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.
|
|
1
|
+
/*! securemark v0.239.0 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) {
|
|
@@ -4037,21 +4037,10 @@ require = function () {
|
|
|
4037
4037
|
const union_1 = _dereq_('./union');
|
|
4038
4038
|
const inits_1 = _dereq_('./inits');
|
|
4039
4039
|
function subsequence(parsers) {
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
case 2:
|
|
4045
|
-
return (0, union_1.union)([
|
|
4046
|
-
(0, inits_1.inits)(parsers),
|
|
4047
|
-
parsers[1]
|
|
4048
|
-
]);
|
|
4049
|
-
default:
|
|
4050
|
-
return subsequence([
|
|
4051
|
-
parsers[0],
|
|
4052
|
-
subsequence(parsers.slice(1))
|
|
4053
|
-
]);
|
|
4054
|
-
}
|
|
4040
|
+
return (0, union_1.union)(parsers.map((_, i) => i < parsers.length - 1 ? (0, inits_1.inits)([
|
|
4041
|
+
parsers[i],
|
|
4042
|
+
subsequence(parsers.slice(i + 1))
|
|
4043
|
+
]) : parsers[i]));
|
|
4055
4044
|
}
|
|
4056
4045
|
exports.subsequence = subsequence;
|
|
4057
4046
|
},
|
|
@@ -4095,7 +4084,7 @@ require = function () {
|
|
|
4095
4084
|
'return (source, context) =>',
|
|
4096
4085
|
'0',
|
|
4097
4086
|
...parsers.map((_, i) => `|| parsers[${ i }](source, context)`)
|
|
4098
|
-
].join(''))(parsers);
|
|
4087
|
+
].join('\n'))(parsers);
|
|
4099
4088
|
}
|
|
4100
4089
|
}
|
|
4101
4090
|
exports.union = union;
|
|
@@ -7048,12 +7037,13 @@ require = function () {
|
|
|
7048
7037
|
function text(source, optional = false) {
|
|
7049
7038
|
var _a;
|
|
7050
7039
|
const indexer = source.querySelector(':scope > .indexer');
|
|
7051
|
-
if (indexer)
|
|
7052
|
-
return indexer.getAttribute('data-index');
|
|
7053
|
-
if (optional)
|
|
7040
|
+
if (!indexer && optional)
|
|
7054
7041
|
return '';
|
|
7042
|
+
const index = indexer === null || indexer === void 0 ? void 0 : indexer.getAttribute('data-index');
|
|
7043
|
+
if (index)
|
|
7044
|
+
return index;
|
|
7055
7045
|
const target = source.cloneNode(true);
|
|
7056
|
-
for (let es = target.querySelectorAll('code[data-src], .math[data-src], .comment, rt, rp, .reference'), i = 0, len = es.length; i < len; ++i) {
|
|
7046
|
+
for (let es = target.querySelectorAll('code[data-src], .math[data-src], .comment, rt, rp, .reference, .checkbox, ul, ol'), i = 0, len = es.length; i < len; ++i) {
|
|
7057
7047
|
const el = es[i];
|
|
7058
7048
|
switch (el.tagName) {
|
|
7059
7049
|
case 'CODE':
|
|
@@ -7061,6 +7051,8 @@ require = function () {
|
|
|
7061
7051
|
continue;
|
|
7062
7052
|
case 'RT':
|
|
7063
7053
|
case 'RP':
|
|
7054
|
+
case 'UL':
|
|
7055
|
+
case 'OL':
|
|
7064
7056
|
el.remove();
|
|
7065
7057
|
continue;
|
|
7066
7058
|
}
|
|
@@ -7069,6 +7061,7 @@ require = function () {
|
|
|
7069
7061
|
(0, typed_dom_1.define)(el, el.getAttribute('data-src'));
|
|
7070
7062
|
continue;
|
|
7071
7063
|
case 'comment':
|
|
7064
|
+
case 'checkbox':
|
|
7072
7065
|
el.remove();
|
|
7073
7066
|
continue;
|
|
7074
7067
|
case 'reference':
|
|
@@ -7094,7 +7087,13 @@ require = function () {
|
|
|
7094
7087
|
const combinator_1 = _dereq_('../../../combinator');
|
|
7095
7088
|
const index_1 = _dereq_('./index');
|
|
7096
7089
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
7097
|
-
exports.indexer = (0, combinator_1.creator)((0, combinator_1.fmap)((0, combinator_1.verify)((0, combinator_1.surround)(/^\s+(?=\[
|
|
7090
|
+
exports.indexer = (0, combinator_1.creator)((0, combinator_1.fmap)((0, combinator_1.verify)((0, combinator_1.surround)(/^\s+(?=\[#\S)/, (0, combinator_1.context)({ syntax: { inline: { index: true } } }, (0, combinator_1.union)([
|
|
7091
|
+
(0, combinator_1.focus)('[#]', () => [
|
|
7092
|
+
[(0, typed_dom_1.html)('a', { href: '#' })],
|
|
7093
|
+
''
|
|
7094
|
+
]),
|
|
7095
|
+
index_1.index
|
|
7096
|
+
])), /^\s*$/), ([el]) => el.getElementsByClassName('invalid').length === 0), ([el]) => [(0, typed_dom_1.html)('span', {
|
|
7098
7097
|
class: 'indexer',
|
|
7099
7098
|
'data-index': el.getAttribute('href').slice(7)
|
|
7100
7099
|
})]));
|
|
@@ -8219,11 +8218,11 @@ require = function () {
|
|
|
8219
8218
|
class: void def.classList.add('invalid'),
|
|
8220
8219
|
'data-invalid-syntax': 'figure',
|
|
8221
8220
|
'data-invalid-type': 'position',
|
|
8222
|
-
'data-invalid-message':
|
|
8221
|
+
'data-invalid-message': messages.declaration,
|
|
8223
8222
|
hidden: null
|
|
8224
8223
|
});
|
|
8225
8224
|
continue;
|
|
8226
|
-
} else if (def.getAttribute('data-invalid-message') ===
|
|
8225
|
+
} else if (def.getAttribute('data-invalid-message') === messages.declaration) {
|
|
8227
8226
|
(0, typed_dom_1.define)(def, {
|
|
8228
8227
|
class: void def.classList.remove('invalid'),
|
|
8229
8228
|
'data-invalid-syntax': null,
|
|
@@ -8260,10 +8259,10 @@ require = function () {
|
|
|
8260
8259
|
class: void def.classList.add('invalid'),
|
|
8261
8260
|
'data-invalid-syntax': 'figure',
|
|
8262
8261
|
'data-invalid-type': 'argument',
|
|
8263
|
-
'data-invalid-message':
|
|
8262
|
+
'data-invalid-message': messages.duplicate
|
|
8264
8263
|
});
|
|
8265
8264
|
continue;
|
|
8266
|
-
} else if (def.getAttribute('data-invalid-message') ===
|
|
8265
|
+
} else if (def.getAttribute('data-invalid-message') === messages.duplicate) {
|
|
8267
8266
|
(0, typed_dom_1.define)(def, {
|
|
8268
8267
|
class: void def.classList.remove('invalid'),
|
|
8269
8268
|
'data-invalid-syntax': null,
|
|
@@ -8274,7 +8273,7 @@ require = function () {
|
|
|
8274
8273
|
labels.add(label);
|
|
8275
8274
|
opts.id !== '' && def.setAttribute('id', `label:${ opts.id ? `${ opts.id }:` : '' }${ label }`);
|
|
8276
8275
|
for (const ref of refs.take(label, global_1.Infinity)) {
|
|
8277
|
-
if (ref.getAttribute('data-invalid-message') ===
|
|
8276
|
+
if (ref.getAttribute('data-invalid-message') === messages.reference) {
|
|
8278
8277
|
(0, typed_dom_1.define)(ref, {
|
|
8279
8278
|
class: void ref.classList.remove('invalid'),
|
|
8280
8279
|
'data-invalid-syntax': null,
|
|
@@ -8293,7 +8292,7 @@ require = function () {
|
|
|
8293
8292
|
class: void ref.classList.add('invalid'),
|
|
8294
8293
|
'data-invalid-syntax': 'label',
|
|
8295
8294
|
'data-invalid-type': 'reference',
|
|
8296
|
-
'data-invalid-message':
|
|
8295
|
+
'data-invalid-message': messages.reference
|
|
8297
8296
|
});
|
|
8298
8297
|
}
|
|
8299
8298
|
yield ref;
|
|
@@ -8301,6 +8300,11 @@ require = function () {
|
|
|
8301
8300
|
return;
|
|
8302
8301
|
}
|
|
8303
8302
|
exports.figure = figure;
|
|
8303
|
+
const messages = {
|
|
8304
|
+
declaration: 'Base index declarations must be after level 1 to 6 headings',
|
|
8305
|
+
duplicate: 'Duplicate label',
|
|
8306
|
+
reference: 'Missing the target figure'
|
|
8307
|
+
};
|
|
8304
8308
|
function increment(bases, el) {
|
|
8305
8309
|
const index = (+el.tagName[1] - 1 || 1) - 1;
|
|
8306
8310
|
return index + 1 < bases.length ? (0, array_1.join)(bases.slice(0, index + 2).map((v, i) => {
|
package/markdown.d.ts
CHANGED
|
@@ -768,9 +768,11 @@ export namespace MarkdownParser {
|
|
|
768
768
|
}
|
|
769
769
|
}
|
|
770
770
|
export interface IndexerParser extends
|
|
771
|
+
// [#]
|
|
771
772
|
// [#index]
|
|
772
773
|
Inline<'extension/indexer'>,
|
|
773
774
|
Parser<HTMLElement, Context, [
|
|
775
|
+
Parser<HTMLAnchorElement, Context, []>,
|
|
774
776
|
IndexParser,
|
|
775
777
|
]> {
|
|
776
778
|
}
|
package/package-lock.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "securemark",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.239.0",
|
|
4
4
|
"lockfileVersion": 1,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"dependencies": {
|
|
@@ -432,13 +432,13 @@
|
|
|
432
432
|
}
|
|
433
433
|
},
|
|
434
434
|
"@npmcli/git": {
|
|
435
|
-
"version": "3.0.
|
|
436
|
-
"resolved": "https://registry.npmjs.org/@npmcli/git/-/git-3.0.
|
|
437
|
-
"integrity": "sha512-
|
|
435
|
+
"version": "3.0.1",
|
|
436
|
+
"resolved": "https://registry.npmjs.org/@npmcli/git/-/git-3.0.1.tgz",
|
|
437
|
+
"integrity": "sha512-UU85F/T+F1oVn3IsB/L6k9zXIMpXBuUBE25QDH0SsURwT6IOBqkC7M16uqo2vVZIyji3X1K4XH9luip7YekH1A==",
|
|
438
438
|
"dev": true,
|
|
439
439
|
"requires": {
|
|
440
|
-
"@npmcli/promise-spawn": "^
|
|
441
|
-
"lru-cache": "^7.
|
|
440
|
+
"@npmcli/promise-spawn": "^3.0.0",
|
|
441
|
+
"lru-cache": "^7.4.4",
|
|
442
442
|
"mkdirp": "^1.0.4",
|
|
443
443
|
"npm-pick-manifest": "^7.0.0",
|
|
444
444
|
"proc-log": "^2.0.0",
|
|
@@ -476,9 +476,9 @@
|
|
|
476
476
|
}
|
|
477
477
|
},
|
|
478
478
|
"@npmcli/move-file": {
|
|
479
|
-
"version": "
|
|
480
|
-
"resolved": "https://registry.npmjs.org/@npmcli/move-file/-/move-file-
|
|
481
|
-
"integrity": "sha512-
|
|
479
|
+
"version": "2.0.0",
|
|
480
|
+
"resolved": "https://registry.npmjs.org/@npmcli/move-file/-/move-file-2.0.0.tgz",
|
|
481
|
+
"integrity": "sha512-UR6D5f4KEGWJV6BGPH3Qb2EtgH+t+1XQ1Tt85c7qicN6cezzuHPdZwwAxqZr4JLtnQu0LZsTza/5gmNmSl8XLg==",
|
|
482
482
|
"dev": true,
|
|
483
483
|
"requires": {
|
|
484
484
|
"mkdirp": "^1.0.4",
|
|
@@ -494,28 +494,28 @@
|
|
|
494
494
|
}
|
|
495
495
|
},
|
|
496
496
|
"@npmcli/node-gyp": {
|
|
497
|
-
"version": "
|
|
498
|
-
"resolved": "https://registry.npmjs.org/@npmcli/node-gyp/-/node-gyp-
|
|
499
|
-
"integrity": "sha512-
|
|
497
|
+
"version": "2.0.0",
|
|
498
|
+
"resolved": "https://registry.npmjs.org/@npmcli/node-gyp/-/node-gyp-2.0.0.tgz",
|
|
499
|
+
"integrity": "sha512-doNI35wIe3bBaEgrlPfdJPaCpUR89pJWep4Hq3aRdh6gKazIVWfs0jHttvSSoq47ZXgC7h73kDsUl8AoIQUB+A==",
|
|
500
500
|
"dev": true
|
|
501
501
|
},
|
|
502
502
|
"@npmcli/promise-spawn": {
|
|
503
|
-
"version": "
|
|
504
|
-
"resolved": "https://registry.npmjs.org/@npmcli/promise-spawn/-/promise-spawn-
|
|
505
|
-
"integrity": "sha512-
|
|
503
|
+
"version": "3.0.0",
|
|
504
|
+
"resolved": "https://registry.npmjs.org/@npmcli/promise-spawn/-/promise-spawn-3.0.0.tgz",
|
|
505
|
+
"integrity": "sha512-s9SgS+p3a9Eohe68cSI3fi+hpcZUmXq5P7w0kMlAsWVtR7XbK3ptkZqKT2cK1zLDObJ3sR+8P59sJE0w/KTL1g==",
|
|
506
506
|
"dev": true,
|
|
507
507
|
"requires": {
|
|
508
508
|
"infer-owner": "^1.0.4"
|
|
509
509
|
}
|
|
510
510
|
},
|
|
511
511
|
"@npmcli/run-script": {
|
|
512
|
-
"version": "3.0.
|
|
513
|
-
"resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-3.0.
|
|
514
|
-
"integrity": "sha512-
|
|
512
|
+
"version": "3.0.2",
|
|
513
|
+
"resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-3.0.2.tgz",
|
|
514
|
+
"integrity": "sha512-vdjD/PMBl+OX9j9C9irx5sCCIKfp2PWkpPNH9zxvlJAfSZ3Qp5aU412v+O3PFJl3R1PFNwuyChCqHg4ma6ci2Q==",
|
|
515
515
|
"dev": true,
|
|
516
516
|
"requires": {
|
|
517
|
-
"@npmcli/node-gyp": "^
|
|
518
|
-
"@npmcli/promise-spawn": "^
|
|
517
|
+
"@npmcli/node-gyp": "^2.0.0",
|
|
518
|
+
"@npmcli/promise-spawn": "^3.0.0",
|
|
519
519
|
"node-gyp": "^9.0.0",
|
|
520
520
|
"read-package-json-fast": "^2.0.3"
|
|
521
521
|
}
|
|
@@ -1777,13 +1777,13 @@
|
|
|
1777
1777
|
"dev": true
|
|
1778
1778
|
},
|
|
1779
1779
|
"cacache": {
|
|
1780
|
-
"version": "16.0.
|
|
1781
|
-
"resolved": "https://registry.npmjs.org/cacache/-/cacache-16.0.
|
|
1782
|
-
"integrity": "sha512-
|
|
1780
|
+
"version": "16.0.4",
|
|
1781
|
+
"resolved": "https://registry.npmjs.org/cacache/-/cacache-16.0.4.tgz",
|
|
1782
|
+
"integrity": "sha512-U0D4wF3/W8ZgK4qDA5fTtOVSr0gaDfd5aa7tUdAV0uukVWKsAIn6SzXQCoVlg7RWZiJa+bcsM3/pXLumGaL2Ug==",
|
|
1783
1783
|
"dev": true,
|
|
1784
1784
|
"requires": {
|
|
1785
1785
|
"@npmcli/fs": "^2.1.0",
|
|
1786
|
-
"@npmcli/move-file": "^
|
|
1786
|
+
"@npmcli/move-file": "^2.0.0",
|
|
1787
1787
|
"chownr": "^2.0.0",
|
|
1788
1788
|
"fs-minipass": "^2.1.0",
|
|
1789
1789
|
"glob": "^7.2.0",
|
|
@@ -1797,7 +1797,7 @@
|
|
|
1797
1797
|
"p-map": "^4.0.0",
|
|
1798
1798
|
"promise-inflight": "^1.0.1",
|
|
1799
1799
|
"rimraf": "^3.0.2",
|
|
1800
|
-
"ssri": "^
|
|
1800
|
+
"ssri": "^9.0.0",
|
|
1801
1801
|
"tar": "^6.1.11",
|
|
1802
1802
|
"unique-filename": "^1.1.1"
|
|
1803
1803
|
},
|
|
@@ -7114,9 +7114,9 @@
|
|
|
7114
7114
|
}
|
|
7115
7115
|
},
|
|
7116
7116
|
"make-fetch-happen": {
|
|
7117
|
-
"version": "10.1.
|
|
7118
|
-
"resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-10.1.
|
|
7119
|
-
"integrity": "sha512-
|
|
7117
|
+
"version": "10.1.2",
|
|
7118
|
+
"resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-10.1.2.tgz",
|
|
7119
|
+
"integrity": "sha512-GWMGiZsKVeJACQGJ1P3Z+iNec7pLsU6YW1q11eaPn3RR8nRXHppFWfP7Eu0//55JK3hSjrAQRl8sDa5uXpq1Ew==",
|
|
7120
7120
|
"dev": true,
|
|
7121
7121
|
"requires": {
|
|
7122
7122
|
"agentkeepalive": "^4.2.1",
|
|
@@ -7134,7 +7134,7 @@
|
|
|
7134
7134
|
"negotiator": "^0.6.3",
|
|
7135
7135
|
"promise-retry": "^2.0.1",
|
|
7136
7136
|
"socks-proxy-agent": "^6.1.1",
|
|
7137
|
-
"ssri": "^
|
|
7137
|
+
"ssri": "^9.0.0"
|
|
7138
7138
|
}
|
|
7139
7139
|
},
|
|
7140
7140
|
"make-iterator": {
|
|
@@ -8127,9 +8127,9 @@
|
|
|
8127
8127
|
}
|
|
8128
8128
|
},
|
|
8129
8129
|
"npm-install-checks": {
|
|
8130
|
-
"version": "
|
|
8131
|
-
"resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-
|
|
8132
|
-
"integrity": "sha512-
|
|
8130
|
+
"version": "5.0.0",
|
|
8131
|
+
"resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-5.0.0.tgz",
|
|
8132
|
+
"integrity": "sha512-65lUsMI8ztHCxFz5ckCEC44DRvEGdZX5usQFriauxHEwt7upv1FKaQEmAtU0YnOAdwuNWCmk64xYiQABNrEyLA==",
|
|
8133
8133
|
"dev": true,
|
|
8134
8134
|
"requires": {
|
|
8135
8135
|
"semver": "^7.1.1"
|
|
@@ -8176,12 +8176,12 @@
|
|
|
8176
8176
|
}
|
|
8177
8177
|
},
|
|
8178
8178
|
"npm-pick-manifest": {
|
|
8179
|
-
"version": "7.0.
|
|
8180
|
-
"resolved": "https://registry.npmjs.org/npm-pick-manifest/-/npm-pick-manifest-7.0.
|
|
8181
|
-
"integrity": "sha512-
|
|
8179
|
+
"version": "7.0.1",
|
|
8180
|
+
"resolved": "https://registry.npmjs.org/npm-pick-manifest/-/npm-pick-manifest-7.0.1.tgz",
|
|
8181
|
+
"integrity": "sha512-IA8+tuv8KujbsbLQvselW2XQgmXWS47t3CB0ZrzsRZ82DbDfkcFunOaPm4X7qNuhMfq+FmV7hQT4iFVpHqV7mg==",
|
|
8182
8182
|
"dev": true,
|
|
8183
8183
|
"requires": {
|
|
8184
|
-
"npm-install-checks": "^
|
|
8184
|
+
"npm-install-checks": "^5.0.0",
|
|
8185
8185
|
"npm-normalize-package-bin": "^1.0.1",
|
|
8186
8186
|
"npm-package-arg": "^9.0.0",
|
|
8187
8187
|
"semver": "^7.3.5"
|
|
@@ -8497,14 +8497,14 @@
|
|
|
8497
8497
|
}
|
|
8498
8498
|
},
|
|
8499
8499
|
"pacote": {
|
|
8500
|
-
"version": "13.0
|
|
8501
|
-
"resolved": "https://registry.npmjs.org/pacote/-/pacote-13.0.
|
|
8502
|
-
"integrity": "sha512-
|
|
8500
|
+
"version": "13.1.0",
|
|
8501
|
+
"resolved": "https://registry.npmjs.org/pacote/-/pacote-13.1.0.tgz",
|
|
8502
|
+
"integrity": "sha512-Ns2chroFx26U4Bd+qm/ETxHGv+HLafoy5TVAcYHigIqANZ+kkk6PANMr1KAugNYecnrN+5lwwiWyBeu40nuU7Q==",
|
|
8503
8503
|
"dev": true,
|
|
8504
8504
|
"requires": {
|
|
8505
8505
|
"@npmcli/git": "^3.0.0",
|
|
8506
8506
|
"@npmcli/installed-package-contents": "^1.0.7",
|
|
8507
|
-
"@npmcli/promise-spawn": "^
|
|
8507
|
+
"@npmcli/promise-spawn": "^3.0.0",
|
|
8508
8508
|
"@npmcli/run-script": "^3.0.1",
|
|
8509
8509
|
"cacache": "^16.0.0",
|
|
8510
8510
|
"chownr": "^2.0.0",
|
|
@@ -8521,7 +8521,7 @@
|
|
|
8521
8521
|
"read-package-json": "^5.0.0",
|
|
8522
8522
|
"read-package-json-fast": "^2.0.3",
|
|
8523
8523
|
"rimraf": "^3.0.2",
|
|
8524
|
-
"ssri": "^
|
|
8524
|
+
"ssri": "^9.0.0",
|
|
8525
8525
|
"tar": "^6.1.11"
|
|
8526
8526
|
},
|
|
8527
8527
|
"dependencies": {
|
|
@@ -10327,9 +10327,9 @@
|
|
|
10327
10327
|
"dev": true
|
|
10328
10328
|
},
|
|
10329
10329
|
"ssri": {
|
|
10330
|
-
"version": "
|
|
10331
|
-
"resolved": "https://registry.npmjs.org/ssri/-/ssri-
|
|
10332
|
-
"integrity": "sha512-
|
|
10330
|
+
"version": "9.0.0",
|
|
10331
|
+
"resolved": "https://registry.npmjs.org/ssri/-/ssri-9.0.0.tgz",
|
|
10332
|
+
"integrity": "sha512-Y1Z6J8UYnexKFN1R/hxUaYoY2LVdKEzziPmVAFKiKX8fiwvCJTVzn/xYE9TEWod5OVyNfIHHuVfIEuBClL/uJQ==",
|
|
10333
10333
|
"dev": true,
|
|
10334
10334
|
"requires": {
|
|
10335
10335
|
"minipass": "^3.1.1"
|
package/package.json
CHANGED
|
@@ -5,13 +5,9 @@ import { inits } from './inits';
|
|
|
5
5
|
export function subsequence<P extends Parser<unknown>>(parsers: SubParsers<P>): SubTree<P> extends Tree<P> ? P : Parser<SubTree<P>, Context<P>, SubParsers<P>>;
|
|
6
6
|
export function subsequence<T, D extends Parser<T>[]>(parsers: D): Parser<T, Ctx, D> {
|
|
7
7
|
assert(parsers.every(f => f));
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return union([inits(parsers), parsers[1]] as unknown as D);
|
|
14
|
-
default:
|
|
15
|
-
return subsequence([parsers[0], subsequence(parsers.slice(1))] as unknown as D);
|
|
16
|
-
}
|
|
8
|
+
return union(
|
|
9
|
+
parsers.map((_, i) =>
|
|
10
|
+
i < parsers.length - 1
|
|
11
|
+
? inits([parsers[i], subsequence(parsers.slice(i + 1))])
|
|
12
|
+
: parsers[i]) as D);
|
|
17
13
|
}
|
|
@@ -4,5 +4,5 @@ import { sequence } from './sequence';
|
|
|
4
4
|
|
|
5
5
|
export function tails<P extends Parser<unknown>>(parsers: SubParsers<P>): SubTree<P> extends Tree<P> ? P : Parser<SubTree<P>, Context<P>, SubParsers<P>>;
|
|
6
6
|
export function tails<T, D extends Parser<T>[]>(parsers: D): Parser<T, Ctx, D> {
|
|
7
|
-
return union(parsers.map((_, i) => sequence(parsers.slice(i))) as
|
|
7
|
+
return union(parsers.map((_, i) => sequence(parsers.slice(i))) as D);
|
|
8
8
|
}
|
|
@@ -126,9 +126,11 @@ describe('Unit: parser/block/olist', () => {
|
|
|
126
126
|
|
|
127
127
|
it('indexer', () => {
|
|
128
128
|
assert.deepStrictEqual(inspect(parser('1. [#a]')), [['<ol><li><a class="index" href="#index:a">a</a></li></ol>'], '']);
|
|
129
|
+
assert.deepStrictEqual(inspect(parser('1. a [#]')), [['<ol><li id="index:a">a<span class="indexer" data-index=""></span></li></ol>'], '']);
|
|
129
130
|
assert.deepStrictEqual(inspect(parser('1. a [#b]')), [['<ol><li id="index:b">a<span class="indexer" data-index="b"></span></li></ol>'], '']);
|
|
130
131
|
assert.deepStrictEqual(inspect(parser('1. [ ] [#a]')), [['<ol class="checklist"><li><span class="checkbox">☐</span><a class="index" href="#index:a">a</a></li></ol>'], '']);
|
|
131
132
|
assert.deepStrictEqual(inspect(parser('1. [ ] a [#b]')), [['<ol class="checklist"><li id="index:b"><span class="checkbox">☐</span>a<span class="indexer" data-index="b"></span></li></ol>'], '']);
|
|
133
|
+
assert.deepStrictEqual(inspect(parser('1. a [#]\n 1. c [#d]')), [['<ol><li id="index:a">a<span class="indexer" data-index=""></span><ol><li id="index:d">c<span class="indexer" data-index="d"></span></li></ol></li></ol>'], '']);
|
|
132
134
|
assert.deepStrictEqual(inspect(parser('1. a [#b]\n 1. c [#d]')), [['<ol><li id="index:b">a<span class="indexer" data-index="b"></span><ol><li id="index:d">c<span class="indexer" data-index="d"></span></li></ol></li></ol>'], '']);
|
|
133
135
|
});
|
|
134
136
|
|
|
@@ -68,9 +68,11 @@ describe('Unit: parser/block/ulist', () => {
|
|
|
68
68
|
|
|
69
69
|
it('indexer', () => {
|
|
70
70
|
assert.deepStrictEqual(inspect(parser('- [#a]')), [['<ul><li><a class="index" href="#index:a">a</a></li></ul>'], '']);
|
|
71
|
+
assert.deepStrictEqual(inspect(parser('- a [#]')), [['<ul><li id="index:a">a<span class="indexer" data-index=""></span></li></ul>'], '']);
|
|
71
72
|
assert.deepStrictEqual(inspect(parser('- a [#b]')), [['<ul><li id="index:b">a<span class="indexer" data-index="b"></span></li></ul>'], '']);
|
|
72
73
|
assert.deepStrictEqual(inspect(parser('- [ ] [#a]')), [['<ul class="checklist"><li><span class="checkbox">☐</span><a class="index" href="#index:a">a</a></li></ul>'], '']);
|
|
73
74
|
assert.deepStrictEqual(inspect(parser('- [ ] a [#b]')), [['<ul class="checklist"><li id="index:b"><span class="checkbox">☐</span>a<span class="indexer" data-index="b"></span></li></ul>'], '']);
|
|
75
|
+
assert.deepStrictEqual(inspect(parser('- a [#]\n - c [#d]')), [['<ul><li id="index:a">a<span class="indexer" data-index=""></span><ul><li id="index:d">c<span class="indexer" data-index="d"></span></li></ul></li></ul>'], '']);
|
|
74
76
|
assert.deepStrictEqual(inspect(parser('- a [#b]\n - c [#d]')), [['<ul><li id="index:b">a<span class="indexer" data-index="b"></span><ul><li id="index:d">c<span class="indexer" data-index="d"></span></li></ul></li></ul>'], '']);
|
|
75
77
|
});
|
|
76
78
|
|
|
@@ -22,12 +22,13 @@ export function text(source: HTMLElement | DocumentFragment, optional = false):
|
|
|
22
22
|
assert(source instanceof DocumentFragment || !source.matches('.indexer'));
|
|
23
23
|
assert(source.querySelectorAll(':scope > .indexer').length <= 1);
|
|
24
24
|
const indexer = source.querySelector(':scope > .indexer');
|
|
25
|
-
if (indexer) return
|
|
26
|
-
|
|
25
|
+
if (!indexer && optional) return '';
|
|
26
|
+
const index = indexer?.getAttribute('data-index');
|
|
27
|
+
if (index) return index;
|
|
27
28
|
assert(!source.querySelector('.annotation, br'));
|
|
28
29
|
const target = source.cloneNode(true) as typeof source;
|
|
29
30
|
for (
|
|
30
|
-
let es = target.querySelectorAll('code[data-src], .math[data-src], .comment, rt, rp, .reference'),
|
|
31
|
+
let es = target.querySelectorAll('code[data-src], .math[data-src], .comment, rt, rp, .reference, .checkbox, ul, ol'),
|
|
31
32
|
i = 0, len = es.length; i < len; ++i) {
|
|
32
33
|
const el = es[i];
|
|
33
34
|
switch (el.tagName) {
|
|
@@ -36,6 +37,8 @@ export function text(source: HTMLElement | DocumentFragment, optional = false):
|
|
|
36
37
|
continue;
|
|
37
38
|
case 'RT':
|
|
38
39
|
case 'RP':
|
|
40
|
+
case 'UL':
|
|
41
|
+
case 'OL':
|
|
39
42
|
el.remove();
|
|
40
43
|
continue;
|
|
41
44
|
}
|
|
@@ -44,6 +47,7 @@ export function text(source: HTMLElement | DocumentFragment, optional = false):
|
|
|
44
47
|
define(el, el.getAttribute('data-src')!);
|
|
45
48
|
continue;
|
|
46
49
|
case 'comment':
|
|
50
|
+
case 'checkbox':
|
|
47
51
|
el.remove();
|
|
48
52
|
continue;
|
|
49
53
|
case 'reference':
|
|
@@ -12,13 +12,14 @@ describe('Unit: parser/inline/extension/indexer', () => {
|
|
|
12
12
|
assert.deepStrictEqual(inspect(parser(' ')), undefined);
|
|
13
13
|
assert.deepStrictEqual(inspect(parser(' #')), undefined);
|
|
14
14
|
assert.deepStrictEqual(inspect(parser(' #a')), undefined);
|
|
15
|
-
assert.deepStrictEqual(inspect(parser(' [#]')), undefined);
|
|
15
|
+
assert.deepStrictEqual(inspect(parser(' [# ]')), undefined);
|
|
16
16
|
assert.deepStrictEqual(inspect(parser(' [#]]')), undefined);
|
|
17
17
|
assert.deepStrictEqual(inspect(parser(' [#a]]')), undefined);
|
|
18
18
|
assert.deepStrictEqual(inspect(parser(' [#&a;]')), undefined);
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
it('valid', () => {
|
|
22
|
+
assert.deepStrictEqual(inspect(parser(' [#]')), [['<span class="indexer" data-index=""></span>'], '']);
|
|
22
23
|
assert.deepStrictEqual(inspect(parser(' [#a]')), [['<span class="indexer" data-index="a"></span>'], '']);
|
|
23
24
|
assert.deepStrictEqual(inspect(parser(' [#a] ')), [['<span class="indexer" data-index="a"></span>'], '']);
|
|
24
25
|
assert.deepStrictEqual(inspect(parser(' [#a ]')), [['<span class="indexer" data-index="a"></span>'], '']);
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { ExtensionParser } from '../../inline';
|
|
2
|
-
import { union, verify, creator, context, surround, fmap } from '../../../combinator';
|
|
2
|
+
import { union, verify, focus, creator, context, surround, fmap } from '../../../combinator';
|
|
3
3
|
import { index } from './index';
|
|
4
4
|
import { html } from 'typed-dom';
|
|
5
5
|
|
|
6
6
|
export const indexer: ExtensionParser.IndexerParser = creator(fmap(verify(surround(
|
|
7
|
-
/^\s+(?=\[
|
|
7
|
+
/^\s+(?=\[#\S)/,
|
|
8
8
|
context({ syntax: { inline: {
|
|
9
9
|
index: true,
|
|
10
10
|
}}},
|
|
11
|
-
union([
|
|
11
|
+
union([
|
|
12
|
+
focus('[#]', () => [[html('a', { href: '#' })], '']),
|
|
13
|
+
index,
|
|
14
|
+
])),
|
|
12
15
|
/^\s*$/),
|
|
13
16
|
// Indexer is invisible but invalids must be visible.
|
|
14
17
|
([el]) => el.getElementsByClassName('invalid').length === 0),
|
|
@@ -64,12 +64,12 @@ export function* figure(
|
|
|
64
64
|
class: void def.classList.add('invalid'),
|
|
65
65
|
'data-invalid-syntax': 'figure',
|
|
66
66
|
'data-invalid-type': 'position',
|
|
67
|
-
'data-invalid-message':
|
|
67
|
+
'data-invalid-message': messages.declaration,
|
|
68
68
|
hidden: null,
|
|
69
69
|
});
|
|
70
70
|
continue;
|
|
71
71
|
}
|
|
72
|
-
else if (def.getAttribute('data-invalid-message') ===
|
|
72
|
+
else if (def.getAttribute('data-invalid-message') === messages.declaration) {
|
|
73
73
|
define(def, {
|
|
74
74
|
class: void def.classList.remove('invalid'),
|
|
75
75
|
'data-invalid-syntax': null,
|
|
@@ -131,11 +131,11 @@ export function* figure(
|
|
|
131
131
|
class: void def.classList.add('invalid'),
|
|
132
132
|
'data-invalid-syntax': 'figure',
|
|
133
133
|
'data-invalid-type': 'argument',
|
|
134
|
-
'data-invalid-message':
|
|
134
|
+
'data-invalid-message': messages.duplicate,
|
|
135
135
|
});
|
|
136
136
|
continue;
|
|
137
137
|
}
|
|
138
|
-
else if (def.getAttribute('data-invalid-message') ===
|
|
138
|
+
else if (def.getAttribute('data-invalid-message') === messages.duplicate) {
|
|
139
139
|
define(def, {
|
|
140
140
|
class: void def.classList.remove('invalid'),
|
|
141
141
|
'data-invalid-syntax': null,
|
|
@@ -146,7 +146,7 @@ export function* figure(
|
|
|
146
146
|
labels.add(label);
|
|
147
147
|
opts.id !== '' && def.setAttribute('id', `label:${opts.id ? `${opts.id}:` : ''}${label}`);
|
|
148
148
|
for (const ref of refs.take(label, Infinity)) {
|
|
149
|
-
if (ref.getAttribute('data-invalid-message') ===
|
|
149
|
+
if (ref.getAttribute('data-invalid-message') === messages.reference) {
|
|
150
150
|
define(ref, {
|
|
151
151
|
class: void ref.classList.remove('invalid'),
|
|
152
152
|
'data-invalid-syntax': null,
|
|
@@ -166,7 +166,7 @@ export function* figure(
|
|
|
166
166
|
class: void ref.classList.add('invalid'),
|
|
167
167
|
'data-invalid-syntax': 'label',
|
|
168
168
|
'data-invalid-type': 'reference',
|
|
169
|
-
'data-invalid-message':
|
|
169
|
+
'data-invalid-message': messages.reference,
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
172
|
yield ref;
|
|
@@ -174,6 +174,12 @@ export function* figure(
|
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
const messages = {
|
|
178
|
+
declaration: 'Base index declarations must be after level 1 to 6 headings',
|
|
179
|
+
duplicate: 'Duplicate label',
|
|
180
|
+
reference: 'Missing the target figure',
|
|
181
|
+
} as const;
|
|
182
|
+
|
|
177
183
|
function increment(bases: readonly string[], el: HTMLHeadingElement): string {
|
|
178
184
|
const index = (+el.tagName[1] - 1 || 1) - 1;
|
|
179
185
|
assert(index >= 0);
|