lib/shuwar/stdlib/nokogiri.rb in shuwar-1.2.0 vs lib/shuwar/stdlib/nokogiri.rb in shuwar-1.3.0
- old
+ new
@@ -12,10 +12,15 @@
class HtmlTag
def initialize(name, attrs, *children)
@name = name.to_s
@attrs = attrs.to_h
- @children = children
+ if children.all? {|a| a.is_a? String}
+ # Multi strings should get a space between them
+ @children = [children.join(" ")]
+ else
+ @children = children
+ end
end
def add_to(a)
ele = a.document.create_element @name, @attrs
@children.each do |c|
\ No newline at end of file