File: attributes.test

package info (click to toggle)
haskell-djot 0.1.2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 560 kB
  • sloc: haskell: 3,440; makefile: 3
file content (322 lines) | stat: -rw-r--r-- 4,064 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
An inline attribute attaches to the preceding element, which might
be complex (span, emphasis, link) or a simple word (defined as a
sequence of non-ASCII-whitespace characters).
```
foo привет{.ru}
.
<p>foo <span class="ru">привет</span></p>
```

```
(some text){.attr}
.
<p>(some <span class="attr">text)</span></p>
```

```
[some text]{.attr}
.
<p><span class="attr">some text</span></p>
```

Ensure that emphasis that starts before the attribute can still close,
even if the attribute contains a potential closer.

```
a *b{#id key="*"}*
.
<p>a <strong><span id="id" key="*">b</span></strong></p>
```

```
a *b{#id key="*"}o
.
<p>a <span id="id" key="*">*b</span>o</p>
```

Don't mind braces in quotes:

```
hi{key="{#hi"}
.
<p><span key="{#hi">hi</span></p>
```

Process escapes correctly:

```
hi{key="\\\\\*"}

{key="\\\\\*"}
foo
.
<p><span key="\\*">hi</span></p>
<p key="\\*">foo</p>
```

Don't allow attributes to start when we're parsing a potential
attribute.

```
hi\{key="abc{#hi}"
.
<p>hi{key=“<span id="hi">abc</span>”</p>
```

```
hi{key="\"#hi"}
.
<p><span key="&quot;#hi">hi</span></p>
```

```
hi{key="hi\"#hi"}
.
<p><span key="hi&quot;#hi">hi</span></p>
```

Line break:

```
hi{#id .class
key="value"}
.
<p><span id="id" class="class" key="value">hi</span></p>
```

Here there is nothing for the attribute to attach to:

```
{#id} at beginning
.
<p> at beginning</p>
```

```
After {#id} space
{.class}
.
<p>After  space
</p>
```

Block attributes come before the block, on a line by themselves.

```
{#id .class}
A paragraph
.
<p id="id" class="class">A paragraph</p>
```

Use indentation if you need to continue the attributes over a line break.

```
{#id .class
  style="color:red"}
A paragraph
.
<p id="id" class="class" style="color:red">A paragraph</p>
```

If the attribute block can't be parsed as attributes, it will be
parsed as a regular paragraph:

```
{#id .cla*ss*
.
<p>{#id .cla<strong>ss</strong></p>
```

You can use consecutive attribute blocks.
In case of conflict, later values take precedence over earlier ones,
but classes accumulate:

```
{#id}
{key=val}
{.foo .bar}
{key=val2}
{.baz}
{#id2}
Okay
.
<p class="foo bar baz" key="val2" id="id2">Okay</p>
```

Attributes on different kinds of blocks:

```
{#id}
> Block quote
.
<blockquote id="id">
<p>Block quote</p>
</blockquote>
```

```
{#id}
# Heading
.
<section id="id">
<h1>Heading</h1>
</section>
```

```
{.blue}
- - - - -
.
<hr class="blue">
```

````
{highlight=3}
``` ruby
x = 3
```
.
<pre highlight="3"><code class="language-ruby">x = 3
</code></pre>
````

```
{.special}
1. one
2. two
.
<ol class="special">
<li>
one
</li>
<li>
two
</li>
</ol>
```

```
> {.foo}
> > {.bar}
> > nested
.
<blockquote>
<blockquote class="foo">
<p class="bar">nested</p>
</blockquote>
</blockquote>
```

Comments start at a `%` character
(not in quotes) and end with another `%` or
the end of the attribute (`}`).
These can be used to comment up an attribute
list or without any real attributes.

```
foo{#ident % this is a comment % .class}
.
<p><span id="ident" class="class">foo</span></p>
```

```
foo{#ident % this is a comment}
.
<p><span id="ident">foo</span></p>
```

In block-level comment, subsequent lines must
be indented, as with attributes:

```
{% This is  a comment before a
  block-level item. %}
Paragraph.
.
<p>Paragraph.</p>
```

Inline attributes can be empty:

```
hi{}
.
<p>hi</p>
```

Block attributes can be empty:

```
{}
hi
.
<p>hi</p>
```

Non-attributes:

```
text{a=x

hello
.
<p>text{a=x</p>
<p>hello</p>
```

skip ```
skip {a=x
skip hello
skip .
skip <p>{a=x
skip hello</p>
skip ```

```
text{a=x
# non-heading
.
<p>text{a=x
# non-heading</p>
```

skip ```
skip {a=x
skip # non-heading
skip .
skip <p>{a=x
skip # non-heading</p>
skip ```

```
{a=" inline text
.
<p>{a=“ inline text</p>
```


```
{
 attr="long
 value
 spanning
 multiple
 lines"
 }
> a
.
<blockquote attr="long value spanning multiple lines">
<p>a</p>
</blockquote>
```

```
> {key="bar
>    a\$bim"}
> ou
.
<blockquote>
<p key="bar a$bim">ou</p>
</blockquote>
```