in _plugins/search-indexer.rb [42:84]
def self.add(page)
return if @excluded_paths.match(page.url)
content = page.content
.gsub(@html_excluded_tags, ' ')
.gsub(@html_block_tags, "\n")
.gsub(/\s*<[?\/!]?[a-z]+.*?>\s*/im, ' ')
.gsub(/\s*[\r\n]+\s*/, "\n")
.gsub(/\s{2,}/, ' ')
.gsub(/\s+([.:;,)!\]?])/, '\1')
.strip
return if content.empty?
url = @site.config["baseurl"] + page.url
ancestors = []
if page.instance_of?(Jekyll::Document)
ancestors.push(@site.config.dig("just_the_docs", "collections", page.collection&.label, "name"))
end
ancestors.push(page.data["grand_parent"]) unless
page.data["grand_parent"].nil? ||
page.data["grand_parent"]&.empty? ||
ancestors.include?(page.data["grand_parent"])
ancestors.push(page.data["parent"]) unless
page.data["parent"].nil? ||
page.data["parent"]&.empty? ||
ancestors.include?(page.data["parent"])
data = {
url: url,
title: page.data["title"],
content: content,
ancestors: ancestors,
type: "DOCS"
}
@data.push(data)
end