middleman-core 4.3.8 → 4.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/features/asset_hash.feature +64 -62
  3. data/features/data.feature +20 -0
  4. data/features/front-matter-neighbor.feature +33 -27
  5. data/features/front-matter.feature +11 -5
  6. data/features/i18n_preview.feature +238 -238
  7. data/features/liquid.feature +5 -2
  8. data/features/support/env.rb +0 -3
  9. data/features/unicode_filenames.feature +3 -3
  10. data/fixtures/basic-data-app/data/test3.toml +7 -0
  11. data/fixtures/basic-data-app/source/data4.html.erb +5 -0
  12. data/fixtures/frontmatter-app/source/raw-front-matter-toml.html +6 -0
  13. data/fixtures/frontmatter-app/source/raw-front-matter.html +1 -1
  14. data/fixtures/frontmatter-neighbor-app/source/raw-front-matter-toml.html +1 -0
  15. data/fixtures/frontmatter-neighbor-app/source/raw-front-matter-toml.html.frontmatter +4 -0
  16. data/lib/middleman-core/builder.rb +1 -1
  17. data/lib/middleman-core/core_extensions/data.rb +4 -2
  18. data/lib/middleman-core/core_extensions/default_helpers.rb +1 -0
  19. data/lib/middleman-core/core_extensions/front_matter.rb +1 -0
  20. data/lib/middleman-core/core_extensions/rendering.rb +0 -6
  21. data/lib/middleman-core/dns_resolver/basic_network_resolver.rb +0 -2
  22. data/lib/middleman-core/dns_resolver.rb +2 -4
  23. data/lib/middleman-core/extensions/asset_hash.rb +1 -1
  24. data/lib/middleman-core/preview_server/server_ip_address.rb +5 -14
  25. data/lib/middleman-core/rack.rb +2 -1
  26. data/lib/middleman-core/step_definitions/commandline_steps.rb +0 -4
  27. data/lib/middleman-core/step_definitions/middleman_steps.rb +1 -1
  28. data/lib/middleman-core/step_definitions/server_steps.rb +3 -2
  29. data/lib/middleman-core/template_context.rb +3 -3
  30. data/lib/middleman-core/template_renderer.rb +1 -1
  31. data/lib/middleman-core/util/data.rb +28 -0
  32. data/lib/middleman-core/util/paths.rb +2 -1
  33. data/lib/middleman-core/version.rb +1 -1
  34. data/middleman-core.gemspec +8 -6
  35. data/spec/middleman-core/dns_resolver_spec.rb +8 -24
  36. data/spec/spec_helper.rb +0 -3
  37. metadata +52 -1083
  38. data/features/stylus.feature +0 -54
  39. data/lib/middleman-core/renderers/stylus.rb +0 -10
@@ -1,252 +1,252 @@
1
- Feature: i18n Preview
2
- In order to preview localized html
1
+ # Feature: i18n Preview
2
+ # In order to preview localized html
3
3
 
