-
Notifications
You must be signed in to change notification settings - Fork 1
/
html.go
562 lines (450 loc) · 13.1 KB
/
html.go
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
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
package htmx
import (
"io"
)
// Doctype represents the HTML doctype declaration.
func Doctype(sibling Node) Node {
return NodeFunc(func(w io.Writer) error {
if _, err := w.Write([]byte("<!DOCTYPE html>")); err != nil {
return err
}
return sibling.Render(w)
})
}
// CustomElement represents a custom HTML element.
func CustomElement(tag string, children ...Node) Node {
return Element(tag, children...)
}
// A represents an HTML anchor element.
func A(children ...Node) Node {
return Element("a", children...)
}
// Address represents an HTML address element.
func Address(children ...Node) Node {
return Element("address", children...)
}
// Area represents an HTML area element.
func Area(children ...Node) Node {
return Element("area", children...)
}
// Article represents an HTML article element.
func Article(children ...Node) Node {
return Element("article", children...)
}
// Aside represents an HTML aside element.
func Aside(children ...Node) Node {
return Element("aside", children...)
}
// Audio represents an HTML audio element.
func Audio(children ...Node) Node {
return Element("audio", children...)
}
// Base represents an HTML base element.
func Base(children ...Node) Node {
return Element("base", children...)
}
// BlockQuote represents an HTML blockquote element.
func BlockQuote(children ...Node) Node {
return Element("blockquote", children...)
}
// Body represents an HTML body element.
func Body(children ...Node) Node {
return Element("body", children...)
}
// Br represents an HTML line break element.
func Br(children ...Node) Node {
return Element("br", children...)
}
// Button represents an HTML button element.
func Button(children ...Node) Node {
return Element("button", children...)
}
// Canvas represents an HTML canvas element.
func Canvas(children ...Node) Node {
return Element("canvas", children...)
}
// Cite represents an HTML cite element.
func Cite(children ...Node) Node {
return Element("cite", children...)
}
// Code represents an HTML code element.
func Code(children ...Node) Node {
return Element("code", children...)
}
// Col represents an HTML col element.
func Col(children ...Node) Node {
return Element("col", children...)
}
// ColGroup represents an HTML colgroup element.
func ColGroup(children ...Node) Node {
return Element("colgroup", children...)
}
// DataElement represents an HTML data element.
func DataElement(children ...Node) Node {
return Element("data", children...)
}
// DataList represents an HTML datalist element.
func DataList(children ...Node) Node {
return Element("datalist", children...)
}
// Details represents an HTML details element.
func Details(children ...Node) Node {
return Element("details", children...)
}
// Dialog represents an HTML dialog element.
func Dialog(children ...Node) Node {
return Element("dialog", children...)
}
// Div represents an HTML div element.
func Div(children ...Node) Node {
return Element("div", children...)
}
// Dl represents an HTML dl element.
func Dl(children ...Node) Node {
return Element("dl", children...)
}
// Embed represents an HTML embed element.
func Embed(children ...Node) Node {
return Element("embed", children...)
}
// FormElement represents an HTML form element.
func FormElement(children ...Node) Node {
return Element("form", children...)
}
// Form represents an HTML form element.
func Form(children ...Node) Node {
return Element("form", children...)
}
// FieldSet represents an HTML fieldset element.
func FieldSet(children ...Node) Node {
return Element("fieldset", children...)
}
// Figure represents an HTML figure element.
func Figure(children ...Node) Node {
return Element("figure", children...)
}
// Footer represents an HTML footer element.
func Footer(children ...Node) Node {
return Element("footer", children...)
}
// Head represents an HTML head element.
func Head(children ...Node) Node {
return Element("head", children...)
}
// Header represents an HTML header element.
func Header(children ...Node) Node {
return Element("header", children...)
}
// HGroup represents an HTML hgroup element.
func HGroup(children ...Node) Node {
return Element("hgroup", children...)
}
// Hr represents an HTML horizontal rule element.
func Hr(children ...Node) Node {
return Element("hr", children...)
}
// HTML represents an HTML html element.
func HTML(children ...Node) Node {
return Element("html", children...)
}
// IFrame represents an HTML iframe element.
func IFrame(children ...Node) Node {
return Element("iframe", children...)
}
// Img represents an HTML img element.
func Img(children ...Node) Node {
return Element("img", children...)
}
// Input represents an HTML input element.
func Input(children ...Node) Node {
return Element("input", children...)
}
// Label represents an HTML label element.
func Label(children ...Node) Node {
return Element("label", children...)
}
// Legend represents an HTML legend element.
func Legend(children ...Node) Node {
return Element("legend", children...)
}
// Li represents an HTML li element.
func Li(children ...Node) Node {
return Element("li", children...)
}
// Link represents an HTML link element.
func Link(children ...Node) Node {
return Element("link", children...)
}
// Main represents an HTML main element.
func Main(children ...Node) Node {
return Element("main", children...)
}
// Meta represents an HTML meta element.
func Meta(children ...Node) Node {
return Element("meta", children...)
}
// Meter represents an HTML meter element.
func Meter(children ...Node) Node {
return Element("meter", children...)
}
// Nav represents an HTML nav element.
func Nav(children ...Node) Node {
return Element("nav", children...)
}
// NoScript represents an HTML noscript element.
func NoScript(children ...Node) Node {
return Element("noscript", children...)
}
// Object represents an HTML object element.
func Object(children ...Node) Node {
return Element("object", children...)
}
// Ol represents an HTML ol element.
func Ol(children ...Node) Node {
return Element("ol", children...)
}
// OptGroup represents an HTML optgroup element.
func OptGroup(children ...Node) Node {
return Element("optgroup", children...)
}
// Option represents an HTML option element.
func Option(children ...Node) Node {
return Element("option", children...)
}
// P represents an HTML p element.
func P(children ...Node) Node {
return Element("p", children...)
}
// Param represents an HTML param element.
func Param(children ...Node) Node {
return Element("param", children...)
}
// Picture represents an HTML picture element.
func Picture(children ...Node) Node {
return Element("picture", children...)
}
// Pre represents an HTML pre element.
func Pre(children ...Node) Node {
return Element("pre", children...)
}
// Progress represents an HTML progress element.
func Progress(children ...Node) Node {
return Element("progress", children...)
}
// Script represents an HTML script element.
func Script(children ...Node) Node {
return Element("script", children...)
}
// Section represents an HTML section element.
func Section(children ...Node) Node {
return Element("section", children...)
}
// Select represents an HTML select element.
func Select(children ...Node) Node {
return Element("select", children...)
}
// Source represents an HTML source element.
func Source(children ...Node) Node {
return Element("source", children...)
}
// Span represents an HTML span element.
func Span(children ...Node) Node {
return Element("span", children...)
}
// StyleElement represents an HTML style element.
func StyleElement(children ...Node) Node {
return Element("style", children...)
}
// Summary represents an HTML summary element.
func Summary(children ...Node) Node {
return Element("summary", children...)
}
// Table represents an HTML table element.
func Table(children ...Node) Node {
return Element("table", children...)
}
// TBody represents an HTML tbody element.
func TBody(children ...Node) Node {
return Element("tbody", children...)
}
// Td represents an HTML td element.
func Td(children ...Node) Node {
return Element("td", children...)
}
// Textarea represents an HTML textarea element.
func Textarea(children ...Node) Node {
return Element("textarea", children...)
}
// TFoot represents an HTML tfoot element.
func TFoot(children ...Node) Node {
return Element("tfoot", children...)
}
// Th represents an HTML th element.
func Th(children ...Node) Node {
return Element("th", children...)
}
// THead represents an HTML thead element.
func THead(children ...Node) Node {
return Element("thead", children...)
}
// Tr represents an HTML tr element.
func Tr(children ...Node) Node {
return Element("tr", children...)
}
// Ul represents an HTML ul element.
func Ul(children ...Node) Node {
return Element("ul", children...)
}
// Wbr represents an HTML wbr element.
func Wbr(children ...Node) Node {
return Element("wbr", children...)
}
// Abbr represents an HTML abbr element.
func Abbr(children ...Node) Node {
return Element("abbr", Group(children...))
}
// B represents an HTML b element.
func B(children ...Node) Node {
return Element("b", Group(children...))
}
// Caption represents an HTML caption element.
func Caption(children ...Node) Node {
return Element("caption", Group(children...))
}
// Dd represents an HTML dd element.
func Dd(children ...Node) Node {
return Element("dd", Group(children...))
}
// DElement represents an HTML del element.
func DElement(children ...Node) Node {
return Element("del", Group(children...))
}
// Dfn represents an HTML dfn element.
func Dfn(children ...Node) Node {
return Element("dfn", Group(children...))
}
// Dt represents an HTML dt element.
func Dt(children ...Node) Node {
return Element("dt", Group(children...))
}
// Em represents an HTML em element.
func Em(children ...Node) Node {
return Element("em", Group(children...))
}
// FigCaption represents an HTML figcaption element.
func FigCaption(children ...Node) Node {
return Element("figcaption", Group(children...))
}
// H1 represents an HTML h1 element.
func H1(children ...Node) Node {
return Element("h1", Group(children...))
}
// H2 represents an HTML h2 element.
func H2(children ...Node) Node {
return Element("h2", Group(children...))
}
// H3 represents an HTML h3 element.
func H3(children ...Node) Node {
return Element("h3", Group(children...))
}
// H4 represents an HTML h4 element.
func H4(children ...Node) Node {
return Element("h4", Group(children...))
}
// H5 represents an HTML h5 element.
func H5(children ...Node) Node {
return Element("h5", Group(children...))
}
// H6 represents an HTML h6 element.
func H6(children ...Node) Node {
return Element("h6", Group(children...))
}
// I represents an HTML i element.
func I(children ...Node) Node {
return Element("i", Group(children...))
}
// Ins represents an HTML ins element.
func Ins(children ...Node) Node {
return Element("ins", Group(children...))
}
// Kbd represents an HTML kbd element.
func Kbd(children ...Node) Node {
return Element("kbd", Group(children...))
}
// Mark represents an HTML mark element.
func Mark(children ...Node) Node {
return Element("mark", Group(children...))
}
// Q represents an HTML q element.
func Q(children ...Node) Node {
return Element("q", Group(children...))
}
// S represents an HTML s element.
func S(children ...Node) Node {
return Element("s", Group(children...))
}
// Samp represents an HTML samp element.
func Samp(children ...Node) Node {
return Element("samp", Group(children...))
}
// Small represents an HTML small element.
func Small(children ...Node) Node {
return Element("small", Group(children...))
}
// Strong represents an HTML strong element.
func Strong(children ...Node) Node {
return Element("strong", Group(children...))
}
// Sub represents an HTML sub element.
func Sub(children ...Node) Node {
return Element("sub", Group(children...))
}
// Sup represents an HTML sup element.
func Sup(children ...Node) Node {
return Element("sup", Group(children...))
}
// Time represents an HTML time element.
func Time(children ...Node) Node {
return Element("time", Group(children...))
}
// TitleElement represents an HTML title element.
func TitleElement(children ...Node) Node {
return Element("title", Group(children...))
}
// Title represents an HTML title element.
func Title(children ...Node) Node {
return Element("title", Group(children...))
}
// U represents an HTML u element.
func U(children ...Node) Node {
return Element("u", Group(children...))
}
// Var represents an HTML var element.
func Var(children ...Node) Node {
return Element("var", Group(children...))
}
// Video represents an HTML video element.
func Video(children ...Node) Node {
return Element("video", Group(children...))
}
// Template represents an HTML template element.
func Template(children ...Node) Node {
return Element("template", Group(children...))
}
// Slot represents an HTML slot element.
func Slot(children ...Node) Node {
return Element("slot", Group(children...))
}
// Track represents an HTML track element.
func Track(children ...Node) Node {
return Element("track", Group(children...))
}
// Comment represents an HTML comment.
func Comment(comment string) Node {
return NodeFunc(func(w io.Writer) error {
if _, err := w.Write([]byte("<!-- " + comment + " -->")); err != nil {
return err
}
return nil
})
}