Class: Banzai::Filter::AutolinkFilter

Inherits:
HTML::Pipeline::Filter
  • Object
show all
Includes:
ActionView::Helpers::TagHelper
Defined in:
lib/banzai/filter/autolink_filter.rb

Overview

HTML Filter for auto-linking URLs in HTML.

Based on HTML::Pipeline::AutolinkFilter

Context options:

:autolink  - Boolean, skips all processing done by this filter when false
:link_attr - Hash of attributes for the generated links

Constant Summary collapse

%r{([a-z][a-z0-9\+\.-]+://\S+)(?<!,|\.)}
IGNORE_PARENTS =

Text matching LINK_PATTERN inside these elements will not be linked

%w(a code kbd pre script style).to_set

Instance Method Summary collapse

Instance Method Details

#callObject


34
35
36
37
38
39
# File 'lib/banzai/filter/autolink_filter.rb', line 34

def call
  return doc if context[:autolink] == false

  rinku_parse
  text_parse
end