Method: Brief::Document::Rendering#to_html

Defined in:
lib/brief/document/rendering.rb

#to_html(options = {}) ⇒ Object

Documents can be rendered into HTML.

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.



39
40
41
42
43
44
45
46
# File 'lib/brief/document/rendering.rb', line 39

def to_html(options = {})
  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
end