4
- Scenario: Running localize with the default config
5
- Given a fixture app "i18n-test-app"
6
- And a file named "config.rb" with:
7
- """
8
- activate :i18n
9
- """
10
- Given the Server is running at "i18n-test-app"
11
- When I go to "/"
12
- Then I should see "Howdy"
13
- When I go to "/hello.html"
14
- Then I should see "Hello World"
15
- When I go to "/morning.html"
16
- Then I should see "Good morning"
17
- When I go to "/one.html"
18
- Then I should see "Only one"
19
- When I go to "/defaults_en/index.html"
20
- Then I should see "File Not Found"
21
- When I go to "/en/index.html"
22
- Then I should see "File Not Found"
23
- When I go to "/en/morning.html"
24
- Then I should see "File Not Found"
25
- When I go to "/defaults_es/index.html"
26
- Then I should see "File Not Found"
27
- When I go to "/es/index.html"
28
- Then I should see "Como Esta?"
29
- When I go to "/es/hola.html"
30
- Then I should see "Hola World"
31
- When I go to "/es/manana.html"
32
- Then I should see "Buenos días"
33
- When I go to "/es/una.html"
34
- Then I should see "Solamente una"
4
+ # Scenario: Running localize with the default config
5
+ # Given a fixture app "i18n-test-app"
6
+ # And a file named "config.rb" with:
7
+ # """
8
+ # activate :i18n
9
+ # """
10
+ # Given the Server is running at "i18n-test-app"
11
+ # When I go to "/"
12
+ # Then I should see "Howdy"
13
+ # When I go to "/hello.html"
14
+ # Then I should see "Hello World"
15
+ # When I go to "/morning.html"
16
+ # Then I should see "Good morning"
17
+ # When I go to "/one.html"
18
+ # Then I should see "Only one"
19
+ # When I go to "/defaults_en/index.html"
20
+ # Then I should see "File Not Found"
21
+ # When I go to "/en/index.html"
22
+ # Then I should see "File Not Found"
23
+ # When I go to "/en/morning.html"
24
+ # Then I should see "File Not Found"
25
+ # When I go to "/defaults_es/index.html"
26
+ # Then I should see "File Not Found"
27
+ # When I go to "/es/index.html"
28
+ # Then I should see "Como Esta?"
29
+ # When I go to "/es/hola.html"
30
+ # Then I should see "Hola World"
31
+ # When I go to "/es/manana.html"
32
+ # Then I should see "Buenos días"
33
+ # When I go to "/es/una.html"
34
+ # Then I should see "Solamente una"
35
35
 
36
- Scenario: A template changes i18n during preview
37
- Given a fixture app "i18n-test-app"
38
- And a file named "config.rb" with:
39
- """
40
- activate :i18n
41
- """
42
- Given the Server is running at "i18n-test-app"
43
- And the file "locales/en.yml" has the contents
44
- """
45
- ---
46
- en:
47
- greetings: "Howdy"
48
- hi: "Hello"
49
- """
50
- When I go to "/"
51
- Then I should see "Howdy"
52
- When I go to "/hello.html"
53
- Then I should see "Hello World"
54
- When the file "locales/en.yml" has the contents
55
- """
56
- ---
57
- en:
58
- greetings: "How You Doin"
59
- hi: "Sup"
60
- """
61
- When I go to "/"
62
- Then I should see "How You Doin"
63
- When I go to "/hello.html"
64
- Then I should see "Sup World"
36
+ # Scenario: A template changes i18n during preview
37
+ # Given a fixture app "i18n-test-app"
38
+ # And a file named "config.rb" with:
39
+ # """
40
+ # activate :i18n
41
+ # """
42
+ # Given the Server is running at "i18n-test-app"
43
+ # And the file "locales/en.yml" has the contents
44
+ # """
45
+ # ---
46
+ # en:
47
+ # greetings: "Howdy"
48
+ # hi: "Hello"
49
+ # """
50
+ # When I go to "/"
51
+ # Then I should see "Howdy"
52
+ # When I go to "/hello.html"
53
+ # Then I should see "Hello World"
54
+ # When the file "locales/en.yml" has the contents
55
+ # """
56
+ # ---
57
+ # en:
58
+ # greetings: "How You Doin"
59
+ # hi: "Sup"
60
+ # """
61
+ # When I go to "/"
62
+ # Then I should see "How You Doin"
63
+ # When I go to "/hello.html"
64
+ # Then I should see "Sup World"
65
65
 
