securemark 0.217.0 → 0.218.3
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 +17 -0
- package/dist/securemark.js +166 -143
- package/markdown.d.ts +7 -6
- package/package-lock.json +7 -7
- package/package.json +1 -1
- package/src/parser/api/bind.test.ts +5 -5
- package/src/parser/api/bind.ts +2 -2
- package/src/parser/api/parse.test.ts +18 -0
- package/src/parser/api/parse.ts +2 -2
- package/src/parser/block/blockquote.test.ts +1 -1
- package/src/parser/block/extension/example.test.ts +1 -1
- package/src/parser/block/extension/fig.ts +1 -1
- package/src/parser/block/extension/table.ts +2 -2
- package/src/parser/block/heading.test.ts +10 -12
- package/src/parser/block/ilist.ts +8 -1
- package/src/parser/block/paragraph.test.ts +7 -0
- package/src/parser/function/footnote.test.ts +16 -16
- package/src/parser/function/footnote.ts +1 -1
- package/src/parser/inline/annotation.test.ts +5 -2
- package/src/parser/inline/annotation.ts +4 -5
- package/src/parser/inline/comment.ts +1 -1
- package/src/parser/inline/deletion.test.ts +1 -0
- package/src/parser/inline/deletion.ts +2 -1
- package/src/parser/inline/emphasis.ts +5 -5
- package/src/parser/inline/emstrong.ts +4 -4
- package/src/parser/inline/extension/index.test.ts +25 -7
- package/src/parser/inline/extension/index.ts +17 -14
- package/src/parser/inline/extension/indexee.ts +1 -1
- package/src/parser/inline/extension/indexer.test.ts +2 -0
- package/src/parser/inline/extension/indexer.ts +5 -3
- package/src/parser/inline/extension/placeholder.test.ts +10 -10
- package/src/parser/inline/extension/placeholder.ts +13 -9
- package/src/parser/inline/html.test.ts +2 -1
- package/src/parser/inline/html.ts +16 -22
- package/src/parser/inline/insertion.test.ts +1 -0
- package/src/parser/inline/insertion.ts +2 -1
- package/src/parser/inline/link.test.ts +3 -7
- package/src/parser/inline/link.ts +9 -9
- package/src/parser/inline/mark.test.ts +1 -0
- package/src/parser/inline/mark.ts +2 -2
- package/src/parser/inline/math.ts +2 -2
- package/src/parser/inline/media.test.ts +3 -7
- package/src/parser/inline/media.ts +5 -5
- package/src/parser/inline/reference.test.ts +24 -9
- package/src/parser/inline/reference.ts +9 -9
- package/src/parser/inline/ruby.test.ts +2 -1
- package/src/parser/inline/ruby.ts +12 -10
- package/src/parser/inline/strong.ts +5 -5
- package/src/parser/segment.ts +11 -17
- package/src/parser/source/escapable.ts +1 -0
- package/src/parser/source/str.ts +3 -5
- package/src/parser/source/text.ts +8 -6
- package/src/parser/source/unescapable.ts +1 -0
- package/src/parser/util.ts +85 -60
package/dist/securemark.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.
|
|
1
|
+
/*! securemark v0.218.3 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) {
|
|
@@ -4511,7 +4511,7 @@ require = function () {
|
|
|
4511
4511
|
if (settings.chunk && revision)
|
|
4512
4512
|
throw new Error('Chunks cannot be updated.');
|
|
4513
4513
|
const url = (_b = (_a = (0, header_2.headers)(source).find(field => field.toLowerCase().startsWith('url:'))) === null || _a === void 0 ? void 0 : _a.slice(4).trim()) !== null && _b !== void 0 ? _b : '';
|
|
4514
|
-
source = (0, normalize_1.normalize)((0, segment_1.
|
|
4514
|
+
source = (0, normalize_1.normalize)((0, segment_1.validate)(source, segment_1.MAX_INPUT_SIZE) ? source : source.slice(0, segment_1.MAX_INPUT_SIZE + 1));
|
|
4515
4515
|
context = (0, alias_1.ObjectAssign)(context, { url: url ? new url_1.ReadonlyURL(url) : global_1.undefined });
|
|
4516
4516
|
const rev = revision = Symbol();
|
|
4517
4517
|
const sourceSegments = [];
|
|
@@ -4809,8 +4809,8 @@ require = function () {
|
|
|
4809
4809
|
const inherit2 = (0, memoize_1.memoize)(context => (0, memoize_1.memoize)(_ => (0, alias_1.ObjectCreate)(context)), new WeakMap());
|
|
4810
4810
|
function parse(source, opts = {}, context) {
|
|
4811
4811
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4812
|
-
if (source
|
|
4813
|
-
throw new Error(`Too large input over ${ segment_1.
|
|
4812
|
+
if (!(0, segment_1.validate)(source, segment_1.MAX_SEGMENT_SIZE))
|
|
4813
|
+
throw new Error(`Too large input over ${ segment_1.MAX_SEGMENT_SIZE.toLocaleString('en') } bytes.`);
|
|
4814
4814
|
const url = (_b = (_a = (0, header_2.headers)(source).find(field => field.toLowerCase().startsWith('url:'))) === null || _a === void 0 ? void 0 : _a.slice(4).trim()) !== null && _b !== void 0 ? _b : '';
|
|
4815
4815
|
source = !context ? (0, normalize_1.normalize)(source) : source;
|
|
4816
4816
|
context = context && url === '' && context.id === opts.id ? context : (0, alias_1.ObjectAssign)(context ? url ? inherit2(context)(url) : inherit(context) : {}, opts, {
|
|
@@ -5316,7 +5316,7 @@ require = function () {
|
|
|
5316
5316
|
])
|
|
5317
5317
|
])));
|
|
5318
5318
|
exports.fig = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.convert)(source => {
|
|
5319
|
-
const fence = (/^[^\n]*\n!?>+\s/.test(source) && source.match(/^~{3,}(?=\s*$)/
|
|
5319
|
+
const fence = (/^[^\n]*\n!?>+\s/.test(source) && source.match(/^~{3,}(?=\s*$)/mg) || []).reduce((max, fence) => fence > max ? fence : max, '~~') + '~';
|
|
5320
5320
|
return `${ fence }figure ${ source }\n\n${ fence }`;
|
|
5321
5321
|
}, (0, combinator_1.union)([figure_1.figure]))));
|
|
5322
5322
|
},
|
|
@@ -5632,11 +5632,11 @@ require = function () {
|
|
|
5632
5632
|
const head = (0, combinator_1.creator)((0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/^#(?:(?!:!*[^\S\n]|0)\d*:(?!0)\d*)?!*(?=[^\S\n])/), (0, combinator_1.rewrite)((0, combinator_1.inits)([
|
|
5633
5633
|
source_1.anyline,
|
|
5634
5634
|
(0, combinator_1.some)(source_1.contentline, delimiter)
|
|
5635
|
-
]), (0, util_1.visualize)((0, combinator_1.trim)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline])))
|
|
5635
|
+
]), (0, util_1.visualize)((0, combinator_1.trim)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]))))), true), ns => [(0, typed_dom_1.html)('th', attributes(ns.shift()), (0, typed_dom_1.defrag)(ns))]), false));
|
|
5636
5636
|
const data = (0, combinator_1.creator)((0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/^:(?:(?!:!*[^\S\n]|0)\d*:(?!0)\d*)?!*(?=[^\S\n])/), (0, combinator_1.rewrite)((0, combinator_1.inits)([
|
|
5637
5637
|
source_1.anyline,
|
|
5638
5638
|
(0, combinator_1.some)(source_1.contentline, delimiter)
|
|
5639
|
-
]), (0, util_1.visualize)((0, combinator_1.trim)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline])))
|
|
5639
|
+
]), (0, util_1.visualize)((0, combinator_1.trim)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]))))), true), ns => [(0, typed_dom_1.html)('td', attributes(ns.shift()), (0, typed_dom_1.defrag)(ns))]), false));
|
|
5640
5640
|
const dataline = (0, combinator_1.creator)((0, combinator_1.line)((0, combinator_1.rewrite)(source_1.contentline, (0, combinator_1.union)([
|
|
5641
5641
|
(0, combinator_1.validate)(/^:!*[^\S\n]/, data),
|
|
5642
5642
|
(0, combinator_1.validate)(/^!+[^\S\n]/, (0, combinator_1.convert)(source => `:${ source }`, data)),
|
|
@@ -6529,7 +6529,7 @@ require = function () {
|
|
|
6529
6529
|
def.lastChild.appendChild((0, typed_dom_1.html)('a', {
|
|
6530
6530
|
href: refId && `#${ refId }`,
|
|
6531
6531
|
title: abbr && !blank ? title : global_1.undefined
|
|
6532
|
-
},
|
|
6532
|
+
}, `^${ refIndex }`));
|
|
6533
6533
|
}
|
|
6534
6534
|
if (!footnote)
|
|
6535
6535
|
return;
|
|
@@ -6731,7 +6731,7 @@ require = function () {
|
|
|
6731
6731
|
const inline_1 = _dereq_('../inline');
|
|
6732
6732
|
const util_1 = _dereq_('../util');
|
|
6733
6733
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
6734
|
-
exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('((', '))', '\n', (0, combinator_1.fmap)((0, combinator_1.
|
|
6734
|
+
exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('((', '))', '\n', (0, combinator_1.fmap)((0, combinator_1.surround)('((', (0, combinator_1.guard)(context => {
|
|
6735
6735
|
var _a, _b, _c;
|
|
6736
6736
|
return (_c = (_b = (_a = context.syntax) === null || _a === void 0 ? void 0 : _a.inline) === null || _b === void 0 ? void 0 : _b.annotation) !== null && _c !== void 0 ? _c : true;
|
|
6737
6737
|
}, (0, util_1.startTight)((0, combinator_1.context)({
|
|
@@ -6743,7 +6743,7 @@ require = function () {
|
|
|
6743
6743
|
}
|
|
6744
6744
|
},
|
|
6745
6745
|
state: global_1.undefined
|
|
6746
|
-
}, (0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, ')', /^\\?\n/)])))), '))'),
|
|
6746
|
+
}, (0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, ')', /^\\?\n/)])))), '))'), ns => [(0, typed_dom_1.html)('sup', { class: 'annotation' }, (0, util_1.trimEnd)((0, typed_dom_1.defrag)(ns)))]))));
|
|
6747
6747
|
},
|
|
6748
6748
|
{
|
|
6749
6749
|
'../../combinator': 30,
|
|
@@ -7097,7 +7097,7 @@ require = function () {
|
|
|
7097
7097
|
exports.comment = (0, combinator_1.creator)((0, combinator_1.validate)('[#', '#]', (0, combinator_1.match)(/^\[(#+)\s+((?:\S+\s+)+?)(\1\]|$)/, ([, , title, closer]) => (rest, {resources}) => closer ? [
|
|
7098
7098
|
[(0, typed_dom_1.html)('sup', {
|
|
7099
7099
|
class: 'comment',
|
|
7100
|
-
title: title.trim()
|
|
7100
|
+
title: title.trim().replace(/\x7F.?/gs, '')
|
|
7101
7101
|
})],
|
|
7102
7102
|
rest
|
|
7103
7103
|
] : resources && void (resources.budget -= title.match(/\s+/g).length))));
|
|
@@ -7115,10 +7115,11 @@ require = function () {
|
|
|
7115
7115
|
const combinator_1 = _dereq_('../../combinator');
|
|
7116
7116
|
const inline_1 = _dereq_('../inline');
|
|
7117
7117
|
const source_1 = _dereq_('../source');
|
|
7118
|
+
const util_1 = _dereq_('../util');
|
|
7118
7119
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
7119
7120
|
const array_1 = _dereq_('spica/array');
|
|
7120
7121
|
exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('~~'), (0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, '~~')]), (0, source_1.str)('~~'), false, ([, bs], rest) => [
|
|
7121
|
-
[(0, typed_dom_1.html)('del', (0, typed_dom_1.defrag)(bs))],
|
|
7122
|
+
[(0, typed_dom_1.html)('del', (0, typed_dom_1.defrag)((0, util_1.trimEndBR)(bs)))],
|
|
7122
7123
|
rest
|
|
7123
7124
|
], ([as, bs], rest) => [
|
|
7124
7125
|
(0, array_1.unshift)(as, bs),
|
|
@@ -7129,6 +7130,7 @@ require = function () {
|
|
|
7129
7130
|
'../../combinator': 30,
|
|
7130
7131
|
'../inline': 92,
|
|
7131
7132
|
'../source': 130,
|
|
7133
|
+
'../util': 136,
|
|
7132
7134
|
'spica/array': 6,
|
|
7133
7135
|
'typed-dom': 29
|
|
7134
7136
|
}
|
|
@@ -7145,10 +7147,10 @@ require = function () {
|
|
|
7145
7147
|
const util_1 = _dereq_('../util');
|
|
7146
7148
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
7147
7149
|
const array_1 = _dereq_('spica/array');
|
|
7148
|
-
exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('*',
|
|
7150
|
+
exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, combinator_1.close)((0, source_1.str)('*'), /^(?!\*)/), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([
|
|
7149
7151
|
strong_1.strong,
|
|
7150
7152
|
(0, combinator_1.some)(inline_1.inline, '*')
|
|
7151
|
-
]))), (0, source_1.str)('*'), false, ([as, bs, cs], rest) => (0, util_1.
|
|
7153
|
+
]))), (0, source_1.str)('*'), false, ([as, bs, cs], rest) => (0, util_1.verifyEndTight)(bs) ? [
|
|
7152
7154
|
[(0, typed_dom_1.html)('em', (0, typed_dom_1.defrag)((0, util_1.trimEndBR)(bs)))],
|
|
7153
7155
|
rest
|
|
7154
7156
|
] : [
|
|
@@ -7182,14 +7184,14 @@ require = function () {
|
|
|
7182
7184
|
const array_1 = _dereq_('spica/array');
|
|
7183
7185
|
exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('***'), (0, util_1.startTight)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, '*')])), (0, source_1.str)(/^\*{1,3}/), false, ([as, bs, cs], rest, context) => {
|
|
7184
7186
|
var _a, _b;
|
|
7185
|
-
if (!(0, util_1.
|
|
7187
|
+
if (!(0, util_1.verifyEndTight)(bs))
|
|
7186
7188
|
return [
|
|
7187
7189
|
(0, array_1.unshift)(as, bs),
|
|
7188
7190
|
cs[0] + rest
|
|
7189
7191
|
];
|
|
7190
7192
|
switch (cs[0]) {
|
|
7191
7193
|
case '*':
|
|
7192
|
-
return (_a = (0, combinator_1.bind)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, '**')]), (ds, rest) => rest.slice(0, 2) === '**' && (0, util_1.
|
|
7194
|
+
return (_a = (0, combinator_1.bind)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, '**')]), (ds, rest) => rest.slice(0, 2) === '**' && (0, util_1.verifyEndTight)(ds) ? [
|
|
7193
7195
|
[(0, typed_dom_1.html)('strong', (0, array_1.unshift)([(0, typed_dom_1.html)('em', (0, typed_dom_1.defrag)((0, util_1.trimEndBR)(bs)))], (0, typed_dom_1.defrag)((0, util_1.trimEndBR)(ds))))],
|
|
7194
7196
|
rest.slice(2)
|
|
7195
7197
|
] : [
|
|
@@ -7206,7 +7208,7 @@ require = function () {
|
|
|
7206
7208
|
rest
|
|
7207
7209
|
];
|
|
7208
7210
|
case '**':
|
|
7209
|
-
return (_b = (0, combinator_1.bind)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, '*')]), (ds, rest) => rest.slice(0, 1) === '*' && (0, util_1.
|
|
7211
|
+
return (_b = (0, combinator_1.bind)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, '*')]), (ds, rest) => rest.slice(0, 1) === '*' && (0, util_1.verifyEndTight)(ds) ? [
|
|
7210
7212
|
[(0, typed_dom_1.html)('em', (0, array_1.unshift)([(0, typed_dom_1.html)('strong', (0, typed_dom_1.defrag)((0, util_1.trimEndBR)(bs)))], (0, typed_dom_1.defrag)((0, util_1.trimEndBR)(ds))))],
|
|
7211
7213
|
rest.slice(1)
|
|
7212
7214
|
] : [
|
|
@@ -7312,7 +7314,7 @@ require = function () {
|
|
|
7312
7314
|
const util_1 = _dereq_('../../util');
|
|
7313
7315
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
7314
7316
|
const array_1 = _dereq_('spica/array');
|
|
7315
|
-
exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('[#', ']', '\n', (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.fmap)((0, combinator_1.
|
|
7317
|
+
exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('[#', ']', '\n', (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.fmap)((0, combinator_1.surround)('[#', (0, combinator_1.guard)(context => {
|
|
7316
7318
|
var _a, _b, _c;
|
|
7317
7319
|
return (_c = (_b = (_a = context.syntax) === null || _a === void 0 ? void 0 : _a.inline) === null || _b === void 0 ? void 0 : _b.index) !== null && _c !== void 0 ? _c : true;
|
|
7318
7320
|
}, (0, util_1.startTight)((0, combinator_1.context)({
|
|
@@ -7327,18 +7329,18 @@ require = function () {
|
|
|
7327
7329
|
autolink: false
|
|
7328
7330
|
}
|
|
7329
7331
|
}
|
|
7330
|
-
}, (0, combinator_1.
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
])))), ']'),
|
|
7332
|
+
}, (0, combinator_1.open)((0, source_1.str)(/^\|?/, false), (0, combinator_1.some)((0, combinator_1.union)([
|
|
7333
|
+
signature,
|
|
7334
|
+
inline_1.inline
|
|
7335
|
+
]), ']', /^\\?\n/), true)))), ']'), ns => [(0, typed_dom_1.html)('a', (0, util_1.trimEnd)((0, typed_dom_1.defrag)(ns)))])), ([el]) => [(0, typed_dom_1.define)(el, {
|
|
7334
7336
|
id: el.id ? null : global_1.undefined,
|
|
7335
7337
|
class: 'index',
|
|
7336
7338
|
href: el.id ? `#${ el.id }` : global_1.undefined
|
|
7337
7339
|
}, el.childNodes)]))));
|
|
7338
|
-
const
|
|
7340
|
+
const signature = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.fmap)((0, combinator_1.open)('|#', (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([
|
|
7339
7341
|
bracket,
|
|
7340
7342
|
source_1.txt
|
|
7341
|
-
]), ']', /^\\?\n/))
|
|
7343
|
+
]), ']', /^\\?\n/))), ns => [(0, typed_dom_1.html)('span', {
|
|
7342
7344
|
class: 'indexer',
|
|
7343
7345
|
'data-index': (0, indexee_1.identify)((0, array_1.join)(ns).trim()).slice(6)
|
|
7344
7346
|
})])));
|
|
@@ -7424,7 +7426,7 @@ require = function () {
|
|
|
7424
7426
|
const combinator_1 = _dereq_('../../../combinator');
|
|
7425
7427
|
const index_1 = _dereq_('./index');
|
|
7426
7428
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
7427
|
-
exports.indexer = (0, combinator_1.creator)((0, combinator_1.fmap)((0, combinator_1.
|
|
7429
|
+
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)([index_1.index])), /^\s*$/), ([el]) => el.getElementsByClassName('invalid').length === 0), ([el]) => [(0, typed_dom_1.html)('span', {
|
|
7428
7430
|
class: 'indexer',
|
|
7429
7431
|
'data-index': el.getAttribute('href').slice(7)
|
|
7430
7432
|
})]));
|
|
@@ -7507,13 +7509,13 @@ require = function () {
|
|
|
7507
7509
|
exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)([
|
|
7508
7510
|
'[:',
|
|
7509
7511
|
'[^'
|
|
7510
|
-
], ']', (0, combinator_1.surround)((0, source_1.str)(/^\[[:^]/), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']')), (0, source_1.str)(']'), false, ([
|
|
7511
|
-
|
|
7512
|
+
], ']', '\n', (0, combinator_1.surround)((0, source_1.str)(/^\[[:^]/), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']')), (0, source_1.str)(']'), false, ([, bs], rest) => [
|
|
7513
|
+
[(0, typed_dom_1.html)('span', {
|
|
7512
7514
|
class: 'invalid',
|
|
7513
7515
|
'data-invalid-syntax': 'extension',
|
|
7514
7516
|
'data-invalid-type': 'syntax',
|
|
7515
7517
|
'data-invalid-description': 'Invalid symbol.'
|
|
7516
|
-
}, (0, typed_dom_1.defrag)(
|
|
7518
|
+
}, (0, typed_dom_1.defrag)(bs))],
|
|
7517
7519
|
rest
|
|
7518
7520
|
], ([as, bs], rest) => [
|
|
7519
7521
|
(0, array_1.unshift)(as, bs),
|
|
@@ -7561,12 +7563,12 @@ require = function () {
|
|
|
7561
7563
|
};
|
|
7562
7564
|
(0, alias_1.ObjectSetPrototypeOf)(attrspec, null);
|
|
7563
7565
|
(0, alias_1.ObjectValues)(attrspec).forEach(o => (0, alias_1.ObjectSetPrototypeOf)(o, null));
|
|
7564
|
-
exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('<', '>', '\n', (0, combinator_1.validate)(/^<[a-z]+[
|
|
7565
|
-
(0, combinator_1.match)(/^(?=<(wbr)(?=[
|
|
7566
|
+
exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('<', '>', '\n', (0, combinator_1.validate)(/^<[a-z]+(?=[^\S\n]|>)/, (0, combinator_1.union)([
|
|
7567
|
+
(0, combinator_1.match)(/^(?=<(wbr)(?=[^\S\n]|>))/, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, source_1.str)(`<${ tag }`), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, source_1.str)('>'), true, ([, as = []], rest) => [
|
|
7566
7568
|
[(0, typed_dom_1.html)(tag, attributes('html', [], attrspec[tag], as))],
|
|
7567
7569
|
rest
|
|
7568
7570
|
]), ([, tag]) => tag)),
|
|
7569
|
-
(0, combinator_1.match)(/^(?=<(sup|sub|small|bdo|bdi)(?=[
|
|
7571
|
+
(0, combinator_1.match)(/^(?=<(sup|sub|small|bdo|bdi)(?=[^\S\n]|>))/, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.validate)(`<${ tag }`, `</${ tag }>`, (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${ tag }`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)('>'), true), (0, util_1.startTight)((0, combinator_1.context)((() => {
|
|
7570
7572
|
switch (tag) {
|
|
7571
7573
|
case 'sup':
|
|
7572
7574
|
case 'sub':
|
|
@@ -7588,22 +7590,19 @@ require = function () {
|
|
|
7588
7590
|
default:
|
|
7589
7591
|
return {};
|
|
7590
7592
|
}
|
|
7591
|
-
})(), (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), `</${ tag }>`))
|
|
7592
|
-
[elem(tag, as, (0, util_1.trimEndBR)(bs), cs, context)],
|
|
7593
|
+
})(), (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), `</${ tag }>`))), (0, source_1.str)(`</${ tag }>`), false, ([as, bs, cs], rest, context) => [
|
|
7594
|
+
[elem(tag, as, (0, util_1.trimEndBR)((0, typed_dom_1.defrag)(bs)), cs, context)],
|
|
7593
7595
|
rest
|
|
7594
7596
|
])), ([, tag]) => tag)),
|
|
7595
|
-
(0, combinator_1.match)(/^(?=<([a-z]+)(?=[
|
|
7596
|
-
[elem(tag, as, (0, util_1.trimEndBR)(bs), cs, {})],
|
|
7597
|
+
(0, combinator_1.match)(/^(?=<([a-z]+)(?=[^\S\n]|>))/, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.validate)(`<${ tag }`, `</${ tag }>`, (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${ tag }`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)('>'), true), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), `</${ tag }>`)), (0, source_1.str)(`</${ tag }>`), false, ([as, bs, cs], rest) => [
|
|
7598
|
+
[elem(tag, as, (0, util_1.trimEndBR)((0, typed_dom_1.defrag)(bs)), cs, {})],
|
|
7597
7599
|
rest
|
|
7598
|
-
]
|
|
7599
|
-
(0, array_1.push)((0, array_1.unshift)(as, bs), cs),
|
|
7600
|
-
rest
|
|
7601
|
-
] : global_1.undefined, ([as, bs], rest) => as.length === 1 ? [
|
|
7600
|
+
], ([as, bs], rest) => as.length === 1 ? [
|
|
7602
7601
|
(0, array_1.unshift)(as, bs),
|
|
7603
7602
|
rest
|
|
7604
7603
|
] : global_1.undefined)), ([, tag]) => tag, new cache_1.Cache(1000)))
|
|
7605
7604
|
])))));
|
|
7606
|
-
exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/^
|
|
7605
|
+
exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\n"])*")?(?=[^\S\n]|>)/)]);
|
|
7607
7606
|
function elem(tag, as, bs, cs, context) {
|
|
7608
7607
|
var _a, _b, _c, _d, _e, _f;
|
|
7609
7608
|
if (!tags.includes(tag))
|
|
@@ -7613,14 +7612,14 @@ require = function () {
|
|
|
7613
7612
|
case 'sub':
|
|
7614
7613
|
switch (true) {
|
|
7615
7614
|
case (_b = (_a = context.state) === null || _a === void 0 ? void 0 : _a.in) === null || _b === void 0 ? void 0 : _b.supsub:
|
|
7616
|
-
return invalid('nest', `<${ tag }> HTML tag
|
|
7615
|
+
return invalid('nest', `<${ tag }> HTML tag cannot be used in <sup>/<sub> HTML tags.`, as, bs, cs);
|
|
7617
7616
|
}
|
|
7618
7617
|
break;
|
|
7619
7618
|
case 'small':
|
|
7620
7619
|
switch (true) {
|
|
7621
7620
|
case (_d = (_c = context.state) === null || _c === void 0 ? void 0 : _c.in) === null || _d === void 0 ? void 0 : _d.supsub:
|
|
7622
7621
|
case (_f = (_e = context.state) === null || _e === void 0 ? void 0 : _e.in) === null || _f === void 0 ? void 0 : _f.small:
|
|
7623
|
-
return invalid('nest', `<${ tag }> HTML tag
|
|
7622
|
+
return invalid('nest', `<${ tag }> HTML tag cannot be used in <sup>/<sub>/<small> HTML tags.`, as, bs, cs);
|
|
7624
7623
|
}
|
|
7625
7624
|
break;
|
|
7626
7625
|
}
|
|
@@ -7631,7 +7630,7 @@ require = function () {
|
|
|
7631
7630
|
case cs.length === 0:
|
|
7632
7631
|
return invalid('closer', `Missing the closing HTML tag <${ tag }>.`, as, bs, cs);
|
|
7633
7632
|
default:
|
|
7634
|
-
return (0, typed_dom_1.html)(tag, attrs,
|
|
7633
|
+
return (0, typed_dom_1.html)(tag, attrs, bs);
|
|
7635
7634
|
}
|
|
7636
7635
|
}
|
|
7637
7636
|
function invalid(type, description, as, bs, cs) {
|
|
@@ -7648,7 +7647,7 @@ require = function () {
|
|
|
7648
7647
|
let invalid = false;
|
|
7649
7648
|
const attrs = {};
|
|
7650
7649
|
for (let i = 0; i < params.length; ++i) {
|
|
7651
|
-
const param = params[i].
|
|
7650
|
+
const param = params[i].trim();
|
|
7652
7651
|
const name = param.split('=', 1)[0];
|
|
7653
7652
|
const value = param !== name ? param.slice(name.length + 2, -1).replace(/\\(.?)/g, '$1') : global_1.undefined;
|
|
7654
7653
|
invalid || (invalid = !spec || name in attrs);
|
|
@@ -7708,10 +7707,11 @@ require = function () {
|
|
|
7708
7707
|
const combinator_1 = _dereq_('../../combinator');
|
|
7709
7708
|
const inline_1 = _dereq_('../inline');
|
|
7710
7709
|
const source_1 = _dereq_('../source');
|
|
7710
|
+
const util_1 = _dereq_('../util');
|
|
7711
7711
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
7712
7712
|
const array_1 = _dereq_('spica/array');
|
|
7713
7713
|
exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('++'), (0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, '++')]), (0, source_1.str)('++'), false, ([, bs], rest) => [
|
|
7714
|
-
[(0, typed_dom_1.html)('ins', (0, typed_dom_1.defrag)(bs))],
|
|
7714
|
+
[(0, typed_dom_1.html)('ins', (0, typed_dom_1.defrag)((0, util_1.trimEndBR)(bs)))],
|
|
7715
7715
|
rest
|
|
7716
7716
|
], ([as, bs], rest) => [
|
|
7717
7717
|
(0, array_1.unshift)(as, bs),
|
|
@@ -7722,6 +7722,7 @@ require = function () {
|
|
|
7722
7722
|
'../../combinator': 30,
|
|
7723
7723
|
'../inline': 92,
|
|
7724
7724
|
'../source': 130,
|
|
7725
|
+
'../util': 136,
|
|
7725
7726
|
'spica/array': 6,
|
|
7726
7727
|
'typed-dom': 29
|
|
7727
7728
|
}
|
|
@@ -7744,7 +7745,7 @@ require = function () {
|
|
|
7744
7745
|
const url_1 = _dereq_('spica/url');
|
|
7745
7746
|
const optspec = { rel: ['nofollow'] };
|
|
7746
7747
|
(0, alias_1.ObjectSetPrototypeOf)(optspec, null);
|
|
7747
|
-
exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.creator)(10, (0, combinator_1.bind)((0, combinator_1.
|
|
7748
|
+
exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.creator)(10, (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.validate)([
|
|
7748
7749
|
'[',
|
|
7749
7750
|
'{'
|
|
7750
7751
|
], '}', '\n', (0, combinator_1.guard)(context => {
|
|
@@ -7770,8 +7771,8 @@ require = function () {
|
|
|
7770
7771
|
(0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([
|
|
7771
7772
|
exports.uri,
|
|
7772
7773
|
(0, combinator_1.some)(exports.option)
|
|
7773
|
-
]), /^
|
|
7774
|
-
])))), ([
|
|
7774
|
+
]), /^[^\S\n]?}/))
|
|
7775
|
+
])))), ([params, content = []], rest, context) => {
|
|
7775
7776
|
var _a, _b;
|
|
7776
7777
|
if ((0, parser_1.eval)((0, combinator_1.some)(autolink_1.autolink)((0, util_1.stringify)(content), context), []).some(node => typeof node === 'object'))
|
|
7777
7778
|
return;
|
|
@@ -7788,13 +7789,14 @@ require = function () {
|
|
|
7788
7789
|
];
|
|
7789
7790
|
})));
|
|
7790
7791
|
exports.uri = (0, combinator_1.union)([
|
|
7791
|
-
(0, combinator_1.open)(
|
|
7792
|
+
(0, combinator_1.open)(/^[^\S\n]/, (0, source_1.str)(/^\S+/)),
|
|
7792
7793
|
(0, source_1.str)(/^[^\s{}]+/)
|
|
7793
7794
|
]);
|
|
7794
7795
|
exports.option = (0, combinator_1.union)([
|
|
7795
|
-
(0, combinator_1.fmap)((0, source_1.str)(/^
|
|
7796
|
-
(0, source_1.str)(/^
|
|
7797
|
-
(0, combinator_1.fmap)((0, source_1.str)(/^
|
|
7796
|
+
(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+nofollow(?=[^\S\n]|})/), () => [` rel="nofollow"`]),
|
|
7797
|
+
(0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\n"])*")?(?=[^\S\n]|})/),
|
|
7798
|
+
(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+(?=})/), () => []),
|
|
7799
|
+
(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[^\n{}]+/), opt => [` \\${ opt.slice(1) }`])
|
|
7798
7800
|
]);
|
|
7799
7801
|
function resolve(uri, host, source) {
|
|
7800
7802
|
var _a;
|
|
@@ -7879,7 +7881,7 @@ require = function () {
|
|
|
7879
7881
|
const util_1 = _dereq_('../util');
|
|
7880
7882
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
7881
7883
|
const array_1 = _dereq_('spica/array');
|
|
7882
|
-
exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('=='), (0, util_1.startTight)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, '==')])), (0, source_1.str)('=='), false, ([as, bs, cs], rest) => (0, util_1.
|
|
7884
|
+
exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('=='), (0, util_1.startTight)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, '==')])), (0, source_1.str)('=='), false, ([as, bs, cs], rest) => (0, util_1.verifyEndTight)(bs) ? [
|
|
7883
7885
|
[(0, typed_dom_1.html)('mark', (0, typed_dom_1.defrag)((0, util_1.trimEndBR)(bs)))],
|
|
7884
7886
|
rest
|
|
7885
7887
|
] : [
|
|
@@ -7911,7 +7913,7 @@ require = function () {
|
|
|
7911
7913
|
const disallowedCommand = /\\(?:begin|tiny|huge|large)(?![0-9a-z])/i;
|
|
7912
7914
|
exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('$', '$', '\n', (0, combinator_1.rewrite)((0, combinator_1.union)([
|
|
7913
7915
|
(0, combinator_1.surround)('$', bracket, '$'),
|
|
7914
|
-
(0, combinator_1.surround)('$', (0, combinator_1.verify)((0, source_1.str)(/^(?=[\\^_[(|]|[A-Za-z][0-9A-Za-z]*'*[ ~]?(?:\$|([\\^_(|:=<>])(?!\1)))(?:\\\$|[\x20-\x23\x25-\x7E])*/), util_1.
|
|
7916
|
+
(0, combinator_1.surround)('$', (0, combinator_1.verify)((0, source_1.str)(/^(?=[\\^_[(|]|[A-Za-z][0-9A-Za-z]*'*[ ~]?(?:\$|([\\^_(|:=<>])(?!\1)))(?:\\\$|[\x20-\x23\x25-\x7E])*/), util_1.verifyEndTight), /^\$(?![0-9A-Za-z])/)
|
|
7915
7917
|
]), (source, {
|
|
7916
7918
|
caches: {math: cache} = {}
|
|
7917
7919
|
}) => {
|
|
@@ -7981,14 +7983,14 @@ require = function () {
|
|
|
7981
7983
|
(0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([
|
|
7982
7984
|
link_1.uri,
|
|
7983
7985
|
(0, combinator_1.some)(option)
|
|
7984
|
-
]), /^
|
|
7986
|
+
]), /^[^\S\n]?}/))
|
|
7985
7987
|
])))), ([as, bs]) => bs ? [
|
|
7986
7988
|
[(0, array_1.join)(as)],
|
|
7987
7989
|
bs
|
|
7988
7990
|
] : [
|
|
7989
7991
|
[''],
|
|
7990
7992
|
as
|
|
7991
|
-
]), ([[text]]) => (0, util_1.
|
|
7993
|
+
]), ([[text]]) => (0, util_1.verifyStartTight)([text || '-'])), ([[text], params], rest, context) => {
|
|
7992
7994
|
var _a, _b, _c, _d;
|
|
7993
7995
|
const INSECURE_URI = params.shift();
|
|
7994
7996
|
const url = new url_1.ReadonlyURL((0, link_1.resolve)(INSECURE_URI, context.host || global_1.location, context.url || global_1.location), ((_a = context.host) === null || _a === void 0 ? void 0 : _a.href) || global_1.location.href);
|
|
@@ -8044,11 +8046,11 @@ require = function () {
|
|
|
8044
8046
|
]), '"'), (0, source_1.str)('"'), true)
|
|
8045
8047
|
]));
|
|
8046
8048
|
const option = (0, combinator_1.union)([
|
|
8047
|
-
(0, combinator_1.fmap)((0, source_1.str)(/^
|
|
8049
|
+
(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[1-9][0-9]*x[1-9][0-9]*(?=[^\S\n]|})/), ([opt]) => [
|
|
8048
8050
|
` width="${ opt.slice(1).split('x')[0] }"`,
|
|
8049
8051
|
` height="${ opt.slice(1).split('x')[1] }"`
|
|
8050
8052
|
]),
|
|
8051
|
-
(0, combinator_1.fmap)((0, source_1.str)(/^
|
|
8053
|
+
(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[1-9][0-9]*:[1-9][0-9]*(?=[^\S\n]|})/), ([opt]) => [` aspect-ratio="${ opt.slice(1).split(':').join('/') }"`]),
|
|
8052
8054
|
link_1.option
|
|
8053
8055
|
]);
|
|
8054
8056
|
function sanitize(uri, target) {
|
|
@@ -8091,7 +8093,7 @@ require = function () {
|
|
|
8091
8093
|
const source_1 = _dereq_('../source');
|
|
8092
8094
|
const util_1 = _dereq_('../util');
|
|
8093
8095
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
8094
|
-
exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('[[', ']]', '\n', (0, combinator_1.fmap)((0, combinator_1.
|
|
8096
|
+
exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('[[', ']]', '\n', (0, combinator_1.fmap)((0, combinator_1.surround)('[[', (0, combinator_1.guard)(context => {
|
|
8095
8097
|
var _a, _b, _c;
|
|
8096
8098
|
return (_c = (_b = (_a = context.syntax) === null || _a === void 0 ? void 0 : _a.inline) === null || _b === void 0 ? void 0 : _b.reference) !== null && _c !== void 0 ? _c : true;
|
|
8097
8099
|
}, (0, util_1.startTight)((0, combinator_1.context)({
|
|
@@ -8112,13 +8114,13 @@ require = function () {
|
|
|
8112
8114
|
],
|
|
8113
8115
|
''
|
|
8114
8116
|
]),
|
|
8115
|
-
(0,
|
|
8116
|
-
])))), ']]'),
|
|
8117
|
-
const abbr = (0, combinator_1.creator)((0, combinator_1.fmap)((0, combinator_1.surround)('^', (0, combinator_1.union)([(0, source_1.str)(/^(?![0-9]+\s?[|\]])[0-9A-Za-z]+(?:(
|
|
8117
|
+
(0, combinator_1.some)(inline_1.inline, ']', /^\\?\n/)
|
|
8118
|
+
])))), ']]'), ns => [(0, typed_dom_1.html)('sup', attributes(ns), (0, util_1.trimEnd)((0, typed_dom_1.defrag)(ns)))]))));
|
|
8119
|
+
const abbr = (0, combinator_1.creator)((0, combinator_1.fmap)((0, combinator_1.verify)((0, combinator_1.surround)('^', (0, combinator_1.union)([(0, source_1.str)(/^(?![0-9]+\s?[|\]])[0-9A-Za-z]+(?:(?:-|(?=\W)(?!'\d)'?(?!\.\d)\.?(?!,\S),? ?)[0-9A-Za-z]+)*(?:-|'?\.?,? ?)?/)]), /^\|?(?=]])|^\|[^\S\n]+/), (_, rest, context) => (0, util_1.isStartTight)(rest, context)), ([source]) => [(0, typed_dom_1.html)('abbr', source)]));
|
|
8118
8120
|
function attributes(ns) {
|
|
8119
8121
|
return typeof ns[0] === 'object' && ns[0].tagName === 'ABBR' ? {
|
|
8120
8122
|
class: 'reference',
|
|
8121
|
-
'data-abbr': (0, util_1.stringify)([ns.shift()])
|
|
8123
|
+
'data-abbr': (0, util_1.stringify)([ns.shift()]).trimEnd()
|
|
8122
8124
|
} : ns[0] === '' ? {
|
|
8123
8125
|
class: 'reference invalid',
|
|
8124
8126
|
'data-invalid-syntax': 'reference',
|
|
@@ -8152,34 +8154,35 @@ require = function () {
|
|
|
8152
8154
|
exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.validate)('[', ')', '\n', (0, combinator_1.sequence)([
|
|
8153
8155
|
(0, combinator_1.surround)('[', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\[\]\n])+(?=]\()/, text), ']'),
|
|
8154
8156
|
(0, combinator_1.surround)('(', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\(\)\n])+(?=\))/, text), ')')
|
|
8155
|
-
])), ([texts]) => (0, util_1.
|
|
8156
|
-
texts[texts.length - 1]
|
|
8157
|
+
])), ([texts]) => (0, util_1.verifyStartTight)(texts)), ([texts, rubies], rest) => {
|
|
8158
|
+
const tail = typeof texts[texts.length - 1] === 'object' ? [texts.pop()] : [];
|
|
8159
|
+
tail.length === 0 && texts[texts.length - 1] === '' && texts.pop();
|
|
8157
8160
|
switch (true) {
|
|
8158
8161
|
case rubies.length <= texts.length:
|
|
8159
8162
|
return [
|
|
8160
|
-
[(0, typed_dom_1.html)('ruby', (0, typed_dom_1.defrag)(texts.reduce((acc, _, i) => (0, array_1.push)(acc, (0, array_1.unshift)([texts[i]], i < rubies.length && rubies[i] ? [
|
|
8163
|
+
[(0, typed_dom_1.html)('ruby', (0, typed_dom_1.defrag)((0, array_1.push)(texts.reduce((acc, _, i) => (0, array_1.push)(acc, (0, array_1.unshift)([texts[i]], i < rubies.length && rubies[i] ? [
|
|
8161
8164
|
(0, typed_dom_1.html)('rp', '('),
|
|
8162
8165
|
(0, typed_dom_1.html)('rt', rubies[i]),
|
|
8163
8166
|
(0, typed_dom_1.html)('rp', ')')
|
|
8164
|
-
] : [(0, typed_dom_1.html)('rt')])), [])))],
|
|
8167
|
+
] : [(0, typed_dom_1.html)('rt')])), []), tail)))],
|
|
8165
8168
|
rest
|
|
8166
8169
|
];
|
|
8167
8170
|
case texts.length === 1 && [...texts[0]].length >= rubies.length:
|
|
8168
8171
|
return [
|
|
8169
|
-
[(0, typed_dom_1.html)('ruby', (0, typed_dom_1.defrag)([...texts[0]].reduce((acc, _, i, texts) => (0, array_1.push)(acc, (0, array_1.unshift)([texts[i]], i < rubies.length && rubies[i] ? [
|
|
8172
|
+
[(0, typed_dom_1.html)('ruby', (0, typed_dom_1.defrag)((0, array_1.push)([...texts[0]].reduce((acc, _, i, texts) => (0, array_1.push)(acc, (0, array_1.unshift)([texts[i]], i < rubies.length && rubies[i] ? [
|
|
8170
8173
|
(0, typed_dom_1.html)('rp', '('),
|
|
8171
8174
|
(0, typed_dom_1.html)('rt', rubies[i]),
|
|
8172
8175
|
(0, typed_dom_1.html)('rp', ')')
|
|
8173
|
-
] : [(0, typed_dom_1.html)('rt')])), [])))],
|
|
8176
|
+
] : [(0, typed_dom_1.html)('rt')])), []), tail)))],
|
|
8174
8177
|
rest
|
|
8175
8178
|
];
|
|
8176
8179
|
default:
|
|
8177
8180
|
return [
|
|
8178
|
-
[(0, typed_dom_1.html)('ruby', (0, typed_dom_1.defrag)((0, array_1.unshift)([(0, array_1.join)(texts, ' ')], [
|
|
8181
|
+
[(0, typed_dom_1.html)('ruby', (0, typed_dom_1.defrag)((0, array_1.push)((0, array_1.unshift)([(0, array_1.join)(texts, ' ')], [
|
|
8179
8182
|
(0, typed_dom_1.html)('rp', '('),
|
|
8180
8183
|
(0, typed_dom_1.html)('rt', (0, array_1.join)(rubies, ' ').trim()),
|
|
8181
8184
|
(0, typed_dom_1.html)('rp', ')')
|
|
8182
|
-
])))],
|
|
8185
|
+
]), tail)))],
|
|
8183
8186
|
rest
|
|
8184
8187
|
];
|
|
8185
8188
|
}
|
|
@@ -8256,11 +8259,11 @@ require = function () {
|
|
|
8256
8259
|
const util_1 = _dereq_('../util');
|
|
8257
8260
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
8258
8261
|
const array_1 = _dereq_('spica/array');
|
|
8259
|
-
exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('**',
|
|
8262
|
+
exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, combinator_1.close)((0, source_1.str)('**'), /^(?!\*)/), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([
|
|
8260
8263
|
emphasis_1.emphasis,
|
|
8261
8264
|
(0, combinator_1.some)(inline_1.inline, '*'),
|
|
8262
8265
|
(0, source_1.str)('*')
|
|
8263
|
-
]), '**')), (0, source_1.str)('**'), false, ([as, bs, cs], rest) => (0, util_1.
|
|
8266
|
+
]), '**')), (0, source_1.str)('**'), false, ([as, bs, cs], rest) => (0, util_1.verifyEndTight)(bs) ? [
|
|
8264
8267
|
[(0, typed_dom_1.html)('strong', (0, typed_dom_1.defrag)((0, util_1.trimEndBR)(bs)))],
|
|
8265
8268
|
rest
|
|
8266
8269
|
] : [
|
|
@@ -8427,7 +8430,7 @@ require = function () {
|
|
|
8427
8430
|
function (_dereq_, module, exports) {
|
|
8428
8431
|
'use strict';
|
|
8429
8432
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
8430
|
-
exports.
|
|
8433
|
+
exports.validate = exports.segment = exports.MAX_INPUT_SIZE = exports.MAX_SEGMENT_SIZE = void 0;
|
|
8431
8434
|
const global_1 = _dereq_('spica/global');
|
|
8432
8435
|
const parser_1 = _dereq_('../combinator/data/parser');
|
|
8433
8436
|
const combinator_1 = _dereq_('../combinator');
|
|
@@ -8436,38 +8439,35 @@ require = function () {
|
|
|
8436
8439
|
const mathblock_1 = _dereq_('./block/mathblock');
|
|
8437
8440
|
const extension_1 = _dereq_('./block/extension');
|
|
8438
8441
|
const source_1 = _dereq_('./source');
|
|
8439
|
-
|
|
8440
|
-
exports.
|
|
8442
|
+
exports.MAX_SEGMENT_SIZE = 100000;
|
|
8443
|
+
exports.MAX_INPUT_SIZE = exports.MAX_SEGMENT_SIZE * 10;
|
|
8441
8444
|
const parser = (0, combinator_1.union)([
|
|
8442
8445
|
heading_1.segment,
|
|
8443
8446
|
codeblock_1.segment,
|
|
8444
8447
|
mathblock_1.segment,
|
|
8445
8448
|
extension_1.segment,
|
|
8446
|
-
(0, combinator_1.some)(source_1.contentline, exports.
|
|
8447
|
-
(0, combinator_1.some)(source_1.emptyline, exports.
|
|
8449
|
+
(0, combinator_1.some)(source_1.contentline, exports.MAX_SEGMENT_SIZE * 2),
|
|
8450
|
+
(0, combinator_1.some)(source_1.emptyline, exports.MAX_SEGMENT_SIZE * 2)
|
|
8448
8451
|
]);
|
|
8449
8452
|
function* segment(source) {
|
|
8450
|
-
if (!validate(source))
|
|
8451
|
-
return yield `\0Too large input over ${
|
|
8453
|
+
if (!validate(source, exports.MAX_INPUT_SIZE))
|
|
8454
|
+
return yield `\0Too large input over ${ exports.MAX_INPUT_SIZE.toLocaleString('en') } bytes.\n${ source.slice(0, 1001) }`;
|
|
8452
8455
|
while (source !== '') {
|
|
8453
8456
|
const result = parser(source, {});
|
|
8454
8457
|
const rest = (0, parser_1.exec)(result);
|
|
8455
8458
|
const segs = (0, parser_1.eval)(result).length ? (0, parser_1.eval)(result) : [source.slice(0, source.length - rest.length)];
|
|
8456
8459
|
for (let i = 0; i < segs.length; ++i) {
|
|
8457
8460
|
const seg = segs[i];
|
|
8458
|
-
|
|
8461
|
+
validate(source, exports.MAX_SEGMENT_SIZE) ? yield seg : yield `\0Too large segment over ${ exports.MAX_SEGMENT_SIZE.toLocaleString('en') } bytes.\n${ seg }`;
|
|
8459
8462
|
}
|
|
8460
8463
|
source = rest;
|
|
8461
8464
|
}
|
|
8462
8465
|
}
|
|
8463
8466
|
exports.segment = segment;
|
|
8464
|
-
function validate(source) {
|
|
8465
|
-
return source.length <=
|
|
8466
|
-
}
|
|
8467
|
-
function prepare(source) {
|
|
8468
|
-
return validate(source) ? source : source.slice(0, INPUT_SIZE_LIMIT + 1);
|
|
8467
|
+
function validate(source, size) {
|
|
8468
|
+
return source.length <= size / 2 || source.length <= size && new global_1.Blob([source]).size <= size;
|
|
8469
8469
|
}
|
|
8470
|
-
exports.
|
|
8470
|
+
exports.validate = validate;
|
|
8471
8471
|
},
|
|
8472
8472
|
{
|
|
8473
8473
|
'../combinator': 30,
|
|
@@ -8625,11 +8625,11 @@ require = function () {
|
|
|
8625
8625
|
exports.str = void 0;
|
|
8626
8626
|
const global_1 = _dereq_('spica/global');
|
|
8627
8627
|
const combinator_1 = _dereq_('../../combinator');
|
|
8628
|
-
function str(pattern,
|
|
8628
|
+
function str(pattern, mustConsume = true) {
|
|
8629
8629
|
return typeof pattern === 'string' ? (0, combinator_1.creator)(source => {
|
|
8630
8630
|
if (source === '')
|
|
8631
8631
|
return;
|
|
8632
|
-
return source.slice(0, pattern.length) === pattern
|
|
8632
|
+
return source.slice(0, pattern.length) === pattern ? [
|
|
8633
8633
|
[pattern],
|
|
8634
8634
|
source.slice(pattern.length)
|
|
8635
8635
|
] : global_1.undefined;
|
|
@@ -8637,7 +8637,7 @@ require = function () {
|
|
|
8637
8637
|
if (source === '')
|
|
8638
8638
|
return;
|
|
8639
8639
|
const m = source.match(pattern);
|
|
8640
|
-
return m &&
|
|
8640
|
+
return m && (!mustConsume || m[0].length > 0) ? [
|
|
8641
8641
|
[m[0]],
|
|
8642
8642
|
source.slice(m[0].length)
|
|
8643
8643
|
] : global_1.undefined;
|
|
@@ -8676,6 +8676,11 @@ require = function () {
|
|
|
8676
8676
|
];
|
|
8677
8677
|
case 0:
|
|
8678
8678
|
switch (source[0]) {
|
|
8679
|
+
case '\x7F':
|
|
8680
|
+
return [
|
|
8681
|
+
[],
|
|
8682
|
+
source.slice(1)
|
|
8683
|
+
];
|
|
8679
8684
|
case '\\':
|
|
8680
8685
|
switch (source[1]) {
|
|
8681
8686
|
case global_1.undefined:
|
|
@@ -8741,7 +8746,7 @@ require = function () {
|
|
|
8741
8746
|
}
|
|
8742
8747
|
});
|
|
8743
8748
|
exports.txt = (0, combinator_1.union)([exports.text]);
|
|
8744
|
-
exports.linebreak = (0, combinator_1.
|
|
8749
|
+
exports.linebreak = (0, combinator_1.focus)('\n', (0, combinator_1.union)([exports.text]));
|
|
8745
8750
|
function isAlphanumeric(char) {
|
|
8746
8751
|
if (char < '0' || '\x7F' < char)
|
|
8747
8752
|
return false;
|
|
@@ -8798,12 +8803,13 @@ require = function () {
|
|
|
8798
8803
|
function (_dereq_, module, exports) {
|
|
8799
8804
|
'use strict';
|
|
8800
8805
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
8801
|
-
exports.stringify = exports.trimEndBR = exports.
|
|
8806
|
+
exports.stringify = exports.trimEndBR = exports.trimEnd = exports.verifyEndTight = exports.verifyStartTight = exports.isStartTight = exports.startTight = exports.visualize = void 0;
|
|
8802
8807
|
const global_1 = _dereq_('spica/global');
|
|
8803
8808
|
const parser_1 = _dereq_('../combinator/data/parser');
|
|
8804
8809
|
const combinator_1 = _dereq_('../combinator');
|
|
8805
8810
|
const comment_1 = _dereq_('./inline/comment');
|
|
8806
8811
|
const htmlentity_1 = _dereq_('./inline/htmlentity');
|
|
8812
|
+
const source_1 = _dereq_('./source');
|
|
8807
8813
|
const array_1 = _dereq_('spica/array');
|
|
8808
8814
|
const invisibleHTMLEntityNames = [
|
|
8809
8815
|
'Tab',
|
|
@@ -8839,22 +8845,20 @@ require = function () {
|
|
|
8839
8845
|
'InvisibleComma',
|
|
8840
8846
|
'ic'
|
|
8841
8847
|
];
|
|
8842
|
-
const blankline = new RegExp(String.raw`^(?!\n|$)(?:\\?\s|&(?:${ invisibleHTMLEntityNames.join('|') })
|
|
8843
|
-
function visualize(parser
|
|
8848
|
+
const blankline = new RegExp(String.raw`^(?!\n|$)(?:\\?\s|&(?:${ invisibleHTMLEntityNames.join('|') });|<wbr>)*\\?(?:\n|$)`, 'gm');
|
|
8849
|
+
function visualize(parser) {
|
|
8844
8850
|
return justify((0, combinator_1.union)([
|
|
8845
8851
|
(0, combinator_1.verify)(parser, (ns, rest, context) => !rest && hasVisible(ns, context)),
|
|
8846
|
-
|
|
8847
|
-
|
|
8848
|
-
|
|
8849
|
-
|
|
8852
|
+
(0, combinator_1.trim)((0, combinator_1.some)((0, combinator_1.union)([
|
|
8853
|
+
(0, combinator_1.clear)((0, source_1.str)('\x7F\\')),
|
|
8854
|
+
source_1.linebreak,
|
|
8855
|
+
source_1.unescsource
|
|
8856
|
+
])))
|
|
8850
8857
|
]));
|
|
8851
8858
|
}
|
|
8852
8859
|
exports.visualize = visualize;
|
|
8853
8860
|
function justify(parser) {
|
|
8854
|
-
return (0, combinator_1.convert)(source => source.replace(blankline,
|
|
8855
|
-
function visualize(line) {
|
|
8856
|
-
return line.replace(/[\\&]/g, '\\$&');
|
|
8857
|
-
}
|
|
8861
|
+
return (0, combinator_1.convert)(source => source.replace(blankline, line => line.replace(/[\\&<]/g, '\x7F\\$&')), parser);
|
|
8858
8862
|
}
|
|
8859
8863
|
function hasVisible(nodes, {
|
|
8860
8864
|
syntax: {
|
|
@@ -8878,61 +8882,64 @@ require = function () {
|
|
|
8878
8882
|
return false;
|
|
8879
8883
|
}
|
|
8880
8884
|
function startTight(parser) {
|
|
8881
|
-
return (source, context) =>
|
|
8882
|
-
var _a, _b;
|
|
8883
|
-
if (source === '')
|
|
8884
|
-
return;
|
|
8885
|
-
switch (source[0]) {
|
|
8886
|
-
case ' ':
|
|
8887
|
-
case '\u3000':
|
|
8888
|
-
case '\t':
|
|
8889
|
-
case '\n':
|
|
8890
|
-
return;
|
|
8891
|
-
case '&':
|
|
8892
|
-
switch (true) {
|
|
8893
|
-
case source.length > 2 && source[1] !== ' ' && ((_a = (0, parser_1.eval)((0, htmlentity_1.htmlentity)(source, context))) === null || _a === void 0 ? void 0 : _a[0].trimStart()) == '':
|
|
8894
|
-
return;
|
|
8895
|
-
}
|
|
8896
|
-
break;
|
|
8897
|
-
case '[':
|
|
8898
|
-
switch (true) {
|
|
8899
|
-
case source.length >= 7 && source[1] === '#' && !!(0, comment_1.comment)(source, context):
|
|
8900
|
-
return;
|
|
8901
|
-
}
|
|
8902
|
-
break;
|
|
8903
|
-
case '<':
|
|
8904
|
-
switch (true) {
|
|
8905
|
-
case source.length >= 5 && source[1] === 'w' && source.slice(0, 5) === '<wbr>':
|
|
8906
|
-
case source.length >= 4 && source[1] === 'b' && source.slice(0, 4) === '<br>':
|
|
8907
|
-
return;
|
|
8908
|
-
}
|
|
8909
|
-
break;
|
|
8910
|
-
}
|
|
8911
|
-
return ((_b = source[0] === '\\' ? source[1] : source[0]) === null || _b === void 0 ? void 0 : _b.trimStart()) ? parser(source, context) : global_1.undefined;
|
|
8912
|
-
};
|
|
8885
|
+
return (source, context) => isStartTight(source, context) ? parser(source, context) : global_1.undefined;
|
|
8913
8886
|
}
|
|
8914
8887
|
exports.startTight = startTight;
|
|
8915
|
-
function isStartTight(
|
|
8916
|
-
|
|
8888
|
+
function isStartTight(source, context) {
|
|
8889
|
+
var _a, _b;
|
|
8890
|
+
if (source === '')
|
|
8891
|
+
return true;
|
|
8892
|
+
switch (source[0]) {
|
|
8893
|
+
case ' ':
|
|
8894
|
+
case '\u3000':
|
|
8895
|
+
case '\t':
|
|
8896
|
+
case '\n':
|
|
8897
|
+
return false;
|
|
8898
|
+
case '\\':
|
|
8899
|
+
return ((_a = source[1]) === null || _a === void 0 ? void 0 : _a.trimStart()) !== '';
|
|
8900
|
+
case '&':
|
|
8901
|
+
switch (true) {
|
|
8902
|
+
case source.length > 2 && source[1] !== ' ' && ((_b = (0, parser_1.eval)((0, htmlentity_1.htmlentity)(source, context))) === null || _b === void 0 ? void 0 : _b[0].trimStart()) == '':
|
|
8903
|
+
return false;
|
|
8904
|
+
}
|
|
8905
|
+
return true;
|
|
8906
|
+
case '<':
|
|
8907
|
+
switch (true) {
|
|
8908
|
+
case source.length >= 5 && source[1] === 'w' && source.slice(0, 5) === '<wbr>':
|
|
8909
|
+
return false;
|
|
8910
|
+
}
|
|
8917
8911
|
return true;
|
|
8918
|
-
|
|
8912
|
+
case '[':
|
|
8913
|
+
switch (true) {
|
|
8914
|
+
case source.length >= 7 && source[1] === '#' && !!(0, comment_1.comment)(source, context):
|
|
8915
|
+
return false;
|
|
8916
|
+
}
|
|
8917
|
+
return true;
|
|
8918
|
+
default:
|
|
8919
|
+
return source[0].trimStart() !== '';
|
|
8920
|
+
}
|
|
8919
8921
|
}
|
|
8920
8922
|
exports.isStartTight = isStartTight;
|
|
8921
|
-
function
|
|
8923
|
+
function verifyStartTight(nodes) {
|
|
8924
|
+
if (nodes.length === 0)
|
|
8925
|
+
return true;
|
|
8926
|
+
return isVisible(nodes[0]);
|
|
8927
|
+
}
|
|
8928
|
+
exports.verifyStartTight = verifyStartTight;
|
|
8929
|
+
function verifyEndTight(nodes) {
|
|
8922
8930
|
if (nodes.length === 0)
|
|
8923
8931
|
return true;
|
|
8924
8932
|
const last = nodes.length - 1;
|
|
8925
|
-
return typeof nodes[last] === 'string' && nodes[last].length > 1 ? isVisible(nodes[last],
|
|
8933
|
+
return typeof nodes[last] === 'string' && nodes[last].length > 1 ? isVisible(nodes[last], -1) || isVisible(nodes[last], -2) : isVisible(nodes[last], -1) || last === 0 || isVisible(nodes[last - 1], -1);
|
|
8926
8934
|
}
|
|
8927
|
-
exports.
|
|
8928
|
-
function isVisible(node,
|
|
8935
|
+
exports.verifyEndTight = verifyEndTight;
|
|
8936
|
+
function isVisible(node, position = 0) {
|
|
8929
8937
|
if (!node)
|
|
8930
8938
|
return false;
|
|
8931
8939
|
switch (typeof node) {
|
|
8932
8940
|
case 'string':
|
|
8933
|
-
const char = node[
|
|
8941
|
+
const char = node[position >= 0 ? position : node.length + position];
|
|
8934
8942
|
switch (char) {
|
|
8935
|
-
case '':
|
|
8936
8943
|
case ' ':
|
|
8937
8944
|
case '\t':
|
|
8938
8945
|
case '\n':
|
|
@@ -8954,6 +8961,21 @@ require = function () {
|
|
|
8954
8961
|
}
|
|
8955
8962
|
}
|
|
8956
8963
|
}
|
|
8964
|
+
function trimEnd(nodes) {
|
|
8965
|
+
const skip = nodes.length > 0 && typeof nodes[nodes.length - 1] === 'object' && nodes[nodes.length - 1]['className'] === 'indexer' ? [nodes.pop()] : [];
|
|
8966
|
+
for (let last = nodes[0]; nodes.length > 0 && !isVisible(last = nodes[nodes.length - 1], -1) && !(typeof last === 'object' && last.className === 'comment');) {
|
|
8967
|
+
if (typeof last === 'string') {
|
|
8968
|
+
const pos = last.trimEnd().length;
|
|
8969
|
+
if (pos > 0) {
|
|
8970
|
+
nodes[nodes.length - 1] = last.slice(0, pos);
|
|
8971
|
+
break;
|
|
8972
|
+
}
|
|
8973
|
+
}
|
|
8974
|
+
nodes.pop();
|
|
8975
|
+
}
|
|
8976
|
+
return (0, array_1.push)(nodes, skip);
|
|
8977
|
+
}
|
|
8978
|
+
exports.trimEnd = trimEnd;
|
|
8957
8979
|
function trimEndBR(nodes) {
|
|
8958
8980
|
if (nodes.length === 0)
|
|
8959
8981
|
return nodes;
|
|
@@ -8980,6 +9002,7 @@ require = function () {
|
|
|
8980
9002
|
'../combinator/data/parser': 49,
|
|
8981
9003
|
'./inline/comment': 104,
|
|
8982
9004
|
'./inline/htmlentity': 116,
|
|
9005
|
+
'./source': 130,
|
|
8983
9006
|
'spica/array': 6,
|
|
8984
9007
|
'spica/global': 17
|
|
8985
9008
|
}
|