html-native 0.3.2 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/html-native.rb +11 -1
- data/lib/html-native/constants.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed3076751962fc9a51ff463fbe86f2716fc06522f838def97ba375270ca81099
|
4
|
+
data.tar.gz: b03dca13fa0ff38781755ab1912cb3890fa8f2210b1cbb2bc9cb5de8f469a6fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a55f9561c6e3cc998e3616bf685a0ff5700284bfe3a68c08cc1b9583e6f2daadd9c48cb7f448abf3479f16024f29906d6f3b70ca7a99289f566a2a1a02ed2e5
|
7
|
+
data.tar.gz: a184b3ddfe8cd71beb7fcb30b9ef460ca16ea9874c53b056b3ee67ffa9292c8ee6a4fb457a02d1f7b2640f0de4349a0e78fa6fbfe480ff2a43acbb49df2da416
|
data/lib/html-native.rb
CHANGED
@@ -3,7 +3,7 @@ require "html-native/builder"
|
|
3
3
|
require "html-native/logic"
|
4
4
|
|
5
5
|
module HTMLComponent
|
6
|
-
|
6
|
+
|
7
7
|
# Generates generation methods for each HTML5-valid tag. These methods have the
|
8
8
|
# name of the tag. Note that this interferes with the builtin `p` method.
|
9
9
|
TAG_LIST.each do |tag|
|
@@ -22,6 +22,16 @@ module HTMLComponent
|
|
22
22
|
Builder.new("<!DOCTYPE #{type}>")
|
23
23
|
end
|
24
24
|
|
25
|
+
def _label(attrs = {}, &block)
|
26
|
+
attrs ||= {}
|
27
|
+
if block
|
28
|
+
body = block.call
|
29
|
+
Builder.new("<label#{attributes_list(:label, attrs)}>") + body + "</label>"
|
30
|
+
else
|
31
|
+
Builder.new("<label#{attributes_list(:label, attrs)}/>")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
25
35
|
# Creates a module that encompasses the given block in an HTMLComponent
|
26
36
|
# context. This gives access to methods in the block as though the block was
|
27
37
|
# declared as the `render` function in a module extending HTMLComponent
|
@@ -17,7 +17,7 @@ module HTMLComponent
|
|
17
17
|
:canvas, :noscript, :script,
|
18
18
|
:del, :ins,
|
19
19
|
:caption, :col, :colgroup, :table, :tbody, :td, :tfoot, :th, :thead, :tr,
|
20
|
-
:button, :datalist, :fieldset, :form, :input, :
|
20
|
+
:button, :datalist, :fieldset, :form, :input, :legend, :meter, :optgroup,
|
21
21
|
:option, :output, :progress, :select, :textarea,
|
22
22
|
:details, :dialog, :menu, :summary,
|
23
23
|
:slot, :template
|