slimmer 3.13.1 → 3.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/slimmer/processors/tag_mover.rb +3 -2
- data/lib/slimmer/version.rb +1 -1
- data/test/typical_usage_test.rb +2 -2
- metadata +50 -50
@@ -1,7 +1,7 @@
|
|
1
1
|
module Slimmer::Processors
|
2
2
|
class TagMover
|
3
3
|
def filter(src,dest)
|
4
|
-
move_tags(src, dest, 'script', :must_have => ['src'])
|
4
|
+
move_tags(src, dest, 'script', :dest_node => 'body', :must_have => ['src'])
|
5
5
|
move_tags(src, dest, 'link', :must_have => ['href'])
|
6
6
|
move_tags(src, dest, 'meta', :must_have => ['name', 'content'], :keys => ['name', 'content', 'http-equiv'])
|
7
7
|
end
|
@@ -29,12 +29,13 @@ module Slimmer::Processors
|
|
29
29
|
already_there = dest.css(type).map { |node|
|
30
30
|
tag_fingerprint(node, comparison_attrs)
|
31
31
|
}.compact
|
32
|
+
dest_node = opts[:dest_node] || 'head'
|
32
33
|
|
33
34
|
src.css(type).each do |node|
|
34
35
|
if include_tag?(node, min_attrs) && !already_there.include?(tag_fingerprint(node, comparison_attrs))
|
35
36
|
node = wrap_node(src, node)
|
36
37
|
node.remove
|
37
|
-
dest.at_xpath(
|
38
|
+
dest.at_xpath("/html/#{dest_node}") << node
|
38
39
|
end
|
39
40
|
end
|
40
41
|
end
|
data/lib/slimmer/version.rb
CHANGED
data/test/typical_usage_test.rb
CHANGED
@@ -113,8 +113,8 @@ module TypicalUsage
|
|
113
113
|
assert_rendered_in_template "head title", "The title of the page"
|
114
114
|
end
|
115
115
|
|
116
|
-
def
|
117
|
-
assert_rendered_in_template "
|
116
|
+
def test_should_move_script_tags_into_the_body
|
117
|
+
assert_rendered_in_template "body script[src='blah.js']"
|
118
118
|
end
|
119
119
|
|
120
120
|
def test_should_move_meta_tags_into_the_head
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: slimmer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 3.
|
5
|
+
version: 3.14.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Ben Griffiths
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2013-03-
|
14
|
+
date: 2013-03-12 00:00:00 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: nokogiri
|
@@ -180,57 +180,57 @@ extra_rdoc_files: []
|
|
180
180
|
files:
|
181
181
|
- README.md
|
182
182
|
- CHANGELOG.md
|
183
|
-
- lib/slimmer.
|
184
|
-
- lib/slimmer/app.rb
|
185
|
-
- lib/slimmer/test_template.rb
|
183
|
+
- lib/tasks/slimmer.rake
|
186
184
|
- lib/slimmer/version.rb
|
187
|
-
- lib/slimmer/railtie.rb
|
188
|
-
- lib/slimmer/processors/tag_mover.rb
|
189
185
|
- lib/slimmer/processors/body_class_copier.rb
|
186
|
+
- lib/slimmer/processors/google_analytics_configurator.rb
|
187
|
+
- lib/slimmer/processors/related_items_inserter.rb
|
188
|
+
- lib/slimmer/processors/body_inserter.rb
|
190
189
|
- lib/slimmer/processors/logo_class_inserter.rb
|
191
|
-
- lib/slimmer/processors/beta_notice_inserter.rb
|
192
|
-
- lib/slimmer/processors/header_context_inserter.rb
|
193
|
-
- lib/slimmer/processors/meta_viewport_remover.rb
|
194
|
-
- lib/slimmer/processors/search_index_setter.rb
|
195
190
|
- lib/slimmer/processors/report_a_problem_inserter.rb
|
196
|
-
- lib/slimmer/processors/campaign_notification_inserter.rb
|
197
191
|
- lib/slimmer/processors/footer_remover.rb
|
198
|
-
- lib/slimmer/processors/
|
199
|
-
- lib/slimmer/processors/title_inserter.rb
|
200
|
-
- lib/slimmer/processors/related_items_inserter.rb
|
201
|
-
- lib/slimmer/processors/section_inserter.rb
|
192
|
+
- lib/slimmer/processors/campaign_notification_inserter.rb
|
202
193
|
- lib/slimmer/processors/conditional_comment_mover.rb
|
203
|
-
- lib/slimmer/processors/
|
194
|
+
- lib/slimmer/processors/beta_notice_inserter.rb
|
195
|
+
- lib/slimmer/processors/section_inserter.rb
|
196
|
+
- lib/slimmer/processors/tag_mover.rb
|
197
|
+
- lib/slimmer/processors/title_inserter.rb
|
198
|
+
- lib/slimmer/processors/search_index_setter.rb
|
199
|
+
- lib/slimmer/processors/header_context_inserter.rb
|
200
|
+
- lib/slimmer/processors/meta_viewport_remover.rb
|
201
|
+
- lib/slimmer/template.rb
|
202
|
+
- lib/slimmer/railtie.rb
|
203
|
+
- lib/slimmer/test.rb
|
204
204
|
- lib/slimmer/artefact.rb
|
205
205
|
- lib/slimmer/skin.rb
|
206
|
+
- lib/slimmer/app.rb
|
206
207
|
- lib/slimmer/headers.rb
|
207
|
-
- lib/slimmer/
|
208
|
-
- lib/slimmer
|
209
|
-
- lib/tasks/slimmer.rake
|
208
|
+
- lib/slimmer/test_template.rb
|
209
|
+
- lib/slimmer.rb
|
210
210
|
- Rakefile
|
211
|
-
- test/processors/header_context_inserter_test.rb
|
212
|
-
- test/processors/google_analytics_test.rb
|
213
|
-
- test/processors/body_inserter_test.rb
|
214
|
-
- test/processors/search_index_setter_test.rb
|
215
211
|
- test/processors/meta_viewport_remover_test.rb
|
212
|
+
- test/processors/related_items_inserter_test.rb
|
216
213
|
- test/processors/report_a_problem_inserter_test.rb
|
217
214
|
- test/processors/section_inserter_test.rb
|
218
|
-
- test/processors/
|
219
|
-
- test/processors/
|
215
|
+
- test/processors/google_analytics_test.rb
|
216
|
+
- test/processors/search_index_setter_test.rb
|
217
|
+
- test/processors/header_context_inserter_test.rb
|
218
|
+
- test/processors/body_inserter_test.rb
|
220
219
|
- test/processors/logo_class_inserter_test.rb
|
221
|
-
- test/
|
222
|
-
- test/headers_test.rb
|
223
|
-
- test/test_helper.rb
|
224
|
-
- test/typical_usage_test.rb
|
220
|
+
- test/processors/campaign_notification_inserter_test.rb
|
225
221
|
- test/artefact_test.rb
|
226
222
|
- test/skin_test.rb
|
227
|
-
- test/
|
223
|
+
- test/headers_test.rb
|
224
|
+
- test/test_template_dependency_on_static_test.rb
|
225
|
+
- test/typical_usage_test.rb
|
226
|
+
- test/fixtures/500.html.erb
|
228
227
|
- test/fixtures/404.html.erb
|
229
228
|
- test/fixtures/beta_notice.html.erb
|
230
|
-
- test/fixtures/500.html.erb
|
231
|
-
- test/fixtures/wrapper.html.erb
|
232
|
-
- test/fixtures/related.raw.html.erb
|
233
229
|
- test/fixtures/report_a_problem.raw.html.erb
|
230
|
+
- test/fixtures/campaign.html.erb
|
231
|
+
- test/fixtures/related.raw.html.erb
|
232
|
+
- test/fixtures/wrapper.html.erb
|
233
|
+
- test/test_helper.rb
|
234
234
|
- bin/render_slimmer_error
|
235
235
|
homepage: http://github.com/alphagov/slimmer
|
236
236
|
licenses: []
|
@@ -245,7 +245,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
245
245
|
requirements:
|
246
246
|
- - ">="
|
247
247
|
- !ruby/object:Gem::Version
|
248
|
-
hash: -
|
248
|
+
hash: -2990153906158645098
|
249
249
|
segments:
|
250
250
|
- 0
|
251
251
|
version: "0"
|
@@ -254,7 +254,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
254
254
|
requirements:
|
255
255
|
- - ">="
|
256
256
|
- !ruby/object:Gem::Version
|
257
|
-
hash: -
|
257
|
+
hash: -2990153906158645098
|
258
258
|
segments:
|
259
259
|
- 0
|
260
260
|
version: "0"
|
@@ -266,26 +266,26 @@ signing_key:
|
|
266
266
|
specification_version: 3
|
267
267
|
summary: Thinner than the skinner
|
268
268
|
test_files:
|
269
|
-
- test/processors/header_context_inserter_test.rb
|
270
|
-
- test/processors/google_analytics_test.rb
|
271
|
-
- test/processors/body_inserter_test.rb
|
272
|
-
- test/processors/search_index_setter_test.rb
|
273
269
|
- test/processors/meta_viewport_remover_test.rb
|
270
|
+
- test/processors/related_items_inserter_test.rb
|
274
271
|
- test/processors/report_a_problem_inserter_test.rb
|
275
272
|
- test/processors/section_inserter_test.rb
|
276
|
-
- test/processors/
|
277
|
-
- test/processors/
|
273
|
+
- test/processors/google_analytics_test.rb
|
274
|
+
- test/processors/search_index_setter_test.rb
|
275
|
+
- test/processors/header_context_inserter_test.rb
|
276
|
+
- test/processors/body_inserter_test.rb
|
278
277
|
- test/processors/logo_class_inserter_test.rb
|
279
|
-
- test/
|
280
|
-
- test/headers_test.rb
|
281
|
-
- test/test_helper.rb
|
282
|
-
- test/typical_usage_test.rb
|
278
|
+
- test/processors/campaign_notification_inserter_test.rb
|
283
279
|
- test/artefact_test.rb
|
284
280
|
- test/skin_test.rb
|
285
|
-
- test/
|
281
|
+
- test/headers_test.rb
|
282
|
+
- test/test_template_dependency_on_static_test.rb
|
283
|
+
- test/typical_usage_test.rb
|
284
|
+
- test/fixtures/500.html.erb
|
286
285
|
- test/fixtures/404.html.erb
|
287
286
|
- test/fixtures/beta_notice.html.erb
|
288
|
-
- test/fixtures/500.html.erb
|
289
|
-
- test/fixtures/wrapper.html.erb
|
290
|
-
- test/fixtures/related.raw.html.erb
|
291
287
|
- test/fixtures/report_a_problem.raw.html.erb
|
288
|
+
- test/fixtures/campaign.html.erb
|
289
|
+
- test/fixtures/related.raw.html.erb
|
290
|
+
- test/fixtures/wrapper.html.erb
|
291
|
+
- test/test_helper.rb
|