Class: Banzai::Filter::AbsoluteLinkFilter

Inherits:
HTML::Pipeline::Filter
  • Object
show all
Includes:
Concerns::PipelineTimingCheck
Defined in:
lib/banzai/filter/absolute_link_filter.rb

Overview

HTML filter that converts relative urls into absolute ones.

Constant Summary collapse

CSS =
'a.gfm'
XPATH =
Gitlab::Utils::Nokogiri.css_to_xpath(CSS).freeze

Constants included from Concerns::PipelineTimingCheck

Concerns::PipelineTimingCheck::MAX_PIPELINE_SECONDS

Instance Method Summary collapse

Methods included from Concerns::PipelineTimingCheck

#exceeded_pipeline_max?

Instance Method Details

#callObject



14
15
16
17
18
19
20
21
22
# File 'lib/banzai/filter/absolute_link_filter.rb', line 14

def call
  return doc if skip?

  doc.xpath(self.class::XPATH).each do |el|
    process_link_attr el.attribute('href')
  end

  doc
end