lib/brief/document/rendering.rb in brief-1.4.4 vs lib/brief/document/rendering.rb in brief-1.5.0
- old
+ new
@@ -35,15 +35,17 @@
# They will first be put through a Nokogiri processor pipeline
# which allows us to wrap things in section containers, apply data
# attributes, and other things to the HTML so that the output HTML retains its
# relationship to the underlying data and document structure.
def to_html(options = {})
- if options[:wrap] == false
+ html = if options[:wrap] == false
unwrapped_html
else
wrapper = options.fetch(:wrapper, 'div')
"<#{ wrapper } data-brief-model='#{ model_class.type_alias }' data-brief-path='#{ relative_path_identifier }'>#{ unwrapped_html }</#{wrapper}>"
end
+
+ html.respond_to?(:html_safe) ? html.html_safe : html.to_s
end
def unwrapped_html
parser.to_html
end