asset urls, padrino helpers and i18n belong in more
This commit is contained in:
parent
1cad726c81
commit
64f84bacd2
|
@ -1,6 +0,0 @@
|
||||||
Feature: Support content_for and yield_content helpers
|
|
||||||
|
|
||||||
Scenario: content_for works as expected in erb
|
|
||||||
Given the Server is running at "content-for-app"
|
|
||||||
When I go to "/content_for_erb.html"
|
|
||||||
Then I should see "In Layout: I am the yielded content erb"
|
|
|
@ -1,48 +0,0 @@
|
||||||
Feature: relative_link_to helper
|
|
||||||
|
|
||||||
Scenario: relative_link_to produces relative links
|
|
||||||
Given a fixture app "indexable-app"
|
|
||||||
And an empty file named "config.rb"
|
|
||||||
And a file named "source/link_to.html.erb" with:
|
|
||||||
"""
|
|
||||||
absolute: <%= link_to "Needs Index", "/needs_index.html", :relative => true %>
|
|
||||||
relative: <%= link_to "Relative", "needs_index.html", :relative => true %>
|
|
||||||
"""
|
|
||||||
And a file named "source/link_to/sub.html.erb" with:
|
|
||||||
"""
|
|
||||||
absolute: <%= link_to "Needs Index", "/needs_index.html", :relative => true %>
|
|
||||||
relative: <%= link_to "Relative", "../needs_index.html", :relative => true %>
|
|
||||||
"""
|
|
||||||
And the Server is running at "indexable-app"
|
|
||||||
When I go to "/link_to.html"
|
|
||||||
Then I should see 'absolute: <a href="needs_index.html">Needs Index</a>'
|
|
||||||
Then I should see 'relative: <a href="needs_index.html">Relative</a>'
|
|
||||||
When I go to "/link_to/sub.html"
|
|
||||||
Then I should see 'absolute: <a href="../needs_index.html">Needs Index</a>'
|
|
||||||
Then I should see 'relative: <a href="../needs_index.html">Relative</a>'
|
|
||||||
|
|
||||||
Scenario: relative_link_to produces relative links when :relative_links is set to true
|
|
||||||
Given a fixture app "indexable-app"
|
|
||||||
And a file named "config.rb" with:
|
|
||||||
"""
|
|
||||||
set :relative_links, true
|
|
||||||
"""
|
|
||||||
And a file named "source/link_to.html.erb" with:
|
|
||||||
"""
|
|
||||||
absolute: <%= link_to "Needs Index", "/needs_index.html" %>
|
|
||||||
relative: <%= link_to "Relative", "needs_index.html", :relative => false %>
|
|
||||||
unknown: <%= link_to "Unknown", "foo.html" %>
|
|
||||||
"""
|
|
||||||
And a file named "source/link_to/sub.html.erb" with:
|
|
||||||
"""
|
|
||||||
absolute: <%= link_to "Needs Index", "/needs_index.html" %>
|
|
||||||
relative: <%= link_to "Relative", "../needs_index.html" %>
|
|
||||||
"""
|
|
||||||
And the Server is running at "indexable-app"
|
|
||||||
When I go to "/link_to.html"
|
|
||||||
Then I should see 'absolute: <a href="needs_index.html">Needs Index</a>'
|
|
||||||
Then I should see 'relative: <a href="/needs_index.html">Relative</a>'
|
|
||||||
Then I should see 'unknown: <a href="foo.html">Unknown</a>'
|
|
||||||
When I go to "/link_to/sub.html"
|
|
||||||
Then I should see 'absolute: <a href="../needs_index.html">Needs Index</a>'
|
|
||||||
Then I should see 'relative: <a href="../needs_index.html">Relative</a>'
|
|
|
@ -1,3 +0,0 @@
|
||||||
with_layout :content_for do
|
|
||||||
page "/content_for_erb.html"
|
|
||||||
end
|
|
|
@ -1,4 +0,0 @@
|
||||||
In Layout: <%= yield_content(:from_template).chomp.strip %>
|
|
||||||
|
|
||||||
In Template:
|
|
||||||
<%= yield %>
|
|
|
@ -3,6 +3,7 @@ require "tilt"
|
||||||
|
|
||||||
# Use ActiveSupport JSON
|
# Use ActiveSupport JSON
|
||||||
require "active_support/json"
|
require "active_support/json"
|
||||||
|
require "active_support/core_ext/integer/inflections"
|
||||||
|
|
||||||
# Simple callback library
|
# Simple callback library
|
||||||
require "middleman-core/vendor/hooks-0.2.0/lib/hooks"
|
require "middleman-core/vendor/hooks-0.2.0/lib/hooks"
|
||||||
|
@ -146,18 +147,9 @@ module Middleman
|
||||||
# Setup external helpers
|
# Setup external helpers
|
||||||
register Middleman::CoreExtensions::ExternalHelpers
|
register Middleman::CoreExtensions::ExternalHelpers
|
||||||
|
|
||||||
# Setup default helpers
|
|
||||||
register Middleman::CoreExtensions::DefaultHelpers
|
|
||||||
|
|
||||||
# Setup asset path pipeline
|
|
||||||
register Middleman::CoreExtensions::Assets
|
|
||||||
|
|
||||||
# with_layout and page routing
|
# with_layout and page routing
|
||||||
register Middleman::CoreExtensions::Routing
|
register Middleman::CoreExtensions::Routing
|
||||||
|
|
||||||
# i18n
|
|
||||||
register Middleman::CoreExtensions::I18n
|
|
||||||
|
|
||||||
# Initialize the Middleman project
|
# Initialize the Middleman project
|
||||||
def initialize(&block)
|
def initialize(&block)
|
||||||
# Current path defaults to nil, used in views.
|
# Current path defaults to nil, used in views.
|
||||||
|
|
|
@ -10,9 +10,6 @@ require "middleman-core/core_extensions/builder"
|
||||||
# Custom Feature API
|
# Custom Feature API
|
||||||
require "middleman-core/core_extensions/extensions"
|
require "middleman-core/core_extensions/extensions"
|
||||||
|
|
||||||
# Asset Path Pipeline
|
|
||||||
require "middleman-core/core_extensions/assets"
|
|
||||||
|
|
||||||
# Data looks at the data/ folder for YAML files and makes them available
|
# Data looks at the data/ folder for YAML files and makes them available
|
||||||
# to dynamic requests.
|
# to dynamic requests.
|
||||||
require "middleman-core/core_extensions/data"
|
require "middleman-core/core_extensions/data"
|
||||||
|
@ -23,9 +20,6 @@ require "middleman-core/core_extensions/front_matter"
|
||||||
# External helpers looks in the helpers/ folder for helper modules
|
# External helpers looks in the helpers/ folder for helper modules
|
||||||
require "middleman-core/core_extensions/external_helpers"
|
require "middleman-core/core_extensions/external_helpers"
|
||||||
|
|
||||||
# DefaultHelpers are the built-in dynamic template helpers.
|
|
||||||
require "middleman-core/core_extensions/default_helpers"
|
|
||||||
|
|
||||||
# Extended version of Padrino's rendering
|
# Extended version of Padrino's rendering
|
||||||
require "middleman-core/core_extensions/rendering"
|
require "middleman-core/core_extensions/rendering"
|
||||||
|
|
||||||
|
@ -33,7 +27,4 @@ require "middleman-core/core_extensions/rendering"
|
||||||
require "middleman-core/core_extensions/routing"
|
require "middleman-core/core_extensions/routing"
|
||||||
|
|
||||||
# Catch and show exceptions at the Rack level
|
# Catch and show exceptions at the Rack level
|
||||||
require "middleman-core/core_extensions/show_exceptions"
|
require "middleman-core/core_extensions/show_exceptions"
|
||||||
|
|
||||||
# i18n
|
|
||||||
require "middleman-core/core_extensions/i18n"
|
|
|
@ -31,12 +31,8 @@ Gem::Specification.new do |s|
|
||||||
|
|
||||||
# Helpers
|
# Helpers
|
||||||
s.add_dependency("activesupport", ["~> 3.2.0"])
|
s.add_dependency("activesupport", ["~> 3.2.0"])
|
||||||
s.add_dependency("padrino-helpers", ["~> 0.10.6"])
|
|
||||||
|
|
||||||
# Watcher
|
# Watcher
|
||||||
s.add_dependency("listen", ["~> 0.4.2"])
|
s.add_dependency("listen", ["~> 0.4.2"])
|
||||||
|
|
||||||
# i18n
|
|
||||||
s.add_dependency("i18n", ["~> 0.6.0"])
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
Feature: Support content_for and yield_content helpers
|
Feature: Support content_for and yield_content helpers
|
||||||
|
|
||||||
|
Scenario: content_for works as expected in erb
|
||||||
|
Given the Server is running at "content-for-app"
|
||||||
|
When I go to "/content_for_erb.html"
|
||||||
|
Then I should see "In Layout: I am the yielded content erb"
|
||||||
|
|
||||||
Scenario: content_for works as expected in haml
|
Scenario: content_for works as expected in haml
|
||||||
Given the Server is running at "content-for-app"
|
Given the Server is running at "content-for-app"
|
||||||
|
|
|
@ -1,5 +1,52 @@
|
||||||
Feature: relative_link_to helper
|
Feature: relative_link_to helper
|
||||||
|
|
||||||
|
Scenario: relative_link_to produces relative links
|
||||||
|
Given a fixture app "indexable-app"
|
||||||
|
And an empty file named "config.rb"
|
||||||
|
And a file named "source/link_to.html.erb" with:
|
||||||
|
"""
|
||||||
|
absolute: <%= link_to "Needs Index", "/needs_index.html", :relative => true %>
|
||||||
|
relative: <%= link_to "Relative", "needs_index.html", :relative => true %>
|
||||||
|
"""
|
||||||
|
And a file named "source/link_to/sub.html.erb" with:
|
||||||
|
"""
|
||||||
|
absolute: <%= link_to "Needs Index", "/needs_index.html", :relative => true %>
|
||||||
|
relative: <%= link_to "Relative", "../needs_index.html", :relative => true %>
|
||||||
|
"""
|
||||||
|
And the Server is running at "indexable-app"
|
||||||
|
When I go to "/link_to.html"
|
||||||
|
Then I should see 'absolute: <a href="needs_index.html">Needs Index</a>'
|
||||||
|
Then I should see 'relative: <a href="needs_index.html">Relative</a>'
|
||||||
|
When I go to "/link_to/sub.html"
|
||||||
|
Then I should see 'absolute: <a href="../needs_index.html">Needs Index</a>'
|
||||||
|
Then I should see 'relative: <a href="../needs_index.html">Relative</a>'
|
||||||
|
|
||||||
|
Scenario: relative_link_to produces relative links when :relative_links is set to true
|
||||||
|
Given a fixture app "indexable-app"
|
||||||
|
And a file named "config.rb" with:
|
||||||
|
"""
|
||||||
|
set :relative_links, true
|
||||||
|
"""
|
||||||
|
And a file named "source/link_to.html.erb" with:
|
||||||
|
"""
|
||||||
|
absolute: <%= link_to "Needs Index", "/needs_index.html" %>
|
||||||
|
relative: <%= link_to "Relative", "needs_index.html", :relative => false %>
|
||||||
|
unknown: <%= link_to "Unknown", "foo.html" %>
|
||||||
|
"""
|
||||||
|
And a file named "source/link_to/sub.html.erb" with:
|
||||||
|
"""
|
||||||
|
absolute: <%= link_to "Needs Index", "/needs_index.html" %>
|
||||||
|
relative: <%= link_to "Relative", "../needs_index.html" %>
|
||||||
|
"""
|
||||||
|
And the Server is running at "indexable-app"
|
||||||
|
When I go to "/link_to.html"
|
||||||
|
Then I should see 'absolute: <a href="needs_index.html">Needs Index</a>'
|
||||||
|
Then I should see 'relative: <a href="/needs_index.html">Relative</a>'
|
||||||
|
Then I should see 'unknown: <a href="foo.html">Unknown</a>'
|
||||||
|
When I go to "/link_to/sub.html"
|
||||||
|
Then I should see 'absolute: <a href="../needs_index.html">Needs Index</a>'
|
||||||
|
Then I should see 'relative: <a href="../needs_index.html">Relative</a>'
|
||||||
|
|
||||||
Scenario: relative_link_to knows about directory indexes
|
Scenario: relative_link_to knows about directory indexes
|
||||||
Given a fixture app "indexable-app"
|
Given a fixture app "indexable-app"
|
||||||
And a file named "source/link_to.html.erb" with:
|
And a file named "source/link_to.html.erb" with:
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
require "slim"
|
require "slim"
|
||||||
|
|
||||||
with_layout :content_for do
|
with_layout :content_for do
|
||||||
|
page "/content_for_erb.html"
|
||||||
page "/content_for_haml.html"
|
page "/content_for_haml.html"
|
||||||
page "/content_for_slim.html"
|
page "/content_for_slim.html"
|
||||||
end
|
end
|
|
@ -43,6 +43,18 @@ module Middleman::More
|
||||||
# Setup Core Extensions
|
# Setup Core Extensions
|
||||||
###
|
###
|
||||||
|
|
||||||
|
# Setup default helpers
|
||||||
|
require "middleman-more/core_extensions/default_helpers"
|
||||||
|
Middleman::Application.register Middleman::CoreExtensions::DefaultHelpers
|
||||||
|
|
||||||
|
# Setup asset path pipeline
|
||||||
|
require "middleman-more/core_extensions/assets"
|
||||||
|
Middleman::Application.register Middleman::CoreExtensions::Assets
|
||||||
|
|
||||||
|
# i18n
|
||||||
|
require "middleman-more/core_extensions/i18n"
|
||||||
|
Middleman::Application.register Middleman::CoreExtensions::I18n
|
||||||
|
|
||||||
# Compass framework
|
# Compass framework
|
||||||
require "middleman-more/core_extensions/compass"
|
require "middleman-more/core_extensions/compass"
|
||||||
Middleman::Application.register Middleman::CoreExtensions::Compass
|
Middleman::Application.register Middleman::CoreExtensions::Compass
|
||||||
|
|
|
@ -7,7 +7,6 @@ module Middleman
|
||||||
class << self
|
class << self
|
||||||
# @private
|
# @private
|
||||||
def registered(app)
|
def registered(app)
|
||||||
require "active_support/core_ext/integer/inflections"
|
|
||||||
require 'padrino-helpers'
|
require 'padrino-helpers'
|
||||||
|
|
||||||
app.helpers ::Padrino::Helpers::OutputHelpers
|
app.helpers ::Padrino::Helpers::OutputHelpers
|
|
@ -27,4 +27,8 @@ Gem::Specification.new do |s|
|
||||||
s.add_dependency("sprockets", ["~> 2.1"])
|
s.add_dependency("sprockets", ["~> 2.1"])
|
||||||
s.add_dependency("sprockets-sass", ["~> 0.8.0"])
|
s.add_dependency("sprockets-sass", ["~> 0.8.0"])
|
||||||
s.add_dependency("maruku", ["~> 0.6.0"])
|
s.add_dependency("maruku", ["~> 0.6.0"])
|
||||||
|
|
||||||
|
# i18n
|
||||||
|
s.add_dependency("i18n", ["~> 0.6.0"])
|
||||||
|
s.add_dependency("padrino-helpers", ["~> 0.10.6"])
|
||||||
end
|
end
|
Loading…
Reference in a new issue