Merge pull request #328 from bhollis/master
Documentation and dead code removal
This commit is contained in:
commit
59e112a022
4 changed files with 23 additions and 29 deletions
|
@ -122,6 +122,23 @@ module Middleman
|
||||||
@_registered ||= {}
|
@_registered ||= {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Register a new extension. Choose a name which will be
|
||||||
|
# used to activate the extension in config.rb, like this:
|
||||||
|
#
|
||||||
|
# activate :my_extension
|
||||||
|
#
|
||||||
|
# Provide your extension module either as the namespace
|
||||||
|
# parameter, or return it from the block:
|
||||||
|
#
|
||||||
|
# @param [Symbol] name The name of the extension
|
||||||
|
# @param [Module] namespace The extension module
|
||||||
|
# @param [String] version A RubyGems-style version string stating
|
||||||
|
# the versions of middleman this extension
|
||||||
|
# is compatible with.
|
||||||
|
# @yield Instead of passing a module in namespace, you can provide
|
||||||
|
# a block which returns your extension module. This gives
|
||||||
|
# you the ability to require other files only when the
|
||||||
|
# extension is activated.
|
||||||
def register(name, namespace=nil, version=nil, &block)
|
def register(name, namespace=nil, version=nil, &block)
|
||||||
# If we've already got a matching extension that passed the
|
# If we've already got a matching extension that passed the
|
||||||
# version check, bail out.
|
# version check, bail out.
|
||||||
|
|
|
@ -11,19 +11,16 @@ module Middleman::Sitemap
|
||||||
# @return [String]
|
# @return [String]
|
||||||
attr_accessor :path
|
attr_accessor :path
|
||||||
|
|
||||||
# @return [Middleman::Sitemap::Page]
|
# The path of the page this page is proxied to, or nil if it's not proxied.
|
||||||
|
# @return [String]
|
||||||
attr_accessor :proxied_to
|
attr_accessor :proxied_to
|
||||||
|
|
||||||
# @return [Symbol]
|
|
||||||
attr_accessor :status
|
|
||||||
|
|
||||||
# Initialize page with parent store and URL
|
# Initialize page with parent store and URL
|
||||||
# @param [Middleman::Sitemap::Store] store
|
# @param [Middleman::Sitemap::Store] store
|
||||||
# @param [String] path
|
# @param [String] path
|
||||||
def initialize(store, path)
|
def initialize(store, path)
|
||||||
@store = store
|
@store = store
|
||||||
@path = path
|
@path = path
|
||||||
@status = :generic
|
|
||||||
@source_file = nil
|
@source_file = nil
|
||||||
@proxied_to = nil
|
@proxied_to = nil
|
||||||
end
|
end
|
||||||
|
@ -83,30 +80,16 @@ module Middleman::Sitemap
|
||||||
# Whether this page is a proxy
|
# Whether this page is a proxy
|
||||||
# @return [Boolean]
|
# @return [Boolean]
|
||||||
def proxy?
|
def proxy?
|
||||||
@status == :proxy
|
!!@proxied_to
|
||||||
end
|
end
|
||||||
|
|
||||||
# Set this page to proxy to a target path
|
# Set this page to proxy to a target path
|
||||||
# @param [String] target
|
# @param [String] target
|
||||||
# @return [void]
|
# @return [void]
|
||||||
def proxy_to(target)
|
def proxy_to(target)
|
||||||
@status = :proxy
|
|
||||||
@proxied_to = target
|
@proxied_to = target
|
||||||
end
|
end
|
||||||
|
|
||||||
# Whether this page is a generic page
|
|
||||||
# @return [Boolean]
|
|
||||||
def generic?
|
|
||||||
@status == :generic
|
|
||||||
end
|
|
||||||
|
|
||||||
# Set this page to be a generic page
|
|
||||||
# @return [void]
|
|
||||||
def make_generic
|
|
||||||
@status = :generic
|
|
||||||
# TODO: Remove from ignore array?
|
|
||||||
end
|
|
||||||
|
|
||||||
# Whether this page is ignored
|
# Whether this page is ignored
|
||||||
# @return [Boolean]
|
# @return [Boolean]
|
||||||
def ignored?
|
def ignored?
|
||||||
|
|
|
@ -91,6 +91,8 @@ module Middleman::Sitemap
|
||||||
end
|
end
|
||||||
|
|
||||||
# Find a page given its destination path
|
# Find a page given its destination path
|
||||||
|
# @param [String] The destination (output) path of a page.
|
||||||
|
# @return [Middleman::Sitemap::Page]
|
||||||
def page_by_destination(destination_path)
|
def page_by_destination(destination_path)
|
||||||
# TODO: memoize this
|
# TODO: memoize this
|
||||||
destination_path = normalize_path(destination_path)
|
destination_path = normalize_path(destination_path)
|
||||||
|
@ -156,14 +158,6 @@ module Middleman::Sitemap
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
# Whether the sitemap should completely ignore a given file/path
|
|
||||||
# @param [String] file
|
|
||||||
# @param [String] path
|
|
||||||
# @return [Boolean]
|
|
||||||
def sitemap_should_ignore?(file, path)
|
|
||||||
@app.sitemap_ignore.every(&:call)
|
|
||||||
end
|
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
# Get a path without templating extensions
|
# Get a path without templating extensions
|
||||||
|
|
|
@ -25,7 +25,7 @@ module Middleman
|
||||||
autoload :Sprockets, "middleman-more/core_extensions/sprockets"
|
autoload :Sprockets, "middleman-more/core_extensions/sprockets"
|
||||||
end
|
end
|
||||||
|
|
||||||
# User-activatable extendions
|
# User-activatable extensions
|
||||||
module Extensions
|
module Extensions
|
||||||
# RelativeAssets allow any asset path in dynamic templates to be either
|
# RelativeAssets allow any asset path in dynamic templates to be either
|
||||||
# relative to the root of the project or use an absolute URL.
|
# relative to the root of the project or use an absolute URL.
|
||||||
|
|
Loading…
Reference in a new issue