66
- Scenario: Running localize with the alt path config
67
- Given a fixture app "i18n-test-app"
68
- And a file named "config.rb" with:
69
- """
70
- activate :i18n, path: "/lang_:locale/"
71
- """
72
- Given the Server is running at "i18n-test-app"
73
- When I go to "/"
74
- Then I should see "Howdy"
75
- When I go to "/hello.html"
76
- Then I should see "Hello World"
77
- When I go to "/lang_en/index.html"
78
- Then I should see "File Not Found"
79
- When I go to "/lang_es/index.html"
80
- Then I should see "Como Esta?"
81
- When I go to "/lang_es/hola.html"
82
- Then I should see "Hola World"
66
+ # Scenario: Running localize with the alt path config
67
+ # Given a fixture app "i18n-test-app"
68
+ # And a file named "config.rb" with:
69
+ # """
70
+ # activate :i18n, path: "/lang_:locale/"
71
+ # """
72
+ # Given the Server is running at "i18n-test-app"
73
+ # When I go to "/"
74
+ # Then I should see "Howdy"
75
+ # When I go to "/hello.html"
76
+ # Then I should see "Hello World"
77
+ # When I go to "/lang_en/index.html"
78
+ # Then I should see "File Not Found"
79
+ # When I go to "/lang_es/index.html"
80
+ # Then I should see "Como Esta?"
81
+ # When I go to "/lang_es/hola.html"
82
+ # Then I should see "Hola World"
83
83
 
84
84
 
85
- Scenario: Running localize with the alt root config
86
- Given a fixture app "i18n-alt-root-app"
87
- And a file named "config.rb" with:
88
- """
89
- activate :i18n, templates_dir: "lang_data"
90
- """
91
- Given the Server is running at "i18n-alt-root-app"
92
- When I go to "/"
93
- Then I should see "Howdy"
94
- When I go to "/hello.html"
95
- Then I should see "Hello World"
96
- When I go to "/en/index.html"
97
- Then I should see "File Not Found"
98
- When I go to "/es/index.html"
99
- Then I should see "Como Esta?"
100
- When I go to "/es/hola.html"
101
- Then I should see "Hola World"
85
+ # Scenario: Running localize with the alt root config
86
+ # Given a fixture app "i18n-alt-root-app"
87
+ # And a file named "config.rb" with:
88
+ # """
89
+ # activate :i18n, templates_dir: "lang_data"
90
+ # """
91
+ # Given the Server is running at "i18n-alt-root-app"
92
+ # When I go to "/"
93
+ # Then I should see "Howdy"
94
+ # When I go to "/hello.html"
95
+ # Then I should see "Hello World"
96
+ # When I go to "/en/index.html"
97
+ # Then I should see "File Not Found"
98
+ # When I go to "/es/index.html"
99
+ # Then I should see "Como Esta?"
100
+ # When I go to "/es/hola.html"
101
+ # Then I should see "Hola World"
102
102
 
103
- Scenario: Running localize with the lang map config
104
- Given a fixture app "i18n-test-app"
105
- And a file named "config.rb" with:
106
- """
107
- activate :i18n, lang_map: { en: :english, es: :spanish }
108
- """
109
- Given the Server is running at "i18n-test-app"
110
- When I go to "/"
111
- Then I should see "Howdy"
112
- When I go to "/hello.html"
113
- Then I should see "Hello World"
114
- When I go to "/english/index.html"
115
- Then I should see "File Not Found"
116
- When I go to "/spanish/index.html"
117
- Then I should see "Como Esta?"
118
- When I go to "/spanish/hola.html"
119
- Then I should see "Hola World"
103
+ # Scenario: Running localize with the lang map config
104
+ # Given a fixture app "i18n-test-app"
105
+ # And a file named "config.rb" with:
106
+ # """
107
+ # activate :i18n, lang_map: { en: :english, es: :spanish }
108
+ # """
109
+ # Given the Server is running at "i18n-test-app"
110
+ # When I go to "/"
111
+ # Then I should see "Howdy"
112
+ # When I go to "/hello.html"
113
+ # Then I should see "Hello World"
114
+ # When I go to "/english/index.html"
115
+ # Then I should see "File Not Found"
116
+ # When I go to "/spanish/index.html"
117
+ # Then I should see "Como Esta?"
118
+ # When I go to "/spanish/hola.html"
119
+ # Then I should see "Hola World"
120
120
 
