vitreous_share 0.0.11 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -33,6 +33,10 @@ module Vitreous
33
33
  def items
34
34
  @hash['elements'].select { |e| e['type'] == 'item' }.map { |e| Element.new( e ) }
35
35
  end
36
+
37
+ def to_md( text )
38
+ RDiscount.new( render( text ) ).to_html
39
+ end
36
40
  end
37
41
  end
38
42
  end
@@ -1,5 +1,5 @@
1
1
  module Vitreous
2
2
  module Share
3
- VERSION = "0.0.11"
3
+ VERSION = "0.0.13"
4
4
  end
5
5
  end
@@ -1,6 +1,7 @@
1
1
  require 'json'
2
2
  require 'dropbox'
3
3
  require 'mustache'
4
+ require 'rdiscount'
4
5
 
5
6
  require "#{File.dirname(__FILE__)}/vitreous/vitreous"
6
7
  require "#{File.dirname(__FILE__)}/vitreous/share/indexer_utils"
data/test/element_test.rb CHANGED
@@ -15,4 +15,36 @@ class ElementTest < Test::Unit::TestCase
15
15
 
16
16
  assert_equal( '/subfolder-1', element.elements.first.link )
17
17
  end
18
+
19
+ def test_render
20
+ element_hash = {
21
+ "title" => "the title",
22
+ "link" => "the link",
23
+ "jpg" => "the jpg",
24
+ "txt" => "the txt"
25
+ }
26
+
27
+ element = Vitreous::Share::Element.new( element_hash )
28
+
29
+ result =
30
+ Mustache.render(
31
+ "{{#element}}{{title}} | {{link}} | {{jpg}} | {{txt}}{{/element}}",
32
+ { :element => element }
33
+ )
34
+
35
+ assert_equal( 'the title | the link | the jpg | the txt', result )
36
+ end
37
+
38
+ def test_to_md
39
+ element_hash = { "txt" => "Eo! MarkDown *rules*." }
40
+ element = Vitreous::Share::Element.new( element_hash )
41
+
42
+ result =
43
+ Mustache.render(
44
+ "{{#element}}{{#to_md}}{{txt}}{{/to_md}}{{/element}}",
45
+ { :element => element }
46
+ )
47
+
48
+ assert_equal( "<p>Eo! MarkDown <em>rules</em>.</p>\n", result )
49
+ end
18
50
  end
@@ -1,29 +1,30 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "vitreous/share/version"
2
+ $:.push File.expand_path('../lib', __FILE__)
3
+ require 'vitreous/share/version'
4
4
 
5
5
  Gem::Specification.new do |s|
6
- s.name = "vitreous_share"
6
+ s.name = 'vitreous_share'
7
7
  s.version = Vitreous::Share::VERSION
8
- s.authors = ["Fernando Guillen"]
9
- s.email = ["fguillen.mail@gmail.com"]
10
- s.homepage = "https://github.com/fguillen/VitreousShare"
11
- s.summary = "Shared components for Vitreous"
12
- s.description = "Shared components for Vitreous"
8
+ s.authors = ['Fernando Guillen']
9
+ s.email = ['fguillen.mail@gmail.com']
10
+ s.homepage = 'https://github.com/fguillen/VitreousShare'
11
+ s.summary = 'Shared components for Vitreous'
12
+ s.description = 'Shared components for Vitreous'
13
13
 
14
- s.rubyforge_project = "vitreous_share"
14
+ s.rubyforge_project = 'vitreous_share'
15
15
 
16
16
  s.files = `git ls-files`.split("\n")
17
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
- s.require_paths = ["lib"]
19
+ s.require_paths = ['lib']
20
20
 
21
- s.add_dependency "json"
22
- s.add_dependency "dropbox"
23
- s.add_dependency "mustache"
21
+ s.add_dependency 'json'
22
+ s.add_dependency 'dropbox'
23
+ s.add_dependency 'mustache'
24
+ s.add_dependency 'rdiscount'
24
25
 
25
- s.add_development_dependency "bundler", ">= 1.0.0.rc.6"
26
- s.add_development_dependency "mocha"
27
- s.add_development_dependency "dummy_dropbox"
28
- s.add_development_dependency "rake"
26
+ s.add_development_dependency 'bundler', '>= 1.0.0.rc.6'
27
+ s.add_development_dependency 'mocha'
28
+ s.add_development_dependency 'dummy_dropbox'
29
+ s.add_development_dependency 'rake'
29
30
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 11
9
- version: 0.0.11
8
+ - 13
9
+ version: 0.0.13
10
10
  platform: ruby
11
11
  authors:
12
12
  - Fernando Guillen
@@ -57,9 +57,22 @@ dependencies:
57
57
  type: :runtime
58
58
  version_requirements: *id003
59
59
  - !ruby/object:Gem::Dependency
60
- name: bundler
60
+ name: rdiscount
61
61
  prerelease: false
62
62
  requirement: &id004 !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ segments:
68
+ - 0
69
+ version: "0"
70
+ type: :runtime
71
+ version_requirements: *id004
72
+ - !ruby/object:Gem::Dependency
73
+ name: bundler
74
+ prerelease: false
75
+ requirement: &id005 !ruby/object:Gem::Requirement
63
76
  none: false
64
77
  requirements:
65
78
  - - ">="
@@ -72,11 +85,11 @@ dependencies:
72
85
  - 6
73
86
  version: 1.0.0.rc.6
74
87
  type: :development
75
- version_requirements: *id004
88
+ version_requirements: *id005
76
89
  - !ruby/object:Gem::Dependency
77
90
  name: mocha
78
91
  prerelease: false
79
- requirement: &id005 !ruby/object:Gem::Requirement
92
+ requirement: &id006 !ruby/object:Gem::Requirement
80
93
  none: false
81
94
  requirements:
82
95
  - - ">="
@@ -85,11 +98,11 @@ dependencies:
85
98
  - 0
86
99
  version: "0"
87
100
  type: :development
88
- version_requirements: *id005
101
+ version_requirements: *id006
89
102
  - !ruby/object:Gem::Dependency
90
103
  name: dummy_dropbox
91
104
  prerelease: false
92
- requirement: &id006 !ruby/object:Gem::Requirement
105
+ requirement: &id007 !ruby/object:Gem::Requirement
93
106
  none: false
94
107
  requirements:
95
108
  - - ">="
@@ -98,11 +111,11 @@ dependencies:
98
111
  - 0
99
112
  version: "0"
100
113
  type: :development
101
- version_requirements: *id006
114
+ version_requirements: *id007
102
115
  - !ruby/object:Gem::Dependency
103
116
  name: rake
104
117
  prerelease: false
105
- requirement: &id007 !ruby/object:Gem::Requirement
118
+ requirement: &id008 !ruby/object:Gem::Requirement
106
119
  none: false
107
120
  requirements:
108
121
  - - ">="
@@ -111,7 +124,7 @@ dependencies:
111
124
  - 0
112
125
  version: "0"
113
126
  type: :development
114
- version_requirements: *id007
127
+ version_requirements: *id008
115
128
  description: Shared components for Vitreous
116
129
  email:
117
130
  - fguillen.mail@gmail.com