securemark 0.245.0 → 0.246.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.
|
|
1
|
+
/*! securemark v0.246.0 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("DOMPurify"), require("Prism"));
|
|
@@ -4307,11 +4307,11 @@ const dom_1 = __webpack_require__(3252);
|
|
|
4307
4307
|
|
|
4308
4308
|
const array_1 = __webpack_require__(8112);
|
|
4309
4309
|
|
|
4310
|
-
const opener = /^(~{3,})table(?!\S)([^\n]*)(?:$|\n)/;
|
|
4310
|
+
const opener = /^(~{3,})table(?:\/(\S+))?(?!\S)([^\n]*)(?:$|\n)/;
|
|
4311
4311
|
exports.segment = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.clear)((0, combinator_1.fence)(opener, 10000))));
|
|
4312
4312
|
exports.segment_ = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.clear)((0, combinator_1.fence)(opener, 10000, false))), false);
|
|
4313
4313
|
exports.table = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.fmap)((0, combinator_1.fence)(opener, 10000), // Bug: Type mismatch between outer and inner.
|
|
4314
|
-
([body, overflow, closer, opener, delim, param], _, context) => {
|
|
4314
|
+
([body, overflow, closer, opener, delim, type, param], _, context) => {
|
|
4315
4315
|
if (!closer || overflow || param.trimStart()) return [(0, dom_1.html)('pre', {
|
|
4316
4316
|
class: 'invalid',
|
|
4317
4317
|
translate: 'no',
|
|
@@ -4319,7 +4319,23 @@ exports.table = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, co
|
|
|
4319
4319
|
'data-invalid-type': !closer || overflow ? 'fence' : 'argument',
|
|
4320
4320
|
'data-invalid-message': !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : 'Invalid argument'
|
|
4321
4321
|
}, `${opener}${body}${overflow || closer}`)];
|
|
4322
|
-
|
|
4322
|
+
|
|
4323
|
+
switch (type) {
|
|
4324
|
+
case 'grid':
|
|
4325
|
+
case global_1.undefined:
|
|
4326
|
+
return ((0, parser_1.eval)(parser(body, context)) ?? [(0, dom_1.html)('table')]).map(el => (0, dom_1.define)(el, {
|
|
4327
|
+
'data-type': type
|
|
4328
|
+
}));
|
|
4329
|
+
|
|
4330
|
+
default:
|
|
4331
|
+
return [(0, dom_1.html)('pre', {
|
|
4332
|
+
class: 'invalid',
|
|
4333
|
+
translate: 'no',
|
|
4334
|
+
'data-invalid-syntax': 'table',
|
|
4335
|
+
'data-invalid-type': 'argument',
|
|
4336
|
+
'data-invalid-message': 'Invalid table type'
|
|
4337
|
+
}, `${opener}${body}${closer}`)];
|
|
4338
|
+
}
|
|
4323
4339
|
})));
|
|
4324
4340
|
const parser = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, locale_1.localize)((0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([row])), rows => [(0, dom_1.html)('table', format(rows))]))));
|
|
4325
4341
|
const row = (0, combinator_1.lazy)(() => (0, combinator_1.dup)((0, combinator_1.fmap)((0, combinator_1.subsequence)([(0, combinator_1.dup)((0, combinator_1.union)([align])), (0, combinator_1.some)((0, combinator_1.union)([head, data, (0, combinator_1.some)(dataline, alignment), source_1.emptyline]))]), ns => !(0, alias_1.isArray)(ns[0]) ? (0, array_1.unshift)([[[]]], ns) : ns)));
|
package/package.json
CHANGED
|
@@ -654,6 +654,15 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
654
654
|
]).outerHTML], '']);
|
|
655
655
|
});
|
|
656
656
|
|
|
657
|
+
it('type', () => {
|
|
658
|
+
assert.deepStrictEqual(
|
|
659
|
+
inspect(parser('~~~table/invalid\n~~~')),
|
|
660
|
+
[['<pre class="invalid" translate="no">~~~table/invalid\n~~~</pre>'], '']);
|
|
661
|
+
assert.deepStrictEqual(
|
|
662
|
+
inspect(parser('~~~table/grid\n~~~')),
|
|
663
|
+
[[html('table', { 'data-type': 'grid' }).outerHTML], '']);
|
|
664
|
+
});
|
|
665
|
+
|
|
657
666
|
});
|
|
658
667
|
|
|
659
668
|
});
|
|
@@ -7,7 +7,7 @@ import { inline } from '../../inline';
|
|
|
7
7
|
import { str, anyline, emptyline, contentline } from '../../source';
|
|
8
8
|
import { localize } from '../../locale';
|
|
9
9
|
import { visualize } from '../../util';
|
|
10
|
-
import { html, defrag } from 'typed-dom/dom';
|
|
10
|
+
import { html, define, defrag } from 'typed-dom/dom';
|
|
11
11
|
import { unshift, splice } from 'spica/array';
|
|
12
12
|
|
|
13
13
|
import TableParser = ExtensionParser.TableParser;
|
|
@@ -15,7 +15,7 @@ import RowParser = TableParser.RowParser;
|
|
|
15
15
|
import AlignParser = TableParser.AlignParser;
|
|
16
16
|
import CellParser = TableParser.CellParser;
|
|
17
17
|
|
|
18
|
-
const opener = /^(~{3,})table(?!\S)([^\n]*)(?:$|\n)/;
|
|
18
|
+
const opener = /^(~{3,})table(?:\/(\S+))?(?!\S)([^\n]*)(?:$|\n)/;
|
|
19
19
|
|
|
20
20
|
export const segment: TableParser.SegmentParser = block(validate('~~~',
|
|
21
21
|
clear(fence(opener, 10000))));
|
|
@@ -26,7 +26,7 @@ export const segment_: TableParser.SegmentParser = block(validate('~~~',
|
|
|
26
26
|
export const table: TableParser = block(validate('~~~', fmap(
|
|
27
27
|
fence(opener, 10000),
|
|
28
28
|
// Bug: Type mismatch between outer and inner.
|
|
29
|
-
([body, overflow, closer, opener, delim, param]: string[], _, context) => {
|
|
29
|
+
([body, overflow, closer, opener, delim, type, param]: string[], _, context) => {
|
|
30
30
|
if (!closer || overflow || param.trimStart()) return [html('pre', {
|
|
31
31
|
class: 'invalid',
|
|
32
32
|
translate: 'no',
|
|
@@ -37,7 +37,20 @@ export const table: TableParser = block(validate('~~~', fmap(
|
|
|
37
37
|
overflow ? `Invalid trailing line after the closing delimiter "${delim}"` :
|
|
38
38
|
'Invalid argument',
|
|
39
39
|
}, `${opener}${body}${overflow || closer}`)];
|
|
40
|
-
|
|
40
|
+
switch (type) {
|
|
41
|
+
case 'grid':
|
|
42
|
+
case undefined:
|
|
43
|
+
return (eval(parser(body, context)) ?? [html('table')])
|
|
44
|
+
.map(el => define(el, { 'data-type': type }));
|
|
45
|
+
default:
|
|
46
|
+
return [html('pre', {
|
|
47
|
+
class: 'invalid',
|
|
48
|
+
translate: 'no',
|
|
49
|
+
'data-invalid-syntax': 'table',
|
|
50
|
+
'data-invalid-type': 'argument',
|
|
51
|
+
'data-invalid-message': 'Invalid table type',
|
|
52
|
+
}, `${opener}${body}${closer}`)];
|
|
53
|
+
}
|
|
41
54
|
})));
|
|
42
55
|
|
|
43
56
|
const parser: TableParser = lazy(() => block(localize(fmap(
|