securemark 0.287.0 → 0.287.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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.287.1
4
+
5
+ - Refactoring.
6
+
3
7
  ## 0.287.0
4
8
 
5
9
  - Change template syntax to disallow linebreaks.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.287.0 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.287.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"));
@@ -1996,13 +1996,13 @@ const combinator_1 = __webpack_require__(3484);
1996
1996
  const link_1 = __webpack_require__(3628);
1997
1997
  const source_1 = __webpack_require__(8745);
1998
1998
  const closer = /^[-+*=~^_,.;:!?]*(?=[\\"`|\[\](){}<>]|$)/;
1999
- exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['http://', 'https://'], (0, combinator_1.rewrite)((0, combinator_1.open)(/^https?:\/\/(?=[\x21-\x7E])/, (0, combinator_1.focus)(/^[\x21-\x7E]+/, (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.verify)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.unescsource, closer)]), ns => ns[0] !== "\u001B" /* Command.Escape */))))), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, false, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.convert)(url => `{ ${url} }`, link_1.unsafelink))), ({
1999
+ exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['http://', 'https://'], (0, combinator_1.rewrite)((0, combinator_1.open)(/^https?:\/\/(?=[\x21-\x7E])/, (0, combinator_1.focus)(/^[\x21-\x7E]+/, (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.verify)(bracket, ns => ns.length > 0), (0, combinator_1.some)(source_1.unescsource, closer)]))))), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, false, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.convert)(url => `{ ${url} }`, link_1.unsafelink))), ({
2000
2000
  source
2001
2001
  }) => [[source], '']]))));
2002
2002
  exports.lineurl = (0, combinator_1.lazy)(() => (0, combinator_1.open)(source_1.linebreak, (0, combinator_1.focus)(/^!?https?:\/\/\S+(?=[^\S\n]*(?:$|\n))/, (0, combinator_1.tails)([(0, source_1.str)('!'), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, false, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.convert)(url => `{ ${url} }`, link_1.unsafelink))), ({
2003
2003
  source
2004
2004
  }) => [[source], '']])]))));
2005
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')')), (0, source_1.str)(')'), true, undefined, () => [["\u001B" /* Command.Escape */], ''], [3 | 0 /* Backtrack.lineunescbracket */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']')), (0, source_1.str)(']'), true, undefined, () => [["\u001B" /* Command.Escape */], ''], [3 | 0 /* Backtrack.lineunescbracket */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}')), (0, source_1.str)('}'), true, undefined, () => [["\u001B" /* Command.Escape */], ''], [3 | 0 /* Backtrack.lineunescbracket */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.unescsource, '"'))), (0, source_1.str)('"'), true, undefined, () => [["\u001B" /* Command.Escape */], ''], [3 | 0 /* Backtrack.lineunescbracket */])]));
2005
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')')), (0, source_1.str)(')'), true, undefined, () => [[], ''], [3 | 0 /* Backtrack.lineunescbracket */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']')), (0, source_1.str)(']'), true, undefined, () => [[], ''], [3 | 0 /* Backtrack.lineunescbracket */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}')), (0, source_1.str)('}'), true, undefined, () => [[], ''], [3 | 0 /* Backtrack.lineunescbracket */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.unescsource, '"'))), (0, source_1.str)('"'), true, undefined, () => [[], ''], [3 | 0 /* Backtrack.lineunescbracket */])]));
2006
2006
 
2007
2007
  /***/ },
2008
2008
 
@@ -5028,10 +5028,10 @@ exports.template = void 0;
5028
5028
  const combinator_1 = __webpack_require__(3484);
5029
5029
  const source_1 = __webpack_require__(8745);
5030
5030
  const dom_1 = __webpack_require__(394);
5031
- exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('{{', (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.verify)((0, combinator_1.union)([bracket, source_1.escsource]), ns => ns[0] !== "\u001B" /* Command.Escape */), '}', [['\n', 9]])), '}}', true, ([, ns = []], rest) => [[(0, dom_1.html)('span', {
5031
+ exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('{{', (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}', [['\n', 9]])), '}}', true, ([, ns = []], rest) => [[(0, dom_1.html)('span', {
5032
5032
  class: 'template'
5033
5033
  }, `{{${ns.join('')}}}`)], rest], undefined, [3 | 16 /* Backtrack.linedoublebracket */, 1 | 4 /* Backtrack.lineescbracket */], 8 /* Backtrack.bracket */));
