middleman-core 4.3.3 → 4.3.8

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
  SHA256:
3
- metadata.gz: 61cbb0971519b39e43ab5691e5b7de36ef5c582c23378c667ab2cc059e3d006b
4
- data.tar.gz: 277df7e8ba7b78e776212de95518611a920ca80a03fac4e373f8a5f1a7f75810
3
+ metadata.gz: 1753d9a760b75d406bc9e1853dc09a0ee7599f13e9973134044b9ab4fdf017d1
4
+ data.tar.gz: 35fb8d16787d1b8c26b5a842a4b63fd95ad81d325dbcd6648732449fea324919
5
5
  SHA512:
6
- metadata.gz: 31be3f47fc41353b3e58a70f4760baa81fc34f0ae1d8a6a08b88aefa9b1682e7b89bb3bb02409d916b945bf21b3e772cb39b911c7bdc26b2137d881181d9cc22
7
- data.tar.gz: abd1e8c5ca18cb09484947d7241e44dccf93f02b0e20dec82b87e5d223c4e07a5839f9b7452994b98134f49f0a42514d06c8efd8e136f3dad4b477e9eccf098b
6
+ metadata.gz: 7a18f53041a601160e5413ffa1294366826fe3d57c4d9927a6cda48eb25dcda81e2484db15d9f55925e653e24dc748dc4501630fa622d77318a0bba23e1c6f6f
7
+ data.tar.gz: 02061053f863a4895c0070b3b1e11734ff71a17870bd4168e7ce762ec892669a3500694dde15a4dca74978c7e6180b782d70bb0f94668d4876d6e64795d9c456
@@ -0,0 +1,11 @@
1
+ Feature: Add an empty alt tag for images that don't have alt tags specified
2
+
3
+ Scenario: Image does not have alt tag specified
4
+ Given the Server is running at "default-alt-tags-app"
5
+ When I go to "/empty-alt-tag.html"
6
+ Then I should see 'alt=""'
7
+
8
+ Scenario: Image has alt tag specified
9
+ Given the Server is running at "default-alt-tags-app"
10
+ When I go to "/meaningful-alt-tag.html"
11
+ Then I should see 'alt="Meaningful alt text"'
@@ -178,6 +178,7 @@ Feature: i18n Paths
178
178
 
179
179
  Current: <%= url_for "/article.html" %>
180
180
  Other: <%= url_for "/article.html", locale: ::I18n.locale == :en ? :es : :en %>
181
+ Current with anchor: <%= url_for "/article.html", :anchor => "test-anchor" %>
181
182
  """
182
183
  And a file named "source/localizable/article.es.html.erb" with:
183
184
  """
@@ -185,6 +186,7 @@ Feature: i18n Paths
185
186
 
186
187
  Current: <%= url_for "/article.html" %>
187
188
  Other: <%= url_for "/article.html", locale: :en %>
189
+ Current with anchor: <%= url_for "/article.html", :anchor => "test-anchor" %>
188
190
  """
189
191
  And a file named "config.rb" with:
190
192
  """
@@ -203,7 +205,9 @@ Feature: i18n Paths
203
205
  Then I should see "Page Lang: Default"
204
206
  Then I should see 'Current: /article.html'
205
207
  Then I should see 'Other: /es/article.html'
208
+ Then I should see 'Current with anchor: /article.html#test-anchor'
206
209
  When I go to "/es/article.html"
207
210
  Then I should see "Page Lang: Spanish"
208
211
  Then I should see 'Current: /es/article.html'
209
212
  Then I should see 'Other: /article.html'
213
+ Then I should see 'Current with anchor: /es/article.html#test-anchor'
@@ -7,11 +7,12 @@ Feature: Ignoring paths
7
7
  ignore 'plain.html'
8
8
  """
9
9
  And a successfully built app at "ignore-app"
10
+ When I cd to "build"
10
11
  Then the following files should exist:
11
- | build/index.html |
12
+ | index.html |
12
13
  And the following files should not exist:
13
- | build/plain.html |
14
- | build/about.html |
14
+ | plain.html |
15
+ | about.html |
15
16
 
16
17
  Scenario: Ignore a single path (server)
17
18
  Given a fixture app "ignore-app"
@@ -66,16 +67,17 @@ Feature: Ignoring paths
66
67
  ignore 'images/**/*.png'
67
68
  """
