document_mapper 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,6 +5,7 @@ module DocumentMapper
5
5
  extend ActiveSupport::Concern
6
6
  include ActiveModel::AttributeMethods
7
7
  include AttributeMethods::Read
8
+ include ToHtml
8
9
  include YamlParsing
9
10
 
10
11
  attr_accessor :attributes, :content, :directory
@@ -0,0 +1,10 @@
1
+ require 'tilt'
2
+
3
+ module DocumentMapper
4
+ module ToHtml
5
+ def to_html
6
+ Tilt.new(extension) { content }.render
7
+ end
8
+ end
9
+ end
10
+
@@ -1,3 +1,3 @@
1
1
  module DocumentMapper
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
@@ -5,6 +5,7 @@ require 'yaml'
5
5
  require 'document_mapper/constants'
6
6
  require 'document_mapper/errors'
7
7
  require 'document_mapper/attribute_methods'
8
+ require 'document_mapper/to_html'
8
9
  require 'document_mapper/yaml_parsing'
9
10
  require 'document_mapper/document'
10
11
  require 'document_mapper/query'
@@ -321,6 +321,17 @@ EOS
321
321
  end
322
322
  end
323
323
 
324
+ describe 'rendering the document as html' do
325
+ before do
326
+ @file_path = sample_file_path_1
327
+ @document = MyDocument.from_file(@file_path)
328
+ end
329
+
330
+ it 'should render the content as html' do
331
+ assert_equal '<p>I like being the demo text.</p>', @document.to_html
332
+ end
333
+ end
334
+
324
335
  def sample_file_path_1
325
336
  'test/documents/2010-08-08-test-document-file.textile'
326
337
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: document_mapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-06-19 00:00:00.000000000Z
12
+ date: 2011-06-23 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &2156885800 !ruby/object:Gem::Requirement
16
+ requirement: &2153304900 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2156885800
24
+ version_requirements: *2153304900
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activemodel
27
- requirement: &2156885300 !ruby/object:Gem::Requirement
27
+ requirement: &2153304400 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 3.0.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2156885300
35
+ version_requirements: *2153304400
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &2156884840 !ruby/object:Gem::Requirement
38
+ requirement: &2153303940 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,7 +43,29 @@ dependencies:
43
43
  version: 0.9.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2156884840
46
+ version_requirements: *2153303940
47
+ - !ruby/object:Gem::Dependency
48
+ name: tilt
49
+ requirement: &2153335980 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 1.3.0
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *2153335980
58
+ - !ruby/object:Gem::Dependency
59
+ name: RedCloth
60
+ requirement: &2153335520 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: 4.2.0
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *2153335520
47
69
  description: ! ' DocumentMapper is an object mapper for plain text documents. The
48
70
  documents look like the ones used in jekyll (http://github.com/mojombo/jekyll).
49
71
  They consist of a preambel written in YAML (also called YAML front matter), and
@@ -67,6 +89,7 @@ files:
67
89
  - lib/document_mapper/errors.rb
68
90
  - lib/document_mapper/query.rb
69
91
  - lib/document_mapper/selector.rb
92
+ - lib/document_mapper/to_html.rb
70
93
  - lib/document_mapper/version.rb
71
94
  - lib/document_mapper/yaml_parsing.rb
72
95
  - lib/document_mapper.rb