Method: HTML::Pipeline::MentionFilter#call

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

#callObject



62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/html/pipeline/@mention_filter.rb', line 62

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

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