class Lookbook::PageEntity

@api public
Represents a documentation page

def add_section(section)

Other tags:
    Api: - private
def add_section(section)
  @sections << section
  @sections.sort_by! { |section| [section.priority, section.label] }
end

def data

Returns:
  • (Hash) - The resolved data hash
def data
  return @_data if @_data
  config_data = fetch_config(:data, {})
  @_data ||= config_data.is_a?(Hash) ? Store.new(config_data) : config_data
end

def docs_path

Returns:
  • (String) - URL path
def docs_path
  lookbook_page_path(lookup_path)
end

def fetch_config(key, fallback = nil, &block)

def fetch_config(key, fallback = nil, &block)
  value = frontmatter[key]
  Utils.value_or_fallback(value, fallback, &block)
end

def file_contents

def file_contents
  @_file_contents ||= File.read(file_path)
end

def footer?

Returns:
  • (Boolean) -
def footer?
  @_footer ||= fetch_config(:footer, true)
end

def frontmatter

def frontmatter
  @_merged_frontmatter ||= Lookbook.config.page_options.deep_merge(@frontmatter.to_h).deep_symbolize_keys
end

def header?

Returns:
  • (Boolean) -
def header?
  @_header ||= fetch_config(:header, true)
end

def initialize(file_path)

Other tags:
    Api: - private
def initialize(file_path)
  @file_path = Pathname(file_path)
  @base_directories = Engine.page_paths
  @lookup_path = PathUtils.to_lookup_path(relative_file_path)
  @frontmatter, @content = FrontmatterExtractor.call(file_contents)
  @priority_prefixes = true
  @sections = []
end

def landing?

Returns:
  • (Boolean) -
def landing?
  @_landing ||= fetch_config(:landing, false)
end

def markdown?

Returns:
  • (Boolean) -
def markdown?
  @_markdown ||= fetch_config(:markdown) { file_path.to_s.match?(/(.*)\.md\.(.*)$/) }
end

def method_missing(method_name, *args, &block)

Other tags:
    Api: - private
def method_missing(method_name, *args, &block)
  method_name.to_s.end_with?("=") ? super : frontmatter.fetch(method_name, nil)
end

def respond_to_missing?(method_name, include_private = false)

Other tags:
    Api: - private
def respond_to_missing?(method_name, include_private = false)
  frontmatter.key?(method_name) || super
end

def search_terms

Other tags:
    Api: - private
def search_terms
  lookup_path.split("/") << label
end

def title

Returns:
  • (String) - The title
def title
  @_title ||= fetch_config(:title, label)
end