philologic-client 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY.rdoc CHANGED
@@ -1,5 +1,9 @@
1
1
  = Philologic::Client History
2
2
 
3
+ == 2012-01-12 v0.0.9
4
+
5
+ * Added +Philologic::Document#html()+
6
+
3
7
  == 2012-01-10 v0.0.8
4
8
 
5
9
  * Added +Philologic::Client#frequency()+ table searching.
data/README.rdoc CHANGED
@@ -12,6 +12,7 @@
12
12
  # Get document
13
13
  first = client.children.first
14
14
  doc = first.document
15
+ html = doc.html
15
16
  txt = doc.text
16
17
 
17
18
  # Simple search
@@ -58,4 +59,5 @@ https://github.com/blairc/philologic-client/
58
59
  * Add +children+ to Philologic::Document
59
60
  * Add +parent+ to Philologic::Document
60
61
  * Unify (as much as possible) Philologic::Document, Philologic::Key, Philologic::Link
62
+ * Cache results?
61
63
 
@@ -20,6 +20,7 @@ require 'open-uri'
20
20
  # # Get document
21
21
  # first = client.children.first
22
22
  # doc = first.document
23
+ # html = doc.html
23
24
  # txt = doc.text
24
25
  #
25
26
  # # Simple search
@@ -66,6 +67,7 @@ require 'open-uri'
66
67
  # * Add +children+ to Philologic::Document
67
68
  # * Add +parent+ to Philologic::Document
68
69
  # * Unify (as much as possible) Philologic::Document, Philologic::Key, Philologic::Link
70
+ # * Cache results?
69
71
  #
70
72
  module Philologic # :nodoc:
71
73
 
@@ -239,6 +241,13 @@ module Philologic # :nodoc:
239
241
  @doc.attributes.key?(key) ? @doc.attributes[key].value : nil
240
242
  end
241
243
 
244
+ #
245
+ # Returns document HTML.
246
+ #
247
+ def html
248
+ @doc.css('div.context_container').to_html
249
+ end
250
+
242
251
  #
243
252
  # Returns document text.
244
253
  #
@@ -5,6 +5,6 @@ module Philologic
5
5
  #
6
6
  # Philologic::Client version
7
7
  #
8
- VERSION = '0.0.8'
8
+ VERSION = '0.0.9'
9
9
  end
10
10
  end
@@ -144,12 +144,15 @@ class TestPhilologicClient < Test::Unit::TestCase
144
144
  doc = client.document(@doc_path)
145
145
  assert_not_nil doc
146
146
 
147
- assert_kind_of Philologic::Document, doc
148
- assert_equal 'philologic_object', doc['class']
147
+ assert_kind_of Philologic::Document, doc
148
+ assert_equal 'philologic_object', doc['class']
149
149
  assert_nil doc['some random attribute']
150
- assert_kind_of String, doc.text
151
- assert_match /^Conon, de Béthune/, doc.text
152
- assert_match /verité." $/, doc.text
150
+ assert_kind_of String, doc.html
151
+ assert_match /^<div class="context_container" id="1">/, doc.html
152
+ assert_match %r{par tans la verité." </div>}, doc.html
153
+ assert_kind_of String, doc.text
154
+ assert_match /^Conon, de Béthune/, doc.text
155
+ assert_match /verité." $/, doc.text
153
156
  end
154
157
  end
155
158
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: philologic-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
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: 2012-01-10 00:00:00.000000000Z
12
+ date: 2012-01-12 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &70366750022700 !ruby/object:Gem::Requirement
16
+ requirement: &70245904566480 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70366750022700
24
+ version_requirements: *70245904566480
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rdoc
27
- requirement: &70366750022260 !ruby/object:Gem::Requirement
27
+ requirement: &70245904566040 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70366750022260
35
+ version_requirements: *70245904566040
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: mocha
38
- requirement: &70366750021840 !ruby/object:Gem::Requirement
38
+ requirement: &70245904565620 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70366750021840
46
+ version_requirements: *70245904565620
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rdoc-readme
49
- requirement: &70366750021340 !ruby/object:Gem::Requirement
49
+ requirement: &70245904565120 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.1.2
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70366750021340
57
+ version_requirements: *70245904565120
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: simplecov
60
- requirement: &70366750020920 !ruby/object:Gem::Requirement
60
+ requirement: &70245904564700 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70366750020920
68
+ version_requirements: *70245904564700
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: nokogiri
71
- requirement: &70366750020460 !ruby/object:Gem::Requirement
71
+ requirement: &70245904564240 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70366750020460
79
+ version_requirements: *70245904564240
80
80
  description: Ruby client for interacting with the Philologic API.
81
81
  email:
82
82
  - blair.christensen@gmail.com
@@ -113,7 +113,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
113
113
  version: '0'
114
114
  segments:
115
115
  - 0
116
- hash: -832477634477053375
116
+ hash: -899217601091423703
117
117
  required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  none: false
119
119
  requirements:
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  version: '0'
123
123
  segments:
124
124
  - 0
125
- hash: -832477634477053375
125
+ hash: -899217601091423703
126
126
  requirements: []
127
127
  rubyforge_project: philologic-client
128
128
  rubygems_version: 1.8.7