Method: HTML::Pipeline::MentionFilter#call

Defined in:
lib/html/pipeline/@mention_filter.rb

#callObject



70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/html/pipeline/@mention_filter.rb', line 70

def call
  result[:mentioned_usernames] ||= []

  doc.search('.//text()').each do |node|
    content = node.to_html
    next unless content.include?('@')
    next if has_ancestor?(node, IGNORE_PARENTS)
    html = mention_link_filter(content, base_url, info_url, username_pattern)
    next if html == content
    node.replace(html)
  end
  doc
end