module StaticMatic::Helpers::CurrentPathHelper

Public Instance Methods

current_page() click to toggle source
# File lib/staticmatic/helpers/current_path_helper.rb, line 6
def current_page
  @staticmatic.current_file
end

Private Instance Methods

current_page_relative_path(current_path = nil) click to toggle source
# File lib/staticmatic/helpers/current_path_helper.rb, line 12
def current_page_relative_path(current_path = nil)
  if current_path.nil? || current_path.match(/^((\.\.?)?\/|\#|.+?\:)/) == nil
    current_page_depth = current_page.split('/').length - 3;
    (current_page_depth > 0) ? ([ '..' ] * current_page_depth).join('/') + '/' : nil
  else
    nil
  end
end