121
- Scenario: Running localize with a non-English mount config
122
- Given a fixture app "i18n-test-app"
123
- And a file named "config.rb" with:
124
- """
125
- activate :i18n, mount_at_root: :es
126
- """
127
- Given the Server is running at "i18n-test-app"
128
- When I go to "/en/index.html"
129
- Then I should see "Howdy"
130
- When I go to "/en/hello.html"
131
- Then I should see "Hello World"
132
- When I go to "/"
133
- Then I should see "Como Esta?"
134
- When I go to "/hola.html"
135
- Then I should see "Hola World"
136
- When I go to "/manana.html"
137
- Then I should see "Buenos días"
138
- When I go to "/hello.html"
139
- Then I should see "File Not Found"
140
- When I go to "/en/morning.html"
141
- Then I should see "Good morning"
142
- When I go to "/es/manana.html"
143
- Then I should see "File Not Found"
144
- When I go to "/es/index.html"
145
- Then I should see "File Not Found"
146
- When I go to "/es/hola.html"
147
- Then I should see "File Not Found"
121
+ # Scenario: Running localize with a non-English mount config
122
+ # Given a fixture app "i18n-test-app"
123
+ # And a file named "config.rb" with:
124
+ # """
125
+ # activate :i18n, mount_at_root: :es
126
+ # """
127
+ # Given the Server is running at "i18n-test-app"
128
+ # When I go to "/en/index.html"
129
+ # Then I should see "Howdy"
130
+ # When I go to "/en/hello.html"
131
+ # Then I should see "Hello World"
132
+ # When I go to "/"
133
+ # Then I should see "Como Esta?"
134
+ # When I go to "/hola.html"
135
+ # Then I should see "Hola World"
136
+ # When I go to "/manana.html"
137
+ # Then I should see "Buenos días"
138
+ # When I go to "/hello.html"
139
+ # Then I should see "File Not Found"
140
+ # When I go to "/en/morning.html"
141
+ # Then I should see "Good morning"
142
+ # When I go to "/es/manana.html"
143
+ # Then I should see "File Not Found"
144
+ # When I go to "/es/index.html"
145
+ # Then I should see "File Not Found"
146
+ # When I go to "/es/hola.html"
147
+ # Then I should see "File Not Found"
148
148
 
149
- Scenario: Running localize with a non-English lang subset
150
- Given a fixture app "i18n-test-app"
151
- And a file named "config.rb" with:
152
- """
153
- activate :i18n, langs: :es
154
- """
155
- Given the Server is running at "i18n-test-app"
156
- When I go to "/en/index.html"
157
- Then I should see "File Not Found"
158
- When I go to "/en/hello.html"
159
- Then I should see "File Not Found"
160
- When I go to "/"
161
- Then I should see "Como Esta?"
162
- When I go to "/hola.html"
163
- Then I should see "Hola World"
164
- When I go to "/hello.html"
165
- Then I should see "File Not Found"
166
- When I go to "/es/index.html"
167
- Then I should see "File Not Found"
168
- When I go to "/es/hola.html"
169
- Then I should see "File Not Found"
149
+ # Scenario: Running localize with a non-English lang subset
150
+ # Given a fixture app "i18n-test-app"
151
+ # And a file named "config.rb" with:
152
+ # """
153
+ # activate :i18n, langs: :es
154
+ # """
155
+ # Given the Server is running at "i18n-test-app"
156
+ # When I go to "/en/index.html"
157
+ # Then I should see "File Not Found"
158
+ # When I go to "/en/hello.html"
159
+ # Then I should see "File Not Found"
160
+ # When I go to "/"
161
+ # Then I should see "Como Esta?"
162
+ # When I go to "/hola.html"
163
+ # Then I should see "Hola World"
164
+ # When I go to "/hello.html"
165
+ # Then I should see "File Not Found"
166
+ # When I go to "/es/index.html"
167
+ # Then I should see "File Not Found"
168
+ # When I go to "/es/hola.html"
169
+ # Then I should see "File Not Found"
170
170
 
171
171
 
