sumitup 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +5 -0
- data/VERSION +1 -1
- data/lib/sumitup/parser.rb +2 -2
- data/spec/sumitup/parser_spec.rb +4 -0
- data/sumitup.gemspec +83 -0
- metadata +4 -3
data/README.rdoc
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
Given an html document or fragment this gem will build a summary of the contents
|
4
4
|
|
5
|
+
|
6
|
+
parser = Sumitup::Parser.new
|
7
|
+
summary = parser.summarize(item.content, length)
|
8
|
+
summary = parser.summarize(item.title, length) if parser.is_blank?(summary)
|
9
|
+
|
5
10
|
== Copyright
|
6
11
|
|
7
12
|
Copyright (c) 2012 Tatemae. See LICENSE.txt for further details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/lib/sumitup/parser.rb
CHANGED
@@ -89,8 +89,8 @@ module Sumitup
|
|
89
89
|
node.remove
|
90
90
|
else
|
91
91
|
# Force width of images
|
92
|
-
node
|
93
|
-
node.attributes['height'].remove
|
92
|
+
node['width'] = me.image_width_limit.to_s
|
93
|
+
node.attributes['height'].remove if node.attributes['height']
|
94
94
|
end
|
95
95
|
end
|
96
96
|
end
|
data/spec/sumitup/parser_spec.rb
CHANGED
@@ -24,6 +24,7 @@ describe Sumitup::Parser do
|
|
24
24
|
youngest daughter had to sit in the room with us the entire time. She said, "Daddy's owie was really gross. I like it when they cover it with
|
25
25
|
something so you can't see it." She's 4 so suck it up.</p>
|
26
26
|
<img src="http://www.example.com/test.jpg" width="600" height="600" />
|
27
|
+
<img src="http://www.example.com/nowidth.jpg" />
|
27
28
|
<p>
|
28
29
|
<style type="text/css">
|
29
30
|
.gallery {
|
@@ -153,6 +154,9 @@ describe Sumitup::Parser do
|
|
153
154
|
doc = Nokogiri::HTML(result)
|
154
155
|
doc.css('img').length.should == 2
|
155
156
|
end
|
157
|
+
it "should add a width to images that don't have one" do
|
158
|
+
@long_result.should include(%Q{<img src="http://www.example.com/nowidth.jpg" width="#{@image_width_limit}">})
|
159
|
+
end
|
156
160
|
end
|
157
161
|
|
158
162
|
describe "snippet" do
|
data/sumitup.gemspec
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "sumitup"
|
8
|
+
s.version = "0.1.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Justin Ball"]
|
12
|
+
s.date = "2012-03-02"
|
13
|
+
s.description = "Given an html document or fragment this gem will build a summary of the content."
|
14
|
+
s.email = "justinball@gmail.com"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".rspec",
|
22
|
+
"Gemfile",
|
23
|
+
"Gemfile.lock",
|
24
|
+
"Guardfile",
|
25
|
+
"LICENSE.txt",
|
26
|
+
"README.rdoc",
|
27
|
+
"Rakefile",
|
28
|
+
"VERSION",
|
29
|
+
"lib/sumitup.rb",
|
30
|
+
"lib/sumitup/parser.rb",
|
31
|
+
"spec/spec_helper.rb",
|
32
|
+
"spec/sumitup/parser_spec.rb",
|
33
|
+
"sumitup.gemspec"
|
34
|
+
]
|
35
|
+
s.homepage = "http://github.com/tatemae/sumitup"
|
36
|
+
s.licenses = ["MIT"]
|
37
|
+
s.require_paths = ["lib"]
|
38
|
+
s.rubygems_version = "1.8.12"
|
39
|
+
s.summary = "Generate a summary of html content"
|
40
|
+
|
41
|
+
if s.respond_to? :specification_version then
|
42
|
+
s.specification_version = 3
|
43
|
+
|
44
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
45
|
+
s.add_runtime_dependency(%q<sanitize>, [">= 0"])
|
46
|
+
s.add_development_dependency(%q<growl>, [">= 0"])
|
47
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
|
48
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
49
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
50
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
|
51
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
52
|
+
s.add_development_dependency(%q<guard>, [">= 1.0.0"])
|
53
|
+
s.add_development_dependency(%q<guard-rspec>, [">= 0.6.0"])
|
54
|
+
s.add_development_dependency(%q<guard-bundler>, [">= 0.1.3"])
|
55
|
+
s.add_development_dependency(%q<ruby-debug>, [">= 0"])
|
56
|
+
else
|
57
|
+
s.add_dependency(%q<sanitize>, [">= 0"])
|
58
|
+
s.add_dependency(%q<growl>, [">= 0"])
|
59
|
+
s.add_dependency(%q<rspec>, ["~> 2.8.0"])
|
60
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
61
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
62
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
63
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
64
|
+
s.add_dependency(%q<guard>, [">= 1.0.0"])
|
65
|
+
s.add_dependency(%q<guard-rspec>, [">= 0.6.0"])
|
66
|
+
s.add_dependency(%q<guard-bundler>, [">= 0.1.3"])
|
67
|
+
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
68
|
+
end
|
69
|
+
else
|
70
|
+
s.add_dependency(%q<sanitize>, [">= 0"])
|
71
|
+
s.add_dependency(%q<growl>, [">= 0"])
|
72
|
+
s.add_dependency(%q<rspec>, ["~> 2.8.0"])
|
73
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
74
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
75
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
76
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
77
|
+
s.add_dependency(%q<guard>, [">= 1.0.0"])
|
78
|
+
s.add_dependency(%q<guard-rspec>, [">= 0.6.0"])
|
79
|
+
s.add_dependency(%q<guard-bundler>, [">= 0.1.3"])
|
80
|
+
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sumitup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Justin Ball
|
@@ -207,6 +207,7 @@ files:
|
|
207
207
|
- lib/sumitup/parser.rb
|
208
208
|
- spec/spec_helper.rb
|
209
209
|
- spec/sumitup/parser_spec.rb
|
210
|
+
- sumitup.gemspec
|
210
211
|
homepage: http://github.com/tatemae/sumitup
|
211
212
|
licenses:
|
212
213
|
- MIT
|