securemark 0.291.1 → 0.292.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 +4 -0
- package/design.md +13 -2
- package/dist/index.js +1093 -756
- package/markdown.d.ts +17 -17
- package/package.json +1 -1
- package/src/combinator/control/constraint/block.test.ts +8 -5
- package/src/combinator/control/constraint/block.ts +9 -9
- package/src/combinator/control/constraint/contract.ts +20 -28
- package/src/combinator/control/constraint/line.test.ts +9 -6
- package/src/combinator/control/constraint/line.ts +21 -22
- package/src/combinator/control/manipulation/convert.ts +29 -13
- package/src/combinator/control/manipulation/fence.ts +18 -15
- package/src/combinator/control/manipulation/indent.test.ts +17 -14
- package/src/combinator/control/manipulation/indent.ts +15 -8
- package/src/combinator/control/manipulation/match.ts +11 -10
- package/src/combinator/control/manipulation/recovery.ts +6 -2
- package/src/combinator/control/manipulation/scope.ts +37 -38
- package/src/combinator/control/manipulation/surround.ts +78 -60
- package/src/combinator/control/manipulation/trim.test.ts +12 -9
- package/src/combinator/control/monad/bind.ts +16 -16
- package/src/combinator/control/monad/fmap.ts +6 -6
- package/src/combinator/data/parser/context/delimiter.ts +8 -7
- package/src/combinator/data/parser/context.test.ts +19 -14
- package/src/combinator/data/parser/context.ts +20 -16
- package/src/combinator/data/parser/inits.ts +13 -14
- package/src/combinator/data/parser/sequence.test.ts +16 -15
- package/src/combinator/data/parser/sequence.ts +13 -14
- package/src/combinator/data/parser/some.test.ts +19 -18
- package/src/combinator/data/parser/some.ts +13 -15
- package/src/combinator/data/parser/subsequence.test.ts +22 -21
- package/src/combinator/data/parser/subsequence.ts +3 -3
- package/src/combinator/data/parser/tails.ts +3 -3
- package/src/combinator/data/parser/union.test.ts +16 -15
- package/src/combinator/data/parser/union.ts +2 -2
- package/src/combinator/data/parser.ts +66 -28
- package/src/debug.test.ts +3 -3
- package/src/parser/api/bind.ts +3 -3
- package/src/parser/api/header.ts +7 -6
- package/src/parser/api/normalize.ts +2 -2
- package/src/parser/api/parse.test.ts +14 -15
- package/src/parser/api/parse.ts +3 -3
- package/src/parser/autolink.test.ts +19 -17
- package/src/parser/block/blockquote.test.ts +86 -84
- package/src/parser/block/blockquote.ts +4 -2
- package/src/parser/block/codeblock.test.ts +58 -56
- package/src/parser/block/codeblock.ts +3 -3
- package/src/parser/block/dlist.test.ts +58 -56
- package/src/parser/block/extension/aside.test.ts +10 -8
- package/src/parser/block/extension/aside.ts +1 -1
- package/src/parser/block/extension/example.test.ts +20 -18
- package/src/parser/block/extension/example.ts +3 -3
- package/src/parser/block/extension/fig.test.ts +38 -36
- package/src/parser/block/extension/fig.ts +1 -1
- package/src/parser/block/extension/figbase.test.ts +17 -15
- package/src/parser/block/extension/figure.test.ts +64 -62
- package/src/parser/block/extension/figure.ts +3 -2
- package/src/parser/block/extension/message.test.ts +15 -13
- package/src/parser/block/extension/message.ts +3 -3
- package/src/parser/block/extension/placeholder.test.ts +3 -1
- package/src/parser/block/extension/table.test.ts +73 -71
- package/src/parser/block/extension/table.ts +5 -5
- package/src/parser/block/extension.test.ts +3 -1
- package/src/parser/block/heading.test.ts +65 -64
- package/src/parser/block/heading.ts +3 -3
- package/src/parser/block/ilist.test.ts +3 -1
- package/src/parser/block/ilist.ts +3 -3
- package/src/parser/block/mathblock.test.ts +33 -31
- package/src/parser/block/mathblock.ts +1 -1
- package/src/parser/block/mediablock.ts +2 -2
- package/src/parser/block/olist.test.ts +99 -97
- package/src/parser/block/olist.ts +2 -2
- package/src/parser/block/pagebreak.test.ts +17 -15
- package/src/parser/block/pagebreak.ts +1 -1
- package/src/parser/block/paragraph.test.ts +60 -57
- package/src/parser/block/reply/cite.test.ts +41 -39
- package/src/parser/block/reply/cite.ts +3 -3
- package/src/parser/block/reply/quote.test.ts +52 -50
- package/src/parser/block/reply.test.ts +21 -19
- package/src/parser/block/sidefence.test.ts +51 -49
- package/src/parser/block/table.test.ts +51 -50
- package/src/parser/block/table.ts +6 -6
- package/src/parser/block/ulist.test.ts +52 -50
- package/src/parser/block/ulist.ts +2 -2
- package/src/parser/block.ts +6 -5
- package/src/parser/context.ts +1 -0
- package/src/parser/header.test.ts +22 -21
- package/src/parser/header.ts +25 -13
- package/src/parser/inline/annotation.test.ts +44 -42
- package/src/parser/inline/annotation.ts +2 -2
- package/src/parser/inline/autolink/account.test.ts +32 -30
- package/src/parser/inline/autolink/account.ts +1 -1
- package/src/parser/inline/autolink/anchor.test.ts +23 -21
- package/src/parser/inline/autolink/anchor.ts +1 -1
- package/src/parser/inline/autolink/channel.test.ts +16 -14
- package/src/parser/inline/autolink/channel.ts +2 -2
- package/src/parser/inline/autolink/email.test.ts +38 -36
- package/src/parser/inline/autolink/email.ts +2 -2
- package/src/parser/inline/autolink/hashnum.test.ts +39 -37
- package/src/parser/inline/autolink/hashnum.ts +1 -1
- package/src/parser/inline/autolink/hashtag.test.ts +58 -56
- package/src/parser/inline/autolink/hashtag.ts +1 -1
- package/src/parser/inline/autolink/url.test.ts +76 -74
- package/src/parser/inline/autolink/url.ts +6 -6
- package/src/parser/inline/bracket.test.ts +69 -67
- package/src/parser/inline/bracket.ts +32 -32
- package/src/parser/inline/code.test.ts +32 -29
- package/src/parser/inline/code.ts +20 -13
- package/src/parser/inline/deletion.test.ts +29 -27
- package/src/parser/inline/deletion.ts +2 -2
- package/src/parser/inline/emphasis.test.ts +40 -36
- package/src/parser/inline/emphasis.ts +2 -2
- package/src/parser/inline/emstrong.test.ts +102 -96
- package/src/parser/inline/emstrong.ts +96 -36
- package/src/parser/inline/extension/index.test.ts +91 -89
- package/src/parser/inline/extension/index.ts +18 -30
- package/src/parser/inline/extension/indexee.ts +1 -1
- package/src/parser/inline/extension/indexer.test.ts +26 -24
- package/src/parser/inline/extension/indexer.ts +1 -1
- package/src/parser/inline/extension/label.test.ts +34 -32
- package/src/parser/inline/extension/placeholder.test.ts +44 -42
- package/src/parser/inline/extension/placeholder.ts +11 -8
- package/src/parser/inline/html.test.ts +108 -106
- package/src/parser/inline/html.ts +24 -23
- package/src/parser/inline/htmlentity.test.ts +39 -37
- package/src/parser/inline/htmlentity.ts +9 -3
- package/src/parser/inline/insertion.test.ts +29 -27
- package/src/parser/inline/insertion.ts +2 -2
- package/src/parser/inline/italic.test.ts +55 -53
- package/src/parser/inline/italic.ts +2 -2
- package/src/parser/inline/link.test.ts +187 -185
- package/src/parser/inline/link.ts +30 -12
- package/src/parser/inline/mark.test.ts +31 -29
- package/src/parser/inline/mark.ts +3 -3
- package/src/parser/inline/math.test.ts +133 -131
- package/src/parser/inline/math.ts +2 -2
- package/src/parser/inline/media.test.ts +93 -91
- package/src/parser/inline/media.ts +41 -17
- package/src/parser/inline/reference.test.ts +110 -108
- package/src/parser/inline/reference.ts +48 -39
- package/src/parser/inline/remark.test.ts +53 -51
- package/src/parser/inline/remark.ts +3 -3
- package/src/parser/inline/ruby.test.ts +46 -44
- package/src/parser/inline/ruby.ts +24 -27
- package/src/parser/inline/shortmedia.test.ts +11 -9
- package/src/parser/inline/strong.test.ts +37 -33
- package/src/parser/inline/strong.ts +6 -3
- package/src/parser/inline/template.test.ts +24 -22
- package/src/parser/inline/template.ts +20 -11
- package/src/parser/inline.test.ts +221 -220
- package/src/parser/inline.ts +13 -8
- package/src/parser/segment.ts +13 -8
- package/src/parser/source/escapable.test.ts +24 -22
- package/src/parser/source/escapable.ts +26 -41
- package/src/parser/source/line.test.ts +19 -17
- package/src/parser/source/line.ts +3 -3
- package/src/parser/source/str.ts +28 -11
- package/src/parser/source/text.test.ts +85 -83
- package/src/parser/source/text.ts +26 -54
- package/src/parser/source/unescapable.test.ts +24 -22
- package/src/parser/source/unescapable.ts +18 -33
- package/src/parser/source.ts +1 -1
- package/src/parser/util.ts +36 -33
- package/src/parser/visibility.ts +19 -15
- package/src/util/quote.ts +4 -2
|
@@ -1,38 +1,40 @@
|
|
|
1
1
|
import { table } from './table';
|
|
2
2
|
import { some } from '../../../combinator';
|
|
3
|
+
import { input } from '../../../combinator/data/parser';
|
|
3
4
|
import { inspect } from '../../../debug.test';
|
|
4
5
|
import { html } from 'typed-dom/dom';
|
|
5
6
|
|
|
6
7
|
describe('Unit: parser/block/extension/table', () => {
|
|
7
8
|
describe('table', () => {
|
|
8
|
-
const parser = (source: string) => some(table)(
|
|
9
|
+
const parser = (source: string) => some(table)(input(source, ctx));
|
|
10
|
+
const { context: ctx } = input('', {});
|
|
9
11
|
|
|
10
12
|
it('invalid', () => {
|
|
11
|
-
assert.deepStrictEqual(inspect(parser('~~~table a\n-\n~~~')), [['<pre class="invalid" translate="no">~~~table a\n-\n~~~</pre>'], '']);
|
|
12
|
-
assert.deepStrictEqual(inspect(parser(`~~~table\n0${'\n'.repeat(10001)}~~~`), '>'), [['<pre class="invalid" translate="no">'], '']);
|
|
13
|
+
assert.deepStrictEqual(inspect(parser('~~~table a\n-\n~~~'), ctx), [['<pre class="invalid" translate="no">~~~table a\n-\n~~~</pre>'], '']);
|
|
14
|
+
assert.deepStrictEqual(inspect(parser(`~~~table\n0${'\n'.repeat(10001)}~~~`), ctx, '>'), [['<pre class="invalid" translate="no">'], '']);
|
|
13
15
|
});
|
|
14
16
|
|
|
15
17
|
it('data', () => {
|
|
16
18
|
assert.deepStrictEqual(
|
|
17
|
-
inspect(parser('~~~table\n~~~')),
|
|
19
|
+
inspect(parser('~~~table\n~~~'), ctx),
|
|
18
20
|
[[html('table').outerHTML], '']);
|
|
19
21
|
assert.deepStrictEqual(
|
|
20
|
-
inspect(parser('~~~table\n\n~~~\n')),
|
|
22
|
+
inspect(parser('~~~table\n\n~~~\n'), ctx),
|
|
21
23
|
[[html('table', [html('thead', [html('tr')]), html('tbody'), html('tfoot')]).outerHTML], '']);
|
|
22
24
|
assert.deepStrictEqual(
|
|
23
|
-
inspect(parser('~~~table\n-\n~~~')),
|
|
25
|
+
inspect(parser('~~~table\n-\n~~~'), ctx),
|
|
24
26
|
[[html('table', [html('thead', [html('tr')]), html('tbody'), html('tfoot')]).outerHTML], '']);
|
|
25
27
|
assert.deepStrictEqual(
|
|
26
|
-
inspect(parser('~~~table\n-\n\n~~~')),
|
|
28
|
+
inspect(parser('~~~table\n-\n\n~~~'), ctx),
|
|
27
29
|
[[html('table', [html('thead', [html('tr')]), html('tbody'), html('tfoot')]).outerHTML], '']);
|
|
28
30
|
assert.deepStrictEqual(
|
|
29
|
-
inspect(parser('~~~table\n0\n\n~~~')),
|
|
31
|
+
inspect(parser('~~~table\n0\n\n~~~'), ctx),
|
|
30
32
|
[[html('table', [html('thead'), html('tbody', [html('tr', [html('td', '0')])]), html('tfoot')]).outerHTML], '']);
|
|
31
33
|
assert.deepStrictEqual(
|
|
32
|
-
inspect(parser('~~~table\n:\n~~~')),
|
|
34
|
+
inspect(parser('~~~table\n:\n~~~'), ctx),
|
|
33
35
|
[[html('table', [html('thead'), html('tbody', [html('tr', [html('td')])]), html('tfoot'),]).outerHTML], '']);
|
|
34
36
|
assert.deepStrictEqual(
|
|
35
|
-
inspect(parser('~~~table\n1.1\n~~~')),
|
|
37
|
+
inspect(parser('~~~table\n1.1\n~~~'), ctx),
|
|
36
38
|
[[html('table', [
|
|
37
39
|
html('thead'),
|
|
38
40
|
html('tbody', [
|
|
@@ -41,7 +43,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
41
43
|
html('tfoot'),
|
|
42
44
|
]).outerHTML], '']);
|
|
43
45
|
assert.deepStrictEqual(
|
|
44
|
-
inspect(parser('~~~table\n1.1\n1.2\n\n1.3\n~~~')),
|
|
46
|
+
inspect(parser('~~~table\n1.1\n1.2\n\n1.3\n~~~'), ctx),
|
|
45
47
|
[[html('table', [
|
|
46
48
|
html('thead'),
|
|
47
49
|
html('tbody', [
|
|
@@ -50,7 +52,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
50
52
|
html('tfoot'),
|
|
51
53
|
]).outerHTML], '']);
|
|
52
54
|
assert.deepStrictEqual(
|
|
53
|
-
inspect(parser('~~~table\n1.1\n-\n2.1\n~~~')),
|
|
55
|
+
inspect(parser('~~~table\n1.1\n-\n2.1\n~~~'), ctx),
|
|
54
56
|
[[html('table', [
|
|
55
57
|
html('thead'),
|
|
56
58
|
html('tbody', [
|
|
@@ -60,7 +62,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
60
62
|
html('tfoot'),
|
|
61
63
|
]).outerHTML], '']);
|
|
62
64
|
assert.deepStrictEqual(
|
|
63
|
-
inspect(parser('~~~table\n: 1.1\n0\n~~~')),
|
|
65
|
+
inspect(parser('~~~table\n: 1.1\n0\n~~~'), ctx),
|
|
64
66
|
[[html('table', [
|
|
65
67
|
html('thead'),
|
|
66
68
|
html('tbody', [
|
|
@@ -69,7 +71,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
69
71
|
html('tfoot'),
|
|
70
72
|
]).outerHTML], '']);
|
|
71
73
|
assert.deepStrictEqual(
|
|
72
|
-
inspect(parser('~~~table\n: 1.1\n: 1.2\n~~~')),
|
|
74
|
+
inspect(parser('~~~table\n: 1.1\n: 1.2\n~~~'), ctx),
|
|
73
75
|
[[html('table', [
|
|
74
76
|
html('thead'),
|
|
75
77
|
html('tbody', [
|
|
@@ -78,7 +80,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
78
80
|
html('tfoot'),
|
|
79
81
|
]).outerHTML], '']);
|
|
80
82
|
assert.deepStrictEqual(
|
|
81
|
-
inspect(parser('~~~table\n: 1.1\n\n1.2\n~~~')),
|
|
83
|
+
inspect(parser('~~~table\n: 1.1\n\n1.2\n~~~'), ctx),
|
|
82
84
|
[[html('table', [
|
|
83
85
|
html('thead'),
|
|
84
86
|
html('tbody', [
|
|
@@ -87,7 +89,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
87
89
|
html('tfoot'),
|
|
88
90
|
]).outerHTML], '']);
|
|
89
91
|
assert.deepStrictEqual(
|
|
90
|
-
inspect(parser('~~~table\n1.1\n: 1.2\n:1:1 1.3\n\n: 1.4\n~~~')),
|
|
92
|
+
inspect(parser('~~~table\n1.1\n: 1.2\n:1:1 1.3\n\n: 1.4\n~~~'), ctx),
|
|
91
93
|
[[html('table', [
|
|
92
94
|
html('thead'),
|
|
93
95
|
html('tbody', [
|
|
@@ -96,7 +98,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
96
98
|
html('tfoot'),
|
|
97
99
|
]).outerHTML], '']);
|
|
98
100
|
assert.deepStrictEqual(
|
|
99
|
-
inspect(parser('~~~table\n:\n1\n~~~')),
|
|
101
|
+
inspect(parser('~~~table\n:\n1\n~~~'), ctx),
|
|
100
102
|
[[html('table', [
|
|
101
103
|
html('thead'),
|
|
102
104
|
html('tbody', [
|
|
@@ -105,7 +107,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
105
107
|
html('tfoot'),
|
|
106
108
|
]).outerHTML], '']);
|
|
107
109
|
assert.deepStrictEqual(
|
|
108
|
-
inspect(parser('~~~table\n: \n1\n~~~')),
|
|
110
|
+
inspect(parser('~~~table\n: \n1\n~~~'), ctx),
|
|
109
111
|
[[html('table', [
|
|
110
112
|
html('thead'),
|
|
111
113
|
html('tbody', [
|
|
@@ -114,7 +116,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
114
116
|
html('tfoot'),
|
|
115
117
|
]).outerHTML], '']);
|
|
116
118
|
assert.deepStrictEqual(
|
|
117
|
-
inspect(parser('~~~table\n: \n 1\n~~~')),
|
|
119
|
+
inspect(parser('~~~table\n: \n 1\n~~~'), ctx),
|
|
118
120
|
[[html('table', [
|
|
119
121
|
html('thead'),
|
|
120
122
|
html('tbody', [
|
|
@@ -123,7 +125,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
123
125
|
html('tfoot'),
|
|
124
126
|
]).outerHTML], '']);
|
|
125
127
|
assert.deepStrictEqual(
|
|
126
|
-
inspect(parser('~~~table\n: \n\n1\n~~~')),
|
|
128
|
+
inspect(parser('~~~table\n: \n\n1\n~~~'), ctx),
|
|
127
129
|
[[html('table', [
|
|
128
130
|
html('thead'),
|
|
129
131
|
html('tbody', [
|
|
@@ -132,7 +134,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
132
134
|
html('tfoot'),
|
|
133
135
|
]).outerHTML], '']);
|
|
134
136
|
assert.deepStrictEqual(
|
|
135
|
-
inspect(parser('~~~table\n\\ \n\\ \n~~~')),
|
|
137
|
+
inspect(parser('~~~table\n\\ \n\\ \n~~~'), ctx),
|
|
136
138
|
[[html('table', [
|
|
137
139
|
html('thead'),
|
|
138
140
|
html('tbody', [
|
|
@@ -141,11 +143,11 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
141
143
|
html('tfoot'),
|
|
142
144
|
]).outerHTML], '']);
|
|
143
145
|
assert.deepStrictEqual(
|
|
144
|
-
inspect(parser('~~~table\n: \\ \n\\ \n0\n~~~')),
|
|
146
|
+
inspect(parser('~~~table\n: \\ \n\\ \n0\n~~~'), ctx),
|
|
145
147
|
[[html('table', [
|
|
146
148
|
html('thead'),
|
|
147
149
|
html('tbody', [
|
|
148
|
-
html('tr', [html('td', ['\\', html('br'), '\\', html('br'), '0'])]),
|
|
150
|
+
html('tr', [html('td', ['\\ ', html('br'), '\\ ', html('br'), '0'])]),
|
|
149
151
|
]),
|
|
150
152
|
html('tfoot'),
|
|
151
153
|
]).outerHTML], '']);
|
|
@@ -153,16 +155,16 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
153
155
|
|
|
154
156
|
it('align', () => {
|
|
155
157
|
assert.deepStrictEqual(
|
|
156
|
-
inspect(parser('~~~table\n-=<>\n~~~')),
|
|
158
|
+
inspect(parser('~~~table\n-=<>\n~~~'), ctx),
|
|
157
159
|
[[html('table', [html('thead', [html('tr')]), html('tbody'), html('tfoot')]).outerHTML], '']);
|
|
158
160
|
assert.deepStrictEqual(
|
|
159
|
-
inspect(parser('~~~table\n-=<>/-=^v\n~~~')),
|
|
161
|
+
inspect(parser('~~~table\n-=<>/-=^v\n~~~'), ctx),
|
|
160
162
|
[[html('table', [html('thead', [html('tr')]), html('tbody'), html('tfoot')]).outerHTML], '']);
|
|
161
163
|
assert.deepStrictEqual(
|
|
162
|
-
inspect(parser('~~~table\n-/-=^v\n~~~')),
|
|
164
|
+
inspect(parser('~~~table\n-/-=^v\n~~~'), ctx),
|
|
163
165
|
[[html('table', [html('thead', [html('tr')]), html('tbody'), html('tfoot')]).outerHTML], '']);
|
|
164
166
|
assert.deepStrictEqual(
|
|
165
|
-
inspect(parser('~~~table\n-=^v\n~~~')),
|
|
167
|
+
inspect(parser('~~~table\n-=^v\n~~~'), ctx),
|
|
166
168
|
[[html('table', [
|
|
167
169
|
html('thead'),
|
|
168
170
|
html('tbody', [
|
|
@@ -170,7 +172,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
170
172
|
]),
|
|
171
173
|
html('tfoot')]).outerHTML], '']);
|
|
172
174
|
assert.deepStrictEqual(
|
|
173
|
-
inspect(parser('~~~table\n=-<>\n1.1\n1.2\n1.3\n1.4\n1.5\n1.6\n~~~')),
|
|
175
|
+
inspect(parser('~~~table\n=-<>\n1.1\n1.2\n1.3\n1.4\n1.5\n1.6\n~~~'), ctx),
|
|
174
176
|
[[html('table', [
|
|
175
177
|
html('thead'),
|
|
176
178
|
html('tbody', [
|
|
@@ -186,7 +188,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
186
188
|
html('tfoot'),
|
|
187
189
|
]).outerHTML], '']);
|
|
188
190
|
assert.deepStrictEqual(
|
|
189
|
-
inspect(parser('~~~table\n=<\n-\n2.1\n2.2\n2.3\n~~~')),
|
|
191
|
+
inspect(parser('~~~table\n=<\n-\n2.1\n2.2\n2.3\n~~~'), ctx),
|
|
190
192
|
[[html('table', [
|
|
191
193
|
html('thead', [html('tr')]),
|
|
192
194
|
html('tbody', [
|
|
@@ -199,7 +201,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
199
201
|
html('tfoot'),
|
|
200
202
|
]).outerHTML], '']);
|
|
201
203
|
assert.deepStrictEqual(
|
|
202
|
-
inspect(parser('~~~table\n=<\n=\n2.1\n2.2\n2.3\n~~~')),
|
|
204
|
+
inspect(parser('~~~table\n=<\n=\n2.1\n2.2\n2.3\n~~~'), ctx),
|
|
203
205
|
[[html('table', [
|
|
204
206
|
html('thead', [html('tr')]),
|
|
205
207
|
html('tbody', [
|
|
@@ -212,7 +214,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
212
214
|
html('tfoot'),
|
|
213
215
|
]).outerHTML], '']);
|
|
214
216
|
assert.deepStrictEqual(
|
|
215
|
-
inspect(parser('~~~table\n=<\n=-\n2.1\n2.2\n2.3\n~~~')),
|
|
217
|
+
inspect(parser('~~~table\n=<\n=-\n2.1\n2.2\n2.3\n~~~'), ctx),
|
|
216
218
|
[[html('table', [
|
|
217
219
|
html('thead', [html('tr')]),
|
|
218
220
|
html('tbody', [
|
|
@@ -225,7 +227,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
225
227
|
html('tfoot'),
|
|
226
228
|
]).outerHTML], '']);
|
|
227
229
|
assert.deepStrictEqual(
|
|
228
|
-
inspect(parser('~~~table\n-/=-^v\n1.1\n1.2\n1.3\n1.4\n1.5\n1.6\n~~~')),
|
|
230
|
+
inspect(parser('~~~table\n-/=-^v\n1.1\n1.2\n1.3\n1.4\n1.5\n1.6\n~~~'), ctx),
|
|
229
231
|
[[html('table', [
|
|
230
232
|
html('thead'),
|
|
231
233
|
html('tbody', [
|
|
@@ -241,7 +243,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
241
243
|
html('tfoot'),
|
|
242
244
|
]).outerHTML], '']);
|
|
243
245
|
assert.deepStrictEqual(
|
|
244
|
-
inspect(parser('~~~table\n-/=^\n-/-\n2.1\n2.2\n2.3\n~~~')),
|
|
246
|
+
inspect(parser('~~~table\n-/=^\n-/-\n2.1\n2.2\n2.3\n~~~'), ctx),
|
|
245
247
|
[[html('table', [
|
|
246
248
|
html('thead', [html('tr')]),
|
|
247
249
|
html('tbody', [
|
|
@@ -257,10 +259,10 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
257
259
|
|
|
258
260
|
it('head', () => {
|
|
259
261
|
assert.deepStrictEqual(
|
|
260
|
-
inspect(parser('~~~table\n#\n~~~')),
|
|
262
|
+
inspect(parser('~~~table\n#\n~~~'), ctx),
|
|
261
263
|
[[html('table', [html('thead', [html('tr', [html('th')])]), html('tbody'), html('tfoot'),]).outerHTML], '']);
|
|
262
264
|
assert.deepStrictEqual(
|
|
263
|
-
inspect(parser('~~~table\n-\n# 1.1\n~~~')),
|
|
265
|
+
inspect(parser('~~~table\n-\n# 1.1\n~~~'), ctx),
|
|
264
266
|
[[html('table', [
|
|
265
267
|
html('thead', [
|
|
266
268
|
html('tr', [html('th', '1.1')]),
|
|
@@ -268,7 +270,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
268
270
|
html('tbody'),
|
|
269
271
|
html('tfoot')]).outerHTML], '']);
|
|
270
272
|
assert.deepStrictEqual(
|
|
271
|
-
inspect(parser('~~~table\n-/-\n# 1.1\n~~~')),
|
|
273
|
+
inspect(parser('~~~table\n-/-\n# 1.1\n~~~'), ctx),
|
|
272
274
|
[[html('table', [
|
|
273
275
|
html('thead', [
|
|
274
276
|
html('tr', [html('th', '1.1')]),
|
|
@@ -276,7 +278,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
276
278
|
html('tbody'),
|
|
277
279
|
html('tfoot')]).outerHTML], '']);
|
|
278
280
|
assert.deepStrictEqual(
|
|
279
|
-
inspect(parser('~~~table\n# 1.1\n~~~')),
|
|
281
|
+
inspect(parser('~~~table\n# 1.1\n~~~'), ctx),
|
|
280
282
|
[[html('table', [
|
|
281
283
|
html('thead', [
|
|
282
284
|
html('tr', [html('th', '1.1')]),
|
|
@@ -284,7 +286,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
284
286
|
html('tbody'),
|
|
285
287
|
html('tfoot')]).outerHTML], '']);
|
|
286
288
|
assert.deepStrictEqual(
|
|
287
|
-
inspect(parser('~~~table\n# 1.1\n: 1.2\n~~~')),
|
|
289
|
+
inspect(parser('~~~table\n# 1.1\n: 1.2\n~~~'), ctx),
|
|
288
290
|
[[html('table', [
|
|
289
291
|
html('thead'),
|
|
290
292
|
html('tbody', [
|
|
@@ -295,7 +297,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
295
297
|
|
|
296
298
|
it('foot', () => {
|
|
297
299
|
assert.deepStrictEqual(
|
|
298
|
-
inspect(parser('~~~table\n1.1\n-\n# 2.1\n~~~')),
|
|
300
|
+
inspect(parser('~~~table\n1.1\n-\n# 2.1\n~~~'), ctx),
|
|
299
301
|
[[html('table', [
|
|
300
302
|
html('thead'),
|
|
301
303
|
html('tbody', [
|
|
@@ -308,7 +310,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
308
310
|
|
|
309
311
|
it('highlight', () => {
|
|
310
312
|
assert.deepStrictEqual(
|
|
311
|
-
inspect(parser('~~~table\n#! 1.1\n~~~')),
|
|
313
|
+
inspect(parser('~~~table\n#! 1.1\n~~~'), ctx),
|
|
312
314
|
[[html('table', [
|
|
313
315
|
html('thead', [
|
|
314
316
|
html('tr', [html('th', { class: 'highlight' }, '1.1')]),
|
|
@@ -317,7 +319,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
317
319
|
html('tfoot'),
|
|
318
320
|
]).outerHTML], '']);
|
|
319
321
|
assert.deepStrictEqual(
|
|
320
|
-
inspect(parser('~~~table\n:! 1.1\n~~~')),
|
|
322
|
+
inspect(parser('~~~table\n:! 1.1\n~~~'), ctx),
|
|
321
323
|
[[html('table', [
|
|
322
324
|
html('thead'),
|
|
323
325
|
html('tbody', [
|
|
@@ -326,7 +328,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
326
328
|
html('tfoot'),
|
|
327
329
|
]).outerHTML], '']);
|
|
328
330
|
assert.deepStrictEqual(
|
|
329
|
-
inspect(parser('~~~table\n#! 1.1\n: 1.2\n~~~')),
|
|
331
|
+
inspect(parser('~~~table\n#! 1.1\n: 1.2\n~~~'), ctx),
|
|
330
332
|
[[html('table', [
|
|
331
333
|
html('thead'),
|
|
332
334
|
html('tbody', [
|
|
@@ -338,7 +340,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
338
340
|
html('tfoot'),
|
|
339
341
|
]).outerHTML], '']);
|
|
340
342
|
assert.deepStrictEqual(
|
|
341
|
-
inspect(parser('~~~table\n: 1.1\n#! 1.2\n~~~')),
|
|
343
|
+
inspect(parser('~~~table\n: 1.1\n#! 1.2\n~~~'), ctx),
|
|
342
344
|
[[html('table', [
|
|
343
345
|
html('thead'),
|
|
344
346
|
html('tbody', [
|
|
@@ -350,7 +352,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
350
352
|
html('tfoot'),
|
|
351
353
|
]).outerHTML], '']);
|
|
352
354
|
assert.deepStrictEqual(
|
|
353
|
-
inspect(parser('~~~table\n#! 1.1\n-\n: 2.1\n~~~')),
|
|
355
|
+
inspect(parser('~~~table\n#! 1.1\n-\n: 2.1\n~~~'), ctx),
|
|
354
356
|
[[html('table', [
|
|
355
357
|
html('thead', [
|
|
356
358
|
html('tr', [html('th', { class: 'highlight' }, '1.1')]),
|
|
@@ -361,7 +363,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
361
363
|
html('tfoot'),
|
|
362
364
|
]).outerHTML], '']);
|
|
363
365
|
assert.deepStrictEqual(
|
|
364
|
-
inspect(parser('~~~table\n#! 1.1\n-\n:!+ 2.1\n~~~')),
|
|
366
|
+
inspect(parser('~~~table\n#! 1.1\n-\n:!+ 2.1\n~~~'), ctx),
|
|
365
367
|
[[html('table', [
|
|
366
368
|
html('thead', [
|
|
367
369
|
html('tr', [html('th', { class: 'highlight' }, '1.1')]),
|
|
@@ -372,7 +374,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
372
374
|
html('tfoot'),
|
|
373
375
|
]).outerHTML], '']);
|
|
374
376
|
assert.deepStrictEqual(
|
|
375
|
-
inspect(parser('~~~table\n#!+ 1.1\n-\n: 2.1\n~~~')),
|
|
377
|
+
inspect(parser('~~~table\n#!+ 1.1\n-\n: 2.1\n~~~'), ctx),
|
|
376
378
|
[[html('table', [
|
|
377
379
|
html('thead', [
|
|
378
380
|
html('tr', [html('th', { class: 'highlight', 'data-highlight-extension': '+' }, '1.1')]),
|
|
@@ -383,7 +385,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
383
385
|
html('tfoot'),
|
|
384
386
|
]).outerHTML], '']);
|
|
385
387
|
assert.deepStrictEqual(
|
|
386
|
-
inspect(parser('~~~table\n#!+ 1.1\n# 1.2\n: 1.3\n~~~')),
|
|
388
|
+
inspect(parser('~~~table\n#!+ 1.1\n# 1.2\n: 1.3\n~~~'), ctx),
|
|
387
389
|
[[html('table', [
|
|
388
390
|
html('thead'),
|
|
389
391
|
html('tbody', [
|
|
@@ -396,7 +398,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
396
398
|
html('tfoot'),
|
|
397
399
|
]).outerHTML], '']);
|
|
398
400
|
assert.deepStrictEqual(
|
|
399
|
-
inspect(parser('~~~table\n: 1.1\n# 1.2\n#!+ 1.3\n~~~')),
|
|
401
|
+
inspect(parser('~~~table\n: 1.1\n# 1.2\n#!+ 1.3\n~~~'), ctx),
|
|
400
402
|
[[html('table', [
|
|
401
403
|
html('thead'),
|
|
402
404
|
html('tbody', [
|
|
@@ -409,7 +411,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
409
411
|
html('tfoot'),
|
|
410
412
|
]).outerHTML], '']);
|
|
411
413
|
assert.deepStrictEqual(
|
|
412
|
-
inspect(parser('~~~table\n#!+ 1.1\n-\n# 2.1\n-\n: 3.1\n~~~')),
|
|
414
|
+
inspect(parser('~~~table\n#!+ 1.1\n-\n# 2.1\n-\n: 3.1\n~~~'), ctx),
|
|
413
415
|
[[html('table', [
|
|
414
416
|
html('thead', [
|
|
415
417
|
html('tr', [html('th', { class: 'highlight', 'data-highlight-extension': '+' }, '1.1')]),
|
|
@@ -421,7 +423,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
421
423
|
html('tfoot'),
|
|
422
424
|
]).outerHTML], '']);
|
|
423
425
|
assert.deepStrictEqual(
|
|
424
|
-
inspect(parser('~~~table\n#:2!+ 1.1\n: 1.3\n~~~')),
|
|
426
|
+
inspect(parser('~~~table\n#:2!+ 1.1\n: 1.3\n~~~'), ctx),
|
|
425
427
|
[[html('table', [
|
|
426
428
|
html('thead'),
|
|
427
429
|
html('tbody', [
|
|
@@ -433,7 +435,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
433
435
|
html('tfoot'),
|
|
434
436
|
]).outerHTML], '']);
|
|
435
437
|
assert.deepStrictEqual(
|
|
436
|
-
inspect(parser('~~~table\n#2:!+ 1.1\n-\n: 3.1\n~~~')),
|
|
438
|
+
inspect(parser('~~~table\n#2:!+ 1.1\n-\n: 3.1\n~~~'), ctx),
|
|
437
439
|
[[html('table', [
|
|
438
440
|
html('thead', [
|
|
439
441
|
html('tr', [html('th', { class: 'highlight', rowspan: '2', 'data-highlight-extension': '+' }, '1.1')]),
|
|
@@ -444,7 +446,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
444
446
|
html('tfoot'),
|
|
445
447
|
]).outerHTML], '']);
|
|
446
448
|
assert.deepStrictEqual(
|
|
447
|
-
inspect(parser('~~~table\n-\n# \n#!+ 1.2\n-\n#!+ 2.1\n: 2.2\n~~~')),
|
|
449
|
+
inspect(parser('~~~table\n-\n# \n#!+ 1.2\n-\n#!+ 2.1\n: 2.2\n~~~'), ctx),
|
|
448
450
|
[[html('table', [
|
|
449
451
|
html('thead', [
|
|
450
452
|
html('tr', [
|
|
@@ -461,7 +463,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
461
463
|
html('tfoot'),
|
|
462
464
|
]).outerHTML], '']);
|
|
463
465
|
assert.deepStrictEqual(
|
|
464
|
-
inspect(parser('~~~table\n-\n# \n#!+ 1.2\n-\n#!+ 2.1\n:! 2.2\n~~~')),
|
|
466
|
+
inspect(parser('~~~table\n-\n# \n#!+ 1.2\n-\n#!+ 2.1\n:! 2.2\n~~~'), ctx),
|
|
465
467
|
[[html('table', [
|
|
466
468
|
html('thead', [
|
|
467
469
|
html('tr', [
|
|
@@ -478,7 +480,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
478
480
|
html('tfoot'),
|
|
479
481
|
]).outerHTML], '']);
|
|
480
482
|
assert.deepStrictEqual(
|
|
481
|
-
inspect(parser('~~~table\n-\n# 1.1\n#!+ 1.2\n-\n# 2.1\n:2:2 2.2\n: 2.4\n-\n#!+ 3.1\n: 3.4\n-\n# 4.1\n: 4.2\n~~~')),
|
|
483
|
+
inspect(parser('~~~table\n-\n# 1.1\n#!+ 1.2\n-\n# 2.1\n:2:2 2.2\n: 2.4\n-\n#!+ 3.1\n: 3.4\n-\n# 4.1\n: 4.2\n~~~'), ctx),
|
|
482
484
|
[[html('table', [
|
|
483
485
|
html('thead', [
|
|
484
486
|
html('tr', [
|
|
@@ -504,7 +506,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
504
506
|
html('tfoot'),
|
|
505
507
|
]).outerHTML], '']);
|
|
506
508
|
assert.deepStrictEqual(
|
|
507
|
-
inspect(parser('~~~table\n-\n# 1.1\n#:2!+ 1.2\n-\n#2:!+ 2.1\n: 2.2\n-\n3.2\n3.3\n~~~')),
|
|
509
|
+
inspect(parser('~~~table\n-\n# 1.1\n#:2!+ 1.2\n-\n#2:!+ 2.1\n: 2.2\n-\n3.2\n3.3\n~~~'), ctx),
|
|
508
510
|
[[html('table', [
|
|
509
511
|
html('thead', [
|
|
510
512
|
html('tr', [
|
|
@@ -530,7 +532,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
530
532
|
`-\n# 1\n${[...Array(32)].map((_, i) => `: ${i + 2}`).join('\n')}`,
|
|
531
533
|
`-\n#!+ 1\n${[...Array(32)].map((_, i) => `: ${i + 2}`).join('\n')}`,
|
|
532
534
|
'~~~'
|
|
533
|
-
].join('\n'))),
|
|
535
|
+
].join('\n')), ctx),
|
|
534
536
|
[[html('table', [
|
|
535
537
|
html('thead'),
|
|
536
538
|
html('tbody', [
|
|
@@ -550,7 +552,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
550
552
|
`-\n${[...Array(32)].map((_, i) => `: ${i + 1}`).join('\n')}\n# 33`,
|
|
551
553
|
`-\n${[...Array(32)].map((_, i) => `: ${i + 1}`).join('\n')}\n#!+ 33`,
|
|
552
554
|
'~~~'
|
|
553
|
-
].join('\n'))),
|
|
555
|
+
].join('\n')), ctx),
|
|
554
556
|
[[html('table', [
|
|
555
557
|
html('thead'),
|
|
556
558
|
html('tbody', [
|
|
@@ -570,7 +572,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
570
572
|
`-\n${[...Array(32)].map((_, i) => `# ${i + 1}`).join('\n')}\n#!+ 33`,
|
|
571
573
|
`-\n${[...Array(33)].map((_, i) => `: ${i + 1}`).join('\n')}`,
|
|
572
574
|
'~~~'
|
|
573
|
-
].join('\n'))),
|
|
575
|
+
].join('\n')), ctx),
|
|
574
576
|
[[html('table', [
|
|
575
577
|
html('thead', [
|
|
576
578
|
html('tr', [
|
|
@@ -590,7 +592,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
590
592
|
'~~~table',
|
|
591
593
|
`${[...Array(7)].map((_, i) => `#${'!'.repeat(i + 1)} ${i + 1}`).join('\n')}`,
|
|
592
594
|
'~~~'
|
|
593
|
-
].join('\n'))),
|
|
595
|
+
].join('\n')), ctx),
|
|
594
596
|
[[html('table', [
|
|
595
597
|
html('thead', [
|
|
596
598
|
html('tr', [
|
|
@@ -607,7 +609,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
607
609
|
'~~~table',
|
|
608
610
|
`${[...Array(7)].map((_, i) => `:${'!'.repeat(i + 1)} ${i + 1}`).join('\n')}`,
|
|
609
611
|
'~~~'
|
|
610
|
-
].join('\n'))),
|
|
612
|
+
].join('\n')), ctx),
|
|
611
613
|
[[html('table', [
|
|
612
614
|
html('thead'),
|
|
613
615
|
html('tbody', [
|
|
@@ -620,7 +622,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
620
622
|
html('tfoot'),
|
|
621
623
|
]).outerHTML], '']);
|
|
622
624
|
assert.deepStrictEqual(
|
|
623
|
-
inspect(parser('~~~table\n#!+ 1\n: 2\n:! 3\n~~~')),
|
|
625
|
+
inspect(parser('~~~table\n#!+ 1\n: 2\n:! 3\n~~~'), ctx),
|
|
624
626
|
[[html('table', [
|
|
625
627
|
html('thead'),
|
|
626
628
|
html('tbody', [
|
|
@@ -633,7 +635,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
633
635
|
html('tfoot'),
|
|
634
636
|
]).outerHTML], '']);
|
|
635
637
|
assert.deepStrictEqual(
|
|
636
|
-
inspect(parser('~~~table\n! 1.1\n!!!!!! 1.2\n!!!!!!! 1.3\n~~~')),
|
|
638
|
+
inspect(parser('~~~table\n! 1.1\n!!!!!! 1.2\n!!!!!!! 1.3\n~~~'), ctx),
|
|
637
639
|
[[html('table', [
|
|
638
640
|
html('thead'),
|
|
639
641
|
html('tbody', [
|
|
@@ -649,7 +651,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
649
651
|
|
|
650
652
|
it('merge', () => {
|
|
651
653
|
assert.deepStrictEqual(
|
|
652
|
-
inspect(parser('~~~table\n:: 1.1\n~~~')),
|
|
654
|
+
inspect(parser('~~~table\n:: 1.1\n~~~'), ctx),
|
|
653
655
|
[[html('table', [
|
|
654
656
|
html('thead'),
|
|
655
657
|
html('tbody', [
|
|
@@ -658,7 +660,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
658
660
|
html('tfoot'),
|
|
659
661
|
]).outerHTML], '']);
|
|
660
662
|
assert.deepStrictEqual(
|
|
661
|
-
inspect(parser('~~~table\n:0:0 1.1\n~~~')),
|
|
663
|
+
inspect(parser('~~~table\n:0:0 1.1\n~~~'), ctx),
|
|
662
664
|
[[html('table', [
|
|
663
665
|
html('thead'),
|
|
664
666
|
html('tbody', [
|
|
@@ -667,7 +669,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
667
669
|
html('tfoot'),
|
|
668
670
|
]).outerHTML], '']);
|
|
669
671
|
assert.deepStrictEqual(
|
|
670
|
-
inspect(parser('~~~table\n:01:01 1.1\n~~~')),
|
|
672
|
+
inspect(parser('~~~table\n:01:01 1.1\n~~~'), ctx),
|
|
671
673
|
[[html('table', [
|
|
672
674
|
html('thead'),
|
|
673
675
|
html('tbody', [
|
|
@@ -676,7 +678,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
676
678
|
html('tfoot'),
|
|
677
679
|
]).outerHTML], '']);
|
|
678
680
|
assert.deepStrictEqual(
|
|
679
|
-
inspect(parser('~~~table\n:1:1 1.1\n~~~')),
|
|
681
|
+
inspect(parser('~~~table\n:1:1 1.1\n~~~'), ctx),
|
|
680
682
|
[[html('table', [
|
|
681
683
|
html('thead'),
|
|
682
684
|
html('tbody', [
|
|
@@ -685,7 +687,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
685
687
|
html('tfoot'),
|
|
686
688
|
]).outerHTML], '']);
|
|
687
689
|
assert.deepStrictEqual(
|
|
688
|
-
inspect(parser('~~~table\n:2: 1.1\n~~~')),
|
|
690
|
+
inspect(parser('~~~table\n:2: 1.1\n~~~'), ctx),
|
|
689
691
|
[[html('table', [
|
|
690
692
|
html('thead'),
|
|
691
693
|
html('tbody', [
|
|
@@ -694,7 +696,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
694
696
|
html('tfoot'),
|
|
695
697
|
]).outerHTML], '']);
|
|
696
698
|
assert.deepStrictEqual(
|
|
697
|
-
inspect(parser('~~~table\n::2 1.1\n~~~')),
|
|
699
|
+
inspect(parser('~~~table\n::2 1.1\n~~~'), ctx),
|
|
698
700
|
[[html('table', [
|
|
699
701
|
html('thead'),
|
|
700
702
|
html('tbody', [
|
|
@@ -703,7 +705,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
703
705
|
html('tfoot'),
|
|
704
706
|
]).outerHTML], '']);
|
|
705
707
|
assert.deepStrictEqual(
|
|
706
|
-
inspect(parser('~~~table\n:2:3 1.1\n~~~')),
|
|
708
|
+
inspect(parser('~~~table\n:2:3 1.1\n~~~'), ctx),
|
|
707
709
|
[[html('table', [
|
|
708
710
|
html('thead'),
|
|
709
711
|
html('tbody', [
|
|
@@ -715,10 +717,10 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
715
717
|
|
|
716
718
|
it('type', () => {
|
|
717
719
|
assert.deepStrictEqual(
|
|
718
|
-
inspect(parser('~~~table/invalid\n~~~')),
|
|
720
|
+
inspect(parser('~~~table/invalid\n~~~'), ctx),
|
|
719
721
|
[['<pre class="invalid" translate="no">~~~table/invalid\n~~~</pre>'], '']);
|
|
720
722
|
assert.deepStrictEqual(
|
|
721
|
-
inspect(parser('~~~table/grid\n~~~')),
|
|
723
|
+
inspect(parser('~~~table/grid\n~~~'), ctx),
|
|
722
724
|
[[html('table', { 'data-type': 'grid' }).outerHTML], '']);
|
|
723
725
|
});
|
|
724
726
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { max, min, isArray } from 'spica/alias';
|
|
2
2
|
import { ExtensionParser } from '../../block';
|
|
3
|
-
import { Node, eval } from '../../../combinator/data/parser';
|
|
3
|
+
import { Node, eval, input } from '../../../combinator/data/parser';
|
|
4
4
|
import { union, subsequence, inits, some, block, line, validate, fence, rewrite, clear, surround, open, convert, dup, lazy, fmap } from '../../../combinator';
|
|
5
5
|
import { inline, medialink, media, shortmedia } from '../../inline';
|
|
6
6
|
import { str, anyline, emptyline, contentline } from '../../source';
|
|
@@ -25,7 +25,7 @@ export const segment_: TableParser.SegmentParser = block(validate('~~~',
|
|
|
25
25
|
export const table: TableParser = block(validate('~~~', fmap(
|
|
26
26
|
fence(opener, 10000),
|
|
27
27
|
// Bug: Type mismatch between outer and inner.
|
|
28
|
-
([body, overflow, closer, opener, delim, type, param]: string[],
|
|
28
|
+
([body, overflow, closer, opener, delim, type, param]: string[], context) => {
|
|
29
29
|
if (!closer || overflow || param.trimStart()) return [html('pre', {
|
|
30
30
|
class: 'invalid',
|
|
31
31
|
translate: 'no',
|
|
@@ -39,7 +39,7 @@ export const table: TableParser = block(validate('~~~', fmap(
|
|
|
39
39
|
switch (type) {
|
|
40
40
|
case 'grid':
|
|
41
41
|
case undefined:
|
|
42
|
-
return (eval(parser(
|
|
42
|
+
return (eval(parser(input(body, { ...context }))) ?? [html('table')])
|
|
43
43
|
.map(el => define(el, { 'data-type': type }));
|
|
44
44
|
default:
|
|
45
45
|
return [html('pre', {
|
|
@@ -114,8 +114,8 @@ const dataline: CellParser.DatalineParser = line(
|
|
|
114
114
|
rewrite(
|
|
115
115
|
contentline,
|
|
116
116
|
union([
|
|
117
|
-
validate(/^!+\s/, convert(source => `:${source}`, data,
|
|
118
|
-
convert(source => `: ${source}`, data,
|
|
117
|
+
validate(/^!+\s/, convert(source => `:${source}`, data, false)),
|
|
118
|
+
convert(source => `: ${source}`, data, false),
|
|
119
119
|
])));
|
|
120
120
|
|
|
121
121
|
function attributes(source: string): Record<string, string | undefined> {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { extension } from './extension';
|
|
2
2
|
import { some } from '../../combinator';
|
|
3
|
+
import { input } from '../../combinator/data/parser';
|
|
3
4
|
|
|
4
5
|
describe('Unit: parser/block/extension', () => {
|
|
5
6
|
describe('extension', () => {
|
|
6
|
-
const parser = (source: string) => some(extension)(
|
|
7
|
+
const parser = (source: string) => some(extension)(input(source, ctx));
|
|
8
|
+
const { context: ctx } = input('', {});
|
|
7
9
|
|
|
8
10
|
it('invalid', () => {
|
|
9
11
|
assert(!parser(''));
|