forked from baixing/jedi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjedi.txt
271 lines (210 loc) · 4.08 KB
/
jedi.txt
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
PHP
<? if (isset($info)): ?>
<div class="alert"><?= $info ?></div>
<? endif ?>
<? if (isset($steps)): ?>
<ol class="process">
<? foreach ($steps as $step): ?>
<li><?= $step ?>
<? endforeach ?>
</ol>
<? endif ?>
Jade
if info
div.alert= info
if steps
ol.process
each step in steps
li= step
Jedi
:if info
div.alert
= info
:if steps
ol.process
:for step in steps
li = step
if {info}, () ->
node div.alert, null, () ->
node anonymous, info, () -> null
Jedi (terse syntax)
div.alert if info
= info
ol.process
:for step in steps
li = step
Jedi (even more terse)
div.alert = info
ol.process for step in steps
li = step
Jedi (even more terse)
div.alert = info
ol.process = steps
li = *
Jedi (more examples)
nav > ul for cat in categories
li > a = cat.link
= cat.label | i18n 'zh'
table let fields = ['name', 'gender', 'age', 'tel']
:for field in fields
col.{field}
thead
tr > th "Name" + th "Gender" + th "Age" + th "Tel"
tbody = users
tr for field in fields
td = *.[field]
div.a.b#id markdown
ol = path.segments
case
li > a = *
:define bx:crumbs
ol = model
li
a = *
:content
bx:crumbs = path
@a-class segment
@li-title *.fullName
:if x > 90
p 'A
:else if x > 80
p 'B
:else if x > 70
p 'C
:else
p 'D
dl.contact#pid = contact
dt 'First Name
dd = *.firstName
dt 'Last Name
dd = *.lastName
ul.contacts = contacts
li > dl.contact#pid-{*.id}
dt 'First Name
dd = *.firstName
dt 'Last Name
dd = *.lastName
信息架构
ul.contacts
= myself
= contacts starred
= contacts unstarred
第一个实现
ul.contacts
= myself
li.me > h1 = *.fullName
= contacts starred
li.starred > dl.contact#pid-{*.id}
dt 'First Name
dd = *.firstName
dt 'Last Name
dd = *.lastName
= contacts unstarred
li > *.fullName
复用
:define dl.contact
dt 'First Name
dd = *.firstName
dt 'Last Name
dd = *.lastName
ul.contacts
= myself
li.me > h1 = *.fullName
= contacts starred
li.starred > dl.contact#pid-{*.id} = *
= contacts unstarred
li.unstarred > dl.contact#pid-{*.id} = *
复用是针对模型的
:define dl (contact)
@class += 'contact'
dt 'First Name
dd = contact.firstName
dt 'Last Name
dd = contact.lastName
ul.contacts
= myself
li.me > h1 = *.fullName
= contacts starred
li.starred > dl = *
= contacts unstarred
li.unstarred > dl = *
dl = myself
:define dl (any)
@dataset = any.meta
:macro bx:contact (contact)
:attr SpacedIDs class
dl.contact#pid-{contact.id}
@class += class
dt 'First Name
dd = contact.firstName
dt 'Last Name
dd = contact.lastName
ul.contacts
= myself
li.me > h1 = *.fullName
= contacts starred
li > bx:contact.starred = *
= contacts unstarred
li > bx:contact.unstarred = *
:define bx:contact (contact)
:attr SpacedIDs class
:attr CommaedIDs order
dl.contact#pid-{contact.id}
@class += class
dt 'First Name
dd = contact.firstName
dt 'Last Name
dd = contact.lastName
ul.contacts
= myself
li.me > h1 = *.fullName
= contacts starred
li > bx:contact.starred = *
@order = 'last, first'
= contacts unstarred
li > bx:contact.unstarred = *
:define bx:contact
li.starred > dl.contact#pid-{*.id}
dt 'First Name
dd = *.firstName
dt 'Last Name
dd = *.lastName
ul.contacts
= myself
li.me > h1 = *.fullName
= contacts starred
bx:contact = *
= contacts unstarred
li > p = *.fullName
div match score
'A' case > 90
'B' case > 80
'C' case > 70
'D' case *
:define button
startTag
attrs #attr
content
endTag
:define bx:if
@extend bx:div
div.container#myDiv (if @test)
#content
:if help
button
startTag
attrs
endTag
:define html:button extends html:@element
if ie < 8:
@type 'button
else:
if ieq:
div.{@tagName}
.test
:define bx
开启数据绑定后,默认自动更新,但是表单控件除外,默认会被锁定(lock)
会要求必须处理model-refresh事件,从最外层的form控件capture阶段开始。
最基本的元素:
宏定义
属性