metamagic 3.1.3 → 3.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db6eed70ef80714dd6ce2abf2734aeabe71337b6
4
- data.tar.gz: 017a7abdbc84eabd2ebab6a16bb52334ea072707
3
+ metadata.gz: 0bd1c5cb5eaeec1a81f04a1351ffa0d4ebcb6bda
4
+ data.tar.gz: aeb4fd251d0f1a35d2fb671f646786e1e16723cd
5
5
  SHA512:
6
- metadata.gz: 86b5bea5a74acfc5c5eed5b997a86d1d31bb2404736cfdc35a889f585b4b8e9ae5eb8b08c633540361df41d520f87f051cd334a7587537486fcfdadd9c2f14cd
7
- data.tar.gz: 9399b18fe4a280bf6102244ad6fe5d37b2f618de6570082ccf8749c8e62532346c4d51a135dfccd2af6f3eab9c27894444de6a70e4fc2f1bd992618ac3bdaa7d
6
+ metadata.gz: 5d26a67f84c95eab8de16287d5c5cb4140109b390ac238f862e8b8a709d58e6745e210c912be710634db2b1d6eb13a617bbfe0bad44aab601c95a43955d3bb64
7
+ data.tar.gz: e075cf385f3da913b9d7ff8e775d1c4633f02cfa7dbfbd717c50e4943632bf85bd8873fc5d7017e4ca9c1f9fb2997ff4299c71af3c5ea910807f135671de9494
@@ -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
- # Shortcut helpers now return the value you send to them.
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
@@ -104,7 +104,7 @@ module Metamagic
104
104
  Array(value).any? do |val|
105
105
  val.is_a?(Proc) ||
106
106
  val.is_a?(Symbol) ||
107
- val =~ /:\w+/
107
+ val =~ /\A:\w+/
108
108
  end
109
109
  end
110
110
 
@@ -1,3 +1,3 @@
1
1
  module Metamagic
2
- VERSION = "3.1.3"
2
+ VERSION = "3.1.4"
3
3
  end
@@ -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.3
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-05 00:00:00.000000000 Z
11
+ date: 2014-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails