class Content::Pipeline::Filters::Blockquote

Constants

XPaths

Public Instance Methods

blockquotes() click to toggle source
# File lib/content/pipeline/filters/blockquote.rb, line 11
def blockquotes
  @str = @str.to_nokogiri_fragment
  @str.xpath(XPaths.join(" | ")).each do |v|
    v.replace(parse_blockquote(
      v.inner_html
    ))
  end
end
parse_blockquote(text) click to toggle source
# File lib/content/pipeline/filters/blockquote.rb, line 20
  def parse_blockquote(text)
    text = text.each_line.to_a
    text[0] = <<-HTML
      <header class="cite">
        #{text[0]}
      </header>
      #{
        if text[1..-1].any?
          <<-HTML
            <p>
              #{text[1..-1].join(
                "\n"
              )}
            </p>
          HTML
        end