Class: Banzai::Filter::UploadLinkFilter

Inherits:
HTML::Pipeline::Filter
  • Object
show all
Defined in:
lib/banzai/filter/upload_link_filter.rb

Overview

HTML filter that “fixes” relative upload links to files. Context options:

:project (required) - Current project

Instance Method Summary collapse

Instance Method Details

#callObject


10
11
12
13
14
15
16
17
18
19
20
# File 'lib/banzai/filter/upload_link_filter.rb', line 10

def call
  doc.search('a').each do |el|
    process_link_attr el.attribute('href')
  end

  doc.search('img').each do |el|
    process_link_attr el.attribute('src')
  end

  doc
end