5034
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')')), (0, source_1.str)(')'), true, undefined, () => [["\u001B" /* Command.Escape */], ''], [3 | 4 /* Backtrack.lineescbracket */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']')), (0, source_1.str)(']'), true, undefined, () => [["\u001B" /* Command.Escape */], ''], [3 | 4 /* Backtrack.lineescbracket */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}'), true, undefined, () => [["\u001B" /* Command.Escape */], ''], [3 | 4 /* Backtrack.lineescbracket */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.escsource, /^["\n]/))), (0, source_1.str)('"'), true, undefined, () => [["\u001B" /* Command.Escape */], ''], [3 | 4 /* Backtrack.lineescbracket */])]));
5034
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')')), (0, source_1.str)(')'), true, undefined, () => [[], ''], [3 | 4 /* Backtrack.lineescbracket */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']')), (0, source_1.str)(']'), true, undefined, () => [[], ''], [3 | 4 /* Backtrack.lineescbracket */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}'), true, undefined, () => [[], ''], [3 | 4 /* Backtrack.lineescbracket */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.escsource, '"'))), (0, source_1.str)('"'), true, undefined, () => [[], ''], [3 | 4 /* Backtrack.lineescbracket */])]));
5035
5035
 
5036
5036
  /***/ },
5037
5037
 
@@ -7318,7 +7318,7 @@ const optspec = {
7318
7318
  rel: undefined
7319
7319
  };
7320
7320
  Object.setPrototypeOf(optspec, null);
7321
- exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* State.media */, false, (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.creation)(10, (0, combinator_1.open)('!', (0, combinator_1.bind)((0, combinator_1.verify)((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.verify)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ns => ns[0] !== "\u001B" /* Command.Escape */), ']', [['\n', 9]])), ']', true, undefined, undefined, [3 | 4 /* Backtrack.lineescbracket */])), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), /^[^\S\n]*}/, false, undefined, undefined, [3 | 24 /* Backtrack.link */]))]), ([as, bs]) => bs ? [[as.join('').trim() || as.join('')], bs] : [[''], as]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], rest, context) => {
7321
+ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* State.media */, false, (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.creation)(10, (0, combinator_1.open)('!', (0, combinator_1.bind)((0, combinator_1.verify)((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]), ']', [['\n', 9]])), ']', true, undefined, undefined, [3 | 4 /* Backtrack.lineescbracket */])), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), /^[^\S\n]*}/, false, undefined, undefined, [3 | 24 /* Backtrack.link */]))]), ([as, bs]) => bs ? [[as.join('').trim() || as.join('')], bs] : [[''], as]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], rest, context) => {
7322
7322
  const INSECURE_URI = params.shift();
7323
7323
  const url = new url_1.ReadonlyURL((0, link_1.resolve)(INSECURE_URI, context.host ?? location, context.url ?? context.host ?? location), context.host?.href || location.href);
7324
7324
  let cache;
@@ -7345,7 +7345,7 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
7345
7345
  });
7346
7346
  }))))));
7347
7347
  exports.linemedia = (0, combinator_1.surround)(source_1.linebreak, (0, combinator_1.union)([exports.media]), /^(?=[^\S\n]*(?:$|\n))/);
7348
- 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, undefined, () => [["\u001B" /* Command.Escape */], ''], [3 | 4 /* Backtrack.lineescbracket */]), (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, undefined, () => [["\u001B" /* Command.Escape */], ''], [3 | 4 /* Backtrack.lineescbracket */]), (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, undefined, () => [["\u001B" /* Command.Escape */], ''], [3 | 4 /* Backtrack.lineescbracket */]), (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, undefined, () => [["\u001B" /* Command.Escape */], ''], [3 | 4 /* Backtrack.lineescbracket */])])));
7348
+ 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, undefined, () => [[], ''], [3 | 4 /* Backtrack.lineescbracket */]), (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, undefined, () => [[], ''], [3 | 4 /* Backtrack.lineescbracket */]), (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, undefined, () => [[], ''], [3 | 4 /* Backtrack.lineescbracket */]), (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, undefined, () => [[], ''], [3 | 4 /* Backtrack.lineescbracket */])])));
7349
7349
  const option = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[1-9][0-9]*x[1-9][0-9]*(?=[^\S\n]|})/), ([opt]) => [` width="${opt.slice(1).split('x')[0]}"`, ` height="${opt.slice(1).split('x')[1]}"`]), (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('/')}"`]), link_1.option]));
