locale_schema 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/lib/locale_schema.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'redcarpet'
1
2
  require "locale_schema/version"
2
3
  require "locale_schema/translation"
3
4
  require "locale_schema/rails/action_view"
@@ -27,7 +27,13 @@ module LocaleSchema
27
27
  end
28
28
 
29
29
  def to_s
30
- I18n.t(defaults[0], options.merge(:default => defaults[1..-1]))
30
+ s = I18n.t(defaults[0], options.merge(:default => defaults[1..-1]))
31
+
32
+ if leaf_name == 'markdown'
33
+ s = ::Redcarpet.new(s).to_html
34
+ end
35
+
36
+ s
31
37
  end
32
38
  end
33
39
  end
@@ -1,3 +1,3 @@
1
1
  module LocaleSchema
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -18,6 +18,8 @@ Gem::Specification.new do |s|
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  s.require_paths = ["lib"]
20
20
 
21
+ s.add_dependency('redcarpet')
22
+
21
23
  s.add_development_dependency('i18n')
22
24
  s.add_development_dependency('rspec')
23
25
  s.add_development_dependency('guard-rspec')
data/spec/fixtures/en.yml CHANGED
@@ -8,4 +8,6 @@ en:
8
8
  new:
9
9
  heading: New project heading
10
10
  button:
11
- submit: Submit button for new project
11
+ submit: Submit button for new project
12
+ body:
13
+ markdown: "**Body** for _new project_"
@@ -62,5 +62,10 @@ describe LocaleSchema::Translation do
62
62
  do_setup(:key => :welcome, :options => {:name => 'Chris'})
63
63
  @translation.to_s.should == "Welcome Chris!"
64
64
  end
65
+
66
+ it "renders markdown when the leaf_name is :markdown" do
67
+ do_setup(:key => :'body.markdown')
68
+ @translation.to_s.should == "<p><strong>Body</strong> for <em>new project</em></p>\n"
69
+ end
65
70
  end
66
71
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: locale_schema
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.4
5
+ version: 0.0.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Christopher Dell
@@ -14,7 +14,7 @@ date: 2011-07-12 00:00:00 +02:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
- name: i18n
17
+ name: redcarpet
18
18
  prerelease: false
19
19
  requirement: &id001 !ruby/object:Gem::Requirement
20
20
  none: false
@@ -22,10 +22,10 @@ dependencies:
22
22
  - - ">="
23
23
  - !ruby/object:Gem::Version
24
24
  version: "0"
25
- type: :development
25
+ type: :runtime
26
26
  version_requirements: *id001
27
27
  - !ruby/object:Gem::Dependency
28
- name: rspec
28
+ name: i18n
29
29
  prerelease: false
30
30
  requirement: &id002 !ruby/object:Gem::Requirement
31
31
  none: false
@@ -36,7 +36,7 @@ dependencies:
36
36
  type: :development
37
37
  version_requirements: *id002
38
38
  - !ruby/object:Gem::Dependency
39
- name: guard-rspec
39
+ name: rspec
40
40
  prerelease: false
41
41
  requirement: &id003 !ruby/object:Gem::Requirement
42
42
  none: false
@@ -46,6 +46,17 @@ dependencies:
46
46
  version: "0"
47
47
  type: :development
48
48
  version_requirements: *id003
49
+ - !ruby/object:Gem::Dependency
50
+ name: guard-rspec
51
+ prerelease: false
52
+ requirement: &id004 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: "0"
58
+ type: :development
59
+ version_requirements: *id004
49
60
  description: This gem provides a hierarchy for I18n defaults
50
61
  email:
51
62
  - chris@tigrish.com