Class: Banzai::Filter::References::WikiPageReferenceFilter

Inherits:
AbstractReferenceFilter show all
Includes:
CrossNamespaceReference
Defined in:
lib/banzai/filter/references/wiki_page_reference_filter.rb

Overview

HTML filter that replaces wiki page references with links.

This filter supports cross-project and cross-group references.

Constant Summary

Constants included from Concerns::TimeoutFilterHandler

Concerns::TimeoutFilterHandler::COMPLEX_MARKDOWN_MESSAGE, Concerns::TimeoutFilterHandler::RENDER_TIMEOUT, Concerns::TimeoutFilterHandler::SANITIZATION_RENDER_TIMEOUT

Constants included from Concerns::PipelineTimingCheck

Concerns::PipelineTimingCheck::MAX_PIPELINE_SECONDS

Constants inherited from ReferenceFilter

ReferenceFilter::REFERENCE_TYPE_ATTRIBUTE, ReferenceFilter::REFERENCE_TYPE_DATA_ATTRIBUTE_NAME

Constants included from Concerns::TextReplacer

Concerns::TextReplacer::REFERENCE_PLACEHOLDER, Concerns::TextReplacer::REFERENCE_PLACEHOLDER_PATTERN

Instance Method Summary collapse

Methods included from CrossNamespaceReference

#parent_from_ref

Methods inherited from AbstractReferenceFilter

#call, #data_attributes_for, #find_object_cached, #find_object_from_link, #find_object_from_link_cached, #from_ref_cached, #identifier, #initialize, #object_link_content_html, #object_link_content_html_extras, #object_link_filter, #object_link_title, #record_identifier, #references_in, #symbol_from_match_data, #url_for_object_cached, #wrap_link

Methods included from CrossProjectReference

#parent_from_ref

Methods included from Concerns::TimeoutFilterHandler

#call

Methods included from Concerns::PipelineTimingCheck

#call, #exceeded_pipeline_max?

Methods inherited from ReferenceFilter

call, #call, #call_and_update_nodes, #each_node, #group, #initialize, #nodes, #nodes?, #object_class, #project, #references_in, #requires_unescaping?

Methods included from Concerns::TextReplacer

#replace_references_in_text_with_html

Methods included from Concerns::HtmlWriter

#write_opening_tag

Methods included from Concerns::OutputSafety

#escape_once

Methods included from RequestStoreReferenceCache

#cached_call, #get_or_set_cache

Constructor Details

This class inherits a constructor from Banzai::Filter::References::AbstractReferenceFilter

Instance Method Details

#find_object(parent_object, id) ⇒ Object



15
16
17
# File 'lib/banzai/filter/references/wiki_page_reference_filter.rb', line 15

def find_object(parent_object, id)
  parent_object.wiki.find_page(id, load_content: false)
end

#parentObject



31
32
33
# File 'lib/banzai/filter/references/wiki_page_reference_filter.rb', line 31

def parent
  project&.project_namespace || group
end

#parent_typeObject



27
28
29
# File 'lib/banzai/filter/references/wiki_page_reference_filter.rb', line 27

def parent_type
  :namespace
end

#parse_symbol(string, _match) ⇒ Object



19
20
21
# File 'lib/banzai/filter/references/wiki_page_reference_filter.rb', line 19

def parse_symbol(string, _match)
  string
end

#url_for_object(object, parent_object) ⇒ Object



23
24
25
# File 'lib/banzai/filter/references/wiki_page_reference_filter.rb', line 23

def url_for_object(object, parent_object)
  Gitlab::UrlBuilder.wiki_page_url(parent_object.wiki, object)
end