File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change
1
+ === master
2
+
3
+ * Add Serializer#self_closing_tag? private method for easier overriding in subclasses (jeremyevans)
4
+
1
5
=== 2.6.0 (2024-06-18)
2
6
3
7
* Add Roda forme_erubi_capture_block plugin to support erubi/capture_block <%= form do %> <% end %> tags (jeremyevans)
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ class Serializer
19
19
def call ( tag )
20
20
case tag
21
21
when Tag
22
- if SELF_CLOSING . include ?( tag . type )
22
+ if self_closing_tag ?( tag . type )
23
23
"<#{ tag . type } #{ attr_html ( tag . attr ) } />"
24
24
else
25
25
"#{ serialize_open ( tag ) } #{ call ( tag . children ) } #{ serialize_close ( tag ) } "
@@ -79,6 +79,12 @@ def attr_html(attr)
79
79
attr = attr . to_a . reject { |k , v | v . nil? }
80
80
" #{ attr . map { |k , v | "#{ k } =\" #{ attr_value ( v ) } \" " } . sort . join ( ' ' ) } " unless attr . empty?
81
81
end
82
+
83
+ # Return whether the tag is self closing. this can be overridden in subclasses
84
+ # to make additional types self closing.
85
+ def self_closing_tag? ( type )
86
+ SELF_CLOSING . include? ( type )
87
+ end
82
88
end
83
89
84
90
# Overrides formatting of dates and times to use an American format without
You can’t perform that action at this time.
0 commit comments