securemark 0.232.0 → 0.232.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.232.1
4
+
5
+ - Refactoring.
6
+
3
7
  ## 0.232.0
4
8
 
5
9
  - Refine paragraph syntax to separate mention syntax.
@@ -1,4 +1,4 @@
1
- /*! securemark v0.232.0 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED */
1
+ /*! securemark v0.232.1 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED */
2
2
  require = function () {
3
3
  function r(e, n, t) {
4
4
  function o(i, f) {
@@ -5807,16 +5807,16 @@ require = function () {
5807
5807
  const util_1 = _dereq_('../util');
5808
5808
  const typed_dom_1 = _dereq_('typed-dom');
5809
5809
  const array_1 = _dereq_('spica/array');
5810
- exports.reply = (0, combinator_1.block)((0, combinator_1.validate)('>', (0, locale_1.localize)((0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.inits)([
5810
+ exports.reply = (0, combinator_1.block)((0, combinator_1.validate)('>', (0, locale_1.localize)((0, combinator_1.fmap)((0, combinator_1.inits)([
5811
5811
  (0, combinator_1.some)((0, combinator_1.inits)([
5812
5812
  cite_1.cite,
5813
5813
  quote_1.quote
5814
5814
  ])),
5815
- (0, combinator_1.subsequence)([
5815
+ (0, combinator_1.some)((0, combinator_1.subsequence)([
5816
5816
  (0, combinator_1.some)(quote_1.quote),
5817
5817
  (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, quote_1.syntax), (0, combinator_1.trim)((0, util_1.visualize)((0, combinator_1.some)(inline_1.inline)))), ns => (0, array_1.push)(ns, [(0, typed_dom_1.html)('br')]))
5818
- ])
5819
- ])), ns => [(0, typed_dom_1.html)('p', (0, typed_dom_1.defrag)((0, array_1.pop)(ns)[0]))]))));
5818
+ ]))
5819
+ ]), ns => [(0, typed_dom_1.html)('p', (0, typed_dom_1.defrag)((0, array_1.pop)(ns)[0]))]))));
5820
5820
  },
5821
5821
  {
5822
5822
  '../../combinator': 27,
@@ -5841,7 +5841,7 @@ require = function () {
5841
5841
  const typed_dom_1 = _dereq_('typed-dom');
5842
5842
  exports.cite = (0, combinator_1.creator)((0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.validate)('>>', (0, combinator_1.reverse)((0, combinator_1.tails)([
5843
5843
  (0, source_1.str)(/^>*(?=>>)/),
5844
- anchor_1.anchor
5844
+ (0, combinator_1.validate)(new RegExp(`${ anchor_1.syntax.source }[^\S\n]*(?:$|\n)`), anchor_1.anchor)
5845
5845
  ]))), ([el, quotes = '']) => [
5846
5846
  (0, typed_dom_1.html)('span', { class: 'cite' }, (0, typed_dom_1.defrag)([
5847
5847
  quotes + '>',
@@ -5873,12 +5873,12 @@ require = function () {
5873
5873
  (0, combinator_1.rewrite)((0, combinator_1.some)((0, combinator_1.validate)(new RegExp(exports.syntax.source.split('|')[0]), source_1.anyline)), qblock),
5874
5874
  (0, combinator_1.rewrite)((0, combinator_1.validate)(new RegExp(exports.syntax.source.split('|').slice(1).join('|')), source_1.anyline), (0, combinator_1.line)((0, combinator_1.union)([(0, source_1.str)(/^.+/)])))
5875
5875
  ])), ns => [
5876
- (0, typed_dom_1.html)('span', ns.length > 1 || /^>+(?=[^\S\n])/.test(ns[0]) ? { class: 'quote' } : {
5876
+ (0, typed_dom_1.html)('span', ns.length > 1 ? { class: 'quote' } : {
5877
5877
  class: 'quote invalid',
5878
5878
  'data-invalid-syntax': 'quote',
5879
5879
  'data-invalid-type': 'syntax',
5880
5880
  'data-invalid-description': `Missing the whitespace after "${ ns[0].split(/[^>]/, 1)[0] }".`
5881
- }, ns),
5881
+ }, (0, typed_dom_1.defrag)(ns)),
5882
5882
  (0, typed_dom_1.html)('br')
5883
5883
  ]), false)));
5884
5884
  const qblock = (source, context) => {
@@ -5908,8 +5908,9 @@ require = function () {
5908
5908
  continue;
5909
5909
  }
5910
5910
  }
5911
+ nodes.unshift('');
5911
5912
  return [
5912
- (0, typed_dom_1.defrag)(nodes),
5913
+ nodes,
5913
5914
  ''
5914
5915
  ];
5915
5916
  };