68
69
  And a successfully built app at "ignore-app"
70
+ When I cd to "build"
69
71
  Then the following files should exist:
70
- | build/plain.html |
71
- | build/images/portrait.jpg |
72
- | build/images/pic.png |
72
+ | plain.html |
73
+ | images/portrait.jpg |
74
+ | images/pic.png |
73
75
  And the following files should not exist:
74
- | build/about.html |
75
- | build/index.html |
76
- | build/reports/index.html |
77
- | build/reports/another.html |
78
- | build/images/icons/messages.png |
76
+ | about.html |
77
+ | index.html |
78
+ | reports/index.html |
79
+ | reports/another.html |
80
+ | images/icons/messages.png |
79
81
 
80
82
  Scenario: Ignore a globbed path (server)
81
83
  Given a fixture app "ignore-app"
@@ -148,3 +150,57 @@ Feature: Ignoring paths
148
150
  Then I should see "File Not Found"
149
151
  When I go to "/images/icons/messages.png"
150
152
  Then I should see "File Not Found"
153
+
154
+ Scenario: Ignore localized templates (build)
155
+ Given a fixture app "i18n-test-app"
156
+ And a file named "config.rb" with:
157
+ """
158
+ activate :i18n
159
+ ignore 'localizable/hello.html.erb'
160
+ ignore /morning/
161
+ ignore 'localizable/*.md'
162
+ """
163
+ And a successfully built app at "i18n-test-app"
164
+ When I cd to "build"
165
+ Then the following files should exist:
166
+ | index.html |
167
+ | es/index.html |
168
+ And the following files should not exist:
169
+ | hello.html |
170
+ | morning.html |
171
+ | one.html |
172
+ | es/hola.html |
173
+ | es/manana.html |
174
+ | es/una.html |
175
+ | es/hello.html |
176
+ | es/morning.html |
177
+ | es/one.html |
178
+ And the file "index.html" should contain "Howdy"
179
+ And the file "es/index.html" should contain "Como Esta?"
180
+
181
+ Scenario: Ignore localized templates (server)
182
+ Given a fixture app "i18n-test-app"
183
+ And a file named "config.rb" with:
184
+ """
185
+ activate :i18n
186
+ ignore 'localizable/hello.html.erb'
187
+ ignore /morning/
188
+ ignore 'localizable/*.md'
189
+ """
190
+ And the Server is running
191
+ When I go to "/index.html"
192
+ Then I should not see "File Not Found"
193
+ When I go to "/es/index.html"
194
+ Then I should not see "File Not Found"
195
+ When I go to "/hello.html"
196
+ Then I should see "File Not Found"
197
+ When I go to "/morning.html"
198
+ Then I should see "File Not Found"
199
+ When I go to "/one.html"
200
+ Then I should see "File Not Found"
201
+ When I go to "/es/hola.html"
202
+ Then I should see "File Not Found"
203
+ When I go to "/es/manana.html"
204
+ Then I should see "File Not Found"
205
+ When I go to "/es/una.html"
206
+ Then I should see "File Not Found"
@@ -36,3 +36,20 @@ Feature: Markdown (Kramdown) support
36
36
  And I should see 'src="/images/blank.gif"'
37
37
  And I should see 'src="/images/blank.gif"'
38
38
  And I should see "&#109;&#097;&#105;&#108;&#064;&#109;&#097;&#105;&#108;&#046;&#099;&#111;&#109;"
