Class: Banzai::Filter::RepositoryLinkFilter

Inherits:
BaseRelativeLinkFilter show all
Defined in:
lib/banzai/filter/repository_link_filter.rb

Overview

HTML filter that “fixes” relative links to files in a repository.

Context options:

:commit
:current_user
:project
:wiki
:ref
:requested_path
:system_note

Instance Method Summary collapse

Methods included from Gitlab::Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Instance Method Details

#callObject


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/banzai/filter/repository_link_filter.rb', line 18

def call
  return doc if context[:system_note]

  clear_memoization(:linkable_files)
  clear_memoization(:linkable_attributes)

  load_uri_types

  linkable_attributes.each do |attr|
    if linkable_files? && repo_visible_to_user?
      process_link_to_repository_attr(attr)
    end
  end

  doc
end