Module: ArticleJSON::Export::Common::HTML::Exporter

Included in:
AMP::Exporter, FacebookInstantArticle::Exporter, HTML::Exporter
Defined in:
lib/article_json/export/common/html/exporter.rb

Instance Method Summary collapse

Instance Method Details

#htmlString

Generate a string with the HTML representation of all elements

Returns:

  • (String)


13
14
15
16
17
18
19
# File 'lib/article_json/export/common/html/exporter.rb', line 13

def html
  doc = Nokogiri::HTML.fragment('')
  element_exporters.each do |element_exporter|
    doc.add_child(element_exporter.export)
  end
  doc.to_html(save_with: 0)
end

#initialize(elements) ⇒ Object

Parameters:



7
8
9
# File 'lib/article_json/export/common/html/exporter.rb', line 7

def initialize(elements)
  @elements = elements
end