@@ -6332,12 +6333,13 @@ require = function () {
6332
6333
  function (_dereq_, module, exports) {
6333
6334
  'use strict';
6334
6335
  Object.defineProperty(exports, '__esModule', { value: true });
6335
- exports.anchor = void 0;
6336
+ exports.anchor = exports.syntax = void 0;
6336
6337
  const combinator_1 = _dereq_('../../../combinator');
6337
6338
  const link_1 = _dereq_('../link');
6338
6339
  const source_1 = _dereq_('../../source');
6339
6340
  const typed_dom_1 = _dereq_('typed-dom');
6340
- exports.anchor = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('>>', (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, source_1.str)(/^>>[0-9a-z]+(?:-[0-9a-z]+)*(?![0-9A-Za-z@#:])/), (0, combinator_1.context)({
6341
+ exports.syntax = /^>>[0-9a-z]+(?:-[0-9a-z]+)*(?![0-9A-Za-z@#:])/;
6342
+ exports.anchor = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('>>', (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, source_1.str)(exports.syntax), (0, combinator_1.context)({
6341
6343
  syntax: {
6342
6344
  inline: {
6343
6345
  link: true,
package/package-lock.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "securemark",
3
- "version": "0.232.0",
3
+ "version": "0.232.1",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
@@ -449,9 +449,9 @@
449
449
  },
450
450
  "dependencies": {
451
451
  "lru-cache": {
452
- "version": "7.4.1",
453
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.4.1.tgz",
454
- "integrity": "sha512-NCD7/WRlFmADccuHjsRUYqdluYBr//n/O0fesCb/n52FoGcgKh8o4Dpm7YIbZwVcDs8rPBQbCZLmWWsp6m+xGQ==",
452
+ "version": "7.4.2",
453
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.4.2.tgz",
454
+ "integrity": "sha512-Xs3+hFPDSKQmL05Gs6NhvAADol1u9TmLoNoE03ZjszX6a5iYIO3rPUM4jIjoBUJeTaWEBMozjjmV70gvdRfIdw==",
455
455
  "dev": true
456
456
  },
457
457
  "mkdirp": {
@@ -3024,9 +3024,9 @@
3024
3024
  "dev": true
3025
3025
  },
3026
3026
  "electron-to-chromium": {
3027
- "version": "1.4.77",
3028
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.77.tgz",
3029
- "integrity": "sha512-fiDxw8mO9Ph1Z0bjX2sFTPpi0J0QkOiwOJF+5Q0J0baNc/F9lLePAvDPlnoxvbUYYMizqrKPeotRRkJ9LtxAew==",
3027
+ "version": "1.4.80",
3028
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.80.tgz",
3029
+ "integrity": "sha512-COsbJCGVYCc/aAY4cd94x1Js3q0r406YKGbdL8LXHg0O9dEjuFEFU/vZneRxBxKo/f1lLHi0YyAR7sbFM+i8Bg==",
3030
3030
  "dev": true
3031
3031
  },
3032
3032
  "elliptic": {
@@ -3243,9 +3243,9 @@
3243
3243
  }
3244
3244
  },
3245
3245
  "es5-ext": {
3246
- "version": "0.10.56",
3247
- "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.56.tgz",
3248
- "integrity": "sha512-YUhqzoMnIjMW5y8FzaMxsCu0eWCwq32GrlwhOhbQmL5OiZReWFm/KvRiYuvqf3CaG/zZ36Kyb4KfVe674cafCQ==",
3246
+ "version": "0.10.57",
3247
+ "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.57.tgz",
3248
+ "integrity": "sha512-L7cCNoPwTkAp7IBHxrKLsh7NKiVFkcdxlP9vbVw9QUvb7gF0Mz9bEBN0WY9xqdTjGF907EMT/iG013vnbqwu1Q==",
3249
3249
  "dev": true,
3250
3250
  "requires": {
3251
3251
  "es6-iterator": "^2.0.3",
@@ -6715,9 +6715,9 @@
6715
6715
  }
6716
6716
  },
6717
6717
  "karma-chrome-launcher": {
6718
- "version": "3.1.0",
6719
- "resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-3.1.0.tgz",
6720
- "integrity": "sha512-3dPs/n7vgz1rxxtynpzZTvb9y/GIaW8xjAwcIGttLbycqoFtI7yo1NGnQi6oFTherRE+GIhCAHZC4vEqWGhNvg==",
6718
+ "version": "3.1.1",
6719
+ "resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-3.1.1.tgz",
6720
+ "integrity": "sha512-hsIglcq1vtboGPAN+DGCISCFOxW+ZVnIqhDQcCMqqCp+4dmJ0Qpq5QAjkbA0X2L9Mi6OBkHi2Srrbmm7pUKkzQ==",
6721
6721
  "dev": true,
6722
6722
  "requires": {
6723
6723
  "which": "^1.2.1"
@@ -7090,9 +7090,9 @@
7090
7090
  }
7091
7091
  },
7092
7092
  "make-fetch-happen": {
7093
- "version": "10.0.4",
7094
- "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-10.0.4.tgz",
7095
- "integrity": "sha512-CiReW6usy3UXby5N46XjWfLPFPq1glugCszh18I0NYJCwr129ZAx9j3Dlv+cRsK0q3VjlVysEzhdtdw2+NhdYA==",
7093
+ "version": "10.0.5",
7094
+ "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-10.0.5.tgz",
7095
+ "integrity": "sha512-0JQ0daMRDFEv14DelmcFlprdhSDNG7WEgInTjBeWYWZ78W0jfDqygZdPLhcrQ4s/G8skNhBrS4fiF6xA+YlFjQ==",
7096
7096
  "dev": true,
7097
7097
  "requires": {
7098
7098
  "agentkeepalive": "^4.2.1",
@@ -7101,10 +7101,10 @@
7101
7101
  "http-proxy-agent": "^5.0.0",
7102
7102
  "https-proxy-agent": "^5.0.0",
7103
7103
  "is-lambda": "^1.0.1",
7104
- "lru-cache": "^7.4.0",
7104
+ "lru-cache": "^7.4.1",
7105
7105
  "minipass": "^3.1.6",
7106
7106
  "minipass-collect": "^1.0.2",
7107
- "minipass-fetch": "^2.0.1",
7107
+ "minipass-fetch": "^2.0.2",
7108
7108
  "minipass-flush": "^1.0.5",
7109
7109
  "minipass-pipeline": "^1.2.4",
7110
7110
  "negotiator": "^0.6.3",
@@ -7114,9 +7114,9 @@
7114
7114
  },
7115
7115
  "dependencies": {
7116
7116
  "lru-cache": {
7117
- "version": "7.4.1",
7118
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.4.1.tgz",
7119
- "integrity": "sha512-NCD7/WRlFmADccuHjsRUYqdluYBr//n/O0fesCb/n52FoGcgKh8o4Dpm7YIbZwVcDs8rPBQbCZLmWWsp6m+xGQ==",
7117
+ "version": "7.4.2",
7118
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.4.2.tgz",
7119
+ "integrity": "sha512-Xs3+hFPDSKQmL05Gs6NhvAADol1u9TmLoNoE03ZjszX6a5iYIO3rPUM4jIjoBUJeTaWEBMozjjmV70gvdRfIdw==",
7120
7120
  "dev": true
7121
7121
  }
7122
7122
  }
@@ -7448,9 +7448,9 @@
7448
7448
  }
7449
7449
  },
7450
7450
  "minipass-fetch": {
7451
- "version": "2.0.2",
7452
- "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-2.0.2.tgz",
7453
- "integrity": "sha512-M63u5yWX0yxY1C3DcLVY1xWai0pNM3qa1xCMXFgdejY5F/NTmyzNVHGcBxKerX51lssqxwWWTjpg/ZPuD39gOQ==",
7451
+ "version": "2.0.3",
7452
+ "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-2.0.3.tgz",
7453
+ "integrity": "sha512-VA+eiiUtaIvpQJXISwE3OiMvQwAWrgKb97F0aXlCS1Ahikr8fEQq8m3Hf7Kv9KT3nokuHigJKsDMB6atU04olQ==",
7454
7454
  "dev": true,
7455
7455
  "requires": {
7456
7456
  "encoding": "^0.1.13",
@@ -9158,9 +9158,9 @@
9158
9158
  }
9159
9159
  },
9160
9160
  "read-package-json": {
9161
- "version": "4.1.1",
9162
- "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-4.1.1.tgz",
9163
- "integrity": "sha512-P82sbZJ3ldDrWCOSKxJT0r/CXMWR0OR3KRh55SgKo3p91GSIEEC32v3lSHAvO/UcH3/IoL7uqhOFBduAnwdldw==",
9161
+ "version": "4.1.2",
9162
+ "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-4.1.2.tgz",
9163
+ "integrity": "sha512-Dqer4pqzamDE2O4M55xp1qZMuLPqi4ldk2ya648FOMHRjwMzFhuxVrG04wd0c38IsvkVdr3vgHI6z+QTPdAjrQ==",
9164
9164
  "dev": true,
9165
9165
  "requires": {
9166
9166
  "glob": "^7.1.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "securemark",
3
- "version": "0.232.0",
3
+ "version": "0.232.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,6 +1,6 @@
1
1
  import { ReplyParser } from '../../block';
2
2
  import { tails, line, validate, creator, reverse, fmap } from '../../../combinator';
3
- import { anchor } from '../../inline/autolink/anchor';
3
+ import { anchor, syntax } from '../../inline/autolink/anchor';
4
4
  import { str } from '../../source';
5
5
  import { html, define, defrag } from 'typed-dom';
6
6
 
@@ -8,7 +8,7 @@ export const cite: ReplyParser.CiteParser = creator(line(fmap(validate(
8
8
  '>>',
9
9
  reverse(tails([
10
10
  str(/^>*(?=>>)/),
11
- anchor,
11
+ validate(new RegExp(`${syntax.source}[^\S\n]*(?:$|\n)`), anchor),
12
12
  ]))),
13
13
  ([el, quotes = '']: [HTMLElement, string?]) => [
14
14
  html('span', { class: 'cite' }, defrag([
@@ -20,7 +20,7 @@ export const quote: ReplyParser.QuoteParser = lazy(() => creator(block(fmap(vali
20
20
  ])),
21
21
  (ns: [string, ...(string | HTMLElement)[]]) => [
22
22
  html('span',
23
- ns.length > 1 || /^>+(?=[^\S\n])/.test(ns[0])
23
+ ns.length > 1
24
24
  ? { class: 'quote' }
25
25
  : {
26
26
  class: 'quote invalid',
@@ -28,7 +28,7 @@ export const quote: ReplyParser.QuoteParser = lazy(() => creator(block(fmap(vali
28
28
  'data-invalid-type': 'syntax',
29
29
  'data-invalid-description': `Missing the whitespace after "${ns[0].split(/[^>]/, 1)[0]}".`,
30
30
  },
31
- ns),
31
+ defrag(ns)),
32
32
  html('br'),
33
33
  ]),
34
34
  false)));
@@ -64,9 +64,11 @@ const qblock: ReplyParser.QuoteParser.BlockParser = (source, context) => {
64
64
  continue;
65
65
  }
66
66
  }
67
+ nodes.unshift('');
68
+ assert(nodes.length > 1);
67
69
  assert(nodes.every(n => typeof n === 'string' || n instanceof HTMLElement));
68
70
  assert(quotes.length === 0);
69
- return [defrag(nodes), ''];
71
+ return [nodes, ''];
70
72
  };
71
73
 
72
74
  const text: ReplyParser.QuoteParser.TextParser = union([
@@ -10,18 +10,18 @@ import { html, defrag } from 'typed-dom';
10
10
  import { push, pop } from 'spica/array';
11
11
 
12
12
  export const reply: ReplyParser = block(validate('>', localize(fmap(
13
- some(inits([
13
+ inits([
14
14
  some(inits([
15
15
  cite,
16
16
  quote,
17
17
  ])),
18
- subsequence([
18
+ some(subsequence([
19
19
  some(quote),
20
20
  fmap(
21
21
  rewrite(
22
22
  some(anyline, delimiter),
23
23
  trim(visualize(some(inline)))),
24
24
  ns => push(ns, [html('br')])),
25
- ]),
26
- ])),
25
+ ])),
26
+ ]),
27
27
  ns => [html('p', defrag(pop(ns)[0]))]))));
@@ -4,8 +4,10 @@ import { link } from '../link';
4
4
  import { str } from '../../source';
5
5
  import { define } from 'typed-dom';
6
6
 
7
+ export const syntax = /^>>[0-9a-z]+(?:-[0-9a-z]+)*(?![0-9A-Za-z@#:])/;
8
+
7
9
  export const anchor: AutolinkParser.AnchorParser = lazy(() => validate('>>', fmap(rewrite(
8
- str(/^>>[0-9a-z]+(?:-[0-9a-z]+)*(?![0-9A-Za-z@#:])/),
10
+ str(syntax),
9
11
  context({ syntax: { inline: {
10
12
  link: true,
11
13
  autolink: false,