middleman-core 4.1.8 → 4.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 99765b41dbcadb0a1fe8e9017ce95171fe5e7877
4
- data.tar.gz: 972fcfba7e09229dc557444eba1434d6d42a0346
3
+ metadata.gz: 1bccc6ed0250ec6eca700de9c7a9fe08d002878d
4
+ data.tar.gz: 74b10ad510adda189d3e9b4f138425b3243246f3
5
5
  SHA512:
6
- metadata.gz: 52e4d9adb600ebb0a3003902d97e349df96d73c4c679c11885f6d867ce178dbe4905b16ae051b5cece2f3fffdee729fd689b8698fbc32fbcbd3067aaa3462dab
7
- data.tar.gz: cbbe75c5a1fc93a1c201cb2db174be431e766eb519f7bba08ba6ff06ccd4e693c7a4707c1602625fc7ac09337e4ddb0cf73e0b55ac1e6d24eae71ece75e69671
6
+ metadata.gz: a9a907fc76debe6f613ab50ed3e061db1aa2e4cb6f4841c92a2a0ca5674231e608f10da5dca677e683b1a53ac2e9f06d88f55c35e0fce6d824408ef35ba86709
7
+ data.tar.gz: add958d204c4d9265d5407b5cb5f66e3e41fd8ea948bab1b4cf0d226343cfe65b61918df21ce55b87eeba34c1d5a03f1285c8dfb3deeb05712f0e58627826902
@@ -40,19 +40,29 @@ Feature: link_to helper
40
40
  """
41
41
  absolute: <%= link_to "Needs Index", "/needs_index.html", relative: true %>
42
42
  relative: <%= link_to "Relative", "needs_index.html", relative: true %>
43
+
44
+ absolute spaces: <%= link_to "Spaces Index", "/evil spaces.html", relative: true %>
45
+ relative spaces: <%= link_to "Spaces Relative", "evil spaces.html", relative: true %>
43
46
  """
44
47
  And a file named "source/link_to/sub.html.erb" with:
45
48
  """
46
49
  absolute: <%= link_to "Needs Index", "/needs_index.html", relative: true %>
47
50
  relative: <%= link_to "Relative", "../needs_index.html", relative: true %>
51
+
52
+ absolute spaces: <%= link_to "Spaces Index", "/evil spaces.html", relative: true %>
53
+ relative spaces: <%= link_to "Spaces Relative", "../evil spaces.html", relative: true %>
48
54
  """
49
55
  And the Server is running at "indexable-app"
50
56
  When I go to "/link_to.html"
51
57
  Then I should see 'absolute: <a href="needs_index.html">Needs Index</a>'
52
58
  Then I should see 'relative: <a href="needs_index.html">Relative</a>'
59
+ Then I should see 'absolute spaces: <a href="evil%20spaces.html">Spaces Index</a>'
60
+ Then I should see 'relative spaces: <a href="evil%20spaces.html">Spaces Relative</a>'
53
61
  When I go to "/link_to/sub.html"
54
62
  Then I should see 'absolute: <a href="../needs_index.html">Needs Index</a>'
55
63
  Then I should see 'relative: <a href="../needs_index.html">Relative</a>'
64
+ Then I should see 'absolute spaces: <a href="../evil%20spaces.html">Spaces Index</a>'
65
+ Then I should see 'relative spaces: <a href="../evil%20spaces.html">Spaces Relative</a>'
56
66
 
57
67
  Scenario: link_to relative works with strip_index_file
58
68
  Given a fixture app "indexable-app"
@@ -113,7 +123,7 @@ Feature: link_to helper
113
123
  When I go to "/link_to/sub.html"
114
124
  Then I should see 'absolute: <a href="../needs_index.html">Needs Index</a>'
115
125
  Then I should see 'relative: <a href="../needs_index.html">Relative</a>'
116
-
126
+
117
127
  Scenario: link_to knows about directory indexes
118
128
  Given a fixture app "indexable-app"
119
129
  And a file named "source/link_to.html.erb" with:
@@ -0,0 +1,41 @@
1
+ Feature: Markdown support in Slim
2
+ In order to test support of the Slim markdown filter
3
+
4
+ Scenario: Markdown filter in Slim works
5
+ Given a fixture app "markdown-in-slim-app"
6
+ And a file named "config.rb" with:
7
+ """
8
+ set :markdown_engine, :redcarpet
9
+ activate :directory_indexes
10
+ """
11
+ And a file named "source/markdown_filter.html.slim" with:
12
+ """
13
+ markdown:
14
+ # H1
15
+
16
+ paragraph
17
+ """
18
+ Given the Server is running at "markdown-in-slim-app"
19
+ When I go to "/markdown_filter/"
20
+ Then I should see ">H1</h1>"
21
+ Then I should see "<p>paragraph</p>"
22
+
23
+
24
+ Scenario: Markdown filter in Slim uses our link_to and image_tag helpers
25
+ Given a fixture app "markdown-in-slim-app"
26
+ And a file named "config.rb" with:
27
+ """
28
+ set :markdown_engine, :redcarpet
29
+ activate :directory_indexes
30
+ """
31
+ And a file named "source/link_and_image.html.slim" with:
32
+ """
33
+ markdown:
34
+ [A link](/link_target.html)
35
+
36
+ ![image](blank.gif)
37
+ """
38
+ Given the Server is running at "markdown-in-slim-app"
39
+ When I go to "/link_and_image/"
40
+ Then I should see "/link_target/"
41
+ Then I should see 'src="/images/blank.gif"'
@@ -0,0 +1,40 @@
1
+ Feature: Sass/SCSS support in Slim
2
+ In order to test support of the Slim sass and scss filters
3
+
4
+ Scenario: Sass filter in Slim works
5
+ Given a fixture app "sass-in-slim-app"
6
+ And a file named "config.rb" with:
7
+ """
8
+ activate :directory_indexes
9
+ """
10
+ And a file named "source/sass_filter.html.slim" with:
11
+ """
12
+ sass:
13
+ .sass
14
+ margin: 0
15
+ """
16
+ Given the Server is running at "sass-in-slim-app"
17
+ When I go to "/sass_filter/"
18
+ Then I should see "text/css"
19
+ Then I should see ".sass"
20
+ Then I should see "margin:0"
21
+
22
+
23
+ Scenario: SCSS filter in Slim works
24
+ Given a fixture app "sass-in-slim-app"
25
+ And a file named "config.rb" with:
26
+ """
27
+ activate :directory_indexes
28
+ """
29
+ And a file named "source/scss_filter.html.slim" with:
30
+ """
31
+ scss:
32
+ .scss {
33
+ margin: 0;
34
+ }
35
+ """
36
+ Given the Server is running at "sass-in-slim-app"
37
+ When I go to "/scss_filter/"
38
+ Then I should see "text/css"
39
+ Then I should see ".scss"
40
+ Then I should see "margin:0"
File without changes
@@ -266,6 +266,8 @@ module Middleman
266
266
  # Evaluate a passed block if given
267
267
  config_context.instance_exec(&block) if block_given?
268
268
 
269
+ apply_cli_options
270
+
269
271
  execute_callbacks(:before_sitemap)
270
272
 
271
273
  # Initialize the Sitemap
@@ -276,8 +278,6 @@ module Middleman
276
278
  # Before config is parsed, before extensions get to it.
277
279
  execute_callbacks(:initialized)
278
280
 
279
- apply_cli_options
280
-
281
281
  # Before config is parsed. Mostly used for extensions.
282
282
  execute_callbacks(:before_configuration)
283
283
 
@@ -12,13 +12,9 @@ class ::Slim::Template
12
12
 
13
13
  def initialize(file, line, opts, &block)
14
14
  if opts.key?(:context)
15
- context_hack = {
16
- context: opts[:context]
17
- }
18
-
19
15
  ::Slim::Embedded::SassEngine.disable_option_validator!
20
16
  %w(sass scss markdown).each do |engine|
21
- ::Slim::Embedded.options[engine.to_sym] = context_hack
17
+ (::Slim::Embedded.options[engine.to_sym] ||= {})[:context] = opts[:context]
22
18
  end
23
19
  end
24
20
 
@@ -127,30 +127,36 @@ module Middleman
127
127
  # @return [String]
128
128
  Contract String, Maybe[Bool] => Maybe[IsA['Middleman::SourceFile']]
