phlex 1.3.1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of phlex might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9cd9fd26d33fcf92978a26d9d94b81485871fa3f54c98639eb4ba5932960df84
4
- data.tar.gz: c8f0ded1ee9cd43c12e8358af687b7fe4f21e732031ca4fb009020dfaaeb72b5
3
+ metadata.gz: fe4d886672079338214f95fb037805836bfae5e975c549153ffbabeef2d1cd35
4
+ data.tar.gz: 4e88e58ab6351024d738b07a4dc7231837462b09396f55fa7cec6904f32b031d
5
5
  SHA512:
6
- metadata.gz: 890ccb499d210d332f5b2213bfdce51bd1e2212c550b20b0d9de3d1698205ca45b82e86e7850dc037e07a43e3da70a011e27d2310618f203882a00b32750704d
7
- data.tar.gz: fd9794d862a27ddaafa53c1f0d5fcecd3a967391083e2073922a2e83cbc19db7f95f4d19dd5db64b3c186e5c1c6292a6cef71dc05842c7216bd1e9b07046edc8
6
+ metadata.gz: 386ab00e03abeb9a752d91ca025c21765bce174a375326544170be5ff032e5ed7289b114981871482baccc46024d9d31cacad64db564d45129b1b182938b349a
7
+ data.tar.gz: 7557c4583e78b49421ca301982b0ee5f8b0dab478075a6882b8040bace46e6dd5f49e81a401f5e3101f42380898e00ddbac7e5a864ce269710415febf8514ac3
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.2.0
1
+ 3.2.1
@@ -34,6 +34,8 @@ module Phlex
34
34
 
35
35
  alias_method :_#{element}, :#{element}
36
36
  RUBY
37
+
38
+ Phlex::HTML::STANDARD_ELEMENTS[element] = tag
37
39
  end
38
40
 
39
41
  def register_void_element(element, tag: element.name.tr("_", "-"))
@@ -52,6 +54,8 @@ module Phlex
52
54
 
53
55
  alias_method :_#{element}, :#{element}
54
56
  RUBY
57
+
58
+ Phlex::HTML::VOID_ELEMENTS[element] = tag
55
59
  end
56
60
  end
57
61
  end
