Merge pull request #328 from bhollis/master

Documentation and dead code removal
This commit is contained in:
Thomas Reynolds 2012-03-27 02:46:35 -07:00
commit 59e112a022
4 changed files with 23 additions and 29 deletions

View file

@ -122,6 +122,23 @@ module Middleman
@_registered ||= {}
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)
# If we've already got a matching extension that passed the
# version check, bail out.

View file

@ -11,19 +11,16 @@ module Middleman::Sitemap
# @return [String]
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
# @return [Symbol]
attr_accessor :status
# Initialize page with parent store and URL
# @param [Middleman::Sitemap::Store] store
# @param [String] path
def initialize(store, path)
@store = store
@path = path
@status = :generic
@source_file = nil
@proxied_to = nil
end
@ -83,30 +80,16 @@ module Middleman::Sitemap
# Whether this page is a proxy
# @return [Boolean]
def proxy?
@status == :proxy
!!@proxied_to
end
# Set this page to proxy to a target path
# @param [String] target
# @return [void]
def proxy_to(target)
@status = :proxy
@proxied_to = target
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
# @return [Boolean]
def ignored?

View file

@ -91,6 +91,8 @@ module Middleman::Sitemap
end
# 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)
# TODO: memoize this
destination_path = normalize_path(destination_path)
@ -156,14 +158,6 @@ module Middleman::Sitemap
true
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
# Get a path without templating extensions

View file

@ -25,7 +25,7 @@ module Middleman
autoload :Sprockets, "middleman-more/core_extensions/sprockets"
end
# User-activatable extendions
# User-activatable extensions
module Extensions
# RelativeAssets allow any asset path in dynamic templates to be either
# relative to the root of the project or use an absolute URL.