129
129
  def locate_partial(partial_path, try_static=true)
130
- return unless resource = sitemap.find_resource_by_destination_path(current_path)
130
+ partial_file = nil
131
+ lookup_stack = []
132
+ non_root = partial_path.to_s.sub(/^\//, '')
133
+ non_root_no_underscore = non_root.sub(/^_/, '').sub(/\/_/, '/')
134
+
135
+ if resource = current_resource
136
+ current_dir = resource.file_descriptor[:relative_path].dirname
137
+ relative_dir = current_dir + Pathname(non_root)
138
+ relative_dir_no_underscore = current_dir + Pathname(non_root_no_underscore)
139
+ end
131
140
 
132
- # Look for partials relative to the current path
133
- current_dir = resource.file_descriptor[:relative_path].dirname
134
- non_root = partial_path.to_s.sub(/^\//, '')
135
- relative_dir = current_dir + Pathname(non_root)
136
141
 
137
- non_root_no_underscore = non_root.sub(/^_/, '').sub(/\/_/, '/')
138
- relative_dir_no_underscore = current_dir + Pathname(non_root_no_underscore)
142
+ lookup_stack.push [ relative_dir.to_s,
143
+ { preferred_engine: resource.file_descriptor[:relative_path]
144
+ .extname[1..-1].to_sym }] if relative_dir
145
+ lookup_stack.push [ non_root ]
146
+ lookup_stack.push [ non_root,
147
+ { try_static: try_static }]
148
+ lookup_stack.push [ relative_dir_no_underscore.to_s,
149
+ { try_static: try_static }] if relative_dir_no_underscore
150
+ lookup_stack.push [ non_root_no_underscore,
151
+ { try_static: try_static }]
139
152
 
140
- partial_file = nil
141
153
 
142
- [
143
- [relative_dir.to_s, { preferred_engine: resource.file_descriptor[:relative_path].extname[1..-1].to_sym }],
144
- [non_root],
145
- [non_root, { try_static: try_static }],
146
- [relative_dir_no_underscore.to_s, { try_static: try_static }],
147
- [non_root_no_underscore, { try_static: try_static }]
148
- ].each do |args|
154
+ lookup_stack.each do |args|
149
155
  partial_file = ::Middleman::TemplateRenderer.resolve_template(@app, *args)
150
156
  break if partial_file
151
157
  end
152
158
 
153
- partial_file || nil
159
+ partial_file
154
160
  end
155
161
 
156
162
  def current_path
@@ -118,7 +118,9 @@ module Middleman
118
118
  # relative path, since it only takes absolute url paths.
119
119
  dest_path = url_for(app, path, options.merge(relative: false))
120
120
 
121
- result = if resource = app.sitemap.find_resource_by_destination_path(dest_path)
121
+ result = if resource = app.sitemap.find_resource_by_path(dest_path)
122
+ resource.url
123
+ elsif resource = app.sitemap.find_resource_by_destination_path(dest_path)
122
124
  resource.url
123
125
  else
124
126
  path = ::File.join(prefix, path)
@@ -158,8 +160,12 @@ module Middleman
158
160
  begin
159
161
  uri = URI(url)
160
162
  rescue ::URI::InvalidURIError
161
- # Nothing we can do with it, it's not really a URI
162
- return url
163
+ begin
164
+ uri = URI(::URI.encode(url))
165
+ rescue ::URI::InvalidURIError
166
+ # Nothing we can do with it, it's not really a URI
167
+ return url
168
+ end
163
169
  end
164
170
 
165
171
  relative = options[:relative]
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  # Current Version
3
3
  # @return [String]
4
- VERSION = '4.1.8'.freeze unless const_defined?(:VERSION)
4
+ VERSION = '4.1.9'.freeze unless const_defined?(:VERSION)
5
5
  end
@@ -26,6 +26,7 @@ Gem::Specification.new do |s|
26
26
  s.add_dependency('fast_blank')
27
27
  s.add_dependency('parallel')
28
28
  s.add_dependency('servolux')
29
+ s.add_dependency('dotenv')
29
30
 
30
31
  # Helpers
31
32
  s.add_dependency('activesupport', ['~> 4.2'])
@@ -162,6 +162,13 @@ describe Middleman::Util do
162
162
  expect( Middleman::Util.asset_url( @mm, '/how/about/that.html' ) ).to eq '/how/about/that/'
163
163
  end
164
164
 
165
+ it "returns a resource url when asset_hash is on" do
166
+ Given.fixture 'asset-hash-app'
167
+ @mm = Middleman::Application.new
168
+
169
+ expect( Middleman::Util.asset_url( @mm, '100px.png', 'images') ).to match %r|/images/100px-[a-f0-9]+.png|
170
+ end
171
+
165
172
  end
166
173
 
167
174
  describe "::find_related_files" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.8
4
+ version: 4.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Reynolds
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-05-11 00:00:00.000000000 Z
13
+ date: 2016-05-31 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -116,6 +116,20 @@ dependencies:
116
116
  - - ">="
117
117
  - !ruby/object:Gem::Version
118
118
  version: '0'
119
+ - !ruby/object:Gem::Dependency
120
+ name: dotenv
121
+ requirement: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ type: :runtime
127
+ prerelease: false
128
+ version_requirements: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
119
133
  - !ruby/object:Gem::Dependency
120
134
  name: activesupport
121
135
  requirement: !ruby/object:Gem::Requirement
@@ -405,6 +419,7 @@ files:
405
419
  - features/markdown_kramdown_in_slim.feature
406
420
  - features/markdown_redcarpet.feature
407
421
  - features/markdown_redcarpet_in_haml.feature
422
+ - features/markdown_redcarpet_in_slim.feature
408
423
  - features/minify_css.feature
409
424
  - features/minify_javascript.feature
410
425
  - features/missing-tilt-lib.feature
@@ -427,6 +442,7 @@ files:
427
442
  - features/relative_assets.feature
428
443
  - features/relative_assets_helpers_only.feature
429
444
  - features/sass-assets-paths.feature
445
+ - features/sass_in_slim.feature
430
446
  - features/sass_partials.feature
431
447
  - features/scss-support.feature
432
448
  - features/sitemap_traversal.feature
@@ -1338,6 +1354,7 @@ files:
1338
1354
  - fixtures/sass-assets-path-app/config.rb
1339
1355
  - fixtures/sass-assets-path-app/my-vendor/stylesheets/_partial.sass
1340
1356
  - fixtures/sass-assets-path-app/source/stylesheets/plain.css.sass
1357
+ - fixtures/sass-in-slim-app/config.rb
1341
1358
  - fixtures/scss-app/config.rb
1342
1359
  - fixtures/scss-app/source/stylesheets/layout.css.sass
1343
1360
  - fixtures/scss-app/source/stylesheets/site_scss.css.scss
@@ -1602,6 +1619,7 @@ test_files:
1602
1619
  - features/markdown_kramdown_in_slim.feature
1603
1620
  - features/markdown_redcarpet.feature
1604
1621
  - features/markdown_redcarpet_in_haml.feature
1622
+ - features/markdown_redcarpet_in_slim.feature
1605
1623
  - features/minify_css.feature
1606
1624
  - features/minify_javascript.feature
1607
1625
  - features/missing-tilt-lib.feature
@@ -1624,6 +1642,7 @@ test_files:
1624
1642
  - features/relative_assets.feature
1625
1643
  - features/relative_assets_helpers_only.feature
1626
1644
  - features/sass-assets-paths.feature
1645
+ - features/sass_in_slim.feature
1627
1646
  - features/sass_partials.feature
1628
1647
  - features/scss-support.feature
1629
1648
  - features/sitemap_traversal.feature
@@ -2535,6 +2554,7 @@ test_files:
2535
2554
  - fixtures/sass-assets-path-app/config.rb
2536
2555
  - fixtures/sass-assets-path-app/my-vendor/stylesheets/_partial.sass
2537
2556
  - fixtures/sass-assets-path-app/source/stylesheets/plain.css.sass
2557
+ - fixtures/sass-in-slim-app/config.rb
2538
2558
  - fixtures/scss-app/config.rb
2539
2559
  - fixtures/scss-app/source/stylesheets/layout.css.sass
2540
2560
  - fixtures/scss-app/source/stylesheets/site_scss.css.scss