forked from santoshrajan/lispyscript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhtml.ls
More file actions
355 lines (242 loc) · 7.04 KB
/
Copy pathhtml.ls
File metadata and controls
355 lines (242 loc) · 7.04 KB
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
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
(macro !-- (rest...)
(str "<!-- " ~rest... " -->"))
(macro a (rest...)
(_LS.expandTag "a" ~rest...))
(macro abbr (rest...)
(_LS.expandTag "abbr" ~rest...))
(macro address (rest...)
(_LS.expandTag "address" ~rest...))
(macro area (rest...)
(_LS.expandTag "area" ~rest...))
(macro article (rest...)
(_LS.expandTag "article" ~rest...))
(macro aside (rest...)
(_LS.expandTag "aside" ~rest...))
(macro audio (rest...)
(_LS.expandTag "audio" ~rest...))
(macro b (rest...)
(_LS.expandTag "b" ~rest...))
(macro base (rest...)
(_LS.expandTag "base" ~rest...))
(macro bdi (rest...)
(_LS.expandTag "bdi" ~rest...))
(macro bdo (rest...)
(_LS.expandTag "bdo" ~rest...))
(macro blockquote (rest...)
(_LS.expandTag "blockquote" ~rest...))
(macro body (rest...)
(_LS.expandTag "body" ~rest...))
(macro br (rest...)
(_LS.expandTag "br" ~rest...))
(macro button (rest...)
(_LS.expandTag "button" ~rest...))
(macro canvas (rest...)
(_LS.expandTag "canvas" ~rest...))
(macro caption (rest...)
(_LS.expandTag "caption" ~rest...))
(macro cite (rest...)
(_LS.expandTag "cite" ~rest...))
(macro code (rest...)
(_LS.expandTag "code" ~rest...))
(macro col (rest...)
(_LS.expandTag "col" ~rest...))
(macro colgroup (rest...)
(_LS.expandTag "colgroup" ~rest...))
(macro command (rest...)
(_LS.expandTag "command" ~rest...))
;; (macro data (rest...)
;; (_LS.expandTag "data" ~rest...))
(macro datalist (rest...)
(_LS.expandTag "datalist" ~rest...))
(macro dd (rest...)
(_LS.expandTag "dd" ~rest...))
(macro del (rest...)
(_LS.expandTag "del" ~rest...))
(macro details (rest...)
(_LS.expandTag "details" ~rest...))
(macro dfn (rest...)
(_LS.expandTag "dfn" ~rest...))
(macro div (rest...)
(_LS.expandTag "div" ~rest...))
(macro dl (rest...)
(_LS.expandTag "dl" ~rest...))
(macro dt (rest...)
(_LS.expandTag "dt" ~rest...))
(macro em (rest...)
(_LS.expandTag "em" ~rest...))
(macro embed (rest...)
(_LS.expandTag "embed" ~rest...))
;;(macro eventsource (rest...)
;; (_LS.expandTag "eventsource" ~rest...))
(macro fieldset (rest...)
(_LS.expandTag "filedset" ~rest...))
(macro figcaption (rest...)
(_LS.expandTag "figcaption" ~rest...))
(macro figure (rest...)
(_LS.expandTag "figure" ~rest...))
(macro footer (rest...)
(_LS.expandTag "footer" ~rest...))
(macro form (rest...)
(_LS.expandTag "form" ~rest...))
(macro h1 (rest...)
(_LS.expandTag "h1" ~rest...))
(macro h2 (rest...)
(_LS.expandTag "h2" ~rest...))
(macro h3 (rest...)
(_LS.expandTag "h3" ~rest...))
(macro h4 (rest...)
(_LS.expandTag "h4" ~rest...))
(macro h5 (rest...)
(_LS.expandTag "h5" ~rest...))
(macro h6 (rest...)
(_LS.expandTag "h6" ~rest...))
(macro head (rest...)
(_LS.expandTag "head" ~rest...))
(macro header (rest...)
(_LS.expandTag "header" ~rest...))
(macro hgroup (rest...)
(_LS.expandTag "hgroup" ~rest...))
(macro hr (rest...)
(_LS.expandTag "hr" ~rest...))
(macro html (rest...)
(+ "<!DOCTYPE html>\n" (_LS.expandTag "html" ~rest...)))
(macro i (rest...)
(_LS.expandTag "i" ~rest...))
(macro iframe (rest...)
(_LS.expandTag "iframe" ~rest...))
(macro img (rest...)
(_LS.expandTag "img" ~rest...))
(macro input (rest...)
(_LS.expandTag "input" ~rest...))
(macro ins (rest...)
(_LS.expandTag "ins" ~rest...))
(macro kbd (rest...)
(_LS.expandTag "kbd" ~rest...))
(macro keygen (rest...)
(_LS.expandTag "keygen" ~rest...))
(macro label (rest...)
(_LS.expandTag "label" ~rest...))
(macro legend (rest...)
(_LS.expandTag "legend" ~rest...))
(macro li (rest...)
(_LS.expandTag "li" ~rest...))
(macro link (rest...)
(_LS.expandTag "link" ~rest...))
(macro map (rest...)
(_LS.expandTag "map" ~rest...))
(macro mark (rest...)
(_LS.expandTag "mark" ~rest...))
(macro menu (rest...)
(_LS.expandTag "menu" ~rest...))
(macro meta (rest...)
(_LS.expandTag "meta" ~rest...))
(macro meter (rest...)
(_LS.expandTag "meter" ~rest...))
(macro nav (rest...)
(_LS.expandTag "nav" ~rest...))
(macro noscript (rest...)
(_LS.expandTag "noscript" ~rest...))
;; Trashes lispyscript 'object' statement
;; (macro object (rest...)
;; (_LS.expandTag "object" ~rest...))
(macro ol (rest...)
(_LS.expandTag "ol" ~rest...))
(macro optgroup (rest...)
(_LS.expandTag "optgroup" ~rest...))
(macro option (rest...)
(_LS.expandTag "option" ~rest...))
(macro output (rest...)
(_LS.expandTag "output" ~rest...))
(macro p (rest...)
(_LS.expandTag "p" ~rest...))
(macro param (rest...)
(_LS.expandTag "param" ~rest...))
(macro pre (rest...)
(_LS.expandTag "pre" ~rest...))
(macro progress (rest...)
(_LS.expandTag "progress" ~rest...))
(macro q (rest...)
(_LS.expandTag "q" ~rest...))
(macro rt (rest...)
(_LS.expandTag "rt" ~rest...))
(macro rp (rest...)
(_LS.expandTag "rp" ~rest...))
(macro ruby (rest...)
(_LS.expandTag "ruby" ~rest...))
(macro s (rest...)
(_LS.expandTag "s" ~rest...))
(macro samp (rest...)
(_LS.expandTag "samp" ~rest...))
(macro script (rest...)
(_LS.expandTag "script" ~rest...))
(macro section (rest...)
(_LS.expandTag "section" ~rest...))
(macro select (rest...)
(_LS.expandTag "select" ~rest...))
(macro small (rest...)
(_LS.expandTag "small" ~rest...))
(macro source (rest...)
(_LS.expandTag "source" ~rest...))
(macro span (rest...)
(_LS.expandTag "span" ~rest...))
(macro strong (rest...)
(_LS.expandTag "strong" ~rest...))
(macro style (rest...)
(_LS.expandTag "style" ~rest...))
(macro sub (rest...)
(_LS.expandTag "sub" ~rest...))
(macro summary (rest...)
(_LS.expandTag "summary" ~rest...))
(macro sup (rest...)
(_LS.expandTag "sup" ~rest...))
(macro table (rest...)
(_LS.expandTag "table" ~rest...))
(macro tbody (rest...)
(_LS.expandTag "tbody" ~rest...))
(macro td (rest...)
(_LS.expandTag "td" ~rest...))
(macro textarea (rest...)
(_LS.expandTag "textarea" ~rest...))
(macro tfoot (rest...)
(_LS.expandTag "tfoot" ~rest...))
(macro th (rest...)
(_LS.expandTag "th" ~rest...))
(macro thead (rest...)
(_LS.expandTag "thead" ~rest...))
(macro time (rest...)
(_LS.expandTag "time" ~rest...))
(macro title (rest...)
(_LS.expandTag "title" ~rest...))
(macro tr (rest...)
(_LS.expandTag "tr" ~rest...))
(macro track (rest...)
(_LS.expandTag "track" ~rest...))
(macro u (rest...)
(_LS.expandTag "u" ~rest...))
(macro ul (rest...)
(_LS.expandTag "ul" ~rest...))
;; 'var' will trash javascript var so use _var instead
(macro _var (rest...)
(_LS.expandTag "var" ~rest...))
(macro video (rest...)
(_LS.expandTag "video" ~rest...))
(macro wbr (rest...)
(_LS.expandTag "wbr" ~rest...))
(var _LS (|| _LS {}))
(set _LS.expandTag
(function (name attr)
(var args (Array.prototype.slice.call arguments))
(var ret "")
(if (string? name)
(do
(set ret (+ "<" name))
(args.shift)
(if (object? attr)
(do
(set ret (+ ret (template-repeat-key attr " " key "=" "\"" value "\"")))
(args.shift)))
(if (|| (> args.length 0) (= name "script"))
(set ret (str ret ">" (args.join "") "</" name ">"))
(set ret (+ ret "/>")))
ret)
"")))