@@ -0,0 +1,602 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Phlex::HTML::StandardElements
4
+ extend Phlex::Elements
5
+
6
+ # @!method a(**attributes, &content)
7
+ # Outputs an <code>a</code> tag
8
+ # @return [nil]
9
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/a
10
+ register_element :a, tag: "a"
11
+
12
+ # @!method abbr(**attributes, &content)
13
+ # Outputs an <code>abbr</code> tag
14
+ # @return [nil]
15
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/abbr
16
+ register_element :abbr, tag: "abbr"
17
+
18
+ # @!method address(**attributes, &content)
19
+ # Outputs an <code>address</code> tag
20
+ # @return [nil]
21
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/address
22
+ register_element :address, tag: "address"
23
+
24
+ # @!method article(**attributes, &content)
25
+ # Outputs an <code>article</code> tag
26
+ # @return [nil]
27
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/article
28
+ register_element :article, tag: "article"
29
+
30
+ # @!method aside(**attributes, &content)
31
+ # Outputs an <code>aside</code> tag
32
+ # @return [nil]
33
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/aside
34
+ register_element :aside, tag: "aside"
35
+
36
+ # @!method b(**attributes, &content)
37
+ # Outputs a <code>b</code> tag
38
+ # @return [nil]
39
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/b
40
+ register_element :b, tag: "b"
41
+
42
+ # @!method bdi(**attributes, &content)
43
+ # Outputs a <code>bdi</code> tag
44
+ # @return [nil]
45
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/bdi
46
+ register_element :bdi, tag: "bdi"
47
+
48
+ # @!method bdo(**attributes, &content)
49
+ # Outputs a <code>bdo</code> tag
50
+ # @return [nil]
51
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/bdo
52
+ register_element :bdo, tag: "bdo"
53
+
54
+ # @!method blockquote(**attributes, &content)
55
+ # Outputs a <code>blockquote</code> tag
56
+ # @return [nil]
57
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/blockquote
58
+ register_element :blockquote, tag: "blockquote"
59
+
60
+ # @!method body(**attributes, &content)
61
+ # Outputs a <code>body</code> tag
62
+ # @return [nil]
63
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/body
64
+ register_element :body, tag: "body"
65
+
66
+ # @!method button(**attributes, &content)
67
+ # Outputs a <code>button</code> tag
68
+ # @return [nil]
69
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/button
70
+ register_element :button, tag: "button"
71
+
72
+ # @!method caption(**attributes, &content)
73
+ # Outputs a <code>caption</code> tag
74
+ # @return [nil]
75
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/caption
76
+ register_element :caption, tag: "caption"
77
+
78
+ # @!method cite(**attributes, &content)
79
+ # Outputs a <code>cite</code> tag
80
+ # @return [nil]
81
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/cite
82
+ register_element :cite, tag: "cite"
83
+
84
+ # @!method code(**attributes, &content)
85
+ # Outputs a <code>code</code> tag
86
+ # @return [nil]
87
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/code
88
+ register_element :code, tag: "code"
89
+
90
+ # @!method colgroup(**attributes, &content)
91
+ # Outputs a <code>colgroup</code> tag
92
+ # @return [nil]
93
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/colgroup
94
+ register_element :colgroup, tag: "colgroup"
95
+
96
+ # @!method data(**attributes, &content)
97
+ # Outputs a <code>data</code> tag
98
+ # @return [nil]
99
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/data
100
+ register_element :data, tag: "data"
101
+
102
+ # @!method datalist(**attributes, &content)
103
+ # Outputs a <code>datalist</code> tag
104
+ # @return [nil]
105
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/datalist
106
+ register_element :datalist, tag: "datalist"
107
+
108
+ # @!method dd(**attributes, &content)
109
+ # Outputs a <code>dd</code> tag
110
+ # @return [nil]
111
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/dd
112
+ register_element :dd, tag: "dd"
113
+
114
+ # @!method del(**attributes, &content)
115
+ # Outputs a <code>del</code> tag
116
+ # @return [nil]
117
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/del
118
+ register_element :del, tag: "del"
119
+
120
+ # @!method details(**attributes, &content)
121
+ # Outputs a <code>details</code> tag
122
+ # @return [nil]
123
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/details
124
+ register_element :details, tag: "details"
125
+
126
+ # @!method dfn(**attributes, &content)
127
+ # Outputs a <code>dfn</code> tag
128
+ # @return [nil]
129
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/dfn
130
+ register_element :dfn, tag: "dfn"
131
+
132
+ # @!method dialog(**attributes, &content)
133
+ # Outputs a <code>dialog</code> tag
134
+ # @return [nil]
135
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/dialog
136
+ register_element :dialog, tag: "dialog"
137
+
138
+ # @!method div(**attributes, &content)
139
+ # Outputs a <code>div</code> tag
140
+ # @return [nil]
141
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/div
142
+ register_element :div, tag: "div"
143
+
144
+ # @!method dl(**attributes, &content)
145
+ # Outputs a <code>dl</code> tag
146
+ # @return [nil]
147
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/dl
148
+ register_element :dl, tag: "dl"
149
+
150
+ # @!method dt(**attributes, &content)
151
+ # Outputs a <code>dt</code> tag
152
+ # @return [nil]
153
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/dt
154
+ register_element :dt, tag: "dt"
155
+
156
+ # @!method em(**attributes, &content)
157
+ # Outputs an <code>em</code> tag
158
+ # @return [nil]
159
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/em
160
+ register_element :em, tag: "em"
161
+
162
+ # @!method fieldset(**attributes, &content)
163
+ # Outputs a <code>fieldset</code> tag
164
+ # @return [nil]
165
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/fieldset
166
+ register_element :fieldset, tag: "fieldset"
167
+
168
+ # @!method figcaption(**attributes, &content)
169
+ # Outputs a <code>figcaption</code> tag
170
+ # @return [nil]
171
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/figcaption
172
+ register_element :figcaption, tag: "figcaption"
173
+
174
+ # @!method figure(**attributes, &content)
175
+ # Outputs a <code>figure</code> tag
176
+ # @return [nil]
177
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/figure
178
+ register_element :figure, tag: "figure"
179
+
180
+ # @!method footer(**attributes, &content)
181
+ # Outputs a <code>footer</code> tag
182
+ # @return [nil]
183
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/footer
184
+ register_element :footer, tag: "footer"
185
+
186
+ # @!method form(**attributes, &content)
187
+ # Outputs a <code>form</code> tag
188
+ # @return [nil]
189
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/form
190
+ register_element :form, tag: "form"
191
+
192
+ # @!method g(**attributes, &content)
193
+ # Outputs a <code>g</code> tag
194
+ # @return [nil]
195
+ # @see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/g
196
+ # @todo move this to SVG
197
+ register_element :g, tag: "g"
198
+
199
+ # @!method h1(**attributes, &content)
200
+ # Outputs an <code>h1</code> tag
201
+ # @return [nil]
202
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/h1
203
+ register_element :h1, tag: "h1"
204
+
205
+ # @!method h2(**attributes, &content)
206
+ # Outputs an <code>h2</code> tag
207
+ # @return [nil]
208
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/h2
209
+ register_element :h2, tag: "h2"
210
+
211
+ # @!method h3(**attributes, &content)
212
+ # Outputs an <code>h3</code> tag
213
+ # @return [nil]
214
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/h3
215
+ register_element :h3, tag: "h3"
216
+
217
+ # @!method h4(**attributes, &content)
218
+ # Outputs an <code>h4</code> tag
219
+ # @return [nil]
220
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/h4
221
+ register_element :h4, tag: "h4"
222
+
223
+ # @!method h5(**attributes, &content)
224
+ # Outputs an <code>h5</code> tag
225
+ # @return [nil]
226
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/h5
227
+ register_element :h5, tag: "h5"
228
+
229
+ # @!method h6(**attributes, &content)
230
+ # Outputs an <code>h6</code> tag
231
+ # @return [nil]
232
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/h6
233
+ register_element :h6, tag: "h6"
234
+
235
+ # @!method head(**attributes, &content)
236
+ # Outputs a <code>head</code> tag
237
+ # @return [nil]
238
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/head
239
+ register_element :head, tag: "head"
240
+
241
+ # @!method header(**attributes, &content)
242
+ # Outputs a <code>header</code> tag
243
+ # @return [nil]
244
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/header
245
+ register_element :header, tag: "header"
246
+
247
+ # @!method hgroup(**attributes, &content)
248
+ # Outputs a <code>hgroup</code> tag
249
+ # @return [nil]
250
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/hgroup
251
+ register_element :hgroup, tag: "hgroup"
252
+
253
+ # @!method html(**attributes, &content)
254
+ # Outputs a <code>html</code> tag
255
+ # @return [nil]
256
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/html
257
+ register_element :html, tag: "html"
258
+
259
+ # @!method i(**attributes, &content)
260
+ # Outputs an <code>i</code> tag
261
+ # @return [nil]
262
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/i
263
+ register_element :i, tag: "i"
264
+
265
+ # @!method iframe(**attributes, &content)
266
+ # Outputs an <code>iframe</code> tag
267
+ # @return [nil]
268
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/iframe
269
+ register_element :iframe, tag: "iframe"
270
+
271
+ # @!method ins(**attributes, &content)
272
+ # Outputs an <code>ins</code> tag
273
+ # @return [nil]
274
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/ins
275
+ register_element :ins, tag: "ins"
276
+
277
+ # @!method kbd(**attributes, &content)
278
+ # Outputs a <code>kbd</code> tag
279
+ # @return [nil]
280
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/kbd
281
+ register_element :kbd, tag: "kbd"
282
+
283
+ # @!method label(**attributes, &content)
284
+ # Outputs a <code>label</code> tag
285
+ # @return [nil]
286
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/label
287
+ register_element :label, tag: "label"
288
+
289
+ # @!method legend(**attributes, &content)
290
+ # Outputs a <code>legend</code> tag
291
+ # @return [nil]
292
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/legend
293
+ register_element :legend, tag: "legend"
294
+
295
+ # @!method li(**attributes, &content)
296
+ # Outputs a <code>li</code> tag
297
+ # @return [nil]
298
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/li
299
+ register_element :li, tag: "li"
300
+
301
+ # @!method main(**attributes, &content)
302
+ # Outputs a <code>main</code> tag
303
+ # @return [nil]
304
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/main
305
+ register_element :main, tag: "main"
306
+
307
+ # @!method map(**attributes, &content)
308
+ # Outputs a <code>map</code> tag
309
+ # @return [nil]
310
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/map
311
+ register_element :map, tag: "map"
312
+
313
+ # @!method mark(**attributes, &content)
314
+ # Outputs a <code>mark</code> tag
315
+ # @return [nil]
316
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/mark
317
+ register_element :mark, tag: "mark"
318
+
319
+ # @!method menuitem(**attributes, &content)
320
+ # Outputs a <code>menuitem</code> tag
321
+ # @return [nil]
322
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/menuitem
323
+ # @deprecated
324
+ register_element :menuitem, tag: "menuitem"
325
+
326
+ # @!method meter(**attributes, &content)
327
+ # Outputs a <code>meter</code> tag
328
+ # @return [nil]
329
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/meter
330
+ register_element :meter, tag: "meter"
331
+
332
+ # @!method nav(**attributes, &content)
333
+ # Outputs a <code>nav</code> tag
334
+ # @return [nil]
335
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/nav
336
+ register_element :nav, tag: "nav"
337
+
338
+ # @!method noscript(**attributes, &content)
339
+ # Outputs a <code>noscript</code> tag
340
+ # @return [nil]
341
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/noscript
342
+ register_element :noscript, tag: "noscript"
343
+
344
+ # @!method object(**attributes, &content)
345
+ # Outputs an <code>object</code> tag
346
+ # @return [nil]
347
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/object
348
+ register_element :object, tag: "object"
349
+
350
+ # @!method ol(**attributes, &content)
351
+ # Outputs an <code>ol</code> tag
352
+ # @return [nil]
353
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/ol
354
+ register_element :ol, tag: "ol"
355
+
356
+ # @!method optgroup(**attributes, &content)
357
+ # Outputs an <code>optgroup</code> tag
358
+ # @return [nil]
359
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/optgroup
360
+ register_element :optgroup, tag: "optgroup"
361
+
362
+ # @!method option(**attributes, &content)
363
+ # Outputs an <code>option</code> tag
364
+ # @return [nil]
365
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/option
366
+ register_element :option, tag: "option"
367
+
368
+ # @!method output(**attributes, &content)
369
+ # Outputs an <code>output</code> tag
370
+ # @return [nil]
371
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/output
372
+ register_element :output, tag: "output"
373
+
374
+ # @!method p(**attributes, &content)
375
+ # Outputs a <code>p</code> tag
376
+ # @return [nil]
377
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/p
378
+ register_element :p, tag: "p"
379
+
380
+ # @!method path(**attributes, &content)
381
+ # Outputs a <code>path</code> tag
382
+ # @return [nil]
383
+ # @see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/path
384
+ # @todo move this to SVG
385
+ register_element :path, tag: "path"
386
+
387
+ # @!method picture(**attributes, &content)
388
+ # Outputs a <code>picture</code> tag
389
+ # @return [nil]
390
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/picture
391
+ register_element :picture, tag: "picture"
392
+
393
+ # @!method pre(**attributes, &content)
394
+ # Outputs a <code>pre</code> tag
395
+ # @return [nil]
396
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/pre
397
+ register_element :pre, tag: "pre"
398
+
399
+ # @!method progress(**attributes, &content)
400
+ # Outputs a <code>progress</code> tag
401
+ # @return [nil]
402
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/progress
403
+ register_element :progress, tag: "progress"
404
+
405
+ # @!method q(**attributes, &content)
406
+ # Outputs a <code>q</code> tag
407
+ # @return [nil]
408
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/q
409
+ register_element :q, tag: "q"
410
+
411
+ # @!method rp(**attributes, &content)
412
+ # Outputs a <code>rp</code> tag
413
+ # @return [nil]
414
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/rp
415
+ register_element :rp, tag: "rp"
416
+
417
+ # @!method rt(**attributes, &content)
418
+ # Outputs a <code>rt</code> tag
419
+ # @return [nil]
420
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/rt
421
+ register_element :rt, tag: "rt"
422
+
423
+ # @!method ruby(**attributes, &content)
424
+ # Outputs a <code>ruby</code> tag
425
+ # @return [nil]
426
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/ruby
427
+ register_element :ruby, tag: "ruby"
428
+
429
+ # @!method s(**attributes, &content)
430
+ # Outputs a <code>s</code> tag
431
+ # @return [nil]
432
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/s
433
+ register_element :s, tag: "s"
434
+
435
+ # @!method samp(**attributes, &content)
436
+ # Outputs a <code>samp</code> tag
437
+ # @return [nil]
438
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/samp
439
+ register_element :samp, tag: "samp"
440
+
441
+ # @!method script(**attributes, &content)
442
+ # Outputs a <code>script</code> tag
443
+ # @return [nil]
444
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/script
445
+ register_element :script, tag: "script"
446
+
447
+ # @!method section(**attributes, &content)
448
+ # Outputs a <code>section</code> tag
449
+ # @return [nil]
450
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/section
451
+ register_element :section, tag: "section"
452
+
453
+ # @!method select(**attributes, &content)
454
+ # Outputs a <code>select</code> tag
455
+ # @return [nil]
456
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/select
457
+ register_element :select, tag: "select"
458
+
459
+ # @!method slot(**attributes, &content)
460
+ # Outputs a <code>slot</code> tag
461
+ # @return [nil]
462
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/slot
463
+ register_element :slot, tag: "slot"
464
+
465
+ # @!method small(**attributes, &content)
466
+ # Outputs a <code>small</code> tag
467
+ # @return [nil]
468
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/small
469
+ register_element :small, tag: "small"
470
+
471
+ # @!method span(**attributes, &content)
472
+ # Outputs a <code>span</code> tag
473
+ # @return [nil]
474
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/span
475
+ register_element :span, tag: "span"
476
+
477
+ # @!method strong(**attributes, &content)
478
+ # Outputs a <code>strong</code> tag
479
+ # @return [nil]
480
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/strong
481
+ register_element :strong, tag: "strong"
482
+
483
+ # @!method style(**attributes, &content)
484
+ # Outputs a <code>style</code> tag
485
+ # @return [nil]
486
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/style
487
+ register_element :style, tag: "style"
488
+
489
+ # @!method sub(**attributes, &content)
490
+ # Outputs a <code>sub</code> tag
491
+ # @return [nil]
492
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/sub
493
+ register_element :sub, tag: "sub"
494
+
495
+ # @!method summary(**attributes, &content)
496
+ # Outputs a <code>summary</code> tag
497
+ # @return [nil]
498
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/summary
499
+ register_element :summary, tag: "summary"
500
+
501
+ # @!method sup(**attributes, &content)
502
+ # Outputs a <code>sup</code> tag
503
+ # @return [nil]
504
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/sup
505
+ register_element :sup, tag: "sup"
506
+
507
+ # @!method svg(**attributes, &content)
508
+ # Outputs a <code>svg</code> tag
509
+ # @return [nil]
510
+ # @see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/svg
511
+ register_element :svg, tag: "svg"
512
+
513
+ # @!method table(**attributes, &content)
514
+ # Outputs a <code>table</code> tag
515
+ # @return [nil]
516
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/table
517
+ register_element :table, tag: "table"
518
+
519
+ # @!method tbody(**attributes, &content)
520
+ # Outputs a <code>tbody</code> tag
521
+ # @return [nil]
522
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/tbody
523
+ register_element :tbody, tag: "tbody"
524
+
525
+ # @!method td(**attributes, &content)
526
+ # Outputs a <code>td</code> tag
527
+ # @return [nil]
528
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/td
529
+ register_element :td, tag: "td"
530
+
531
+ # @!method template_tag(**attributes, &content)
532
+ # Outputs a <code>template</code> tag
533
+ # @return [nil]
534
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/template
535
+ register_element :template_tag, tag: "template"
536
+
537
+ # @!method textarea(**attributes, &content)
538
+ # Outputs a <code>textarea</code> tag
539
+ # @return [nil]
540
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/textarea
541
+ register_element :textarea, tag: "textarea"
542
+
543
+ # @!method tfoot(**attributes, &content)
544
+ # Outputs a <code>tfoot</code> tag
545
+ # @return [nil]
546
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/tfoot
547
+ register_element :tfoot, tag: "tfoot"
548
+
549
+ # @!method th(**attributes, &content)
550
+ # Outputs a <code>th</code> tag
551
+ # @return [nil]
552
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/th
553
+ register_element :th, tag: "th"
554
+
555
+ # @!method thead(**attributes, &content)
556
+ # Outputs a <code>thead</code> tag
557
+ # @return [nil]
558
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/thead
559
+ register_element :thead, tag: "thead"
560
+
561
+ # @!method time(**attributes, &content)
562
+ # Outputs a <code>time</code> tag
563
+ # @return [nil]
564
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/time
565
+ register_element :time, tag: "time"
566
+
567
+ # @!method title(**attributes, &content)
568
+ # Outputs a <code>title</code> tag
569
+ # @return [nil]
570
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/title
571
+ register_element :title, tag: "title"
572
+
573
+ # @!method tr(**attributes, &content)
574
+ # Outputs a <code>tr</code> tag
575
+ # @return [nil]
576
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/tr
577
+ register_element :tr, tag: "tr"
578
+
579
+ # @!method u(**attributes, &content)
580
+ # Outputs an <code>u</code> tag
581
+ # @return [nil]
582
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/u
583
+ register_element :u, tag: "u"
584
+
585
+ # @!method ul(**attributes, &content)
586
+ # Outputs an <code>ul</code> tag
587
+ # @return [nil]
588
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/ul
589
+ register_element :ul, tag: "ul"
590
+
591
+ # @!method video(**attributes, &content)
592
+ # Outputs a <code>video</code> tag
593
+ # @return [nil]
594
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/video
595
+ register_element :video, tag: "video"
596
+
597
+ # @!method wbr(**attributes, &content)
598
+ # Outputs a <code>wbr</code> tag
599
+ # @return [nil]
600
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/wbr
601
+ register_element :wbr, tag: "wbr"
602
+ end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Phlex::HTML::VoidElements
4
+ extend Phlex::Elements
5
+
6
+ # @!method area(**attributes, &content)
7
+ # Outputs an <code>area</code> tag
8
+ # @return [nil]
9
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/area
10
+ register_void_element :area, tag: "area"
11
+
12
+ # @!method br(**attributes, &content)
13
+ # Outputs a <code>br</code> tag
14
+ # @return [nil]
15
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/br
16
+ register_void_element :br, tag: "br"
17
+
18
+ # @!method embed(**attributes, &content)
19
+ # Outputs an <code>embed</code> tag
20
+ # @return [nil]
21
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/embed
22
+ register_void_element :embed, tag: "embed"
23
+
24
+ # @!method hr(**attributes, &content)
25
+ # Outputs a <code>hr</code> tag
26
+ # @return [nil]
27
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/hr
28
+ register_void_element :hr, tag: "hr"
29
+
30
+ # @!method img(**attributes, &content)
31
+ # Outputs an <code>img</code> tag
32
+ # @return [nil]
33
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/img
34
+ register_void_element :img, tag: "img"
35
+
36
+ # @!method input(**attributes, &content)
37
+ # Outputs an <code>input</code> tag
38
+ # @return [nil]
39
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/input
40
+ register_void_element :input, tag: "input"
41
+
42
+ # @!method link(**attributes, &content)
43
+ # Outputs a <code>link</code> tag
44
+ # @return [nil]
45
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/link
46
+ register_void_element :link, tag: "link"
47
+
48
+ # @!method meta(**attributes, &content)
49
+ # Outputs a <code>meta</code> tag
50
+ # @return [nil]
51
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/meta
52
+ register_void_element :meta, tag: "meta"
53
+
54
+ # @!method param(**attributes, &content)
55
+ # Outputs a <code>param</code> tag
56
+ # @return [nil]
57
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/param
58
+ register_void_element :param, tag: "param"
59
+
60
+ # @!method source(**attributes, &content)
61
+ # Outputs a <code>source</code> tag
62
+ # @return [nil]
63
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/source
64
+ register_void_element :source, tag: "source"
65
+
66
+ # @!method track(**attributes, &content)
67
+ # Outputs a <code>track</code> tag
68
+ # @return [nil]
69
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/track
70
+ register_void_element :track, tag: "track"
71
+
72
+ # @!method col(**attributes, &content)
73
+ # Outputs a <code>col</code> tag
74
+ # @return [nil]
75
+ # @see https://developer.mozilla.org/docs/Web/HTML/Element/col
76
+ register_void_element :col, tag: "col"
77
+ end
data/lib/phlex/html.rb CHANGED
@@ -8,128 +8,18 @@ module Phlex
8
8
  class HTML