7350
7350
  function sanitize(target, uri, alt) {
7351
7351
  switch (uri.protocol) {
package/markdown.d.ts CHANGED
@@ -1194,8 +1194,8 @@ export namespace MarkdownParser {
1194
1194
  }
1195
1195
  export interface BracketParser extends
1196
1196
  Inline<'url/bracket'>,
1197
- Parser<string | Command.Escape, Context, [
1198
- Parser<string | Command.Escape, Context, [
1197
+ Parser<string, Context, [
1198
+ Parser<string, Context, [
1199
1199
  BracketParser,
1200
1200
  SourceParser.UnescapableSourceParser,
1201
1201
  ]>,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "securemark",
3
- "version": "0.287.0",
3
+ "version": "0.287.1",
4
4
  "description": "Secure markdown renderer working on browsers for user input data.",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/falsandtru/securemark",
@@ -1,5 +1,5 @@
1
1
  import { AutolinkParser } from '../../inline';
2
- import { State, Recursion, Backtrack, Command } from '../../context';
2
+ import { State, Recursion, Backtrack } from '../../context';
3
3
  import { union, tails, some, recursion, precedence, state, constraint, validate, verify, focus, rewrite, convert, surround, open, lazy } from '../../../combinator';
4
4
  import { unsafelink } from '../link';
5
5
  import { linebreak, unescsource, str } from '../../source';
@@ -9,10 +9,10 @@ const closer = /^[-+*=~^_,.;:!?]*(?=[\\"`|\[\](){}<>]|$)/;
9
9
  export const url: AutolinkParser.UrlParser = lazy(() => validate(['http://', 'https://'], rewrite(
10
10
  open(
11
11
  /^https?:\/\/(?=[\x21-\x7E])/,
12
- focus(/^[\x21-\x7E]+/, precedence(1, some(verify(union([
13
- bracket,
12
+ focus(/^[\x21-\x7E]+/, precedence(1, some(union([
13
+ verify(bracket, ns => ns.length > 0),
14
14
  some(unescsource, closer),
15
- ]), ns => ns[0] !== Command.Escape))))),
15
+ ]))))),
16
16
  union([
17
17
  constraint(State.autolink, false, state(State.autolink, convert(
18
18
  url => `{ ${url} }`,
@@ -36,11 +36,11 @@ export const lineurl: AutolinkParser.UrlParser.LineUrlParser = lazy(() => open(
36
36
 
37
37
  const bracket: AutolinkParser.UrlParser.BracketParser = lazy(() => union([
38
38
  surround(str('('), recursion(Recursion.terminal, some(union([bracket, unescsource]), ')')), str(')'), true,
39
- undefined, () => [[Command.Escape], ''], [3 | Backtrack.lineunescbracket]),
39
+ undefined, () => [[], ''], [3 | Backtrack.lineunescbracket]),
40
40
  surround(str('['), recursion(Recursion.terminal, some(union([bracket, unescsource]), ']')), str(']'), true,
41
- undefined, () => [[Command.Escape], ''], [3 | Backtrack.lineunescbracket]),
41
+ undefined, () => [[], ''], [3 | Backtrack.lineunescbracket]),
42
42
  surround(str('{'), recursion(Recursion.terminal, some(union([bracket, unescsource]), '}')), str('}'), true,
43
- undefined, () => [[Command.Escape], ''], [3 | Backtrack.lineunescbracket]),
43
+ undefined, () => [[], ''], [3 | Backtrack.lineunescbracket]),
44
44
  surround(str('"'), precedence(2, recursion(Recursion.terminal, some(unescsource, '"'))), str('"'), true,
45
- undefined, () => [[Command.Escape], ''], [3 | Backtrack.lineunescbracket]),
45
+ undefined, () => [[], ''], [3 | Backtrack.lineunescbracket]),
46
46
  ]));
@@ -23,11 +23,11 @@ export const media: MediaParser = lazy(() => constraint(State.media, false, vali
23
23
  bind(verify(fmap(tails([
24
24
  dup(surround(
25
25
  '[',
26
- precedence(1, some(verify(union([
26
+ precedence(1, some(union([
27
27
  unsafehtmlentity,
28
28
  bracket,
29
29
  txt,
30
- ]), ns => ns[0] !== Command.Escape), ']', [['\n', 9]])),
30
+ ]), ']', [['\n', 9]])),
31
31
  ']',
32
32
  true, undefined, undefined, [3 | Backtrack.lineescbracket])),
33
33
  dup(surround(
@@ -75,13 +75,13 @@ export const linemedia: MediaParser.LineMediaParser = surround(
75
75
 
76
76
  const bracket: MediaParser.TextParser.BracketParser = lazy(() => recursion(Recursion.terminal, union([
77
77
  surround(str('('), some(union([unsafehtmlentity, bracket, txt]), ')'), str(')'), true,
78
- undefined, () => [[Command.Escape], ''], [3 | Backtrack.lineescbracket]),
78
+ undefined, () => [[], ''], [3 | Backtrack.lineescbracket]),
79
79
  surround(str('['), some(union([unsafehtmlentity, bracket, txt]), ']'), str(']'), true,
80
- undefined, () => [[Command.Escape], ''], [3 | Backtrack.lineescbracket]),
80
+ undefined, () => [[], ''], [3 | Backtrack.lineescbracket]),
81
81
  surround(str('{'), some(union([unsafehtmlentity, bracket, txt]), '}'), str('}'), true,
82
- undefined, () => [[Command.Escape], ''], [3 | Backtrack.lineescbracket]),
82
+ undefined, () => [[], ''], [3 | Backtrack.lineescbracket]),
83
83
  surround(str('"'), precedence(2, some(union([unsafehtmlentity, txt]), '"')), str('"'), true,
84
- undefined, () => [[Command.Escape], ''], [3 | Backtrack.lineescbracket]),
84
+ undefined, () => [[], ''], [3 | Backtrack.lineescbracket]),
85
85
  ])));
86
86
 
87
87
  const option: MediaParser.ParameterParser.OptionParser = lazy(() => union([
@@ -1,13 +1,13 @@
1
1
  import { TemplateParser } from '../inline';
2
- import { Recursion, Backtrack, Command } from '../context';
3
- import { union, some, recursion, precedence, verify, surround, lazy } from '../../combinator';
2
+ import { Recursion, Backtrack } from '../context';
3
+ import { union, some, recursion, precedence, surround, lazy } from '../../combinator';
4
4
  import { escsource, str } from '../source';
5
5
  import { html } from 'typed-dom/dom';
6
6
 
7
7
  export const template: TemplateParser = lazy(() => surround(
8
8
  '{{',
9
9
  precedence(1,
10
- some(verify(union([bracket, escsource]), ns => ns[0] !== Command.Escape), '}', [['\n', 9]])),
10
+ some(union([bracket, escsource]), '}', [['\n', 9]])),
11
11
  '}}',
12
12
  true,
13
13
  ([, ns = []], rest) => [[html('span', { class: 'template' }, `{{${ns.join('')}}}`)], rest],
@@ -15,11 +15,11 @@ export const template: TemplateParser = lazy(() => surround(
15
15
 
16
16
  const bracket: TemplateParser.BracketParser = lazy(() => union([
17
17
  surround(str('('), recursion(Recursion.terminal, some(union([bracket, escsource]), ')')), str(')'), true,
18
- undefined, () => [[Command.Escape], ''], [3 | Backtrack.lineescbracket]),
18
+ undefined, () => [[], ''], [3 | Backtrack.lineescbracket]),
19
19
  surround(str('['), recursion(Recursion.terminal, some(union([bracket, escsource]), ']')), str(']'), true,
20
- undefined, () => [[Command.Escape], ''], [3 | Backtrack.lineescbracket]),
20
+ undefined, () => [[], ''], [3 | Backtrack.lineescbracket]),
21
21
  surround(str('{'), recursion(Recursion.terminal, some(union([bracket, escsource]), '}')), str('}'), true,
22
- undefined, () => [[Command.Escape], ''], [3 | Backtrack.lineescbracket]),
23
- surround(str('"'), precedence(2, recursion(Recursion.terminal, some(escsource, /^["\n]/))), str('"'), true,
24
- undefined, () => [[Command.Escape], ''], [3 | Backtrack.lineescbracket]),
22
+ undefined, () => [[], ''], [3 | Backtrack.lineescbracket]),
23
+ surround(str('"'), precedence(2, recursion(Recursion.terminal, some(escsource, '"'))), str('"'), true,
24
+ undefined, () => [[], ''], [3 | Backtrack.lineescbracket]),
25
25
  ]));