updated from stable
This commit is contained in:
commit
0f785a448a
16
CHANGELOG.md
16
CHANGELOG.md
|
@ -28,6 +28,22 @@ master
|
||||||
* Remove old module-style extension support
|
* Remove old module-style extension support
|
||||||
* Placed all `config.rb` evaluation inside the `ConfigContext` class
|
* Placed all `config.rb` evaluation inside the `ConfigContext` class
|
||||||
|
|
||||||
|
3.3.5
|
||||||
|
===
|
||||||
|
|
||||||
|
* Update Padrino to ~> 0.12.3 (removed breadcrumb helper)
|
||||||
|
* Update compass-import-once to 1.0.5
|
||||||
|
* Fix issue with Slim partials. #1327
|
||||||
|
|
||||||
|
3.3.4
|
||||||
|
===
|
||||||
|
|
||||||
|
* Fix `automatic_alt_tags` error. #1341
|
||||||
|
* `partial` now looks for i18n suffixed filenames. #1333
|
||||||
|
* Allow excluding paths from `gzip`. #1268
|
||||||
|
* Let LiveReload work on 404 pages.
|
||||||
|
* Update `listen` dependency.
|
||||||
|
|
||||||
3.3.3
|
3.3.3
|
||||||
===
|
===
|
||||||
|
|
||||||
|
|
2
Gemfile
2
Gemfile
|
@ -23,7 +23,7 @@ gem 'liquid', '>= 2.6', require: false
|
||||||
gem 'stylus', '>= 1.0', require: false
|
gem 'stylus', '>= 1.0', require: false
|
||||||
gem 'sinatra', '>= 1.4', require: false
|
gem 'sinatra', '>= 1.4', require: false
|
||||||
gem 'redcarpet', '>= 3.1', require: false unless RUBY_ENGINE == 'jruby'
|
gem 'redcarpet', '>= 3.1', require: false unless RUBY_ENGINE == 'jruby'
|
||||||
gem 'asciidoctor', '>= 0.1', require: false
|
gem 'asciidoctor', '~> 0.1', require: false
|
||||||
|
|
||||||
# For less, note there is no compatible JS runtime for windows
|
# For less, note there is no compatible JS runtime for windows
|
||||||
gem 'therubyrhino', '>= 2.0', platforms: :jruby
|
gem 'therubyrhino', '>= 2.0', platforms: :jruby
|
||||||
|
|
8
middleman-core/features/automatic_alt_tags.feature
Normal file
8
middleman-core/features/automatic_alt_tags.feature
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
Feature: Automatically detect and insert image dimensions into tags
|
||||||
|
In order to speed up development and appease YSlow
|
||||||
|
|
||||||
|
Scenario: Rendering an image with the feature enabled
|
||||||
|
Given "automatic_alt_tags" feature is "enabled"
|
||||||
|
And the Server is running at "automatic-alt-tags-app"
|
||||||
|
When I go to "/auto-image-sizes.html"
|
||||||
|
Then I should see 'alt="Blank"'
|
23
middleman-core/features/i18n_partials.feature
Normal file
23
middleman-core/features/i18n_partials.feature
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
Feature: i18n Partials
|
||||||
|
|
||||||
|
Scenario: Running localize with the default config
|
||||||
|
Given a fixture app "i18n-test-app"
|
||||||
|
And a file named "config.rb" with:
|
||||||
|
"""
|
||||||
|
activate :i18n
|
||||||
|
"""
|
||||||
|
Given the Server is running at "i18n-test-app"
|
||||||
|
When I go to "/partials/index.html"
|
||||||
|
Then I should see "Country: USA"
|
||||||
|
Then I should see "State: District of Columbia"
|
||||||
|
Then I should see "Greeting: Hello"
|
||||||
|
Then I should see "Site: Locale Site"
|
||||||
|
Then I should see "Flag: stars"
|
||||||
|
Then I should see "President: obama"
|
||||||
|
When I go to "/es/partials/index.html"
|
||||||
|
Then I should see "Country: Mexico"
|
||||||
|
Then I should see "State: Distrito Federal"
|
||||||
|
Then I should see "Greeting: Hola"
|
||||||
|
Then I should see "Site: Locale Site"
|
||||||
|
Then I should see "Flag: bars"
|
||||||
|
Then I should see "President: nieto"
|
|
@ -49,3 +49,9 @@ Feature: Provide Sane Defaults for Partial Behavior
|
||||||
Given the Server is running at "partials-app"
|
Given the Server is running at "partials-app"
|
||||||
When I go to "/svg.html"
|
When I go to "/svg.html"
|
||||||
Then I should see "<svg"
|
Then I should see "<svg"
|
||||||
|
When I go to "/static_underscore.html"
|
||||||
|
Then I should see "<p>Hello World</p>"
|
||||||
|
When I go to "/code_snippet.html"
|
||||||
|
Then I should see "File Not Found"
|
||||||
|
When I go to "/_code_snippet.html"
|
||||||
|
Then I should see "File Not Found"
|
||||||
|
|
|
@ -19,3 +19,63 @@ Feature: Support slim templating language
|
||||||
And the Server is running at "empty_app"
|
And the Server is running at "empty_app"
|
||||||
When I go to "/slim.html"
|
When I go to "/slim.html"
|
||||||
Then I should see "<h1>Welcome to Slim</h1>"
|
Then I should see "<h1>Welcome to Slim</h1>"
|
||||||
|
|
||||||
|
Scenario: Slim Content For
|
||||||
|
Given the Server is running at "slim-content-for-app"
|
||||||
|
When I go to "/index.html"
|
||||||
|
Then I should not see "Content AContent B"
|
||||||
|
Then I should see "Content for A:Content A"
|
||||||
|
Then I should see "Content for main:Content Main"
|
||||||
|
Then I should see "Content for B:Content B"
|
||||||
|
|
||||||
|
Scenario: Rendering Scss in a Slim filter
|
||||||
|
Given an empty app
|
||||||
|
And a file named "config.rb" with:
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
And a file named "source/scss.html.slim" with:
|
||||||
|
"""
|
||||||
|
doctype 5
|
||||||
|
html lang='en'
|
||||||
|
head
|
||||||
|
meta charset="utf-8"
|
||||||
|
scss:
|
||||||
|
@mixin global-reset {
|
||||||
|
html, body, div {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@include global-reset;
|
||||||
|
body
|
||||||
|
h1 Welcome to Slim
|
||||||
|
"""
|
||||||
|
And a file named "source/sass.html.slim" with:
|
||||||
|
"""
|
||||||
|
doctype 5
|
||||||
|
html lang='en'
|
||||||
|
head
|
||||||
|
meta charset="utf-8"
|
||||||
|
sass:
|
||||||
|
html, body, div
|
||||||
|
padding: 0
|
||||||
|
body
|
||||||
|
h1 Welcome to Slim
|
||||||
|
"""
|
||||||
|
And a file named "source/error.html.slim" with:
|
||||||
|
"""
|
||||||
|
doctype 5
|
||||||
|
html lang='en'
|
||||||
|
head
|
||||||
|
meta charset="utf-8"
|
||||||
|
scss:
|
||||||
|
+global-reset2
|
||||||
|
body
|
||||||
|
h1 Welcome to Slim
|
||||||
|
"""
|
||||||
|
And the Server is running at "empty_app"
|
||||||
|
When I go to "/scss.html"
|
||||||
|
Then I should see "html,body,div"
|
||||||
|
When I go to "/sass.html"
|
||||||
|
Then I should see "html,body,div"
|
||||||
|
When I go to "/error.html"
|
||||||
|
Then I should see "Syntax error"
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
<%= image_tag "blank.gif" %>
|
BIN
middleman-core/fixtures/automatic-alt-tags-app/source/images/blank.gif
Executable file
BIN
middleman-core/fixtures/automatic-alt-tags-app/source/images/blank.gif
Executable file
Binary file not shown.
After Width: | Height: | Size: 43 B |
|
@ -0,0 +1 @@
|
||||||
|
USA
|
|
@ -0,0 +1 @@
|
||||||
|
Mexico
|
1
middleman-core/fixtures/i18n-test-app/source/_site.erb
Normal file
1
middleman-core/fixtures/i18n-test-app/source/_site.erb
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Locale Site
|
|
@ -0,0 +1 @@
|
||||||
|
obama
|
|
@ -0,0 +1 @@
|
||||||
|
nieto
|
|
@ -0,0 +1 @@
|
||||||
|
District of Columbia
|
|
@ -0,0 +1 @@
|
||||||
|
Distrito Federal
|
|
@ -0,0 +1 @@
|
||||||
|
stars
|
|
@ -0,0 +1 @@
|
||||||
|
bars
|
|
@ -0,0 +1 @@
|
||||||
|
Hello
|
|
@ -0,0 +1 @@
|
||||||
|
Hola
|
|
@ -0,0 +1,6 @@
|
||||||
|
Site: <%= partial :site %>
|
||||||
|
Country: <%= partial :country %>
|
||||||
|
Greeting: <%= partial :greeting %>
|
||||||
|
State: <%= partial :state %>
|
||||||
|
Flag: <%= partial "images/flag.svg" %>
|
||||||
|
President: <%= partial "images/president.svg" %>
|
|
@ -0,0 +1 @@
|
||||||
|
<p>Hello World</p>
|
|
@ -0,0 +1 @@
|
||||||
|
<%= partial "code_snippet.html" %>
|
0
middleman-core/fixtures/slim-content-for-app/config.rb
Executable file
0
middleman-core/fixtures/slim-content-for-app/config.rb
Executable file
7
middleman-core/fixtures/slim-content-for-app/source/index.html.slim
Executable file
7
middleman-core/fixtures/slim-content-for-app/source/index.html.slim
Executable file
|
@ -0,0 +1,7 @@
|
||||||
|
- content_for :a do
|
||||||
|
| Content A
|
||||||
|
|
||||||
|
| Content Main
|
||||||
|
|
||||||
|
- content_for :b do
|
||||||
|
| Content B
|
15
middleman-core/fixtures/slim-content-for-app/source/layouts/layout.slim
Executable file
15
middleman-core/fixtures/slim-content-for-app/source/layouts/layout.slim
Executable file
|
@ -0,0 +1,15 @@
|
||||||
|
doctype html
|
||||||
|
html
|
||||||
|
body
|
||||||
|
.test
|
||||||
|
| Content for A:
|
||||||
|
== yield_content :a
|
||||||
|
br
|
||||||
|
|
||||||
|
| Content for main:
|
||||||
|
== yield
|
||||||
|
br
|
||||||
|
|
||||||
|
| Content for B:
|
||||||
|
== yield_content :b
|
||||||
|
br
|
|
@ -16,7 +16,7 @@ module Middleman
|
||||||
def_delegator :@app, :logger
|
def_delegator :@app, :logger
|
||||||
|
|
||||||
# Sort order, images, fonts, js/css and finally everything else.
|
# Sort order, images, fonts, js/css and finally everything else.
|
||||||
SORT_ORDER = %w(.png .jpeg .jpg .gif .bmp .svg .svgz .ico .woff .otf .ttf .eot .js .css)
|
SORT_ORDER = %w(.png .jpeg .jpg .gif .bmp .svg .svgz .webp .ico .woff .otf .ttf .eot .js .css)
|
||||||
|
|
||||||
# Create a new Builder instance.
|
# Create a new Builder instance.
|
||||||
# @param [Middleman::Application] app The app to build.
|
# @param [Middleman::Application] app The app to build.
|
||||||
|
|
|
@ -29,7 +29,6 @@ class Middleman::CoreExtensions::DefaultHelpers < ::Middleman::Extension
|
||||||
::Middleman::TemplateContext.send :include, ::Padrino::Helpers::RenderHelpers
|
::Middleman::TemplateContext.send :include, ::Padrino::Helpers::RenderHelpers
|
||||||
::Middleman::TemplateContext.send :include, ::Padrino::Helpers::NumberHelpers
|
::Middleman::TemplateContext.send :include, ::Padrino::Helpers::NumberHelpers
|
||||||
# ::Middleman::TemplateContext.send :include, ::Padrino::Helpers::TranslationHelpers
|
# ::Middleman::TemplateContext.send :include, ::Padrino::Helpers::TranslationHelpers
|
||||||
::Middleman::TemplateContext.send :include, ::Padrino::Helpers::Breadcrumbs
|
|
||||||
|
|
||||||
app.config.define_setting :relative_links, false, 'Whether to generate relative links instead of absolute ones'
|
app.config.define_setting :relative_links, false, 'Whether to generate relative links instead of absolute ones'
|
||||||
end
|
end
|
||||||
|
|
|
@ -40,6 +40,33 @@ class Middleman::CoreExtensions::Internationalization < ::Middleman::Extension
|
||||||
def t(*args)
|
def t(*args)
|
||||||
::I18n.t(*args)
|
::I18n.t(*args)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def locate_partial(partial_name)
|
||||||
|
locals_dir = extensions[:i18n].options[:templates_dir]
|
||||||
|
|
||||||
|
# Try /localizable
|
||||||
|
partials_path = File.join(locals_dir, partial_name)
|
||||||
|
|
||||||
|
lang_suffix = current_resource.metadata[:locals] && current_resource.metadata[:locals][:lang]
|
||||||
|
|
||||||
|
extname = File.extname(partial_name)
|
||||||
|
maybe_static = extname.length > 0
|
||||||
|
suffixed_partial_name = if maybe_static
|
||||||
|
partial_name.sub(extname, ".#{lang_suffix}#{extname}")
|
||||||
|
else
|
||||||
|
"#{partial_name}.#{lang_suffix}"
|
||||||
|
end
|
||||||
|
|
||||||
|
if lang_suffix
|
||||||
|
super(suffixed_partial_name) ||
|
||||||
|
super(File.join(locals_dir, suffixed_partial_name)) ||
|
||||||
|
super(partials_path) ||
|
||||||
|
super
|
||||||
|
else
|
||||||
|
super(partials_path) ||
|
||||||
|
super
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Contract None => ArrayOf[Symbol]
|
Contract None => ArrayOf[Symbol]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require 'middleman-core/util'
|
require 'middleman-core/util'
|
||||||
|
|
||||||
class Middleman::Extensions::AssetHash < ::Middleman::Extension
|
class Middleman::Extensions::AssetHash < ::Middleman::Extension
|
||||||
option :exts, %w(.jpg .jpeg .png .gif .js .css .otf .woff .eot .ttf .svg), 'List of extensions that get asset hashes appended to them.'
|
option :exts, %w(.jpg .jpeg .png .gif .webp .js .css .otf .woff .eot .ttf .svg), 'List of extensions that get asset hashes appended to them.'
|
||||||
option :ignore, [], 'Regexes of filenames to skip adding asset hashes to'
|
option :ignore, [], 'Regexes of filenames to skip adding asset hashes to'
|
||||||
|
|
||||||
def initialize(app, options_hash={}, &block)
|
def initialize(app, options_hash={}, &block)
|
||||||
|
|
|
@ -2,7 +2,7 @@ require 'middleman-core/middleware/inline_url_rewriter'
|
||||||
|
|
||||||
class Middleman::Extensions::AssetHost < ::Middleman::Extension
|
class Middleman::Extensions::AssetHost < ::Middleman::Extension
|
||||||
option :host, nil, 'The asset host to use or a Proc to determine asset host', required: true
|
option :host, nil, 'The asset host to use or a Proc to determine asset host', required: true
|
||||||
option :exts, %w(.css .png .jpg .jpeg .svg .svgz .js .gif), 'List of extensions that get cache busters strings appended to them.'
|
option :exts, %w(.css .png .jpg .jpeg .webp .svg .svgz .js .gif), 'List of extensions that get cache busters strings appended to them.'
|
||||||
option :sources, %w(.htm .html .php .css .js), 'List of extensions that are searched for bustable assets.'
|
option :sources, %w(.htm .html .php .css .js), 'List of extensions that are searched for bustable assets.'
|
||||||
option :ignore, [], 'Regexes of filenames to skip adding query strings to'
|
option :ignore, [], 'Regexes of filenames to skip adding query strings to'
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,15 @@
|
||||||
# Automatic Image alt tags from image names extension
|
# Automatic Image alt tags from image names extension
|
||||||
class Middleman::Extensions::AutomaticAltTags < ::Middleman::Extension
|
class Middleman::Extensions::AutomaticAltTags < ::Middleman::Extension
|
||||||
def initialize(app, options_hash={}, &block)
|
|
||||||
super
|
|
||||||
end
|
|
||||||
|
|
||||||
helpers do
|
helpers do
|
||||||
# Override default image_tag helper to automatically insert alt tag
|
# Override default image_tag helper to automatically insert alt tag
|
||||||
# containing image name.
|
# containing image name.
|
||||||
|
|
||||||
def image_tag(path)
|
def image_tag(path, params={})
|
||||||
unless path.include?('://')
|
unless path.include?('://')
|
||||||
params[:alt] ||= ''
|
params[:alt] ||= ''
|
||||||
|
|
||||||
real_path = path.dup
|
real_path = path.dup
|
||||||
real_path = File.join(images_dir, real_path) unless real_path.start_with?('/')
|
real_path = File.join(config[:images_dir], real_path) unless real_path.start_with?('/')
|
||||||
|
|
||||||
file = app.files.find(:source, real_path)
|
file = app.files.find(:source, real_path)
|
||||||
|
|
||||||
|
@ -26,7 +22,7 @@ class Middleman::Extensions::AutomaticAltTags < ::Middleman::Extension
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
super(path)
|
super(path, params)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# The Cache Buster extension
|
# The Cache Buster extension
|
||||||
class Middleman::Extensions::CacheBuster < ::Middleman::Extension
|
class Middleman::Extensions::CacheBuster < ::Middleman::Extension
|
||||||
option :exts, %w(.css .png .jpg .jpeg .svg .svgz .js .gif), 'List of extensions that get cache busters strings appended to them.'
|
option :exts, %w(.css .png .jpg .jpeg .webp .svg .svgz .js .gif), 'List of extensions that get cache busters strings appended to them.'
|
||||||
option :sources, %w(.htm .html .php .css .js), 'List of extensions that are searched for bustable assets.'
|
option :sources, %w(.htm .html .php .css .js), 'List of extensions that are searched for bustable assets.'
|
||||||
option :ignore, [], 'Regexes of filenames to skip adding query strings to'
|
option :ignore, [], 'Regexes of filenames to skip adding query strings to'
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Relative Assets extension
|
# Relative Assets extension
|
||||||
class Middleman::Extensions::RelativeAssets < ::Middleman::Extension
|
class Middleman::Extensions::RelativeAssets < ::Middleman::Extension
|
||||||
option :exts, %w(.css .png .jpg .jpeg .svg .svgz .js .gif .ttf .otf .woff), 'List of extensions that get cache busters strings appended to them.'
|
option :exts, %w(.css .png .jpg .jpeg .webp .svg .svgz .js .gif .ttf .otf .woff), 'List of extensions that get cache busters strings appended to them.'
|
||||||
option :sources, %w(.htm .html .css), 'List of extensions that are searched for relative assets.'
|
option :sources, %w(.htm .html .css), 'List of extensions that are searched for relative assets.'
|
||||||
option :ignore, [], 'Regexes of filenames to skip adding query strings to'
|
option :ignore, [], 'Regexes of filenames to skip adding query strings to'
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,14 @@ Then /^I should not see content matching %r{(.*)}$/ do |expected|
|
||||||
expect(@last_response.body).to_not match(expected)
|
expect(@last_response.body).to_not match(expected)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Then /^I should not see:$/ do |expected|
|
||||||
|
expect(@browser.last_response.body).to_not include(expected.chomp)
|
||||||
|
end
|
||||||
|
|
||||||
|
Then /^the status code should be "([^\"]*)"$/ do |expected|
|
||||||
|
expect(@browser.last_response.status).to eq expected.to_i
|
||||||
|
end
|
||||||
|
|
||||||
Then /^I should see "([^\"]*)" lines$/ do |lines|
|
Then /^I should see "([^\"]*)" lines$/ do |lines|
|
||||||
expect(@last_response.body.chomp.split($/).length).to eq(lines.to_i)
|
expect(@last_response.body.chomp.split($/).length).to eq(lines.to_i)
|
||||||
end
|
end
|
||||||
|
|
|
@ -104,10 +104,11 @@ module Middleman
|
||||||
|
|
||||||
raise ::Middleman::TemplateRenderer::TemplateNotFound, "Could not locate partial: #{name}" unless partial_file
|
raise ::Middleman::TemplateRenderer::TemplateNotFound, "Could not locate partial: #{name}" unless partial_file
|
||||||
|
|
||||||
r = sitemap.find_resource_by_path(sitemap.file_to_path(partial_file))
|
source_path = sitemap.file_to_path(partial_file)
|
||||||
|
r = sitemap.find_resource_by_path(source_path)
|
||||||
|
|
||||||
if r && !r.template?
|
if (r && !r.template?) || (Tilt[partial_file[:full_path]].nil? && partial_file[:full_path].exist?)
|
||||||
File.read(r.source_file[:full_path])
|
File.read(partial_file[:full_path])
|
||||||
else
|
else
|
||||||
opts = options.dup
|
opts = options.dup
|
||||||
locs = opts.delete(:locals)
|
locs = opts.delete(:locals)
|
||||||
|
@ -116,8 +117,6 @@ module Middleman
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
|
||||||
|
|
||||||
# Locate a partial relative to the current path or the source dir, given a partial's path.
|
# Locate a partial relative to the current path or the source dir, given a partial's path.
|
||||||
#
|
#
|
||||||
# @api private
|
# @api private
|
||||||
|
@ -140,6 +139,7 @@ module Middleman
|
||||||
[
|
[
|
||||||
[relative_dir.to_s, { preferred_engine: resource.source_file[:relative_path].extname[1..-1].to_sym }],
|
[relative_dir.to_s, { preferred_engine: resource.source_file[:relative_path].extname[1..-1].to_sym }],
|
||||||
[non_root],
|
[non_root],
|
||||||
|
[non_root, { try_static: true }],
|
||||||
[relative_dir_no_underscore.to_s, { try_static: true }],
|
[relative_dir_no_underscore.to_s, { try_static: true }],
|
||||||
[non_root_no_underscore, { try_static: true }]
|
[non_root_no_underscore, { try_static: true }]
|
||||||
].each do |args|
|
].each do |args|
|
||||||
|
@ -147,9 +147,11 @@ module Middleman
|
||||||
break if partial_file
|
break if partial_file
|
||||||
end
|
end
|
||||||
|
|
||||||
partial_file
|
partial_file || nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
# Render a path with locs, opts and contents block.
|
# Render a path with locs, opts and contents block.
|
||||||
#
|
#
|
||||||
# @api private
|
# @api private
|
||||||
|
|
|
@ -27,7 +27,7 @@ Gem::Specification.new do |s|
|
||||||
|
|
||||||
# Helpers
|
# Helpers
|
||||||
s.add_dependency('activesupport', ['~> 4.1.0'])
|
s.add_dependency('activesupport', ['~> 4.1.0'])
|
||||||
s.add_dependency("padrino-helpers", ['~> 0.12.1'])
|
s.add_dependency('padrino-helpers', ['~> 0.12.3'])
|
||||||
|
|
||||||
# Watcher
|
# Watcher
|
||||||
s.add_dependency('listen', ['>= 2.7.9', '< 3.0'])
|
s.add_dependency('listen', ['>= 2.7.9', '< 3.0'])
|
||||||
|
|
Loading…
Reference in a new issue