9
9
  DOCTYPE = "<!DOCTYPE html>"
10
10
 
11
- STANDARD_ELEMENTS = {
12
- a: "a",
13
- abbr: "abbr",
14
- address: "address",
15
- article: "article",
16
- aside: "aside",
17
- b: "b",
18
- bdi: "bdi",
19
- bdo: "bdo",
20
- blockquote: "blockquote",
21
- body: "body",
22
- button: "button",
23
- caption: "caption",
24
- cite: "cite",
25
- code: "code",
26
- colgroup: "colgroup",
27
- data: "data",
28
- datalist: "datalist",
29
- dd: "dd",
30
- del: "del",
31
- details: "details",
32
- dfn: "dfn",
33
- dialog: "dialog",
34
- div: "div",
35
- dl: "dl",
36
- dt: "dt",
37
- em: "em",
38
- fieldset: "fieldset",
39
- figcaption: "figcaption",
40
- figure: "figure",
41
- footer: "footer",
42
- form: "form",
43
- g: "g",
44
- h1: "h1",
45
- h2: "h2",
46
- h3: "h3",
47
- h4: "h4",
48
- h5: "h5",
49
- h6: "h6",
50
- head: "head",
51
- header: "header",
52
- html: "html",
53
- i: "i",
54
- iframe: "iframe",
55
- ins: "ins",
56
- kbd: "kbd",
57
- label: "label",
58
- legend: "legend",
59
- li: "li",
60
- main: "main",
61
- map: "map",
62
- mark: "mark",
63
- menuitem: "menuitem",
64
- meter: "meter",
65
- nav: "nav",
66
- noscript: "noscript",
67
- object: "object",
68
- ol: "ol",
69
- optgroup: "optgroup",
70
- option: "option",
71
- output: "output",
72
- p: "p",
73
- path: "path",
74
- picture: "picture",
75
- pre: "pre",
76
- progress: "progress",
77
- q: "q",
78
- rp: "rp",
79
- rt: "rt",
80
- ruby: "ruby",
81
- s: "s",
82
- samp: "samp",
83
- script: "script",
84
- section: "section",
85
- select: "select",
86
- slot: "slot",
87
- small: "small",
88
- span: "span",
89
- strong: "strong",
90
- style: "style",
91
- sub: "sub",
92
- summary: "summary",
93
- sup: "sup",
94
- svg: "svg",
95
- table: "table",
96
- tbody: "tbody",
97
- td: "td",
98
- template_tag: "template",
99
- textarea: "textarea",
100
- tfoot: "tfoot",
101
- th: "th",
102
- thead: "thead",
103
- time: "time",
104
- title: "title",
105
- tr: "tr",
106
- u: "u",
107
- ul: "ul",
108
- video: "video",
109
- wbr: "wbr",
110
- }.freeze
111
-
112
- VOID_ELEMENTS = {
113
- area: "area",
114
- br: "br",
115
- embed: "embed",
116
- hr: "hr",
117
- img: "img",
118
- input: "input",
119
- link: "link",
120
- meta: "meta",
121
- param: "param",
122
- source: "source",
123
- track: "track",
124
- col: "col",
125
- }.freeze
126
-
127
- EVENT_ATTRIBUTES = %w[onabort onafterprint onbeforeprint onbeforeunload onblur oncanplay oncanplaythrough onchange onclick oncontextmenu oncopy oncuechange oncut ondblclick ondrag ondragend ondragenter ondragleave ondragover ondragstart ondrop ondurationchange onemptied onended onerror onerror onfocus onhashchange oninput oninvalid onkeydown onkeypress onkeyup onload onloadeddata onloadedmetadata onloadstart onmessage onmousedown onmousemove onmouseout onmouseover onmouseup onmousewheel onoffline ononline onpagehide onpageshow onpaste onpause onplay onplaying onpopstate onprogress onratechange onreset onresize onscroll onsearch onseeked onseeking onselect onstalled onstorage onsubmit onsuspend ontimeupdate ontoggle onunload onvolumechange onwaiting onwheel].to_h { [_1, true] }.freeze
11
+ STANDARD_ELEMENTS = Concurrent::Map.new
12
+ VOID_ELEMENTS = Concurrent::Map.new
13
+
14
+ EVENT_ATTRIBUTES = %w[onabort onafterprint onbeforeprint onbeforeunload onblur oncanplay oncanplaythrough onchange onclick oncontextmenu oncopy oncuechange oncut ondblclick ondrag ondragend ondragenter ondragleave ondragover ondragstart ondrop ondurationchange onemptied onended onerror onfocus onhashchange oninput oninvalid onkeydown onkeypress onkeyup onload onloadeddata onloadedmetadata onloadstart onmessage onmousedown onmousemove onmouseout onmouseover onmouseup onmousewheel onoffline ononline onpagehide onpageshow onpaste onpause onplay onplaying onpopstate onprogress onratechange onreset onresize onscroll onsearch onseeked onseeking onselect onstalled onstorage onsubmit onsuspend ontimeupdate ontoggle onunload onvolumechange onwaiting onwheel].to_h { [_1, true] }.freeze
128
15
 