39
+
40
+ Scenario: Kramdown uses our link_to with options parameter
41
+ Given a fixture app "markdown-app"
42
+ And a file named "config.rb" with:
43
+ """
44
+ set :markdown_engine, :kramdown
45
+ activate :directory_indexes
46
+ """
47
+ And a file named "source/links.html.markdown" with:
48
+ """
49
+ [A link](/smarty_pants.html)
50
+ [A second link](/smarty_pants.html){: anchor="test-anchor"}
51
+ """
52
+ Given the Server is running at "markdown-app"
53
+ When I go to "/links/"
54
+ Then I should see "/smarty_pants/"
55
+ And I should see "/smarty_pants/#test-anchor"
@@ -131,7 +131,7 @@ Feature: Relative Assets
131
131
  """
132
132
  And the Server is running at "relative-assets-app"
133
133
  When I go to "/sub/image_tag.html"
134
- Then I should see '<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" />'
134
+ Then I should see '<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" alt="" />'
135
135
 
136
136
  Scenario: URLs are not rewritten for rewrite ignored paths
137
137
  Given a fixture app "relative-assets-app"
@@ -87,7 +87,7 @@ Feature: Relative Assets (Helpers Only)
87
87
  """
88
88
  And the Server is running at "relative-assets-app"
89
89
  When I go to "/sub/image_tag.html"
90
- Then I should see '<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" />'
90
+ Then I should see '<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" alt="" />'
91
91
 
92
92
  @wip
93
93
  Scenario: URLs are not rewritten for rewrite ignored paths
@@ -0,0 +1 @@
1
+ <%= image_tag "blank.gif" %>
@@ -0,0 +1 @@
1
+ <%= image_tag "blank.gif", alt: "Meaningful alt text" %>
@@ -282,6 +282,8 @@ class Middleman::CoreExtensions::DefaultHelpers < ::Middleman::Extension
282
282
  params[:srcset] = images_sources.join(', ')
283
283
  end
284
284
 
285
+ params[:alt] ||= ''
286
+
285
287
  super(path, params)
286
288
  end
287
289
 
@@ -74,8 +74,12 @@ class Middleman::CoreExtensions::Internationalization < ::Middleman::Extension
74
74
  opts = options.dup
75
75
 
76
76
  should_relativize = opts.key?(:relative) ? opts[:relative] : config[:relative_links]
77
+ anchor = opts[:anchor]
77
78
 
79
+ # The first call to `super()` is only to find the correct URL. The next
80
+ # call will relativize and add the anchor.
78
81
  opts[:relative] = false
82
+ opts[:anchor] = nil
79
83
 
80
84
  href = super(path_or_resource, opts)
81
85
 
@@ -87,6 +91,7 @@ class Middleman::CoreExtensions::Internationalization < ::Middleman::Extension
87
91
  end
88
92
 
89
93
  opts[:relative] = should_relativize
94
+ opts[:anchor] = anchor
90
95
 
91
96
  begin
92
97
  super(final_path, opts)
@@ -155,6 +160,8 @@ class Middleman::CoreExtensions::Internationalization < ::Middleman::Extension
155
160
 
156
161
  # If it's a "localizable template"
157
162
  localizable_folder_resources.each do |resource|
163
+ next if resource.ignored?
164
+
158
165
  page_id = File.basename(resource.path, File.extname(resource.path))
159
166
  locales.each do |locale|
160
167
  # Remove folder name
@@ -174,6 +181,8 @@ class Middleman::CoreExtensions::Internationalization < ::Middleman::Extension
174
181
 
175
182
  # If it uses file extension localization
176
183
  file_extension_resources.each do |resource|
184
+ next if resource.ignored?
185
+
177
186
  result = parse_locale_extension(resource.path)
178
187
  ext_locale, path, page_id = result
179
188
  new_resources << build_resource(path, resource.path, page_id, ext_locale)
@@ -123,6 +123,11 @@ module Middleman
123
123
  end
124
124
  end
125
125
 
126
+ # Rewriting might have changed Content-Length, so we need
127
+ # to reset it to the actual result. The rewritten result is
128
+ # always a String, not an Array or Enumerable.
129
+ headers['Content-Length'] = rewritten.bytesize.to_s
130
+
126
131
  ::Rack::Response.new(
127
132
  rewritten,
128
133
  status,
@@ -45,6 +45,10 @@ module Middleman
45
45
  attr = el.attr.dup
46
46
  link = attr.delete('href')
47
47
 
48
+ # options to link_to are expected to be symbols, but in Markdown
49
+ # everything is a string.
50
+ attr.transform_keys!(&:to_sym)
51
+
48
52
  scope.link_to(content, link, attr)
49
53
  end
50
54
  end
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  # Current Version
3
3
  # @return [String]
4
- VERSION = '4.3.3'.freeze unless const_defined?(:VERSION)
4
+ VERSION = '4.3.8'.freeze unless const_defined?(:VERSION)
5
5
  end
@@ -29,7 +29,7 @@ Gem::Specification.new do |s|
29
29
  s.add_dependency('dotenv')
30
30
 
31
31
  # Helpers
32
- s.add_dependency('activesupport', ['>= 4.2', '< 5.1'])
32
+ s.add_dependency('activesupport', ['>= 4.2', '< 6.0'])
33
33
  s.add_dependency('padrino-helpers', ['~> 0.13.0'])
34
34
  s.add_dependency("addressable", ["~> 2.3"])
35
35
  s.add_dependency('memoist', ['~> 0.14'])
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.3.3
4
+ version: 4.3.8
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: 2019-02-18 00:00:00.000000000 Z
13
+ date: 2020-08-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -139,7 +139,7 @@ dependencies:
139
139
  version: '4.2'
140
140
  - - "<"
141
141
  - !ruby/object:Gem::Version
142
- version: '5.1'
142
+ version: '6.0'
143
143
  type: :runtime
144
144
  prerelease: false
145
145
  version_requirements: !ruby/object:Gem::Requirement
@@ -149,7 +149,7 @@ dependencies:
149
149
  version: '4.2'
150
150
  - - "<"
151
151
  - !ruby/object:Gem::Version
152
- version: '5.1'
152
+ version: '6.0'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: padrino-helpers
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -370,6 +370,7 @@ files:
370
370
  - features/custom_layouts.feature
371
371
  - features/data.feature
372
372
  - features/default-layout.feature
373
+ - features/default_alt_tag.feature
373
374
  - features/directory_index.feature
374
375
  - features/dynamic_pages.feature
375
376
  - features/encoding_option.feature
@@ -658,6 +659,10 @@ files:
658
659
  - fixtures/data-app/data/pages.yml
659
660
  - fixtures/data-app/source/index.html.erb
660
661
  - fixtures/data-app/source/layout.erb
662
+ - fixtures/default-alt-tags-app/config.rb
663
+ - fixtures/default-alt-tags-app/source/empty-alt-tag.html.erb
664
+ - fixtures/default-alt-tags-app/source/images/blank.gif
665
+ - fixtures/default-alt-tags-app/source/meaningful-alt-tag.html.erb
661
666
  - fixtures/different-engine-layout/config.rb
662
667
  - fixtures/different-engine-layout/source/index.haml
663
668
  - fixtures/different-engine-layout/source/index.html.str
@@ -1553,7 +1558,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1553
1558
  - !ruby/object:Gem::Version
1554
1559
  version: '0'
1555
1560
  requirements: []
1556
- rubygems_version: 3.0.2
1561
+ rubygems_version: 3.0.6
1557
1562
  signing_key:
1558
1563
  specification_version: 4
1559
1564
  summary: Hand-crafted frontend development
@@ -1579,6 +1584,7 @@ test_files:
1579
1584
  - features/custom_layouts.feature
1580
1585
  - features/data.feature
1581
1586
  - features/default-layout.feature
1587
+ - features/default_alt_tag.feature
1582
1588
  - features/directory_index.feature
1583
1589
  - features/dynamic_pages.feature
1584
1590
  - features/encoding_option.feature
@@ -1867,6 +1873,10 @@ test_files:
1867
1873
  - fixtures/data-app/data/pages.yml
1868
1874
  - fixtures/data-app/source/index.html.erb
1869
1875
  - fixtures/data-app/source/layout.erb
1876
+ - fixtures/default-alt-tags-app/config.rb
1877
+ - fixtures/default-alt-tags-app/source/empty-alt-tag.html.erb
1878
+ - fixtures/default-alt-tags-app/source/images/blank.gif
1879
+ - fixtures/default-alt-tags-app/source/meaningful-alt-tag.html.erb
1870
1880
  - fixtures/different-engine-layout/config.rb
1871
1881
  - fixtures/different-engine-layout/source/index.haml
1872
1882
  - fixtures/different-engine-layout/source/index.html.str