class ArticleJSON::Export::FacebookInstantArticle::Elements::TextBox

Public Instance Methods

export() click to toggle source

Generate a `<div>` node containing all text box elements and surrounded by an ASCII-art line to the top and bottom @return [Nokogiri::XML::NodeSet]

# File lib/article_json/export/facebook_instant_article/elements/text_box.rb, line 11
def export
  create_element(:div, class: 'text-box') do |div|
    div.add_child(ascii_art_line_node)
    @element.content.each do |child_element|
      div.add_child(base_class.new(child_element).export)
    end
    div.add_child(ascii_art_line_node)
  end
end

Private Instance Methods

ascii_art_line_node() click to toggle source

Returns a paragraph with the `ascii_art_line_text_element`. This gets inserted above and below the text box content @return [Nokogiri::XML::NodeSet]

# File lib/article_json/export/facebook_instant_article/elements/text_box.rb, line 26
def ascii_art_line_node
  create_element(:p) { |p| p.add_child ascii_art_line_text_element }
end
ascii_art_line_text_element() click to toggle source

Returns the delimiter of text boxes. Overwrite this method to have a custom text box delimiter @return [String]

# File lib/article_json/export/facebook_instant_article/elements/text_box.rb, line 33
def ascii_art_line_text_element
  '────────'
end