172
- Scenario: Running localize with the no mount config
173
- Given a fixture app "i18n-test-app"
174
- And a file named "config.rb" with:
175
- """
176
- activate :i18n, mount_at_root: false
177
- """
178
- Given the Server is running at "i18n-test-app"
179
- When I go to "/en/index.html"
180
- Then I should see "Howdy"
181
- When I go to "/en/hello.html"
182
- Then I should see "Hello World"
183
- When I go to "/"
184
- Then I should see "File Not Found"
185
- When I go to "/hello.html"
186
- Then I should see "File Not Found"
187
- When I go to "/es/index.html"
188
- Then I should see "Como Esta?"
189
- When I go to "/es/hola.html"
190
- Then I should see "Hola World"
172
+ # Scenario: Running localize with the no mount config
173
+ # Given a fixture app "i18n-test-app"
174
+ # And a file named "config.rb" with:
175
+ # """
176
+ # activate :i18n, mount_at_root: false
177
+ # """
178
+ # Given the Server is running at "i18n-test-app"
179
+ # When I go to "/en/index.html"
180
+ # Then I should see "Howdy"
181
+ # When I go to "/en/hello.html"
182
+ # Then I should see "Hello World"
183
+ # When I go to "/"
184
+ # Then I should see "File Not Found"
185
+ # When I go to "/hello.html"
186
+ # Then I should see "File Not Found"
187
+ # When I go to "/es/index.html"
188
+ # Then I should see "Como Esta?"
189
+ # When I go to "/es/hola.html"
190
+ # Then I should see "Hola World"
191
191
 
192
- Scenario: Running localize with the subset config
193
- Given a fixture app "i18n-test-app"
194
- And a file named "config.rb" with:
195
- """
196
- activate :i18n, langs: [:en]
197
- """
198
- Given the Server is running at "i18n-test-app"
199
- When I go to "/"
200
- Then I should see "Howdy"
201
- When I go to "/hello.html"
202
- Then I should see "Hello World"
203
- When I go to "/en/index.html"
204
- Then I should see "File Not Found"
205
- When I go to "/es/index.html"
206
- Then I should see "File Not Found"
207
- When I go to "/es/hola.html"
208
- Then I should see "File Not Found"
192
+ # Scenario: Running localize with the subset config
193
+ # Given a fixture app "i18n-test-app"
194
+ # And a file named "config.rb" with:
195
+ # """
196
+ # activate :i18n, langs: [:en]
197
+ # """
198
+ # Given the Server is running at "i18n-test-app"
199
+ # When I go to "/"
200
+ # Then I should see "Howdy"
201
+ # When I go to "/hello.html"
202
+ # Then I should see "Hello World"
203
+ # When I go to "/en/index.html"
204
+ # Then I should see "File Not Found"
205
+ # When I go to "/es/index.html"
206
+ # Then I should see "File Not Found"
207
+ # When I go to "/es/hola.html"
208
+ # Then I should see "File Not Found"
209
209
 
210
- Scenario: Running localize with relative_assets
211
- Given a fixture app "i18n-test-app"
212
- And a file named "config.rb" with:
213
- """
214
- activate :i18n
215
- activate :relative_assets
216
- """
217
- Given the Server is running at "i18n-test-app"
218
- When I go to "/"
219
- Then I should see '"stylesheets/site.css"'
220
- When I go to "/hello.html"
221
- Then I should see '"stylesheets/site.css"'
222
- When I go to "/es/index.html"
223
- Then I should see '"../stylesheets/site.css"'
224
- When I go to "/es/hola.html"
225
- Then I should see '"../stylesheets/site.css"'
210
+ # Scenario: Running localize with relative_assets
211
+ # Given a fixture app "i18n-test-app"
212
+ # And a file named "config.rb" with:
213
+ # """
214
+ # activate :i18n
215
+ # activate :relative_assets
216
+ # """
217
+ # Given the Server is running at "i18n-test-app"
218
+ # When I go to "/"
219
+ # Then I should see '"stylesheets/site.css"'
220
+ # When I go to "/hello.html"
221
+ # Then I should see '"stylesheets/site.css"'
222
+ # When I go to "/es/index.html"
223
+ # Then I should see '"../stylesheets/site.css"'
224
+ # When I go to "/es/hola.html"
225
+ # Then I should see '"../stylesheets/site.css"'
226
226
 
