module Amber::Render::Filter::Autolink

Constants

AUTO_EMAIL_LOCAL_RE
AUTO_EMAIL_RE

regexps for determining context, used high-volume

BRACKETS
WORD_PATTERN

Public Class Methods

run(text) click to toggle source
# File lib/amber/render/filter/autolink.rb, line 10
def self.run(text)
  auto_link_email_addresses(auto_link_urls(text))
end

Private Class Methods

auto_linked?(left, right) click to toggle source

Detects already linked context or position in the middle of a tag

# File lib/amber/render/filter/autolink.rb, line 76
def self.auto_linked?(left, right)
  (left =~ AUTO_LINK_CRE[0] and right =~ AUTO_LINK_CRE[1]) or
    (left.rindex(AUTO_LINK_CRE[2]) and $' !~ AUTO_LINK_CRE[3])
end