text_helpers 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 307f8ef83a7eb8077ed118ef2bf734a50928a154
4
- data.tar.gz: 310ecdda9460282480f1aa0b4631b2ab34959d82
3
+ metadata.gz: 1ef277a88af65658970b04c07ca2adb16066170f
4
+ data.tar.gz: 0e3a5b3c17b5ef338b960ee306f9dbdec0d92791
5
5
  SHA512:
6
- metadata.gz: d74b813995973bbd20a31e896de3da1d0591a78149af78f9aca8520ea9eaf84111b6c9493ea6617751b2605bea2eb8cb09f1faf4719374222a5df8e51942a106
7
- data.tar.gz: 5d076830d152a39124937a218916066838ac3c16f6a77670ee4655dee9bdbffc2f0562b97187cbc9692bfc3b809e7d70c50273ec14329f6d3faef1f141cecc57
6
+ metadata.gz: 6726802e15929375da0058260934d0a07e67ac78750d59b1cdd3a7d27d5dbc5870d24ce2e33c20986ea401591fb550dfe0e8659004dfffbeaf203968a825d075
7
+ data.tar.gz: 32d0d2d6cd249b5d97d964eaabe3ae2cfafd014dbf02b2091e89c67de77596e1c5808d1e7b068076e25db02e620479af7a2db31cae40fad2e5fd84b72e3ad026
@@ -35,7 +35,7 @@ module TextHelpers
35
35
  def html(key, options = {})
36
36
  rendered = GitHub::Markdown.render(text(key, options))
37
37
  if options[:inline]
38
- rendered.match(/\A<p>(.*)<\/p>\Z/)[1].html_safe
38
+ rendered.gsub(/<\/?p>/, '').html_safe
39
39
  else
40
40
  rendered.html_safe
41
41
  end
@@ -1,3 +1,3 @@
1
1
  module TextHelpers
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -26,19 +26,19 @@ describe TextHelpers::Translation do
26
26
  end
27
27
 
28
28
  it "looks up the text for the key in a scope derived from the call stack" do
29
- assert_equal @helper.text(:test_key), "*#{@scoped_text}*"
29
+ assert_equal "*#{@scoped_text}*", @helper.text(:test_key)
30
30
  end
31
31
 
32
32
  it "converts the text to HTML via Markdown" do
33
- assert_equal @helper.html(:test_key), "<p><em>#{@scoped_text}</em></p>\n"
33
+ assert_equal "<p><em>#{@scoped_text}</em></p>\n", @helper.html(:test_key)
34
34
  end
35
35
 
36
36
  it "removes the enclosing paragraph with :inline" do
37
- assert_equal @helper.html(:test_key, inline: true), "<em>#{@scoped_text}</em>"
37
+ assert_equal "<em>#{@scoped_text}</em>\n", @helper.html(:test_key, inline: true)
38
38
  end
39
39
 
40
40
  it "interpolates values wrapped in !!" do
41
- assert_equal @helper.text(:interpolated_key), "Global? (#{@global_text})"
41
+ assert_equal "Global? (#{@global_text})", @helper.text(:interpolated_key)
42
42
  end
43
43
  end
44
44
 
@@ -50,7 +50,7 @@ describe TextHelpers::Translation do
50
50
  end
51
51
 
52
52
  it "defaults to a globally-defined value for the key" do
53
- assert_equal @helper.text(:test_key), @global_text
53
+ assert_equal @global_text, @helper.text(:test_key)
54
54
  end
55
55
  end
56
56
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: text_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Horner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-15 00:00:00.000000000 Z
11
+ date: 2013-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport