class ArticleJSON::Export::PlainText::Elements::Quote
Public Instance Methods
export()
click to toggle source
Quotes are just rendered with a preceding blank line. If a caption is present, it is rendered below the quote indented with two dashes. @return [String]
# File lib/article_json/export/plain_text/elements/quote.rb, line 9 def export "\n#{quote_text}\n" end
Private Instance Methods
extract_text(elements)
click to toggle source
Extract plain text from given element @param [ArticleJSON::Elements::Base] elements @return [String]
# File lib/article_json/export/plain_text/elements/quote.rb, line 28 def extract_text(elements) elements.map { |text| base_class.new(text).export }.join end
quote_text()
click to toggle source
Plain text representation of the entire quote @return [String]
# File lib/article_json/export/plain_text/elements/quote.rb, line 17 def quote_text extract_text(@element.content).tap do |text| if @element.caption&.any? text << " --#{extract_text(@element.caption)}\n" end end end