securemark 0.295.7 → 0.295.8
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/index.js +2 -38
- package/package.json +1 -1
- package/src/parser/inline/math.test.ts +10 -2
- package/src/parser/inline/math.ts +2 -2
- package/src/parser/source/text.ts +0 -37
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.295.
|
|
1
|
+
/*! securemark v0.295.8 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"));
|
|
@@ -7559,7 +7559,7 @@ const source_1 = __webpack_require__(8745);
|
|
|
7559
7559
|
const util_1 = __webpack_require__(4992);
|
|
7560
7560
|
const dom_1 = __webpack_require__(394);
|
|
7561
7561
|
const forbiddenCommand = /\\(?:begin|tiny|huge|large)(?![a-z])|:\/\//i;
|
|
7562
|
-
exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)(/\$(?={)/y, (0, combinator_1.precedence)(4, bracket), '$', false, [3 | 16 /* Backtrack.escapable */]), (0, combinator_1.surround)(/\$(?![\s{}])/y, (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(source_1.escsource,
|
|
7562
|
+
exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)(/\$(?={)/y, (0, combinator_1.precedence)(4, bracket), '$', false, [3 | 16 /* Backtrack.escapable */]), (0, combinator_1.surround)(/\$(?![\s{}])/y, (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(source_1.escsource, /\$|[`"{}\n]/y), (0, combinator_1.precedence)(4, bracket)]))), /(?<!\s)\$(?![-0-9A-Za-z])/y, false, [3 | 16 /* Backtrack.escapable */])]), ({
|
|
7563
7563
|
context: {
|
|
7564
7564
|
source,
|
|
7565
7565
|
caches: {
|
|
@@ -8613,7 +8613,6 @@ exports.isAlphanumeric = exports.next = exports.canSkip = exports.txt = exports.
|
|
|
8613
8613
|
const parser_1 = __webpack_require__(605);
|
|
8614
8614
|
const combinator_1 = __webpack_require__(3484);
|
|
8615
8615
|
const dom_1 = __webpack_require__(394);
|
|
8616
|
-
//const delimiter = /(?=[\\!@#$&"`\[\](){}<>()[]{}*%|\r\n]|([+~=])\1|\/{3}|\s(?:\\?(?:$|\s)|[$%])|:\/\/)/g;
|
|
8617
8616
|
exports.nonWhitespace = /[^ \t ]/g;
|
|
8618
8617
|
const text = input => {
|
|
8619
8618
|
const {
|
|
@@ -8758,44 +8757,9 @@ function isAlphanumeric(char) {
|
|
|
8758
8757
|
return '0' <= char && char <= '9' || 'A' <= char && char <= 'Z' || 'a' <= char && char <= 'z';
|
|
8759
8758
|
}
|
|
8760
8759
|
exports.isAlphanumeric = isAlphanumeric;
|
|
8761
|
-
//const dict = new class {
|
|
8762
|
-
// constructor() {
|
|
8763
|
-
// [
|
|
8764
|
-
// '\\',
|
|
8765
|
-
// '!',
|
|
8766
|
-
// '@',
|
|
8767
|
-
// '#',
|
|
8768
|
-
// '$',
|
|
8769
|
-
// '&',
|
|
8770
|
-
// '"',
|
|
8771
|
-
// '`',
|
|
8772
|
-
// '[',
|
|
8773
|
-
// ']',
|
|
8774
|
-
// '(',
|
|
8775
|
-
// ')',
|
|
8776
|
-
// '{',
|
|
8777
|
-
// '}',
|
|
8778
|
-
// '<',
|
|
8779
|
-
// '>',
|
|
8780
|
-
// '(',
|
|
8781
|
-
// ')',
|
|
8782
|
-
// '[',
|
|
8783
|
-
// ']',
|
|
8784
|
-
// '{',
|
|
8785
|
-
// '}',
|
|
8786
|
-
// '*',
|
|
8787
|
-
// '%',
|
|
8788
|
-
// '|',
|
|
8789
|
-
// '\r',
|
|
8790
|
-
// '\n',
|
|
8791
|
-
// ].forEach(c =>
|
|
8792
|
-
// this[c.charCodeAt(0)] = undefined);
|
|
8793
|
-
// }
|
|
8794
|
-
//};
|
|
8795
8760
|
function seek(source, position, state) {
|
|
8796
8761
|
for (let i = position + 1; i < source.length; ++i) {
|
|
8797
8762
|
const fst = source[i];
|
|
8798
|
-
//if (fst.charCodeAt(0) in dict) return i;
|
|
8799
8763
|
switch (fst) {
|
|
8800
8764
|
case '\\':
|
|
8801
8765
|
case '!':
|
package/package.json
CHANGED
|
@@ -14,6 +14,8 @@ describe('Unit: parser/inline/math', () => {
|
|
|
14
14
|
assert.deepStrictEqual(inspect(parser, input('$$', new Context())), undefined);
|
|
15
15
|
assert.deepStrictEqual(inspect(parser, input('$$$', new Context())), undefined);
|
|
16
16
|
assert.deepStrictEqual(inspect(parser, input('$0 $', new Context())), undefined);
|
|
17
|
+
assert.deepStrictEqual(inspect(parser, input('$0\\ $', new Context())), undefined);
|
|
18
|
+
assert.deepStrictEqual(inspect(parser, input('$0\\\n$', new Context())), undefined);
|
|
17
19
|
assert.deepStrictEqual(inspect(parser, input('$-0, $-1', new Context())), undefined);
|
|
18
20
|
assert.deepStrictEqual(inspect(parser, input('$-0 and $-1', new Context())), undefined);
|
|
19
21
|
assert.deepStrictEqual(inspect(parser, input('$-0と$-1', new Context())), undefined);
|
|
@@ -38,9 +40,13 @@ describe('Unit: parser/inline/math', () => {
|
|
|
38
40
|
assert.deepStrictEqual(inspect(parser, input('$a$b', new Context())), undefined);
|
|
39
41
|
assert.deepStrictEqual(inspect(parser, input('$a$b$', new Context())), undefined);
|
|
40
42
|
assert.deepStrictEqual(inspect(parser, input('$ $', new Context())), undefined);
|
|
43
|
+
assert.deepStrictEqual(inspect(parser, input('$\\ $', new Context())), undefined);
|
|
41
44
|
assert.deepStrictEqual(inspect(parser, input('$ a$', new Context())), undefined);
|
|
42
45
|
assert.deepStrictEqual(inspect(parser, input('$ a $', new Context())), undefined);
|
|
43
46
|
assert.deepStrictEqual(inspect(parser, input('$\n$', new Context())), undefined);
|
|
47
|
+
assert.deepStrictEqual(inspect(parser, input('$\\\n$', new Context())), undefined);
|
|
48
|
+
assert.deepStrictEqual(inspect(parser, input('$a\nb$', new Context())), undefined);
|
|
49
|
+
assert.deepStrictEqual(inspect(parser, input('$a\\\nb$', new Context())), undefined);
|
|
44
50
|
assert.deepStrictEqual(inspect(parser, input('$a\\$\nb$', new Context())), undefined);
|
|
45
51
|
assert.deepStrictEqual(inspect(parser, input('$a\\$\\\nb$', new Context())), undefined);
|
|
46
52
|
assert.deepStrictEqual(inspect(parser, input('$`$', new Context())), undefined);
|
|
@@ -74,9 +80,12 @@ describe('Unit: parser/inline/math', () => {
|
|
|
74
80
|
assert.deepStrictEqual(inspect(parser, input('${a}b$', new Context())), undefined);
|
|
75
81
|
assert.deepStrictEqual(inspect(parser, input('${a}b{c}$', new Context())), undefined);
|
|
76
82
|
assert.deepStrictEqual(inspect(parser, input('${a}{b}$', new Context())), undefined);
|
|
77
|
-
assert.deepStrictEqual(inspect(parser, input('${$}$', new Context())), undefined);
|
|
78
83
|
assert.deepStrictEqual(inspect(parser, input('${\\}$', new Context())), undefined);
|
|
79
84
|
assert.deepStrictEqual(inspect(parser, input('${\n}$', new Context())), undefined);
|
|
85
|
+
assert.deepStrictEqual(inspect(parser, input('${\\\n}$', new Context())), undefined);
|
|
86
|
+
assert.deepStrictEqual(inspect(parser, input('${a\nb}$', new Context())), undefined);
|
|
87
|
+
assert.deepStrictEqual(inspect(parser, input('${a\\\nb}$', new Context())), undefined);
|
|
88
|
+
assert.deepStrictEqual(inspect(parser, input('${$}$', new Context())), undefined);
|
|
80
89
|
assert.deepStrictEqual(inspect(parser, input('${a\\$\nb}$', new Context())), undefined);
|
|
81
90
|
assert.deepStrictEqual(inspect(parser, input('${a\\$\\\nb}$', new Context())), undefined);
|
|
82
91
|
assert.deepStrictEqual(inspect(parser, input('$\\begin$', new Context())), [['<span class="invalid" translate="no">$\\begin$</span>'], '']);
|
|
@@ -109,7 +118,6 @@ describe('Unit: parser/inline/math', () => {
|
|
|
109
118
|
assert.deepStrictEqual(inspect(parser, input('$a$[A](a)', new Context())), [['<span class="math" translate="no" data-src="$a$">$a$</span>'], '[A](a)']);
|
|
110
119
|
assert.deepStrictEqual(inspect(parser, input('$A$', new Context())), [['<span class="math" translate="no" data-src="$A$">$A$</span>'], '']);
|
|
111
120
|
assert.deepStrictEqual(inspect(parser, input('$-a$', new Context())), [['<span class="math" translate="no" data-src="$-a$">$-a$</span>'], '']);
|
|
112
|
-
assert.deepStrictEqual(inspect(parser, input('$\\ $', new Context())), [['<span class="math" translate="no" data-src="$\\ $">$\\ $</span>'], '']);
|
|
113
121
|
assert.deepStrictEqual(inspect(parser, input('$\\$$', new Context())), [['<span class="math" translate="no" data-src="$\\$$">$\\$$</span>'], '']);
|
|
114
122
|
assert.deepStrictEqual(inspect(parser, input('$\\Pi$', new Context())), [['<span class="math" translate="no" data-src="$\\Pi$">$\\Pi$</span>'], '']);
|
|
115
123
|
assert.deepStrictEqual(inspect(parser, input('$\\ 0$', new Context())), [['<span class="math" translate="no" data-src="$\\ 0$">$\\ 0$</span>'], '']);
|
|
@@ -19,10 +19,10 @@ export const math: MathParser = lazy(() => rewrite(
|
|
|
19
19
|
surround(
|
|
20
20
|
/\$(?![\s{}])/y,
|
|
21
21
|
precedence(2, some(union([
|
|
22
|
-
some(escsource,
|
|
22
|
+
some(escsource, /\$|[`"{}\n]/y),
|
|
23
23
|
precedence(4, bracket),
|
|
24
24
|
]))),
|
|
25
|
-
|
|
25
|
+
/(?<!\s)\$(?![-0-9A-Za-z])/y,
|
|
26
26
|
false,
|
|
27
27
|
[3 | Backtrack.escapable]),
|
|
28
28
|
]),
|
|
@@ -4,7 +4,6 @@ import { List, Node } from '../../combinator/data/parser';
|
|
|
4
4
|
import { union, consume } from '../../combinator';
|
|
5
5
|
import { html } from 'typed-dom/dom';
|
|
6
6
|
|
|
7
|
-
//const delimiter = /(?=[\\!@#$&"`\[\](){}<>()[]{}*%|\r\n]|([+~=])\1|\/{3}|\s(?:\\?(?:$|\s)|[$%])|:\/\/)/g;
|
|
8
7
|
export const nonWhitespace = /[^ \t ]/g;
|
|
9
8
|
|
|
10
9
|
export const text: TextParser = input => {
|
|
@@ -177,45 +176,9 @@ export function isAlphanumeric(char: string): boolean {
|
|
|
177
176
|
|| 'a' <= char && char <= 'z';
|
|
178
177
|
}
|
|
179
178
|
|
|
180
|
-
//const dict = new class {
|
|
181
|
-
// constructor() {
|
|
182
|
-
// [
|
|
183
|
-
// '\\',
|
|
184
|
-
// '!',
|
|
185
|
-
// '@',
|
|
186
|
-
// '#',
|
|
187
|
-
// '$',
|
|
188
|
-
// '&',
|
|
189
|
-
// '"',
|
|
190
|
-
// '`',
|
|
191
|
-
// '[',
|
|
192
|
-
// ']',
|
|
193
|
-
// '(',
|
|
194
|
-
// ')',
|
|
195
|
-
// '{',
|
|
196
|
-
// '}',
|
|
197
|
-
// '<',
|
|
198
|
-
// '>',
|
|
199
|
-
// '(',
|
|
200
|
-
// ')',
|
|
201
|
-
// '[',
|
|
202
|
-
// ']',
|
|
203
|
-
// '{',
|
|
204
|
-
// '}',
|
|
205
|
-
// '*',
|
|
206
|
-
// '%',
|
|
207
|
-
// '|',
|
|
208
|
-
// '\r',
|
|
209
|
-
// '\n',
|
|
210
|
-
// ].forEach(c =>
|
|
211
|
-
// this[c.charCodeAt(0)] = undefined);
|
|
212
|
-
// }
|
|
213
|
-
//};
|
|
214
|
-
|
|
215
179
|
function seek(source: string, position: number, state: number): number {
|
|
216
180
|
for (let i = position + 1; i < source.length; ++i) {
|
|
217
181
|
const fst = source[i];
|
|
218
|
-
//if (fst.charCodeAt(0) in dict) return i;
|
|
219
182
|
switch (fst) {
|
|
220
183
|
case '\\':
|
|
221
184
|
case '!':
|