227
- Scenario: Missing translations fall back to the default locale
228
- Given a fixture app "i18n-default-app"
229
- And a file named "config.rb" with:
230
- """
231
- activate :i18n, mount_at_root: :es
232
- """
233
- Given the Server is running at "i18n-default-app"
234
- When I go to "/en/"
235
- Then I should see "Default locale: es"
236
- Then I should see "Current locale: en"
237
- Then I should see "Buenos días"
238
- Then I should see "Howdy"
227
+ # Scenario: Missing translations fall back to the default locale
228
+ # Given a fixture app "i18n-default-app"
229
+ # And a file named "config.rb" with:
230
+ # """
231
+ # activate :i18n, mount_at_root: :es
232
+ # """
233
+ # Given the Server is running at "i18n-default-app"
234
+ # When I go to "/en/"
235
+ # Then I should see "Default locale: es"
236
+ # Then I should see "Current locale: en"
237
+ # Then I should see "Buenos días"
238
+ # Then I should see "Howdy"
239
239
 
240
- Scenario: Nested i18n yaml
241
- Given a fixture app "i18n-nested-app"
242
- And a file named "config.rb" with:
243
- """
244
- activate :i18n
245
- """
246
- Given the Server is running at "i18n-nested-app"
247
- When I go to "/"
248
- Then I should see "Howdy"
249
- Then I should see "More"
250
- When I go to "/es/"
251
- Then I should see "Como Esta?"
252
- Then I should see "Mucho"
240
+ # Scenario: Nested i18n yaml
241
+ # Given a fixture app "i18n-nested-app"
242
+ # And a file named "config.rb" with:
243
+ # """
244
+ # activate :i18n
245
+ # """
246
+ # Given the Server is running at "i18n-nested-app"
247
+ # When I go to "/"
248
+ # Then I should see "Howdy"
249
+ # Then I should see "More"
250
+ # When I go to "/es/"
251
+ # Then I should see "Como Esta?"
252
+ # Then I should see "Mucho"
@@ -4,8 +4,11 @@ Feature: Support liquid partials
4
4
  Given the Server is running at "liquid-app"
5
5
  When I go to "/liquid_master.html"
6
6
  Then I should see "Greetings"
7
-
7
+
8
8
  Scenario: Rendering liquid
9
9
  Given the Server is running at "liquid-app"
10
10
  When I go to "/data2.html"
11
- Then I should see "OneTwo"
11
+ Then I should see "OneTwo"
12
+
13
+ Scenario: Building liquid
14
+ Given a successfully built app at "liquid-app"
@@ -8,9 +8,6 @@ SimpleCov.root(File.expand_path(File.dirname(__FILE__) + '/../..'))
8
8
  require 'coveralls'
9
9
  Coveralls.wear!
10
10
 
11
- require 'codeclimate-test-reporter'
12
- CodeClimate::TestReporter.start
13
-
14
11
  PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
15
12
  require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-core')
16
13
  require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-core', 'step_definitions')
@@ -1,4 +1,4 @@
1
- @encoding @travishatesme @wip
1
+ @encoding @wip
2
2
 
3
3
  Feature: Unicode filenames
4
4
  In order to support non-ASCII characters in filenames
@@ -12,7 +12,7 @@ Feature: Unicode filenames
12
12
  """
13
13
  Snowman!
14
14
  <div style="text-align:center; font-size:4000%;">
15
-
15
+
16
16
  </div>
17
17
  """
18
18
  And a successfully built app at "empty-app"
@@ -28,7 +28,7 @@ Feature: Unicode filenames
28
28
  """
29
29
  Snowman!
30
30
  <div style="text-align:center; font-size:4000%;">
31
-
31
+
32
32
  </div>
33
33
  """
