securemark 0.289.0 → 0.289.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/README.md +1 -1
- package/dist/index.js +6 -6
- package/package.json +1 -1
- package/src/parser/inline/bracket.ts +36 -8
- package/src/parser/inline.test.ts +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.289.
|
|
1
|
+
/*! securemark v0.289.1 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"));
|
|
@@ -6121,17 +6121,17 @@ const array_1 = __webpack_require__(6876);
|
|
|
6121
6121
|
const dom_1 = __webpack_require__(394);
|
|
6122
6122
|
const indexA = /^[0-9A-Za-z]+(?:(?:[.-]|, )[0-9A-Za-z]+)*$/;
|
|
6123
6123
|
const indexF = new RegExp(indexA.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => String.fromCodePoint(c.codePointAt(0) + 0xFEE0)));
|
|
6124
|
-
exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.
|
|
6124
|
+
exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest, {
|
|
6125
6125
|
recent = []
|
|
6126
6126
|
}) => [indexA.test(recent[1]) ? recent : [(0, dom_1.html)('span', {
|
|
6127
6127
|
class: 'paren'
|
|
6128
|
-
}, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], [2 | 8 /* Backtrack.bracket */]), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.
|
|
6128
|
+
}, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], [2 | 8 /* Backtrack.bracket */]), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest, {
|
|
6129
6129
|
recent = []
|
|
6130
6130
|
}) => [indexF.test(recent[1]) ? recent : [(0, dom_1.html)('span', {
|
|
6131
6131
|
class: 'paren'
|
|
6132
|
-
}, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.
|
|
6133
|
-
//
|
|
6134
|
-
(0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.
|
|
6132
|
+
}, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], [2 | 8 /* Backtrack.bracket */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], [2 | 8 /* Backtrack.bracket */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]),
|
|
6133
|
+
// 同一行内でしか閉じない以外括弧と同じ挙動
|
|
6134
|
+
(0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '"', [['"', 2, false]]))), (0, source_1.str)('"'), true, ([as, bs = [], cs], rest, {
|
|
6135
6135
|
linebreak = 0
|
|
6136
6136
|
}) => linebreak > rest.length ? [(0, array_1.unshift)(as, bs), cs[0] + rest] : [(0, array_1.push)((0, array_1.unshift)(as, bs), cs), rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], [2 | 8 /* Backtrack.bracket */])]));
|
|
6137
6137
|
|
package/package.json
CHANGED
|
@@ -11,7 +11,11 @@ const indexF = new RegExp(indexA.source.replace(', ', '[,、]')
|
|
|
11
11
|
.replace(/[09AZaz.]|\-(?!\w)/g, c => String.fromCodePoint(c.codePointAt(0)! + 0xFEE0)));
|
|
12
12
|
|
|
13
13
|
export const bracket: BracketParser = lazy(() => union([
|
|
14
|
-
surround(
|
|
14
|
+
surround(
|
|
15
|
+
str('('),
|
|
16
|
+
precedence(1, recursion(Recursion.bracket, some(inline, ')', [[')', 1]]))),
|
|
17
|
+
str(')'),
|
|
18
|
+
true,
|
|
15
19
|
([as, bs = [], cs], rest, { recent = [] }) => [
|
|
16
20
|
indexA.test(recent[1])
|
|
17
21
|
? recent
|
|
@@ -19,7 +23,11 @@ export const bracket: BracketParser = lazy(() => union([
|
|
|
19
23
|
rest
|
|
20
24
|
],
|
|
21
25
|
([as, bs = []], rest) => [unshift(as, bs), rest], [2 | Backtrack.bracket]),
|
|
22
|
-
surround(
|
|
26
|
+
surround(
|
|
27
|
+
str('('),
|
|
28
|
+
precedence(1, recursion(Recursion.bracket, some(inline, ')', [[')', 1]]))),
|
|
29
|
+
str(')'),
|
|
30
|
+
true,
|
|
23
31
|
([as, bs = [], cs], rest, { recent = [] }) => [
|
|
24
32
|
indexF.test(recent[1])
|
|
25
33
|
? recent
|
|
@@ -27,20 +35,40 @@ export const bracket: BracketParser = lazy(() => union([
|
|
|
27
35
|
rest
|
|
28
36
|
],
|
|
29
37
|
([as, bs = []], rest) => [unshift(as, bs), rest]),
|
|
30
|
-
surround(
|
|
38
|
+
surround(
|
|
39
|
+
str('['),
|
|
40
|
+
precedence(1, recursion(Recursion.bracket, some(inline, ']', [[']', 1]]))),
|
|
41
|
+
str(']'),
|
|
42
|
+
true,
|
|
31
43
|
undefined,
|
|
32
44
|
([as, bs = []], rest) => [unshift(as, bs), rest], [2 | Backtrack.bracket]),
|
|
33
|
-
surround(
|
|
45
|
+
surround(
|
|
46
|
+
str('['),
|
|
47
|
+
precedence(1, recursion(Recursion.bracket, some(inline, ']', [[']', 1]]))),
|
|
48
|
+
str(']'),
|
|
49
|
+
true,
|
|
34
50
|
undefined,
|
|
35
51
|
([as, bs = []], rest) => [unshift(as, bs), rest]),
|
|
36
|
-
surround(
|
|
52
|
+
surround(
|
|
53
|
+
str('{'),
|
|
54
|
+
precedence(1, recursion(Recursion.bracket, some(inline, '}', [['}', 1]]))),
|
|
55
|
+
str('}'),
|
|
56
|
+
true,
|
|
37
57
|
undefined,
|
|
38
58
|
([as, bs = []], rest) => [unshift(as, bs), rest], [2 | Backtrack.bracket]),
|
|
39
|
-
surround(
|
|
59
|
+
surround(
|
|
60
|
+
str('{'),
|
|
61
|
+
precedence(1, recursion(Recursion.bracket, some(inline, '}', [['}', 1]]))),
|
|
62
|
+
str('}'),
|
|
63
|
+
true,
|
|
40
64
|
undefined,
|
|
41
65
|
([as, bs = []], rest) => [unshift(as, bs), rest]),
|
|
42
|
-
//
|
|
43
|
-
surround(
|
|
66
|
+
// 同一行内でしか閉じない以外括弧と同じ挙動
|
|
67
|
+
surround(
|
|
68
|
+
str('"'),
|
|
69
|
+
precedence(2, recursion(Recursion.bracket, some(inline, '"', [['"', 2, false]]))),
|
|
70
|
+
str('"'),
|
|
71
|
+
true,
|
|
44
72
|
([as, bs = [], cs], rest, { linebreak = 0 }) =>
|
|
45
73
|
linebreak > rest.length
|
|
46
74
|
? [unshift(as, bs), cs[0] + rest]
|
|
@@ -84,7 +84,7 @@ describe('Unit: parser/inline', () => {
|
|
|
84
84
|
assert.deepStrictEqual(inspect(parser('"*a\nb*')), [['"', '<em>a<br>b</em>'], '']);
|
|
85
85
|
assert.deepStrictEqual(inspect(parser('"*a\n""b*')), [['"', '<em>a<br>""b</em>'], '']);
|
|
86
86
|
assert.deepStrictEqual(inspect(parser('"a\n"*b"c*')), [['"', 'a', '<br>', '"', '*', 'b', '"', 'c', '*'], '']);
|
|
87
|
-
assert.deepStrictEqual(inspect(parser('"*a
|
|
87
|
+
assert.deepStrictEqual(inspect(parser('"*a**b\nc**"("*')), [['"', '<em>a<strong>b<br>c</strong>"("</em>'], '']);
|
|
88
88
|
assert.deepStrictEqual(inspect(parser('<bdi>a"\nb</bdi>')), [['<bdi>a"<br>b</bdi>'], '']);
|
|
89
89
|
assert.deepStrictEqual(inspect(parser('"<bdi>"a\n""b</bdi>"')), [['"', '<bdi>"a<br>""b</bdi>', '"'], '']);
|
|
90
90
|
assert.deepStrictEqual(inspect(parser('<bdi>*<bdi>a</bdi>*</bdi>')), [['<bdi><em><bdi>a</bdi></em></bdi>'], '']);
|