-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_suite.slim
334 lines (248 loc) · 5.29 KB
/
test_suite.slim
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
323
324
325
326
327
328
329
330
331
332
333
334
/ These are Slim code blocks extracted from the Slim test suite:
https://github.com/slim-template/slim/blob/main/test/literate/TESTS.md
| Text block
|< Text with leading whitespace.
| Text with leading whitespace.
|> Text with trailing whitespace.
|<> Text with both leading and trailing whitespace.
| Text
block
with
multiple
lines
|
Text
block
with
multiple
lines
|><
Text
block
with
multiple
lines
body
| Text
| <a href="http://github.com/slim-template/slim">github.com/slim-template/slim</a>
|<a href="http://github.com/slim-template/slim">github.com/slim-template/slim</a>
' Text block
' Link to
a href="http://github.com/slim-template/slim" github.com/slim-template/slim
' Text
block
with
multiple
lines
'
Text
block
with
multiple
lines
<a href="http://github.com/slim-template/slim">github.com/slim-template/slim</a>
<html>
<head>
title Example
</head>
body
- if true
| yes
- else
| no
</html>
- greeting = 'Hello, World!'
- if false
| Not true
- else
= greeting
- greeting = 'Hello, '+\
\
'World!'
- if false
| Not true
- else
= greeting
- items = [{name: 'table', price: 10}, {name: 'chair', price: 5}]
table#items
- for item in items do
tr
td.name = item[:name]
td.price = item[:price]
- items = [{name: 'table', price: 10}, {name: 'chair', price: 5}]
table#items
- for item in items
tr
td.name = item[:name]
td.price = item[:price]
= 7*7
= '<script>evil();</script>'
= (0..10).map do |i|\
2**i \
end.join(', ')
ruby:
def self.test(*args)
args.join('-')
end
= test('arg1',
'arg2',
'arg3')
=> 7*7
=< 7*7
=<> 7*7
== '<script>evil();</script>'
==> '<script>evil();</script>'
/ Comment
body
/ Another comment
with
multiple lines
p Hello!
/! Comment
body
/! Another comment
with multiple lines
p Hello!
/!
First line determines indentation
of the comment
/[if IE]
p Get a better browser.
doctype xml
doctype xml ISO-8859-1
doctype html
doctype 5
doctype 1.1
doctype strict
doctype frameset
doctype mobile
doctype basic
doctype transitional
doctype html
doctype 5
doctype strict
doctype frameset
doctype transitional
div id="not-closed"
.closed/
#closed/
div id="closed"/
img src="image.png"
a#closed> class="test" /
a#closed> class="test"/
a> href='url1' Link1
a< href='url1' Link1
a> => 'Text1'
a => 'Text2'
a> = 'Text3'
a>= 'Text4'
a=> 'Text5'
a<= 'Text6'
a=< 'Text7'
a#closed< class="test" /
a#closed< class="test"/
a< href='url1' Link1
a< href='url2' Link2
a#closed<> class="test" /
a#closed>< class="test"/
a<> href='url1' Link1
a<> href='url2' Link2
ul
li.first: a href="/first" First
li: a href="/second" Second
ul
li.first: a(href="/first") First
li: a(href="/second") Second
li
a(href="http://github.com/slim-template/slim" class="important") Link
li
a[href="http://github.com/slim-template/slim" class="important"] Link
li
a{href="http://github.com/slim-template/slim" class="important"} Link
a(href="http://github.com/slim-template/slim"
class="important") Link
dl(
itemprop='address'
itemscope
itemtype='http://schema.org/PostalAddress'
)
h1 id = "logo" Logo
h2 [ id = "tagline" ] Tagline
a href="http://github.com/slim-template/slim" title='Slim Homepage' Goto the Slim homepage
- url='github.com/slim-template/slim'
a href="http://#{url}" Goto the #{url}
a href="{"test"}" Test of quoted text in braces
li
a href='&' Link
li
a href=="&" Link
a data-title="help" data-content="extremely long help text that goes on
and one and one and then starts over...." Link
a data-title="help" data-content="extremely long help text that goes on\
and one and one and then starts over...." Link
ruby:
def self.test(*args)
args.join('-')
end
a href=some_path
a[href=some_path]
a(href=some_path)
a{href=some_path}
a href=1+\
1 Link
a href=some_method('arg1',
100,
path: "arg2",
variant: 'arg3')
- true_value1 = ""
- true_value2 = true
input type="text" disabled=true_value1
input type="text" disabled=true_value2
input type="text" disabled="disabled"
input type="text" disabled=true
input(type="text" disabled)
- false_value1 = false
- false_value2 = nil
input type="text" disabled=false_value1
input type="text" disabled=false_value2
input type="text"
input type="text" disabled=false
input type="text" disabled=nil
a.menu class="highlight" href="http://github.com/slim-template/slim/" github.com/slim-template/slim
- classes = [:alpha, :beta]
span class=["first","highlight"] class=classes First
span class=:second,:highlight class=classes Second
ruby:
def self.a_unless_current
@page_current ? {tag: 'span'} : {tag: 'a', href: 'http://github.com/slim-template/slim/'}
end
- @page_current = true
*a_unless_current Link
- @page_current = false
*a_unless_current Link
.test
.#test
.test
#test
.-test text
#test- text
.--a#b- text
.a--test-123#--b text
.a-1/2#b-1/2 text
.ab:c-test#d:e text
- user="John Doe <john@doe.net>"
h1 Welcome #{user}!
doctype xml
document
closed-element/
element(boolean-attribute)
child attribute="value"
| content
/ Tailwind CSS
span.text-2xl.text-gray-500/90.dark:hover:text-blue-500/30
| Hello, World!
markdown:
# Hello, World!
Something **important** and _emphasized_.
- Item 1
- Item 2