Sha256: e2755a286d7f8ce49311d36da8b4b87cecd25da2c301b898f4d96f457b6284ba
Contents?: true
Size: 740 Bytes
Versions: 1
Compression:
Stored size: 740 Bytes
Contents
class Quote < PostType fields :quote, :source required :quote primary :quote special :quote do |quote_content| unless (quote_content =~ /^<blockquote/).nil? doc = Nokogiri::HTML(quote_content) doc.css('blockquote').each { |q| quote_content = q.content } else quote_content = '' end quote_content.strip end def self.detect?(text) pairs = get_pairs(text) the_quote = pairs.select { |pair| pair.keys.first == :quote } the_quote = the_quote.first || {} markdown = Markdown.new(the_quote[:quote]) quote_html = markdown.to_html || "" quote_html.strip! !(text =~ /Quote: (.*)/).nil? || !(quote_html =~ /^<blockquote(.+)<\/blockquote>$/m).nil? end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
myobie-turbine-core-0.3.6 | lib/turbine-core/types/quote.rb |