Module: ArticleJSON::Export::Common::HTML::Elements::Image

Includes:
Shared::Caption, Shared::Float
Included in:
AMP::Elements::Image, FacebookInstantArticle::Elements::Image, HTML::Elements::Image
Defined in:
lib/article_json/export/common/html/elements/image.rb

Instance Method Summary collapse

Methods included from Shared::Float

#floating_class

Methods included from Shared::Caption

#caption_node

Instance Method Details

#exportNokogiri::XML::Element

Generate the ‘<figure>` node containing the image and caption

Returns:

  • (Nokogiri::XML::Element)


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

def export
  create_element(:figure, node_opts) do |figure|
    figure.add_child(image_node)
    if @element.caption&.any?
      figure.add_child(caption_node(:figcaption))
    end
  end
end