slimmer 8.3.0 → 8.4.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/slimmer/processors/tag_mover.rb +1 -0
- data/lib/slimmer/version.rb +1 -1
- data/test/processors/tag_mover_test.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 875dfb2d0b78d4f4817412d2c9cf0df02effd389
|
4
|
+
data.tar.gz: 2048023302d2f1a6a3f8a6d809999f92c50f5148
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36709486290961f9bd3550496b9a4403643a9e220e580032da4f2a349858352192b8e924b742a700a8e98d8c0371db173841fc4ea78838219d4b2ce82be183d2
|
7
|
+
data.tar.gz: 9a379eb78b51a175672935c88eb17039f4b465b9af0c69e7988a4bcf5a008cf62914de2b07c5fb836fd1183523bcc2dc02a8c5b0ee690ecb2fc280d22b7680df
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
# 8.4.0
|
2
|
+
|
3
|
+
* Add support for moving `meta` tags that use `property` attribute
|
4
|
+
|
5
|
+
Previously only meta tags using the `name` attribute were moved into the
|
6
|
+
`head` of the page. This allows OpenGraph-style meta tags to be included
|
7
|
+
by an application using Slimmer.
|
8
|
+
|
1
9
|
# 8.3.0
|
2
10
|
|
3
11
|
* Add support for 403 error page.
|
@@ -4,6 +4,7 @@ module Slimmer::Processors
|
|
4
4
|
move_tags(src, dest, 'script', :dest_node => 'body', :keys => ['src', 'inner_html'])
|
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
|
+
move_tags(src, dest, 'meta', :must_have => ['property', 'content'], :keys => ['property', 'content'])
|
7
8
|
end
|
8
9
|
|
9
10
|
def include_tag?(node, min_attrs)
|
data/lib/slimmer/version.rb
CHANGED
@@ -13,6 +13,9 @@ class TagMoverTest < MiniTest::Test
|
|
13
13
|
<meta name="no_content" />
|
14
14
|
<meta content="no_name" />
|
15
15
|
<meta name="duplicate" content="name and content" />
|
16
|
+
<meta property="p:baz" content="bat" />
|
17
|
+
<meta property="p:empty" />
|
18
|
+
<meta property="p:duplicate" content="name and content" />
|
16
19
|
</head>
|
17
20
|
<body class="mainstream">
|
18
21
|
<div id="wrapper"></div>
|
@@ -26,6 +29,7 @@ class TagMoverTest < MiniTest::Test
|
|
26
29
|
<head>
|
27
30
|
<link rel="stylesheet" href="http://www.example.com/duplicate.css" />
|
28
31
|
<meta name="duplicate" content="name and content" />
|
32
|
+
<meta property="p:duplicate" content="name and content" />
|
29
33
|
</head>
|
30
34
|
<body class="mainstream">
|
31
35
|
<div id="wrapper"></div>
|
@@ -73,7 +77,19 @@ class TagMoverTest < MiniTest::Test
|
|
73
77
|
assert_not_in @template, "meta[content='no_name']"
|
74
78
|
end
|
75
79
|
|
80
|
+
def test_should_move_meta_tags_with_property_into_the_head
|
81
|
+
assert_in @template, "meta[property='p:baz'][content='bat']", nil, "Should have moved the a:baz=bat meta (property) tag"
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_should_ignore_meta_tags_with_property_but_no_content
|
85
|
+
assert_not_in @template, "meta[property='p:empty']"
|
86
|
+
end
|
87
|
+
|
76
88
|
def test_should_ignore_meta_tags_already_in_the_destination_with_the_same_name_and_content
|
77
89
|
assert @template.css("meta[name='duplicate'][content='name and content']").length == 1, "Expected there to only be one duplicate=name and content meta tag."
|
78
90
|
end
|
91
|
+
|
92
|
+
def test_should_ignore_meta_tags_with_property_already_in_the_destination_with_the_same_name_and_content
|
93
|
+
assert @template.css("meta[property='p:duplicate'][content='name and content']").length == 1, "Expected there to only be one duplicate=name and content meta (property) tag."
|
94
|
+
end
|
79
95
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slimmer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.
|
4
|
+
version: 8.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Griffiths
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-07-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|