metamagic 3.1.3 → 3.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/README.md +5 -4
- data/lib/metamagic/renderer.rb +1 -1
- data/lib/metamagic/version.rb +1 -1
- data/test/metamagic_test.rb +8 -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: 0bd1c5cb5eaeec1a81f04a1351ffa0d4ebcb6bda
|
4
|
+
data.tar.gz: aeb4fd251d0f1a35d2fb671f646786e1e16723cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d26a67f84c95eab8de16287d5c5cb4140109b390ac238f862e8b8a709d58e6745e210c912be710634db2b1d6eb13a617bbfe0bad44aab601c95a43955d3bb64
|
7
|
+
data.tar.gz: e075cf385f3da913b9d7ff8e775d1c4633f02cfa7dbfbd717c50e4943632bf85bd8873fc5d7017e4ca9c1f9fb2997ff4299c71af3c5ea910807f135671de9494
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## Version 3.1.4
|
4
|
+
|
5
|
+
* Fixes a bug where symbol-like strings inside meta tags would raise an exception
|
6
|
+
|
3
7
|
## Version 3.1.3
|
4
8
|
|
5
|
-
|
9
|
+
* Shortcut helpers now return the value you send to them.
|
6
10
|
|
7
11
|
## Version 3.1.2
|
8
12
|
|
data/README.md
CHANGED
@@ -108,24 +108,25 @@ metamagic site: "My Site", title: -> { title.include?(site) ? title : "#{title}
|
|
108
108
|
|
109
109
|
This will insert the site name only if it is not already present in the title.
|
110
110
|
|
111
|
-
You could also do this with a view helper:
|
111
|
+
You could also do this with a view helper. I use this in one of my websites:
|
112
112
|
|
113
113
|
```ruby
|
114
114
|
module ApplicationHelper
|
115
115
|
def meta_title_for(title, site)
|
116
|
+
return site if title.blank?
|
116
117
|
title.include?(site) ? title : "#{title} — #{site}"
|
117
118
|
end
|
118
119
|
end
|
119
120
|
```
|
120
121
|
|
122
|
+
The proc is still needed in the layout to ensure the right context for the template:
|
123
|
+
|
121
124
|
```erb
|
122
125
|
<%
|
123
126
|
metamagic site: "My Site", title: -> { meta_title_for(title, site) }
|
124
127
|
%>
|
125
128
|
```
|
126
129
|
|
127
|
-
The proc is still needed here to ensure the right context for the template.
|
128
|
-
|
129
130
|
#### Keywords template
|
130
131
|
|
131
132
|
Keyword templates can be used to add some default keywords to all pages on your site.
|
@@ -424,4 +425,4 @@ Contributors
|
|
424
425
|
|
425
426
|
* [See the list of contributors](https://github.com/lassebunk/metamagic/graphs/contributors)
|
426
427
|
|
427
|
-
Copyright (c) 2010-2014 [Lasse Bunk](http://lassebunk.dk), released under the MIT license
|
428
|
+
Copyright (c) 2010-2014 [Lasse Bunk](http://lassebunk.dk), released under the MIT license
|
data/lib/metamagic/renderer.rb
CHANGED
data/lib/metamagic/version.rb
CHANGED
data/test/metamagic_test.rb
CHANGED
@@ -20,6 +20,14 @@ class MetamagicTest < ActionView::TestCase
|
|
20
20
|
metamagic(title: "Default Title", description: "Default description", test: "Default test")
|
21
21
|
end
|
22
22
|
|
23
|
+
test "default meta tags containing colons" do
|
24
|
+
meta title: "Test Title",
|
25
|
+
test: "Test tag"
|
26
|
+
|
27
|
+
assert_equal %{<title>Test Title</title>\n<meta content="Test tag" name="test" />\n<meta content="Default\n:something" name="description" />},
|
28
|
+
metamagic(title: "Default:Title", description: "Default\n:something", test: "Default test")
|
29
|
+
end
|
30
|
+
|
23
31
|
test "not adding existing meta tags" do
|
24
32
|
meta title: "Test Title",
|
25
33
|
description: "Test description."
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metamagic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lasse Bunk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07
|
11
|
+
date: 2014-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|