class SlackMarkdown::Filters::MultipleQuoteFilter

Public Instance Methods

call() click to toggle source
# File lib/slack_markdown/filters/multiple_quote_filter.rb, line 11
def call
  doc.search('.//text()').each do |node|
    content = node.to_html
    next if has_ancestor?(node, ignored_ancestor_tags)
    next unless content.include?('>>>')
    html = multiple_quote_filter(content)
    next if html == content
    node.replace(html)
  end
  doc
end

Private Instance Methods

multiple_quote_filter(text) click to toggle source
# File lib/slack_markdown/filters/multiple_quote_filter.rb, line 25
def multiple_quote_filter(text)
  lines = text.split(/^>>>(?:\s|\n)*/, 2)
  if lines.size < 2
    text
  else
    "#{lines.join('<blockquote>')}</blockquote>"
  end
end