securemark 0.294.8 → 0.294.9
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
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.294.
|
|
1
|
+
/*! securemark v0.294.9 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
|
|
2
2
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
3
3
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
4
4
|
module.exports = factory(require("Prism"), require("DOMPurify"));
|
|
@@ -4659,9 +4659,10 @@ const opener = /(?=>>+(?:$|[ \n]))/y;
|
|
|
4659
4659
|
const indent = (0, combinator_1.block)((0, combinator_1.open)(opener, (0, combinator_1.some)(source_1.contentline, />(?:$|[ \n])/y)), false);
|
|
4660
4660
|
const unindent = source => source.replace(/(?<=^|\n)>(?: |(?=>*(?:$|[ \n])))|\n$/g, '');
|
|
4661
4661
|
const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(2 /* Recursion.blockquote */, (0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, source, false, true)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (0, combinator_1.fmap)(autolink_1.autolink, ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false, true))]))), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
|
|
4662
|
-
const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(2 /* Recursion.blockquote */, (0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, markdown, false, true)), (0, combinator_1.
|
|
4662
|
+
const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(2 /* Recursion.blockquote */, (0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, markdown, false, true)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, ({
|
|
4663
4663
|
context
|
|
4664
4664
|
}) => {
|
|
4665
|
+
(0, combinator_1.consume)(10, context);
|
|
4665
4666
|
const {
|
|
4666
4667
|
source
|
|
4667
4668
|
} = context;
|
|
@@ -4676,7 +4677,7 @@ const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combina
|
|
|
4676
4677
|
}, context);
|
|
4677
4678
|
context.position = source.length;
|
|
4678
4679
|
return new parser_1.List([new parser_1.Data((0, dom_1.html)('section', [document, (0, dom_1.html)('h2', 'References'), references]))]);
|
|
4679
|
-
}, false, true))
|
|
4680
|
+
}, false, true))]))), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
|
|
4680
4681
|
|
|
4681
4682
|
/***/ },
|
|
4682
4683
|
|
|
@@ -6273,9 +6274,9 @@ const source_1 = __webpack_require__(8745);
|
|
|
6273
6274
|
const dom_1 = __webpack_require__(394);
|
|
6274
6275
|
// https://example/@user must be a user page or a redirect page going there.
|
|
6275
6276
|
// https://example/@user?ch=a+b must be a user channel page or a redirect page going there.
|
|
6276
|
-
exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)((0, combinator_1.surround)(/(?<![0-9a-z])@/yi, (0, source_1.str)(/[0-9a-z](?:[.-](?=[0-9a-z])|[0-9a-z]){0,254}\/|/yi), (0, source_1.str)(/[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*(?![-.]?[0-9a-z@]|>>|:\S)/yi)), (0, combinator_1.some)((0, combinator_1.surround)('#', (0, combinator_1.verify)((0, source_1.str)(new RegExp([/(?!['_])(?:[^\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^\p{C}\p{S}\p{P}\s]|emoji))+/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu')), ([{
|
|
6277
|
+
exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)((0, combinator_1.surround)(/(?<![0-9a-z])@/yi, (0, source_1.str)(/[0-9a-z](?:[.-](?=[0-9a-z])|[0-9a-z]){0,254}\/|/yi), (0, source_1.str)(/[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*(?![-.]?[0-9a-z@]|>>|:\S)/yi), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.some)((0, combinator_1.surround)('#', (0, combinator_1.verify)((0, source_1.str)(new RegExp([/(?!['_])(?:[^\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^\p{C}\p{S}\p{P}\s]|emoji))+/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu')), ([{
|
|
6277
6278
|
value
|
|
6278
|
-
}]) => /^[0-9]{0,4}[^0-9]/.test(value)), new RegExp([/(?![0-9a-z@]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu'), false, [3 | 0 /* Backtrack.autolink */])), '', false, [
|
|
6279
|
+
}]) => /^[0-9]{0,4}[^0-9]/.test(value)), new RegExp([/(?![0-9a-z@]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu'), false, [3 | 0 /* Backtrack.autolink */])), '', false, [], ([[{
|
|
6279
6280
|
value: host
|
|
6280
6281
|
}, {
|
|
6281
6282
|
value: account
|
|
@@ -7263,7 +7264,7 @@ const optspec = {
|
|
|
7263
7264
|
rel: ['nofollow']
|
|
7264
7265
|
};
|
|
7265
7266
|
Object.setPrototypeOf(optspec, null);
|
|
7266
|
-
exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */, (0, combinator_1.
|
|
7267
|
+
exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */, (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.bind)((0, combinator_1.subsequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])), ']', true, [3 | 64 /* Backtrack.bracket */, 3 | 16 /* Backtrack.link */, 2 | 8 /* Backtrack.ruby */], ([, ns = new parser_1.List()], context) => context.linebreak === 0 ? ns.push(new parser_1.Data("\u001F" /* Command.Separator */)) && ns : undefined)),
|
|
7267
7268
|
// `{ `と`{`で個別にバックトラックが発生し+1nされる。
|
|
7268
7269
|
// 自己再帰的にパースしてもオプションの不要なパースによる計算量の増加により相殺される。
|
|
7269
7270
|
(0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y, false, [3 | 16 /* Backtrack.link */], undefined, ([as, bs], context) => {
|
|
@@ -7295,16 +7296,17 @@ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /
|
|
|
7295
7296
|
}
|
|
7296
7297
|
if (content.length !== 0 && (0, visibility_1.trimBlankNodeEnd)(content).length === 0) return;
|
|
7297
7298
|
return new parser_1.List([new parser_1.Data(parse(content, params, context))]);
|
|
7298
|
-
})))))
|
|
7299
|
-
exports.medialink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */ | 4 /* State.media */, (0, combinator_1.
|
|
7299
|
+
})))));
|
|
7300
|
+
exports.medialink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */ | 4 /* State.media */, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.bind)((0, combinator_1.sequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.union)([inline_1.media, inline_1.shortmedia]), ']')), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y))]), ([{
|
|
7300
7301
|
value: content
|
|
7301
7302
|
}, {
|
|
7302
7303
|
value: params
|
|
7303
|
-
}], context) => new parser_1.List([new parser_1.Data(parse(content, params, context))])))))
|
|
7304
|
+
}], context) => new parser_1.List([new parser_1.Data(parse(content, params, context))])))));
|
|
7304
7305
|
exports.uri = (0, combinator_1.union)([(0, combinator_1.open)(/ /y, (0, source_1.str)(/\S+/y)), (0, source_1.str)(/[^\s{}]+/y)]);
|
|
7305
7306
|
exports.option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/ nofollow(?=[ }])/y), () => new parser_1.List([new parser_1.Data(' rel="nofollow"')])), (0, source_1.str)(/ [a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[ }])/yi), (0, source_1.str)(/ [^\s{}]+/y)]);
|
|
7306
7307
|
function parse(content, params, context) {
|
|
7307
7308
|
const INSECURE_URI = params.shift().value;
|
|
7309
|
+
(0, combinator_1.consume)(10, context);
|
|
7308
7310
|
let uri;
|
|
7309
7311
|
try {
|
|
7310
7312
|
uri = new url_1.ReadonlyURL(resolve(INSECURE_URI, context.host ?? location, context.url ?? context.host ?? location), context.host?.href || location.href);
|
|
@@ -7490,7 +7492,7 @@ const optspec = {
|
|
|
7490
7492
|
rel: undefined
|
|
7491
7493
|
};
|
|
7492
7494
|
Object.setPrototypeOf(optspec, null);
|
|
7493
|
-
exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.
|
|
7495
|
+
exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.open)('!', (0, combinator_1.bind)((0, combinator_1.fmap)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']')), ']', true, [3 | 4 /* Backtrack.escbracket */], ([, ns = new parser_1.List()], context) => context.linebreak === 0 ? ns : undefined)), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), / ?}/y, false, [3 | 16 /* Backtrack.link */], undefined, ([as, bs], context) => {
|
|
7494
7496
|
if (!bs) return;
|
|
7495
7497
|
const head = context.position - context.range;
|
|
7496
7498
|
(0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
|
|
@@ -7506,6 +7508,7 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
|
|
|
7506
7508
|
}], context) => {
|
|
7507
7509
|
if (text && text.trimStart() === '') return;
|
|
7508
7510
|
text = text.trim();
|
|
7511
|
+
(0, combinator_1.consume)(100, context);
|
|
7509
7512
|
if (params.last.value === "\u0018" /* Command.Cancel */) {
|
|
7510
7513
|
params.pop();
|
|
7511
7514
|
return new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
|
|
@@ -7539,7 +7542,7 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
|
|
|
7539
7542
|
class: null,
|
|
7540
7543
|
target: '_blank'
|
|
7541
7544
|
}, [el]))]);
|
|
7542
|
-
}))))
|
|
7545
|
+
}))));
|
|
7543
7546
|
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')'), (0, source_1.str)(')'), true, [3 | 4 /* Backtrack.escbracket */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']'), (0, source_1.str)(']'), true, [3 | 4 /* Backtrack.escbracket */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), '}'), (0, source_1.str)('}'), true, [3 | 4 /* Backtrack.escbracket */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"')), (0, source_1.str)('"'), true, [3 | 4 /* Backtrack.escbracket */], undefined, () => new parser_1.List())])));
|
|
7544
7547
|
const option = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, combinator_1.open)(/ /y, (0, source_1.str)(/[1-9][0-9]*/y)), (0, source_1.str)(/[x:]/y), (0, source_1.str)(/[1-9][0-9]*(?=[ }])/y), false, [], ([[{
|
|
7545
7548
|
value: a
|
|
@@ -7566,11 +7569,6 @@ function sanitize(target, uri) {
|
|
|
7566
7569
|
type = 'argument';
|
|
7567
7570
|
message = 'Invalid protocol';
|
|
7568
7571
|
}
|
|
7569
|
-
//else {
|
|
7570
|
-
// target.setAttribute('alt', alt.replace(CmdRegExp.Error, ''));
|
|
7571
|
-
// type = 'argument';
|
|
7572
|
-
// message = `Invalid HTML entitiy "${alt.match(/&[0-9A-Za-z]+;/)![0]}"`;
|
|
7573
|
-
//}
|
|
7574
7572
|
(0, dom_1.define)(target, {
|
|
7575
7573
|
'data-src': null,
|
|
7576
7574
|
class: 'invalid',
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BlockquoteParser } from '../block';
|
|
2
2
|
import { Recursion } from '../context';
|
|
3
3
|
import { List, Data } from '../../combinator/data/parser';
|
|
4
|
-
import { union, some,
|
|
4
|
+
import { union, some, consume, recursion, block, validate, rewrite, open, convert, lazy, fmap } from '../../combinator';
|
|
5
5
|
import { autolink } from '../autolink';
|
|
6
6
|
import { contentline } from '../source';
|
|
7
7
|
import { unwrap } from '../util';
|
|
@@ -37,10 +37,10 @@ const markdown: BlockquoteParser.MarkdownParser = lazy(() => fmap(
|
|
|
37
37
|
rewrite(
|
|
38
38
|
indent,
|
|
39
39
|
convert(unindent, markdown, false, true)),
|
|
40
|
-
creation(10,
|
|
41
40
|
rewrite(
|
|
42
41
|
some(contentline, opener),
|
|
43
42
|
convert(unindent, ({ context }) => {
|
|
43
|
+
consume(10, context);
|
|
44
44
|
const { source } = context;
|
|
45
45
|
const references = html('ol', { class: 'references' });
|
|
46
46
|
const document = parse(source, {
|
|
@@ -51,6 +51,6 @@ const markdown: BlockquoteParser.MarkdownParser = lazy(() => fmap(
|
|
|
51
51
|
}, context);
|
|
52
52
|
context.position = source.length;
|
|
53
53
|
return new List([new Data(html('section', [document, html('h2', 'References'), references]))]);
|
|
54
|
-
}, false, true))
|
|
54
|
+
}, false, true)),
|
|
55
55
|
]))),
|
|
56
56
|
ns => new List([new Data(html('blockquote', unwrap(ns)))])));
|
|
@@ -15,7 +15,9 @@ export const account: AutolinkParser.AccountParser = lazy(() => constraint(State
|
|
|
15
15
|
surround(
|
|
16
16
|
/(?<![0-9a-z])@/yi,
|
|
17
17
|
str(/[0-9a-z](?:[.-](?=[0-9a-z])|[0-9a-z]){0,254}\/|/yi),
|
|
18
|
-
str(/[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*(?![-.]?[0-9a-z@]|>>|:\S)/yi)
|
|
18
|
+
str(/[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*(?![-.]?[0-9a-z@]|>>|:\S)/yi),
|
|
19
|
+
false,
|
|
20
|
+
[3 | Backtrack.autolink]),
|
|
19
21
|
some(surround(
|
|
20
22
|
'#',
|
|
21
23
|
verify(
|
|
@@ -29,8 +31,7 @@ export const account: AutolinkParser.AccountParser = lazy(() => constraint(State
|
|
|
29
31
|
false,
|
|
30
32
|
[3 | Backtrack.autolink])),
|
|
31
33
|
'',
|
|
32
|
-
false,
|
|
33
|
-
[3 | Backtrack.autolink],
|
|
34
|
+
false, [],
|
|
34
35
|
([[{ value: host }, { value: account }], nodes], context) => {
|
|
35
36
|
const hashes = nodes.foldl((acc, { value }) => acc + '#' + value, '');
|
|
36
37
|
const param = nodes.foldl((acc, { value }) => acc ? acc + '+' + value : value, '');
|
|
@@ -2,7 +2,7 @@ import { MarkdownParser } from '../../../markdown';
|
|
|
2
2
|
import { LinkParser } from '../inline';
|
|
3
3
|
import { State, Backtrack, Command } from '../context';
|
|
4
4
|
import { List, Data } from '../../combinator/data/parser';
|
|
5
|
-
import { union, inits, sequence, subsequence, some,
|
|
5
|
+
import { union, inits, sequence, subsequence, some, consume, precedence, state, constraint, surround, open, setBacktrack, dup, lazy, fmap, bind } from '../../combinator';
|
|
6
6
|
import { inline, media, shortmedia } from '../inline';
|
|
7
7
|
import { attributes } from './html';
|
|
8
8
|
import { str } from '../source';
|
|
@@ -16,7 +16,7 @@ const optspec = {
|
|
|
16
16
|
} as const;
|
|
17
17
|
Object.setPrototypeOf(optspec, null);
|
|
18
18
|
|
|
19
|
-
export const textlink: LinkParser.TextLinkParser = lazy(() => constraint(State.link,
|
|
19
|
+
export const textlink: LinkParser.TextLinkParser = lazy(() => constraint(State.link,
|
|
20
20
|
precedence(1, state(State.linkers,
|
|
21
21
|
bind(subsequence([
|
|
22
22
|
dup(surround(
|
|
@@ -72,9 +72,9 @@ export const textlink: LinkParser.TextLinkParser = lazy(() => constraint(State.l
|
|
|
72
72
|
assert(content.head?.value !== '');
|
|
73
73
|
if (content.length !== 0 && trimBlankNodeEnd(content).length === 0) return;
|
|
74
74
|
return new List([new Data(parse(content, params as List<Data<string>>, context))]);
|
|
75
|
-
})))))
|
|
75
|
+
})))));
|
|
76
76
|
|
|
77
|
-
export const medialink: LinkParser.MediaLinkParser = lazy(() => constraint(State.link | State.media,
|
|
77
|
+
export const medialink: LinkParser.MediaLinkParser = lazy(() => constraint(State.link | State.media,
|
|
78
78
|
state(State.linkers,
|
|
79
79
|
bind(sequence([
|
|
80
80
|
dup(surround(
|
|
@@ -84,7 +84,7 @@ export const medialink: LinkParser.MediaLinkParser = lazy(() => constraint(State
|
|
|
84
84
|
dup(surround(/{(?![{}])/y, inits([uri, some(option)]), / ?}/y)),
|
|
85
85
|
]),
|
|
86
86
|
([{ value: content }, { value: params }], context) =>
|
|
87
|
-
new List([new Data(parse(content, params as List<Data<string>>, context))])))))
|
|
87
|
+
new List([new Data(parse(content, params as List<Data<string>>, context))])))));
|
|
88
88
|
|
|
89
89
|
export const uri: LinkParser.ParameterParser.UriParser = union([
|
|
90
90
|
open(/ /y, str(/\S+/y)),
|
|
@@ -106,6 +106,7 @@ export function parse(
|
|
|
106
106
|
const INSECURE_URI = params.shift()!.value;
|
|
107
107
|
assert(INSECURE_URI === INSECURE_URI.trim());
|
|
108
108
|
assert(!INSECURE_URI.match(/\s/));
|
|
109
|
+
consume(10, context);
|
|
109
110
|
let uri: ReadonlyURL | undefined;
|
|
110
111
|
try{
|
|
111
112
|
uri = new ReadonlyURL(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MediaParser } from '../inline';
|
|
2
2
|
import { State, Recursion, Backtrack, Command } from '../context';
|
|
3
3
|
import { List, Data } from '../../combinator/data/parser';
|
|
4
|
-
import { union, inits, tails, some,
|
|
4
|
+
import { union, inits, tails, some, consume, recursion, precedence, constraint, surround, open, setBacktrack, dup, lazy, fmap, bind } from '../../combinator';
|
|
5
5
|
import { uri, option as linkoption, resolve, decode, parse } from './link';
|
|
6
6
|
import { attributes } from './html';
|
|
7
7
|
import { unsafehtmlentity } from './htmlentity';
|
|
@@ -18,7 +18,7 @@ const optspec = {
|
|
|
18
18
|
} as const;
|
|
19
19
|
Object.setPrototypeOf(optspec, null);
|
|
20
20
|
|
|
21
|
-
export const media: MediaParser = lazy(() => constraint(State.media,
|
|
21
|
+
export const media: MediaParser = lazy(() => constraint(State.media, open(
|
|
22
22
|
'!',
|
|
23
23
|
bind(fmap(tails([
|
|
24
24
|
dup(surround(
|
|
@@ -56,6 +56,7 @@ export const media: MediaParser = lazy(() => constraint(State.media, creation(10
|
|
|
56
56
|
([{ value: [{ value: text }] }, { value: params }], context) => {
|
|
57
57
|
if (text && text.trimStart() === '') return;
|
|
58
58
|
text = text.trim();
|
|
59
|
+
consume(100, context);
|
|
59
60
|
if (params.last!.value === Command.Cancel) {
|
|
60
61
|
params.pop();
|
|
61
62
|
return new List([
|
|
@@ -106,7 +107,7 @@ export const media: MediaParser = lazy(() => constraint(State.media, creation(10
|
|
|
106
107
|
context),
|
|
107
108
|
{ class: null, target: '_blank' }, [el]))
|
|
108
109
|
]);
|
|
109
|
-
}))))
|
|
110
|
+
}))));
|
|
110
111
|
|
|
111
112
|
const bracket: MediaParser.TextParser.BracketParser = lazy(() => recursion(Recursion.terminal, union([
|
|
112
113
|
surround(str('('), some(union([unsafehtmlentity, bracket, txt]), ')'), str(')'),
|
|
@@ -153,11 +154,6 @@ function sanitize(target: HTMLElement, uri: ReadonlyURL | undefined): boolean {
|
|
|
153
154
|
type = 'argument';
|
|
154
155
|
message = 'Invalid protocol';
|
|
155
156
|
}
|
|
156
|
-
//else {
|
|
157
|
-
// target.setAttribute('alt', alt.replace(CmdRegExp.Error, ''));
|
|
158
|
-
// type = 'argument';
|
|
159
|
-
// message = `Invalid HTML entitiy "${alt.match(/&[0-9A-Za-z]+;/)![0]}"`;
|
|
160
|
-
//}
|
|
161
157
|
define(target, {
|
|
162
158
|
'data-src': null,
|
|
163
159
|
class: 'invalid',
|