34
34
  And the Server is running
@@ -0,0 +1,7 @@
1
+ [titles]
2
+
3
+ [titles.first]
4
+ title = "One"
5
+
6
+ [titles.second]
7
+ title = "Two"
@@ -0,0 +1,5 @@
1
+ <% if data.respond_to?(:test3) && data.test3.respond_to?(:titles) %>
2
+ <%= data.test3.titles.map { |r| r[1].title }.join(":") %>
3
+ <% else %>
4
+ No Test Data
5
+ <% end %>
@@ -0,0 +1,6 @@
1
+ +++
2
+ layout = false
3
+ title = "This is the title"
4
+ +++
5
+
6
+ <h1><%= current_page.data.title %></h1>
@@ -3,4 +3,4 @@ layout: false
3
3
  title: This is the title
4
4
  ---
5
5
 
6
- <h1><%= current_page.data.title %></h1>
6
+ <h1><%= current_page.data.title %></h1>
@@ -0,0 +1 @@
1
+ <h1><%= current_page.data.title %></h1>
@@ -0,0 +1,4 @@
1
+ +++
2
+ layout = false
3
+ title = "This is the title"
4
+ +++
@@ -229,7 +229,7 @@ module Middleman
229
229
  if resource.binary?
230
230
  export_file!(output_file, resource.file_descriptor[:full_path])
231
231
  else
232
- response = @rack.get(::URI.escape(resource.request_path))
232
+ response = @rack.get(::WEBrick::HTTPUtils.escape(resource.request_path))
233
233
 
234
234
  # If we get a response, save it to a tempfile.
235
235
  if response.status == 200
@@ -17,7 +17,7 @@ module Middleman
17
17
  expose_to_template data: :data_store
18
18
 
19
19
  # The regex which tells Middleman which files are for data
20
- DATA_FILE_MATCHER = /^(.*?)[\w-]+\.(yml|yaml|json)$/
20
+ DATA_FILE_MATCHER = /^(.*?)[\w-]+\.(yml|yaml|json|toml)$/
21
21
 
22
22
  def initialize(app, config={}, &block)
23
23
  super
@@ -102,13 +102,15 @@ module Middleman
102
102
  extension = File.extname(data_path)
103
103
  basename = File.basename(data_path, extension)
104
104
 
105
- return unless %w(.yaml .yml .json).include?(extension)
105
+ return unless %w(.yaml .yml .json .toml).include?(extension)
106
106
 
107
107
  if %w(.yaml .yml).include?(extension)
108
108
  data, postscript = ::Middleman::Util::Data.parse(file, @app.config[:frontmatter_delims], :yaml)
109
109
  data[:postscript] = postscript if !postscript.nil? && data.is_a?(Hash)
110
110
  elsif extension == '.json'
111
111
  data, _postscript = ::Middleman::Util::Data.parse(file, @app.config[:frontmatter_delims], :json)
112
+ elsif extension == '.toml'
113
+ data, _postscript = ::Middleman::Util::Data.parse(file, @app.config[:frontmatter_delims], :toml)
112
114
  end
113
115
 
114
116
  data_branch = @local_data
@@ -6,6 +6,7 @@ require 'padrino-helpers/format_helpers'
6
6
  require 'padrino-helpers/number_helpers'
7
7
  require 'padrino-helpers/output_helpers'
8
8
  require 'padrino-helpers/render_helpers'
9
+ require 'active_support/core_ext/array/extract_options'
9
10
  require 'middleman-core/contracts'
10
11
 
11
12
  # Don't fail on invalid locale, that's not what our current
@@ -17,6 +17,7 @@ module Middleman::CoreExtensions
17
17
  # Set textual delimiters that denote the start and end of frontmatter
18
18
  define_setting :frontmatter_delims, {
19
19
  json: [%w(;;; ;;;)],
20
+ toml: [%w(+++ +++)],
20
21
  yaml: [%w(--- ---), %w(--- ...)]
21
22
  }, 'Allowed frontmatter delimiters'
22
23