securemark 0.237.0 → 0.237.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 +4 -0
- package/dist/securemark.js +69 -33
- package/package-lock.json +10 -10
- package/package.json +1 -1
- package/src/parser/block/codeblock.ts +1 -1
- package/src/parser/block/extension/aside.ts +1 -1
- package/src/parser/block/extension/example.ts +1 -1
- package/src/parser/block/extension/figure.ts +1 -1
- package/src/parser/block/extension/message.ts +1 -1
- package/src/parser/block/extension/placeholder.ts +1 -1
- package/src/parser/block/extension/table.ts +1 -1
- package/src/parser/block/heading.test.ts +1 -1
- package/src/parser/block/heading.ts +10 -4
- package/src/parser/block/mathblock.ts +1 -1
- package/src/parser/processor/figure.test.ts +41 -17
- package/src/parser/processor/figure.ts +57 -20
- package/src/parser/processor/footnote.ts +1 -1
- package/src/util/quote.ts +1 -0
package/CHANGELOG.md
CHANGED
package/dist/securemark.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.237.
|
|
1
|
+
/*! securemark v0.237.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) {
|
|
@@ -4776,7 +4776,7 @@ require = function () {
|
|
|
4776
4776
|
class: 'invalid',
|
|
4777
4777
|
translate: 'no',
|
|
4778
4778
|
'data-invalid-syntax': 'codeblock',
|
|
4779
|
-
'data-invalid-type': !closer ? '
|
|
4779
|
+
'data-invalid-type': !closer ? 'fence' : 'argument',
|
|
4780
4780
|
'data-invalid-message': !closer ? `Missing the closing delimiter "${ delim }"` : 'Invalid argument'
|
|
4781
4781
|
}, `${ opener }${ body }${ closer }`)];
|
|
4782
4782
|
const file = (_a = path.split('/').pop()) !== null && _a !== void 0 ? _a : '';
|
|
@@ -4910,7 +4910,7 @@ require = function () {
|
|
|
4910
4910
|
class: 'invalid',
|
|
4911
4911
|
translate: 'no',
|
|
4912
4912
|
'data-invalid-syntax': 'aside',
|
|
4913
|
-
'data-invalid-type': !closer ? '
|
|
4913
|
+
'data-invalid-type': !closer ? 'fence' : 'argument',
|
|
4914
4914
|
'data-invalid-message': !closer ? `Missing the closing delimiter "${ delim }"` : 'Invalid argument'
|
|
4915
4915
|
}, `${ opener }${ body }${ closer }`)];
|
|
4916
4916
|
const annotations = (0, typed_dom_1.html)('ol', { class: 'annotations' });
|
|
@@ -4965,7 +4965,7 @@ require = function () {
|
|
|
4965
4965
|
class: 'invalid',
|
|
4966
4966
|
translate: 'no',
|
|
4967
4967
|
'data-invalid-syntax': 'example',
|
|
4968
|
-
'data-invalid-type': !closer ? '
|
|
4968
|
+
'data-invalid-type': !closer ? 'fence' : 'argument',
|
|
4969
4969
|
'data-invalid-message': !closer ? `Missing the closing delimiter "${ delim }"` : 'Invalid argument'
|
|
4970
4970
|
}, `${ opener }${ body }${ closer }`)];
|
|
4971
4971
|
switch (type) {
|
|
@@ -5112,7 +5112,7 @@ require = function () {
|
|
|
5112
5112
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
5113
5113
|
const memoize_1 = _dereq_('spica/memoize');
|
|
5114
5114
|
const array_1 = _dereq_('spica/array');
|
|
5115
|
-
exports.segment = (0, combinator_1.block)((0, combinator_1.match)(/^(~{3,})(?:figure[^\S\n]+)?(?=\[?\$[A-Za-z-][^\n]*\n
|
|
5115
|
+
exports.segment = (0, combinator_1.block)((0, combinator_1.match)(/^(~{3,})(?:figure[^\S\n]+)?(?=\[?\$[A-Za-z-][^\n]*\n)/, (0, memoize_1.memoize)(([, fence], closer = new RegExp(String.raw`^${ fence }[^\S\n]*(?:$|\n)`)) => (0, combinator_1.close)((0, combinator_1.sequence)([
|
|
5116
5116
|
(0, combinator_1.line)((0, combinator_1.close)(label_1.segment, /^.*\n/)),
|
|
5117
5117
|
(0, combinator_1.inits)([
|
|
5118
5118
|
(0, combinator_1.union)([
|
|
@@ -5253,7 +5253,7 @@ require = function () {
|
|
|
5253
5253
|
class: 'invalid',
|
|
5254
5254
|
translate: 'no',
|
|
5255
5255
|
'data-invalid-syntax': 'message',
|
|
5256
|
-
'data-invalid-type': !closer ? '
|
|
5256
|
+
'data-invalid-type': !closer ? 'fence' : 'argument',
|
|
5257
5257
|
'data-invalid-message': !closer ? `Missing the closing delimiter "${ delim }"` : 'Invalid argument'
|
|
5258
5258
|
}, `${ opener }${ body }${ closer }`)];
|
|
5259
5259
|
switch (type) {
|
|
@@ -5324,7 +5324,7 @@ require = function () {
|
|
|
5324
5324
|
class: 'invalid',
|
|
5325
5325
|
translate: 'no',
|
|
5326
5326
|
'data-invalid-syntax': 'extension',
|
|
5327
|
-
'data-invalid-type': !closer ? '
|
|
5327
|
+
'data-invalid-type': !closer ? 'fence' : 'syntax',
|
|
5328
5328
|
'data-invalid-message': !closer ? `Missing the closing delimiter "${ delim }"` : 'Invalid syntax'
|
|
5329
5329
|
}, `${ opener }${ body }${ closer }`)])));
|
|
5330
5330
|
},
|
|
@@ -5358,7 +5358,7 @@ require = function () {
|
|
|
5358
5358
|
class: 'invalid',
|
|
5359
5359
|
translate: 'no',
|
|
5360
5360
|
'data-invalid-syntax': 'table',
|
|
5361
|
-
'data-invalid-type': !closer ? '
|
|
5361
|
+
'data-invalid-type': !closer ? 'fence' : 'argument',
|
|
5362
5362
|
'data-invalid-message': !closer ? `Missing the closing delimiter "${ delim }"` : 'Invalid argument'
|
|
5363
5363
|
}, `${ opener }${ body }${ closer }`)];
|
|
5364
5364
|
return (_a = (0, parser_1.eval)(parser(body, context))) !== null && _a !== void 0 ? _a : [(0, typed_dom_1.html)('table')];
|
|
@@ -5611,8 +5611,7 @@ require = function () {
|
|
|
5611
5611
|
const source_1 = _dereq_('../source');
|
|
5612
5612
|
const util_1 = _dereq_('../util');
|
|
5613
5613
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
5614
|
-
|
|
5615
|
-
exports.segment = (0, combinator_1.block)((0, combinator_1.validate)('#', (0, combinator_1.focus)(/^#{1,6}[^\S\n]+\S[^\n]*(?:\n#{1,6}(?!\S)[^\n]*)*(?:$|\n)/, (0, combinator_1.some)((0, combinator_1.line)(source => [
|
|
5614
|
+
exports.segment = (0, combinator_1.block)((0, combinator_1.validate)('#', (0, combinator_1.focus)(/^#+[^\S\n]+\S[^\n]*(?:\n#+(?!\S)[^\n]*)*(?:$|\n)/, (0, combinator_1.some)((0, combinator_1.line)(source => [
|
|
5616
5615
|
[source],
|
|
5617
5616
|
''
|
|
5618
5617
|
])))));
|
|
@@ -5636,14 +5635,18 @@ require = function () {
|
|
|
5636
5635
|
inline_1.indexer,
|
|
5637
5636
|
inline_1.inline
|
|
5638
5637
|
]))))), true)
|
|
5639
|
-
]), ns => [(0, typed_dom_1.html)(`h${ (0,
|
|
5638
|
+
]), ([h, ...ns]) => [h.length <= 6 ? (0, typed_dom_1.html)(`h${ h.length }`, (0, typed_dom_1.defrag)(ns)) : (0, typed_dom_1.html)(`h6`, {
|
|
5639
|
+
class: 'invalid',
|
|
5640
|
+
'data-invalid-syntax': 'heading',
|
|
5641
|
+
'data-invalid-type': 'syntax',
|
|
5642
|
+
'data-invalid-message': 'Heading level must be up to 6'
|
|
5643
|
+
}, (0, typed_dom_1.defrag)(ns))]))))));
|
|
5640
5644
|
},
|
|
5641
5645
|
{
|
|
5642
5646
|
'../../combinator': 27,
|
|
5643
5647
|
'../inline': 88,
|
|
5644
5648
|
'../source': 128,
|
|
5645
5649
|
'../util': 134,
|
|
5646
|
-
'spica/array': 6,
|
|
5647
5650
|
'typed-dom': 26
|
|
5648
5651
|
}
|
|
5649
5652
|
],
|
|
@@ -5726,7 +5729,7 @@ require = function () {
|
|
|
5726
5729
|
class: 'invalid',
|
|
5727
5730
|
translate: 'no',
|
|
5728
5731
|
'data-invalid-syntax': 'mathblock',
|
|
5729
|
-
'data-invalid-type': delim.length > 2 ? 'syntax' : !closer ? '
|
|
5732
|
+
'data-invalid-type': delim.length > 2 ? 'syntax' : !closer ? 'fence' : 'argument',
|
|
5730
5733
|
'data-invalid-message': delim.length > 2 ? 'Invalid syntax' : !closer ? `Missing the closing delimiter "${ delim }"` : 'Invalid argument'
|
|
5731
5734
|
}, `${ opener }${ body }${ closer }`)];
|
|
5732
5735
|
})));
|
|
@@ -8166,7 +8169,7 @@ require = function () {
|
|
|
8166
8169
|
const multimap_1 = _dereq_('spica/multimap');
|
|
8167
8170
|
const array_1 = _dereq_('spica/array');
|
|
8168
8171
|
function* figure(target, footnotes, opts = {}) {
|
|
8169
|
-
var _a, _b, _c;
|
|
8172
|
+
var _a, _b, _c, _d;
|
|
8170
8173
|
const refs = new multimap_1.MultiMap((0, array_1.push)((0, array_1.push)((0, array_1.push)([], target.querySelectorAll('a.label:not(.disabled)[data-label]')), (_a = footnotes === null || footnotes === void 0 ? void 0 : footnotes.annotations.querySelectorAll('a.label:not(.disabled)')) !== null && _a !== void 0 ? _a : []), (_b = footnotes === null || footnotes === void 0 ? void 0 : footnotes.references.querySelectorAll('a.label:not(.disabled)')) !== null && _b !== void 0 ? _b : []).map(el => [
|
|
8171
8174
|
el.getAttribute('data-label'),
|
|
8172
8175
|
el
|
|
@@ -8176,40 +8179,71 @@ require = function () {
|
|
|
8176
8179
|
let base = '0';
|
|
8177
8180
|
let bases = base.split('.');
|
|
8178
8181
|
let index = bases;
|
|
8179
|
-
for (let defs = target.querySelectorAll('figure[data-label], h1, h2
|
|
8182
|
+
for (let defs = target.querySelectorAll('figure[data-label], h1, h2'), i = 0, len = defs.length; i < len; ++i) {
|
|
8180
8183
|
yield;
|
|
8181
8184
|
const def = defs[i];
|
|
8182
8185
|
if (def.parentNode !== target)
|
|
8183
8186
|
continue;
|
|
8184
|
-
|
|
8187
|
+
const {tagName, classList} = def;
|
|
8188
|
+
if (bases.length === 1 && tagName[0] === 'H')
|
|
8185
8189
|
continue;
|
|
8186
|
-
const label =
|
|
8190
|
+
const label = tagName === 'FIGURE' ? def.getAttribute('data-label') : `$-${ increment(index, def) }`;
|
|
8187
8191
|
if (label.endsWith('-'))
|
|
8188
8192
|
continue;
|
|
8189
|
-
if (label.endsWith('-0'))
|
|
8193
|
+
if (label.endsWith('-0')) {
|
|
8194
|
+
(0, typed_dom_1.define)(def, {
|
|
8195
|
+
class: void classList.add('invalid'),
|
|
8196
|
+
'data-invalid-syntax': 'figure',
|
|
8197
|
+
'data-invalid-type': 'argument',
|
|
8198
|
+
'data-invalid-message': 'Invalid base index',
|
|
8199
|
+
hidden: null
|
|
8200
|
+
});
|
|
8190
8201
|
continue;
|
|
8191
|
-
|
|
8192
|
-
|
|
8202
|
+
}
|
|
8203
|
+
if (tagName === 'FIGURE' && label.endsWith('.0')) {
|
|
8204
|
+
if (label.lastIndexOf('.', label.length - 3) !== -1) {
|
|
8205
|
+
(0, typed_dom_1.define)(def, {
|
|
8206
|
+
class: void classList.add('invalid'),
|
|
8207
|
+
'data-invalid-syntax': 'figure',
|
|
8208
|
+
'data-invalid-type': 'argument',
|
|
8209
|
+
'data-invalid-message': 'Base index must be $-x.0 format',
|
|
8210
|
+
hidden: null
|
|
8211
|
+
});
|
|
8193
8212
|
continue;
|
|
8194
|
-
|
|
8213
|
+
}
|
|
8214
|
+
if (!/^H[1-6]$/.test((_d = (_c = def.previousElementSibling) === null || _c === void 0 ? void 0 : _c.tagName) !== null && _d !== void 0 ? _d : '')) {
|
|
8215
|
+
(0, typed_dom_1.define)(def, {
|
|
8216
|
+
class: void classList.add('invalid'),
|
|
8217
|
+
'data-invalid-syntax': 'figure',
|
|
8218
|
+
'data-invalid-type': 'position',
|
|
8219
|
+
'data-invalid-message': 'Base index declarations must be after level 1 or 2 headings',
|
|
8220
|
+
hidden: null
|
|
8221
|
+
});
|
|
8195
8222
|
continue;
|
|
8223
|
+
} else {
|
|
8224
|
+
classList.contains('invalid') && (0, typed_dom_1.define)(def, {
|
|
8225
|
+
class: void classList.remove('invalid'),
|
|
8226
|
+
'data-invalid-syntax': null,
|
|
8227
|
+
'data-invalid-type': null,
|
|
8228
|
+
'data-invalid-message': null,
|
|
8229
|
+
hidden: ''
|
|
8230
|
+
});
|
|
8231
|
+
}
|
|
8196
8232
|
}
|
|
8197
8233
|
const group = label.split('-', 1)[0];
|
|
8198
8234
|
let number = (0, label_1.number)(label, numbers.has(group) && !(0, label_1.isFixed)(label) ? (0, array_1.join)(numbers.get(group).split('.').slice(0, bases.length), '.') : base);
|
|
8199
8235
|
if (number.endsWith('.0')) {
|
|
8200
|
-
if (
|
|
8201
|
-
continue;
|
|
8202
|
-
if (group !== '$' || def.tagName === 'FIGURE' && def.firstChild)
|
|
8236
|
+
if (group !== '$' || tagName === 'FIGURE' && def.firstChild)
|
|
8203
8237
|
continue;
|
|
8204
8238
|
if (number.startsWith('0.')) {
|
|
8205
|
-
number = (0, array_1.join)(index.slice(0).reduce((ns, _, i,
|
|
8206
|
-
i === ns.length ?
|
|
8239
|
+
number = (0, array_1.join)(index.slice(0).reduce((ns, _, i, xs) => {
|
|
8240
|
+
i === ns.length ? xs.length = i : ns[i] = +ns[i] > +xs[i] ? ns[i] : +ns[i] === 0 ? xs[i] : `${ +xs[i] + 1 }`;
|
|
8207
8241
|
return ns;
|
|
8208
8242
|
}, number.split('.')), '.');
|
|
8209
8243
|
}
|
|
8210
8244
|
base = number;
|
|
8211
8245
|
bases = index = base.split('.');
|
|
8212
|
-
numbers.clear();
|
|
8246
|
+
tagName !== 'FIGURE' && numbers.clear();
|
|
8213
8247
|
continue;
|
|
8214
8248
|
}
|
|
8215
8249
|
!(0, label_1.isFixed)(label) && numbers.set(group, number);
|
|
@@ -8217,11 +8251,11 @@ require = function () {
|
|
|
8217
8251
|
const figindex = group === '$' ? `(${ number })` : `${ capitalize(group) }${ group === 'fig' ? '.' : '' } ${ number }`;
|
|
8218
8252
|
(0, typed_dom_1.define)(def.querySelector(':scope > figcaption > .figindex'), group === '$' ? figindex : `${ figindex }. `);
|
|
8219
8253
|
if (labels.has(label)) {
|
|
8220
|
-
if (
|
|
8254
|
+
if (classList.contains('invalid') && def.getAttribute('data-invalid-message') !== 'Duplicate label')
|
|
8221
8255
|
continue;
|
|
8222
8256
|
(0, typed_dom_1.define)(def, {
|
|
8223
8257
|
id: null,
|
|
8224
|
-
class: void
|
|
8258
|
+
class: void classList.add('invalid'),
|
|
8225
8259
|
'data-invalid-syntax': 'figure',
|
|
8226
8260
|
'data-invalid-type': 'argument',
|
|
8227
8261
|
'data-invalid-message': 'Duplicate label'
|
|
@@ -8230,7 +8264,7 @@ require = function () {
|
|
|
8230
8264
|
} else {
|
|
8231
8265
|
labels.add(label);
|
|
8232
8266
|
(0, typed_dom_1.define)(def, {
|
|
8233
|
-
class: void
|
|
8267
|
+
class: void classList.remove('invalid'),
|
|
8234
8268
|
'data-invalid-syntax': null,
|
|
8235
8269
|
'data-invalid-type': null,
|
|
8236
8270
|
'data-invalid-message': null
|
|
@@ -8320,7 +8354,7 @@ require = function () {
|
|
|
8320
8354
|
style !== null && style !== void 0 ? style : style = abbr ? 'abbr' : 'count';
|
|
8321
8355
|
if (style === 'count' ? abbr : !abbr) {
|
|
8322
8356
|
(0, typed_dom_1.define)(ref, {
|
|
8323
|
-
class:
|
|
8357
|
+
class: void ref.classList.add('invalid'),
|
|
8324
8358
|
'data-invalid-syntax': syntax,
|
|
8325
8359
|
'data-invalid-type': 'style',
|
|
8326
8360
|
'data-invalid-message': `${ syntax[0].toUpperCase() + syntax.slice(1) } style must be consistent`
|
|
@@ -9477,6 +9511,7 @@ require = function () {
|
|
|
9477
9511
|
'use strict';
|
|
9478
9512
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9479
9513
|
exports.quote = void 0;
|
|
9514
|
+
const global_1 = _dereq_('spica/global');
|
|
9480
9515
|
const parser_1 = _dereq_('../combinator/data/parser');
|
|
9481
9516
|
const cite_1 = _dereq_('../parser/block/reply/cite');
|
|
9482
9517
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
@@ -9511,7 +9546,7 @@ require = function () {
|
|
|
9511
9546
|
}
|
|
9512
9547
|
for (let es = node.querySelectorAll('br'), i = 0, len = es.length; i < len; ++i) {
|
|
9513
9548
|
const el = es[i];
|
|
9514
|
-
if (anchor && el.nextSibling instanceof Element && el.nextSibling.matches('.cite, .quote')) {
|
|
9549
|
+
if (anchor && el.nextSibling instanceof global_1.Element && el.nextSibling.matches('.cite, .quote')) {
|
|
9515
9550
|
el.replaceWith(`\n>${ el.nextSibling.matches('.quote.invalid') ? ' ' : '' }`);
|
|
9516
9551
|
continue;
|
|
9517
9552
|
}
|
|
@@ -9538,7 +9573,7 @@ require = function () {
|
|
|
9538
9573
|
if ((_a = node.parentElement) === null || _a === void 0 ? void 0 : _a.matches('.cite > .anchor')) {
|
|
9539
9574
|
return void range.setStart(node.parentElement.previousSibling, 0);
|
|
9540
9575
|
}
|
|
9541
|
-
if (node.nodeName === 'BR' && node.nextSibling instanceof Element && node.nextSibling.matches('.cite, .quote')) {
|
|
9576
|
+
if (node.nodeName === 'BR' && node.nextSibling instanceof global_1.Element && node.nextSibling.matches('.cite, .quote')) {
|
|
9542
9577
|
return void range.setStart(node.nextSibling.firstChild, 0);
|
|
9543
9578
|
}
|
|
9544
9579
|
const offset = range.startOffset;
|
|
@@ -9558,6 +9593,7 @@ require = function () {
|
|
|
9558
9593
|
{
|
|
9559
9594
|
'../combinator/data/parser': 47,
|
|
9560
9595
|
'../parser/block/reply/cite': 83,
|
|
9596
|
+
'spica/global': 15,
|
|
9561
9597
|
'typed-dom': 26
|
|
9562
9598
|
}
|
|
9563
9599
|
],
|
package/package-lock.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "securemark",
|
|
3
|
-
"version": "0.237.
|
|
3
|
+
"version": "0.237.1",
|
|
4
4
|
"lockfileVersion": 1,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"dependencies": {
|
|
@@ -8018,15 +8018,15 @@
|
|
|
8018
8018
|
}
|
|
8019
8019
|
},
|
|
8020
8020
|
"npm-check-updates": {
|
|
8021
|
-
"version": "12.5.
|
|
8022
|
-
"resolved": "https://registry.npmjs.org/npm-check-updates/-/npm-check-updates-12.5.
|
|
8023
|
-
"integrity": "sha512-
|
|
8021
|
+
"version": "12.5.7",
|
|
8022
|
+
"resolved": "https://registry.npmjs.org/npm-check-updates/-/npm-check-updates-12.5.7.tgz",
|
|
8023
|
+
"integrity": "sha512-WDkqPBevmgphV1UH3FImsDEpTAq2UFvnMZC3GdXPknE2VL701kfKylnae8IA9ZeYfm/uU0249N9gjMXqA/9y3w==",
|
|
8024
8024
|
"dev": true,
|
|
8025
8025
|
"requires": {
|
|
8026
8026
|
"chalk": "^4.1.2",
|
|
8027
8027
|
"cint": "^8.2.1",
|
|
8028
8028
|
"cli-table": "^0.3.11",
|
|
8029
|
-
"commander": "^9.
|
|
8029
|
+
"commander": "^9.1.0",
|
|
8030
8030
|
"fast-memoize": "^2.5.2",
|
|
8031
8031
|
"find-up": "5.0.0",
|
|
8032
8032
|
"fp-and-or": "^0.1.3",
|
|
@@ -8039,11 +8039,11 @@
|
|
|
8039
8039
|
"lodash": "^4.17.21",
|
|
8040
8040
|
"minimatch": "^5.0.1",
|
|
8041
8041
|
"p-map": "^4.0.0",
|
|
8042
|
-
"pacote": "^13.0.
|
|
8042
|
+
"pacote": "^13.0.5",
|
|
8043
8043
|
"parse-github-url": "^1.0.2",
|
|
8044
8044
|
"progress": "^2.0.3",
|
|
8045
8045
|
"prompts": "^2.4.2",
|
|
8046
|
-
"rc-config-loader": "^4.
|
|
8046
|
+
"rc-config-loader": "^4.1.0",
|
|
8047
8047
|
"remote-git-tags": "^3.0.0",
|
|
8048
8048
|
"rimraf": "^3.0.2",
|
|
8049
8049
|
"semver": "^7.3.5",
|
|
@@ -9124,9 +9124,9 @@
|
|
|
9124
9124
|
}
|
|
9125
9125
|
},
|
|
9126
9126
|
"rc-config-loader": {
|
|
9127
|
-
"version": "4.
|
|
9128
|
-
"resolved": "https://registry.npmjs.org/rc-config-loader/-/rc-config-loader-4.
|
|
9129
|
-
"integrity": "sha512
|
|
9127
|
+
"version": "4.1.0",
|
|
9128
|
+
"resolved": "https://registry.npmjs.org/rc-config-loader/-/rc-config-loader-4.1.0.tgz",
|
|
9129
|
+
"integrity": "sha512-aW+kX4qy0CiM9L4fG4Us3oEOpIrOrXzWykAn+xldD07Y9PXWjTH744oHbv0Kc9ZwWaylw3jMjxaf14RgStrNrA==",
|
|
9130
9130
|
"dev": true,
|
|
9131
9131
|
"requires": {
|
|
9132
9132
|
"debug": "^4.1.1",
|
package/package.json
CHANGED
|
@@ -29,7 +29,7 @@ export const codeblock: CodeBlockParser = block(validate('```', fmap(
|
|
|
29
29
|
class: 'invalid',
|
|
30
30
|
translate: 'no',
|
|
31
31
|
'data-invalid-syntax': 'codeblock',
|
|
32
|
-
'data-invalid-type': !closer ? '
|
|
32
|
+
'data-invalid-type': !closer ? 'fence' : 'argument',
|
|
33
33
|
'data-invalid-message': !closer ? `Missing the closing delimiter "${delim}"` : 'Invalid argument',
|
|
34
34
|
}, `${opener}${body}${closer}`)];
|
|
35
35
|
const file = path.split('/').pop() ?? '';
|
|
@@ -12,7 +12,7 @@ export const aside: ExtensionParser.AsideParser = creator(100, block(validate('~
|
|
|
12
12
|
class: 'invalid',
|
|
13
13
|
translate: 'no',
|
|
14
14
|
'data-invalid-syntax': 'aside',
|
|
15
|
-
'data-invalid-type': !closer ? '
|
|
15
|
+
'data-invalid-type': !closer ? 'fence' : 'argument',
|
|
16
16
|
'data-invalid-message': !closer ? `Missing the closing delimiter "${delim}"` : 'Invalid argument',
|
|
17
17
|
}, `${opener}${body}${closer}`)];
|
|
18
18
|
const annotations = html('ol', { class: 'annotations' });
|
|
@@ -15,7 +15,7 @@ export const example: ExtensionParser.ExampleParser = creator(100, block(validat
|
|
|
15
15
|
class: 'invalid',
|
|
16
16
|
translate: 'no',
|
|
17
17
|
'data-invalid-syntax': 'example',
|
|
18
|
-
'data-invalid-type': !closer ? '
|
|
18
|
+
'data-invalid-type': !closer ? 'fence' : 'argument',
|
|
19
19
|
'data-invalid-message': !closer ? `Missing the closing delimiter "${delim}"` : 'Invalid argument',
|
|
20
20
|
}, `${opener}${body}${closer}`)];
|
|
21
21
|
switch (type) {
|
|
@@ -22,7 +22,7 @@ import { unshift } from 'spica/array';
|
|
|
22
22
|
import FigureParser = ExtensionParser.FigureParser;
|
|
23
23
|
|
|
24
24
|
export const segment: FigureParser.SegmentParser = block(match(
|
|
25
|
-
/^(~{3,})(?:figure[^\S\n]+)?(?=\[?\$[A-Za-z-][^\n]*\n
|
|
25
|
+
/^(~{3,})(?:figure[^\S\n]+)?(?=\[?\$[A-Za-z-][^\n]*\n)/,
|
|
26
26
|
memoize(
|
|
27
27
|
([, fence], closer = new RegExp(String.raw`^${fence}[^\S\n]*(?:$|\n)`)) =>
|
|
28
28
|
close(
|
|
@@ -24,7 +24,7 @@ export const message: MessageParser = block(validate('~~~', fmap(
|
|
|
24
24
|
class: 'invalid',
|
|
25
25
|
translate: 'no',
|
|
26
26
|
'data-invalid-syntax': 'message',
|
|
27
|
-
'data-invalid-type': !closer ? '
|
|
27
|
+
'data-invalid-type': !closer ? 'fence' : 'argument',
|
|
28
28
|
'data-invalid-message': !closer ? `Missing the closing delimiter "${delim}"` : 'Invalid argument',
|
|
29
29
|
}, `${opener}${body}${closer}`)];
|
|
30
30
|
switch (type) {
|
|
@@ -17,7 +17,7 @@ export const placeholder: ExtensionParser.PlaceholderParser = block(validate('~~
|
|
|
17
17
|
class: 'invalid',
|
|
18
18
|
translate: 'no',
|
|
19
19
|
'data-invalid-syntax': 'extension',
|
|
20
|
-
'data-invalid-type': !closer ? '
|
|
20
|
+
'data-invalid-type': !closer ? 'fence' : 'syntax',
|
|
21
21
|
'data-invalid-message': !closer ? `Missing the closing delimiter "${delim}"` : 'Invalid syntax',
|
|
22
22
|
}, `${opener}${body}${closer}`)
|
|
23
23
|
])));
|
|
@@ -31,7 +31,7 @@ export const table: TableParser = block(validate('~~~', recover(fmap(
|
|
|
31
31
|
class: 'invalid',
|
|
32
32
|
translate: 'no',
|
|
33
33
|
'data-invalid-syntax': 'table',
|
|
34
|
-
'data-invalid-type': !closer ? '
|
|
34
|
+
'data-invalid-type': !closer ? 'fence' : 'argument',
|
|
35
35
|
'data-invalid-message': !closer ? `Missing the closing delimiter "${delim}"` : 'Invalid argument',
|
|
36
36
|
}, `${opener}${body}${closer}`)];
|
|
37
37
|
return eval(parser(body, context)) ?? [html('table')];
|
|
@@ -27,7 +27,7 @@ describe('Unit: parser/block/heading', () => {
|
|
|
27
27
|
assert.deepStrictEqual(inspect(parser('# a\nb')), undefined);
|
|
28
28
|
assert.deepStrictEqual(inspect(parser('# *a\nb*')), undefined);
|
|
29
29
|
assert.deepStrictEqual(inspect(parser('# a\n#b')), undefined);
|
|
30
|
-
assert.deepStrictEqual(inspect(parser('####### a')),
|
|
30
|
+
assert.deepStrictEqual(inspect(parser('####### a')), [['<h6 class="invalid" id="index:a">a</h6>'], '']);
|
|
31
31
|
assert.deepStrictEqual(inspect(parser(' # a')), undefined);
|
|
32
32
|
});
|
|
33
33
|
|
|
@@ -4,10 +4,9 @@ import { inline, indexee, indexer } from '../inline';
|
|
|
4
4
|
import { str } from '../source';
|
|
5
5
|
import { visualize } from '../util';
|
|
6
6
|
import { html, defrag } from 'typed-dom';
|
|
7
|
-
import { shift } from 'spica/array';
|
|
8
7
|
|
|
9
8
|
export const segment: HeadingParser.SegmentParser = block(validate('#', focus(
|
|
10
|
-
|
|
9
|
+
/^#+[^\S\n]+\S[^\n]*(?:\n#+(?!\S)[^\n]*)*(?:$|\n)/,
|
|
11
10
|
some(line(source => [[source], ''])))));
|
|
12
11
|
|
|
13
12
|
export const heading: HeadingParser = block(rewrite(segment,
|
|
@@ -30,6 +29,13 @@ export const heading: HeadingParser = block(rewrite(segment,
|
|
|
30
29
|
}}},
|
|
31
30
|
trim(visualize(some(union([indexer, inline]))))), true),
|
|
32
31
|
]),
|
|
33
|
-
(ns: [string, ...(HTMLElement | string)[]]) => [
|
|
34
|
-
|
|
32
|
+
([h, ...ns]: [string, ...(HTMLElement | string)[]]) => [
|
|
33
|
+
h.length <= 6
|
|
34
|
+
? html(`h${h.length as 1}`, defrag(ns))
|
|
35
|
+
: html(`h6`, {
|
|
36
|
+
class: 'invalid',
|
|
37
|
+
'data-invalid-syntax': 'heading',
|
|
38
|
+
'data-invalid-type': 'syntax',
|
|
39
|
+
'data-invalid-message': 'Heading level must be up to 6',
|
|
40
|
+
}, defrag(ns))
|
|
35
41
|
]))))));
|
|
@@ -22,7 +22,7 @@ export const mathblock: MathBlockParser = block(validate('$$', fmap(
|
|
|
22
22
|
class: 'invalid',
|
|
23
23
|
translate: 'no',
|
|
24
24
|
'data-invalid-syntax': 'mathblock',
|
|
25
|
-
'data-invalid-type': delim.length > 2 ? 'syntax' : !closer ? '
|
|
25
|
+
'data-invalid-type': delim.length > 2 ? 'syntax' : !closer ? 'fence' : 'argument',
|
|
26
26
|
'data-invalid-message': delim.length > 2 ? 'Invalid syntax' : !closer ? `Missing the closing delimiter "${delim}"` : 'Invalid argument',
|
|
27
27
|
}, `${opener}${body}${closer}`),
|
|
28
28
|
])));
|
|
@@ -134,6 +134,8 @@ describe('Unit: parser/processor/figure', () => {
|
|
|
134
134
|
'$fig-b\n> ',
|
|
135
135
|
'## 0',
|
|
136
136
|
'$-0.0.0',
|
|
137
|
+
'### 0',
|
|
138
|
+
'$-0.0',
|
|
137
139
|
'$fig-c\n> ',
|
|
138
140
|
'## 0',
|
|
139
141
|
'$-0.1.0',
|
|
@@ -172,15 +174,17 @@ describe('Unit: parser/processor/figure', () => {
|
|
|
172
174
|
'<blockquote><section><h2>0</h2><ol class="annotations"></ol><ol class="references"></ol></section></blockquote>',
|
|
173
175
|
'<figure data-type="quote" data-label="fig-b" data-group="fig" data-number="2.1" id="label:fig-b"><div><blockquote></blockquote></div><figcaption><span class="figindex">Fig. 2.1. </span></figcaption></figure>',
|
|
174
176
|
'<h2 id="index:0">0</h2>',
|
|
175
|
-
'<figure data-label="$-0.0.0" data-group="$"
|
|
177
|
+
'<figure data-label="$-0.0.0" data-group="$" class="invalid" data-invalid-syntax="figure" data-invalid-type="argument" data-invalid-message="Base index must be $-x.0 format"></figure>',
|
|
178
|
+
'<h3 id="index:0">0</h3>',
|
|
179
|
+
'<figure data-label="$-0.0" data-group="$" hidden="" data-number="3.0"></figure>',
|
|
176
180
|
'<figure data-type="quote" data-label="fig-c" data-group="fig" data-number="3.1" id="label:fig-c"><div><blockquote></blockquote></div><figcaption><span class="figindex">Fig. 3.1. </span></figcaption></figure>',
|
|
177
181
|
'<h2 id="index:0">0</h2>',
|
|
178
|
-
'<figure data-label="$-0.1.0" data-group="$"
|
|
182
|
+
'<figure data-label="$-0.1.0" data-group="$" class="invalid" data-invalid-syntax="figure" data-invalid-type="argument" data-invalid-message="Base index must be $-x.0 format"></figure>',
|
|
179
183
|
'<figure data-type="quote" data-label="fig-d" data-group="fig" data-number="4.1" id="label:fig-d"><div><blockquote></blockquote></div><figcaption><span class="figindex">Fig. 4.1. </span></figcaption></figure>',
|
|
180
|
-
'<figure data-label="$-0.0" data-group="$"
|
|
181
|
-
'<figure data-label="$-0.1.0" data-group="$"
|
|
182
|
-
'<figure data-label="$-0.4.0" data-group="$"
|
|
183
|
-
'<figure data-label="$-0.1.0" data-group="$"
|
|
184
|
+
'<figure data-label="$-0.0" data-group="$" class="invalid" data-invalid-syntax="figure" data-invalid-type="position" data-invalid-message="Base index declarations must be after level 1 or 2 headings"></figure>',
|
|
185
|
+
'<figure data-label="$-0.1.0" data-group="$" class="invalid" data-invalid-syntax="figure" data-invalid-type="argument" data-invalid-message="Base index must be $-x.0 format"></figure>',
|
|
186
|
+
'<figure data-label="$-0.4.0" data-group="$" class="invalid" data-invalid-syntax="figure" data-invalid-type="argument" data-invalid-message="Base index must be $-x.0 format"></figure>',
|
|
187
|
+
'<figure data-label="$-0.1.0" data-group="$" class="invalid" data-invalid-syntax="figure" data-invalid-type="argument" data-invalid-message="Base index must be $-x.0 format"></figure>',
|
|
184
188
|
'<h2 id="index:0">0</h2>',
|
|
185
189
|
'<h2 id="index:0">0</h2>',
|
|
186
190
|
'<figure data-label="$-0.0" data-group="$" hidden="" data-number="6.0"></figure>',
|
|
@@ -188,10 +192,10 @@ describe('Unit: parser/processor/figure', () => {
|
|
|
188
192
|
'<h2 id="index:0">0</h2>',
|
|
189
193
|
'<figure data-label="$-5.0" data-group="$" hidden="" data-number="5.0"></figure>',
|
|
190
194
|
'<figure data-type="quote" data-label="fig-f" data-group="fig" data-number="5.1" id="label:fig-f"><div><blockquote></blockquote></div><figcaption><span class="figindex">Fig. 5.1. </span></figcaption></figure>',
|
|
191
|
-
'<figure data-label="$-0" data-group="$"
|
|
195
|
+
'<figure data-label="$-0" data-group="$" class="invalid" data-invalid-syntax="figure" data-invalid-type="argument" data-invalid-message="Invalid base index"></figure>',
|
|
192
196
|
'<figure data-type="quote" data-label="fig-g" data-group="fig" data-number="5.2" id="label:fig-g"><div><blockquote></blockquote></div><figcaption><span class="figindex">Fig. 5.2. </span></figcaption></figure>',
|
|
193
197
|
'<h3 id="index:0">0</h3>',
|
|
194
|
-
'<figure data-label="$-0.0.0" data-group="$"
|
|
198
|
+
'<figure data-label="$-0.0.0" data-group="$" class="invalid" data-invalid-syntax="figure" data-invalid-type="argument" data-invalid-message="Base index must be $-x.0 format"></figure>',
|
|
195
199
|
'<figure data-type="quote" data-label="fig-h" data-group="fig" data-number="5.3" id="label:fig-h"><div><blockquote></blockquote></div><figcaption><span class="figindex">Fig. 5.3. </span></figcaption></figure>',
|
|
196
200
|
'<h3 id="index:0">0</h3>',
|
|
197
201
|
'<figure data-type="quote" data-label="fig-i" data-group="fig" data-number="5.4" id="label:fig-i"><div><blockquote></blockquote></div><figcaption><span class="figindex">Fig. 5.4. </span></figcaption></figure>',
|
|
@@ -201,32 +205,52 @@ describe('Unit: parser/processor/figure', () => {
|
|
|
201
205
|
}
|
|
202
206
|
});
|
|
203
207
|
|
|
204
|
-
it('
|
|
208
|
+
it('concat', () => {
|
|
205
209
|
const target = parse([
|
|
206
|
-
'# 0',
|
|
207
210
|
'$-0.0',
|
|
208
211
|
'## 0',
|
|
212
|
+
'$-0.0',
|
|
213
|
+
'$fig-a\n> ',
|
|
214
|
+
'$-0.0',
|
|
209
215
|
'## 0',
|
|
216
|
+
'$fig-b\n> ',
|
|
217
|
+
'$-0.0',
|
|
218
|
+
'### 0',
|
|
219
|
+
'$fig-c\n> ',
|
|
210
220
|
'$-1.0',
|
|
211
|
-
'$fig-a\n> ',
|
|
212
221
|
'## 0',
|
|
213
222
|
'$-0.0',
|
|
214
|
-
'$fig-
|
|
223
|
+
'$fig-d\n> ',
|
|
224
|
+
'### 0',
|
|
225
|
+
'$-0.0',
|
|
226
|
+
'## 0',
|
|
227
|
+
'$-9.0',
|
|
228
|
+
'$fig-e\n> ',
|
|
215
229
|
].join('\n\n'));
|
|
216
230
|
for (let i = 0; i < 3; ++i) {
|
|
217
231
|
[...figure(target)];
|
|
218
232
|
assert.deepStrictEqual(
|
|
219
233
|
[...target.children].map(el => normalize(el.outerHTML)),
|
|
220
234
|
[
|
|
221
|
-
'<
|
|
222
|
-
'<figure data-label="$-0.0" data-group="$" hidden="" data-number="0.0"></figure>',
|
|
235
|
+
'<figure data-label="$-0.0" data-group="$" class="invalid" data-invalid-syntax="figure" data-invalid-type="position" data-invalid-message="Base index declarations must be after level 1 or 2 headings"></figure>',
|
|
223
236
|
'<h2 id="index:0">0</h2>',
|
|
237
|
+
'<figure data-label="$-0.0" data-group="$" hidden="" data-number="0.0"></figure>',
|
|
238
|
+
'<figure data-type="quote" data-label="fig-a" data-group="fig" data-number="0.1" id="label:fig-a"><div><blockquote></blockquote></div><figcaption><span class="figindex">Fig. 0.1. </span></figcaption></figure>',
|
|
239
|
+
'<figure data-label="$-0.0" data-group="$" class="invalid" data-invalid-syntax="figure" data-invalid-type="position" data-invalid-message="Base index declarations must be after level 1 or 2 headings"></figure>',
|
|
224
240
|
'<h2 id="index:0">0</h2>',
|
|
225
|
-
'<figure data-
|
|
226
|
-
'<figure data-
|
|
241
|
+
'<figure data-type="quote" data-label="fig-b" data-group="fig" data-number="1.1" id="label:fig-b"><div><blockquote></blockquote></div><figcaption><span class="figindex">Fig. 1.1. </span></figcaption></figure>',
|
|
242
|
+
'<figure data-label="$-0.0" data-group="$" class="invalid" data-invalid-syntax="figure" data-invalid-type="position" data-invalid-message="Base index declarations must be after level 1 or 2 headings"></figure>',
|
|
243
|
+
'<h3 id="index:0">0</h3>',
|
|
244
|
+
'<figure data-type="quote" data-label="fig-c" data-group="fig" data-number="1.2" id="label:fig-c"><div><blockquote></blockquote></div><figcaption><span class="figindex">Fig. 1.2. </span></figcaption></figure>',
|
|
245
|
+
'<figure data-label="$-1.0" data-group="$" class="invalid" data-invalid-syntax="figure" data-invalid-type="position" data-invalid-message="Base index declarations must be after level 1 or 2 headings"></figure>',
|
|
227
246
|
'<h2 id="index:0">0</h2>',
|
|
228
247
|
'<figure data-label="$-0.0" data-group="$" hidden="" data-number="2.0"></figure>',
|
|
229
|
-
'<figure data-type="quote" data-label="fig-
|
|
248
|
+
'<figure data-type="quote" data-label="fig-d" data-group="fig" data-number="2.1" id="label:fig-d"><div><blockquote></blockquote></div><figcaption><span class="figindex">Fig. 2.1. </span></figcaption></figure>',
|
|
249
|
+
'<h3 id="index:0">0</h3>',
|
|
250
|
+
'<figure data-label="$-0.0" data-group="$" hidden="" data-number="2.0"></figure>',
|
|
251
|
+
'<h2 id="index:0">0</h2>',
|
|
252
|
+
'<figure data-label="$-9.0" data-group="$" hidden="" data-number="9.0"></figure>',
|
|
253
|
+
'<figure data-type="quote" data-label="fig-e" data-group="fig" data-number="9.1" id="label:fig-e"><div><blockquote></blockquote></div><figcaption><span class="figindex">Fig. 9.1. </span></figcaption></figure>',
|
|
230
254
|
]);
|
|
231
255
|
}
|
|
232
256
|
});
|
|
@@ -22,25 +22,62 @@ export function* figure(
|
|
|
22
22
|
let bases: readonly string[] = base.split('.');
|
|
23
23
|
let index: readonly string[] = bases;
|
|
24
24
|
// Bug: Firefox
|
|
25
|
-
//for (let defs = target.querySelectorAll(':scope > figure[data-label], :scope > h1, :scope > h2
|
|
25
|
+
//for (let defs = target.querySelectorAll(':scope > figure[data-label], :scope > h1, :scope > h2'), i = 0, len = defs.length; i < len; ++i) {
|
|
26
26
|
for (
|
|
27
|
-
let defs = target.querySelectorAll('figure[data-label], h1, h2
|
|
27
|
+
let defs = target.querySelectorAll('figure[data-label], h1, h2'),
|
|
28
28
|
i = 0, len = defs.length; i < len; ++i) {
|
|
29
29
|
yield;
|
|
30
30
|
const def = defs[i];
|
|
31
31
|
if (def.parentNode !== target) continue;
|
|
32
|
-
|
|
32
|
+
const { tagName, classList } = def;
|
|
33
|
+
if (bases.length === 1 && tagName[0] === 'H') continue;
|
|
33
34
|
assert(base === '0' || bases.length > 1);
|
|
34
|
-
const label =
|
|
35
|
+
const label = tagName === 'FIGURE'
|
|
35
36
|
? def.getAttribute('data-label')!
|
|
36
37
|
: `$-${increment(index, def as HTMLHeadingElement)}`;
|
|
37
38
|
if (label.endsWith('-')) continue;
|
|
38
|
-
if (label.endsWith('-0'))
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
if (label.endsWith('-0')) {
|
|
40
|
+
define(def, {
|
|
41
|
+
class: void classList.add('invalid'),
|
|
42
|
+
'data-invalid-syntax': 'figure',
|
|
43
|
+
'data-invalid-type': 'argument',
|
|
44
|
+
'data-invalid-message': 'Invalid base index',
|
|
45
|
+
hidden: null,
|
|
46
|
+
});
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (tagName === 'FIGURE' && label.endsWith('.0')) {
|
|
42
50
|
// $-x.x.0 is disabled.
|
|
43
|
-
if (label.lastIndexOf('.', label.length - 3)
|
|
51
|
+
if (label.lastIndexOf('.', label.length - 3) !== -1) {
|
|
52
|
+
define(def, {
|
|
53
|
+
class: void classList.add('invalid'),
|
|
54
|
+
'data-invalid-syntax': 'figure',
|
|
55
|
+
'data-invalid-type': 'argument',
|
|
56
|
+
'data-invalid-message': 'Base index must be $-x.0 format',
|
|
57
|
+
hidden: null,
|
|
58
|
+
});
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
// $-x.0 after h1-h6.
|
|
62
|
+
if (!/^H[1-6]$/.test(def.previousElementSibling?.tagName ?? '')) {
|
|
63
|
+
define(def, {
|
|
64
|
+
class: void classList.add('invalid'),
|
|
65
|
+
'data-invalid-syntax': 'figure',
|
|
66
|
+
'data-invalid-type': 'position',
|
|
67
|
+
'data-invalid-message': 'Base index declarations must be after level 1 or 2 headings',
|
|
68
|
+
hidden: null,
|
|
69
|
+
});
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
classList.contains('invalid') && define(def, {
|
|
74
|
+
class: void classList.remove('invalid'),
|
|
75
|
+
'data-invalid-syntax': null,
|
|
76
|
+
'data-invalid-type': null,
|
|
77
|
+
'data-invalid-message': null,
|
|
78
|
+
hidden: '',
|
|
79
|
+
});
|
|
80
|
+
}
|
|
44
81
|
}
|
|
45
82
|
const group = label.split('-', 1)[0];
|
|
46
83
|
assert(label && group);
|
|
@@ -53,27 +90,27 @@ export function* figure(
|
|
|
53
90
|
assert(def.matches('figure') || number.endsWith('.0'));
|
|
54
91
|
if (number.endsWith('.0')) {
|
|
55
92
|
assert(isFixed(label));
|
|
56
|
-
|
|
57
|
-
if (group !== '$' ||
|
|
93
|
+
assert(number.split('.').length <= 2);
|
|
94
|
+
if (group !== '$' || tagName === 'FIGURE' && def.firstChild) continue;
|
|
58
95
|
if (number.startsWith('0.')) {
|
|
59
96
|
assert(number.endsWith('.0'));
|
|
60
97
|
number = join(
|
|
61
98
|
index.slice(0)
|
|
62
|
-
.reduce((ns, _, i,
|
|
99
|
+
.reduce((ns, _, i, xs) => {
|
|
63
100
|
i === ns.length
|
|
64
|
-
?
|
|
65
|
-
: ns[i] = +ns[i] > +
|
|
101
|
+
? xs.length = i
|
|
102
|
+
: ns[i] = +ns[i] > +xs[i]
|
|
66
103
|
? ns[i]
|
|
67
104
|
: +ns[i] === 0
|
|
68
|
-
?
|
|
69
|
-
: `${+
|
|
105
|
+
? xs[i]
|
|
106
|
+
: `${+xs[i] + 1}`;
|
|
70
107
|
return ns;
|
|
71
108
|
}, number.split('.')),
|
|
72
109
|
'.');
|
|
73
110
|
}
|
|
74
111
|
base = number;
|
|
75
112
|
bases = index = base.split('.');
|
|
76
|
-
numbers.clear();
|
|
113
|
+
tagName !== 'FIGURE' && numbers.clear();
|
|
77
114
|
assert(def.tagName !== 'FIGURE' || !+def.setAttribute('data-number', number));
|
|
78
115
|
continue;
|
|
79
116
|
}
|
|
@@ -89,11 +126,11 @@ export function* figure(
|
|
|
89
126
|
def.querySelector(':scope > figcaption > .figindex')!,
|
|
90
127
|
group === '$' ? figindex : `${figindex}. `);
|
|
91
128
|
if (labels.has(label)) {
|
|
92
|
-
if (
|
|
129
|
+
if (classList.contains('invalid') &&
|
|
93
130
|
def.getAttribute('data-invalid-message') !== 'Duplicate label') continue;
|
|
94
131
|
define(def, {
|
|
95
132
|
id: null,
|
|
96
|
-
class: void
|
|
133
|
+
class: void classList.add('invalid'),
|
|
97
134
|
'data-invalid-syntax': 'figure',
|
|
98
135
|
'data-invalid-type': 'argument',
|
|
99
136
|
'data-invalid-message': 'Duplicate label',
|
|
@@ -103,7 +140,7 @@ export function* figure(
|
|
|
103
140
|
else {
|
|
104
141
|
labels.add(label);
|
|
105
142
|
define(def, {
|
|
106
|
-
class: void
|
|
143
|
+
class: void classList.remove('invalid'),
|
|
107
144
|
'data-invalid-syntax': null,
|
|
108
145
|
'data-invalid-type': null,
|
|
109
146
|
'data-invalid-message': null,
|
|
@@ -53,7 +53,7 @@ function build(
|
|
|
53
53
|
style ??= abbr ? 'abbr' : 'count';
|
|
54
54
|
if (style === 'count' ? abbr : !abbr) {
|
|
55
55
|
define(ref, {
|
|
56
|
-
class:
|
|
56
|
+
class: void ref.classList.add('invalid'),
|
|
57
57
|
'data-invalid-syntax': syntax,
|
|
58
58
|
'data-invalid-type': 'style',
|
|
59
59
|
'data-invalid-message': `${syntax[0].toUpperCase() + syntax.slice(1)} style must be consistent`,
|
package/src/util/quote.ts
CHANGED