129
16
  UNBUFFERED_MUTEX = Mutex.new
130
17
 
131
18
  extend Elements
19
+
132
20
  include Helpers
21
+ include VoidElements
22
+ include StandardElements
133
23
 
134
24
  class << self
135
25
  def call(...)
@@ -219,14 +109,6 @@ module Phlex
219
109
  :html
220
110
  end
221
111
 
222
- STANDARD_ELEMENTS.each do |method_name, tag|
223
- register_element(method_name, tag: tag)
224
- end
225
-
226
- VOID_ELEMENTS.each do |method_name, tag|
227
- register_void_element(method_name, tag: tag)
228
- end
229
-
230
112
  def text(content)
231
113
  @_target << ERB::Util.html_escape(
232
114
  case content
@@ -270,14 +152,14 @@ module Phlex
270
152
  @_target << content
271
153
  end
272
154
 
273
- def capture
155
+ def capture(&block)
274
156
  return unless block_given?
275
157
 
276
158
  original_buffer = @_target
277
159
  new_buffer = +""
278
160
  @_target = new_buffer
279
161
 
280
- yield
162
+ yield_content(&block)
281
163
 
282
164
  new_buffer
283
165
  ensure
@@ -4,6 +4,10 @@ module Phlex
4
4
  module Testing
5
5
  module ViewHelper
6
6
  def render(view, &block)
7
+ if view.is_a?(Class) && view < Phlex::HTML
8
+ view = view.new
9
+ end
10
+
7
11
  view.call(view_context: view_context, &block)
8
12
  end
9
13
 
data/lib/phlex/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Phlex
4
- VERSION = "1.3.1"
4
+ VERSION = "1.3.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phlex
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Drapper
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-30 00:00:00.000000000 Z
11
+ date: 2023-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -68,6 +68,8 @@ files:
68
68
  - lib/phlex/elements.rb
69
69
  - lib/phlex/helpers.rb
70
70
  - lib/phlex/html.rb
71
+ - lib/phlex/html/standard_elements.rb
72
+ - lib/phlex/html/void_elements.rb
71
73
  - lib/phlex/testing/view_helper.rb
72
74
  - lib/phlex/unbuffered.rb
73
75
  - lib/phlex/version.rb
@@ -97,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
99
  - !ruby/object:Gem::Version
98
100
  version: '0'
99
101
  requirements: []
100
- rubygems_version: 3.4.4
102
+ rubygems_version: 3.4.6
101
103
  signing_key:
102
104
  specification_version: 4
103
105
  summary: A framework for building views in Ruby.