auto_excerpt 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,3 +1,5 @@
1
1
  *.php
2
2
  *.zip
3
3
  extra
4
+ *.gemspec
5
+ pkg
data/CHANGELOG CHANGED
@@ -0,0 +1,8 @@
1
+ == 0.6.3 (2010-01-26)
2
+ * Removed limit by :characters for the time being
3
+ * Improved limit by characters to be more accurate
4
+ * Changed method of stripping HTML
5
+ * Changed Regexp used for closing unclosed HTML tags
6
+
7
+ == 0.6.2 (2010-01-20)
8
+ * Original cleanup of what was already written and turning it into a gem.
data/README.textile CHANGED
@@ -1,5 +1,7 @@
1
1
  h1. AutoExcerpt
2
2
 
3
+ pre. [sudo] gem install auto_excerpt
4
+
3
5
  Creates Automatic excerpts of html formatted text.
4
6
 
5
7
  pre. AutoExcerpt.new("<span>This is <strong>some</strong> fancy html formatted text homie</span>", {:words => 5})
@@ -8,37 +10,42 @@ pre. AutoExcerpt.new("<span>This is <strong>some</strong> fancy html formatted t
8
10
  h3. Features
9
11
 
10
12
  * There are 4 different ways to limit the length of an excerpt: *characters*, *words*, *sentences*, *paragraphs*
11
- * If limiting by *characters*, the gem will ensure that the excerpt does not cutoff in the middle of a word. If the excerpt would be shorter than the limit that is set, the entire text will be shown.
13
+ * If the excerpt would be shorter than the limit that is set, the entire text will be shown.
12
14
  * HTML can be stripped
13
15
  * HTML tags are automatically closed.
14
16
 
15
17
  h3. Options
16
18
 
17
- *:characters*
19
+ @:characters@
18
20
  The number of characters to display from the text.
19
21
  Default: 150 (does not need to be reset to 0 if you choose another option)
20
22
 
21
- *:words*, *:sentences*, *:paragraphs*
23
+ If you need to be 100% accurate in your character count, then remove the @:ending@
24
+
25
+ pre. AutoExcerpt.new("<h1>Hello World!</h1>", {:characters => 5, :ending => nil})
26
+ # => <h1>Hello</h1>
27
+
28
+ @:words@, @:sentences@, @:paragraphs@
22
29
  The number of [which] to display from the text.
23
30
 
24
- *:ending*
31
+ @:ending@
25
32
  The text that will be displayed at the end of the excerpt when generating the excerpt by length or words. Set to @nil@ if you don't want it.
26
33
  Default: "..."
27
34
 
28
35
  pre. AutoExcerpt.new("This is cool stuff man!", :ending => ". Srsly!", :words => 3)
29
36
  # => "This is cool. Srsly!"
30
37
 
31
- *:strip_html*
38
+ @:strip_html@
32
39
  Strips HTML tags from the excerpt that is displayed.
33
40
  Default: false
34
41
 
35
- *:strip_paragraphs*
42
+ @:strip_paragraphs@
36
43
  Strip all paragraph tags from the html.
37
44
  Default: false
38
45
 
39
- *:skip_characters*, *:skip_words*, *:skip_sentences*, *:skip_paragraphs*
46
+ @:skip_words@, @:skip_sentences@, @:skip_paragraphs@
40
47
  The number of [which] to skip at the beginning of the html when returned.
41
- Default 0
48
+ Default: 0
42
49
 
43
50
  h2. Help out on Github!
44
51
 
data/Rakefile CHANGED
@@ -11,6 +11,9 @@ begin
11
11
  gemspec.email = "kabari@gmail.com"
12
12
  gemspec.homepage = "http://github.com/kabari/auto_excerpt"
13
13
  gemspec.authors = ["Kabari Hendrick"]
14
+
15
+ gemspec.add_development_dependency "rspec", ">= 1.2.9"
16
+ gemspec.add_development_dependency "yard", ">= 0"
14
17
  end
15
18
  Jeweler::GemcutterTasks.new
16
19
  rescue LoadError
@@ -21,7 +24,7 @@ end
21
24
  desc "spec"
22
25
  Spec::Rake::SpecTask.new do |t|
23
26
  t.libs << "spec"
24
- t.spec_files = FileList['spec/**/*_spec.rb']
27
+ t.spec_files = FileList['spec/*_spec.rb']
25
28
  end
26
29
 
27
30
 
@@ -29,7 +32,7 @@ begin
29
32
  require 'yard'
30
33
  YARD::Rake::YardocTask.new
31
34
  rescue LoadError
32
- task :yardoc do
35
+ task :yard do
33
36
  abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
34
37
  end
35
38
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.2
1
+ 0.6.3
data/lib/auto_excerpt.rb CHANGED
@@ -9,50 +9,60 @@ class String
9
9
  end
10
10
 
11
11
  # TODO allow for default options to be set.
12
- class AutoExcerpt < String
13
- VERSION = '0.6'
14
-
12
+ class AutoExcerpt < String
15
13
  DEFAULTS = {
16
14
  :characters => 0,
17
15
  :words => 0,
18
16
  :sentences => 0,
19
17
  :paragraphs => 0,
20
- :skip_characters => 0,
18
+ # :skip_characters => 0,
21
19
  :skip_words => 0,
22
20
  :skip_sentences => 0,
23
21
  :skip_paragraphs => 0,
24
22
  :ending => '...',
25
- :strip_html => false, #:allowed_tags => [],
23
+ :strip_html => false, :allowed_tags => [],
26
24
  :strip_breaks_tabs => false,
27
25
  :strip_paragraphs => false
28
- }.freeze
26
+ }
29
27
 
30
28
  # TODO add and allowwed tags option
31
- HTMLTAGS = /<(.|\n)+?>/
32
29
  PUNCTUATION_MARKS = /\!\s|\.\s|\?\s/
33
30
  NO_CLOSE = %w( br hr img input ) # tags that do not have opposite closing tags
34
-
31
+ OPENING_TAG = /<([a-z0-9]{1,})\b[^>]*>/im
32
+ CLOSING_TAG = /<\/([a-z0-9]{1,})>/im
33
+
35
34
  # @param [String] text The text to be excerpted
36
35
  # @param [Hash] settings The settings for creating the excerpt
37
- # @option settings [Integer] :characters (0)
38
- #
39
- #
36
+ # @option settings [Integer] :characters (0) The number of characters to limit the html by
37
+ # @option settings [Integer] :words (0) The number of words to limit the html by
38
+ # @option settings [Integer] :sentences (0) The number of sentences to limit the html by
39
+ # @option settings [Integer] :paragraphs (0) The number of paragraphs to limit the html by
40
+ # @option settings [Integer] :skip_characters (0) The number of characters to skip from the start of the html
41
+ # @option settings [Integer] :skip_words (0) The number of words to skip from the start of the html
42
+ # @option settings [Integer] :skip_sentences (0) The number of sentences to skip from the start of the html
43
+ # @option settings [Integer] :skip_paragraphs (0) The number of paragraphs to skip from the start of the html
44
+ # @option settings [String] :ending ('...') A string added to the end of the excerpt
45
+ # @option settings [Boolean] :strip_html (false) Strip all HTML from the text before creating the excerpt
46
+ # @option settings [Boolean] :strip_paragraphs (false) Strip all <p> tags from the HTML before creating the excerpt
40
47
  def initialize(text, settings = {})
41
- @settings = DEFAULTS.dup.merge(settings)
48
+ @settings = Marshal.load(Marshal.dump(DEFAULTS)).merge(settings)
42
49
 
43
50
  # make our copy
44
51
  @body = text.dup.strip
45
52
  @excerpt = ""
46
- @body.gsub!(HTMLTAGS, "") if @settings[:strip_html]
47
- @body.clean! if @settings[:strip_breaks_tabs]
53
+
54
+ if @settings[:strip_html]
55
+ (@settings[:allowed_tags] << "p") if @settings[:paragraphs] > 0 # don't stip P tags if that is the limiter
56
+ @body = strip_html(@body)
57
+ end
58
+ @body = @body.clean if @settings[:strip_breaks_tabs]
48
59
  # TODO replace this with better regex
49
60
  @body.replace(@body.gsub(/<(\/|)p>/,'')) if @settings[:strip_paragraphs]
50
- # @charcount = @body.gsub(HTMLTAGS, "").length
51
- @charcount = @body.length
52
- @wordcount = @body.gsub(HTMLTAGS, "").scan(/\w+/).size
61
+ @charcount = strip_html(@body).length
62
+ @wordcount = strip_html(@body).scan(/\w+/).size
53
63
  @sencount = @body.split(PUNCTUATION_MARKS).size
54
64
  @pghcount = @body.split("</p>").size
55
- @settings[:characters] = 150 if @settings.values_at(:characters, :words, :sentences, :paragraphs).all?{|val| val.zero? }
65
+ @settings[:characters] = 150 if @settings.values_at(:characters, :words, :sentences, :paragraphs).all?{|val| val.zero? || val.nil? }
56
66
 
57
67
  create_excerpt
58
68
  super(@excerpt)
@@ -60,35 +70,42 @@ class AutoExcerpt < String
60
70
 
61
71
 
62
72
  protected
73
+
63
74
  attr_reader :charcount, :wordcount, :sencount, :pghcount
64
75
  attr_accessor :settings, :body, :excerpt
65
76
 
66
77
  # close html tags
67
78
  # TODO make this work with new strip_html method. Improve regex
68
79
  def close_tags(text)
69
- tagstoclose = ""
70
- tags = []
71
- opentags = text.scan( /<(([A-Z]|[a-z]).*?)(( )|(>))/is ).transpose[0] || []
72
- opentags.reverse!
73
- closedtags = text.scan(/<\/(([A-Z]|[a-z]).*?)(( )|(>))/is).transpose[0] || []
80
+ # Don't bother closing tags if html is stripped since there are no tags.
81
+ if @settings[:strip_html] && @settings[:allowed_tags].empty?
82
+ tagstoclose = nil
83
+ else
84
+ tagstoclose = ""
85
+ tags = []
86
+ # /<(([A-Z]|[a-z]).*?)(( )|(>))/is
87
+ # /<\/(([A-Z]|[a-z]).*?)(( )|(>))/is
88
+ opentags = text.scan(OPENING_TAG).transpose[0] || []
89
+ opentags.reverse!
90
+ closedtags = text.scan(CLOSING_TAG).transpose[0] || []
74
91
 
75
- opentags.each do |ot|
76
- if closedtags.include?(ot)
77
- closedtags.delete_at(closedtags.index(ot))
78
- else
79
- tags << ot
92
+ opentags.each do |ot|
93
+ if closedtags.include?(ot)
94
+ closedtags.delete_at(closedtags.index(ot))
95
+ else
96
+ tags << ot
97
+ end
80
98
  end
81
- end
82
99
 
83
- tags.each do |tag|
84
- tagstoclose << "</#{tag.strip.downcase}>" unless NO_CLOSE.include?(tag)
100
+ tags.each do |tag|
101
+ tagstoclose << "</#{tag.strip.downcase}>" unless NO_CLOSE.include?(tag)
102
+ end
85
103
  end
86
104
 
87
- text << (@settings[:ending] || "") + tagstoclose
88
- @excerpt = text
105
+ @excerpt = [text, @settings[:ending], tagstoclose].compact.join
89
106
  end
90
107
 
91
- def create_excerpt #:nodoc:
108
+ def create_excerpt
92
109
  return characters unless @settings[:characters].zero?
93
110
  return words unless @settings[:words].zero?
94
111
  return sentences unless @settings[:sentences].zero?
@@ -99,13 +116,28 @@ class AutoExcerpt < String
99
116
  @settings[:ending] = nil
100
117
  close_tags(@body)
101
118
  end
102
-
119
+
103
120
  # limit by characters
121
+ # @todo make this work with skip characters
104
122
  def characters
105
123
  return non_excerpted_text if @charcount < @settings[:characters]
106
- text = @body[@settings[:skip_characters]...@settings[:characters]].split(" ")
107
- text.pop if text.length > 1
108
- text = text.join(" ")
124
+ text = ""
125
+ html_count = char_count = 0
126
+ start_end_tags = /#{Regexp.union(/(<[a-z0-9]{1,}\b[^>]*>)/,/(<\/[a-z0-9]{1,}>)/)}/io
127
+ @body.split(start_end_tags).each do |piece|
128
+ if piece =~ start_end_tags
129
+ html_count += piece.length
130
+ else
131
+ chars_left = @settings[:characters] - char_count
132
+ # TODO don't clip the middle of a word
133
+ # unless piece[0...(chars_left+1)] =~ /(\s|\W)$/
134
+ # chars_left += 1 until piece[0...chars_left] =~ /(\s|\W)$/
135
+ # end
136
+ char_count += piece[0...chars_left].length
137
+ end
138
+ break if (char_count >= @settings[:characters])
139
+ end
140
+ text = @body[0...(html_count+char_count)]
109
141
  close_tags(text)
110
142
  end
111
143
 
@@ -119,6 +151,7 @@ class AutoExcerpt < String
119
151
  # limit by sentences
120
152
  def sentences
121
153
  return non_excerpted_text if @sencount < @settings[:sentences]
154
+ # TODO don't change punctuation
122
155
  text = @body.split(PUNCTUATION_MARKS).slice(@settings[:skip_sentences], @settings[:sentences]).join(". ")
123
156
  close_tags(text)
124
157
  end
@@ -128,24 +161,24 @@ class AutoExcerpt < String
128
161
  return non_excerpted_text if @pghcount < @settings[:paragraphs]
129
162
  text = @body.split("</p>").slice(@settings[:skip_paragraphs], @settings[:paragraphs])
130
163
  @settings[:ending] = nil
131
- # text.last.replace(text.last.rstrip.concat(@settings.delete(:ending)))
132
164
  text = text.join("</p>")
133
165
  close_tags(text)
134
166
  end
135
167
 
136
168
  # Removes HTML tags from a string. Allows you to specify some tags to be kept.
137
169
  # @see http://codesnippets.joyent.com/posts/show/1354#comment-293
138
- # def strip_html(html)
139
- # reg = if @settings[:allowed_tags].any?
140
- # Regexp.new(
141
- # %(<(?!(\\s|\\/)*(#{
142
- # @settings[:allowed_tags].map {|tag| Regexp.escape( tag )}.join( "|" )
143
- # })( |>|\\/|'|"|<|\\s*\\z))[^>]*(>+|\\s*\\z)),
144
- # Regexp::IGNORECASE | Regexp::MULTILINE, 'u'
145
- # )
146
- # else
147
- # /<[^>]*(>+|\s*\z)/m
148
- # end
149
- # html.gsub(reg,'')
150
- # end
170
+ def strip_html(html)
171
+ allowed = @settings[:allowed_tags]
172
+ reg = if allowed.any?
173
+ Regexp.new(
174
+ %(<(?!(\\s|\\/)*(#{
175
+ allowed.map {|tag| Regexp.escape( tag )}.join( "|" )
176
+ })( |>|\\/|'|"|<|\\s*\\z))[^>]*(>+|\\s*\\z)),
177
+ Regexp::IGNORECASE | Regexp::MULTILINE, 'u'
178
+ )
179
+ else
180
+ /<[^>]*(>+|\s*\z)/m
181
+ end
182
+ @stripped_html ||= html.gsub(reg,'')
183
+ end
151
184
  end
@@ -1,49 +1,60 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
2
- # require File.join(File.dirname(__FILE__), "shared_strip_tags")
2
+ require File.join(File.dirname(__FILE__), *%w[shared strip_html_spec])
3
3
 
4
4
  # I definitely need more tests
5
5
  describe AutoExcerpt do
6
- include AutoExcerptHelpers
7
6
 
8
- it "should limit characters" do
9
- text = html_excerpt({:characters => 5})
7
+ it "should limit characters" do
8
+ text = html_excerpt({:characters => 5, :ending => nil})
10
9
  stripped_text(text).length.should eql(5)
11
-
12
- text = heavy_excerpt({:characters => 5})
13
- stripped_text(text).length.should eql(5)
14
- end
15
-
16
- it "should default to 150 characters" do
17
- text = html_excerpt
18
- text.length.should be_close(150, 4)
19
- end
20
10
 
21
- it "should limit words" do
11
+ text = heavy_excerpt({:characters => 5, :ending => nil})
12
+ stripped_text(text).length.should eql(5)
13
+ end
14
+
15
+ it "should default to 150 characters" do
16
+ text = html_excerpt(:ending => nil)
17
+ stripped_text(text).length.should eql(150)
18
+ end
19
+
20
+ it "does not include html tags in character count" do
21
+ AutoExcerpt.new("<h1>Hello World!</h1>", {:characters => 5, :ending => nil}).should == "<h1>Hello</h1>"
22
+ end
23
+
24
+ it "should not cutoff in the middle of a word" do
25
+ pending("this does not work yet") do
26
+ AutoExcerpt.new("<h1>Hello World!</h1>", {:characters => 4, :ending => nil}).should == "<h1>Hello</h1>"
27
+ end
28
+ end
29
+
30
+ it "should limit words" do
22
31
  text = html_excerpt({:words => 5})
23
32
  stripped_text(text).split(" ").length.should eql(5)
24
-
33
+
25
34
  text = heavy_excerpt({:words => 5})
26
35
  stripped_text(text).split(" ").length.should eql(5)
27
-
28
- end
29
36
 
30
- it "should limit sentences" do
37
+ end
38
+
39
+ it "should limit sentences" do
31
40
  text = html_excerpt({:sentences => 3})
32
- stripped_text(text).split(AutoExcerpt::PUNCTUATION_MARKS).length.should eql(3)
33
-
34
- text = heavy_excerpt({:sentences => 3})
35
- stripped_text(text).split(AutoExcerpt::PUNCTUATION_MARKS).length.should eql(3)
36
-
37
- end
41
+ text.should == %{<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur...</p>}
38
42
 
39
- it "should limit paragraphs" do
43
+ # text = heavy_excerpt({:sentences => 3})
44
+ # text.should == %{<p>Alright&hellip;ok&hellip;that title is a bold faced lie. I don&rsquo;t give a damn about <acronym title="Cascading Style Sheets">CSS</acronym> validation! Being a designer for a living, you have to know when to ditch some of these &lsquo;web 2.0&rsquo; type fads...</p>}
45
+ end
46
+
47
+ it "should limit paragraphs" do
40
48
  text = html_excerpt({:paragraphs => 1})
41
49
  stripped_text(text).split("</p>").length.should eql(1)
50
+ end
51
+
52
+ it "should not include the :ending when limited by paragraph" do
53
+ text = html_excerpt({:paragraphs => 1})
42
54
  stripped_text(text).split("</p>").last[-3..-1].should_not == '...'
43
- end
44
-
45
-
46
- it "should close the effin B tag" do
55
+ end
56
+
57
+ it "should close the effin B tag" do
47
58
  t = %{
48
59
  <strong>
49
60
  left a greeting on Kroogi page of <a href="http://localhost:3000/user/sasha/" frwrd_type="user" title="sasha">sasha</a>
@@ -55,7 +66,15 @@ describe AutoExcerpt do
55
66
  }
56
67
  text = AutoExcerpt.new(t,{:characters => 270})
57
68
  text.match(/(<(\/|)b>)/).captures.length.should eql(2)
58
- end
59
-
60
- # it_should_behave_like "HTML stripper"
69
+ end
70
+
71
+ end
72
+
73
+ describe AutoExcerpt, "when stripping HTML" do
74
+
75
+ it_should_behave_like "an HTML stripper"
76
+
77
+ it "should not strip P tags if :paragraphs option is set" do
78
+ AutoExcerpt.new("<p>this is a paragraph.</p><p>this is also a paragraph.</p>",{:paragraphs => 1, :strip_html => true}).should eql("<p>this is a paragraph.</p>")
79
+ end
61
80
  end
@@ -1,11 +1,13 @@
1
- describe "HTML stripper", :shared => true do
1
+ describe "an HTML stripper", :shared => true do
2
+
2
3
  before(:all) do
3
4
  @html = "foo < BAR> <><a href=\"www.beer.com\">xyzzy</a>>><br /><p><br/><p><br///><p></><br ///><p></br><p></ br> <cheeky"
5
+
4
6
  end
5
-
6
7
  it "should strip html tags" do
7
8
  AutoExcerpt.new(@html, {:strip_html => true}).should == "foo xyzzy "
8
9
  end
10
+
9
11
  # cheeky keeper
10
12
  it "should allow given tags" do
11
13
  AutoExcerpt.new(@html, {:strip_html => true, :allowed_tags => %w(bar br ) }).should == "foo < BAR> xyzzy<br /><br/><br///><br ///></br></ br> "
@@ -14,8 +16,8 @@ describe "HTML stripper", :shared => true do
14
16
  it "should treat unclosed tags at the end of the document as tags to be safe" do
15
17
  AutoExcerpt.new(@html, {:strip_html => true, :allowed_tags => %w(cheeky monkey) }).should == "foo xyzzy <cheeky"
16
18
  AutoExcerpt.new("pass< cheeky", {:strip_html => true, :allowed_tags => %w(cheeky) }).should == "pass< cheeky"
17
- AutoExcerpt.new("pass< cheeky ", {:strip_html => true, :allowed_tags => %w(bar br ) }).should == "pass< cheeky "
18
- AutoExcerpt.new("pass< cheeky ", {:strip_html => true, :allowed_tags => %w(cheeky) }).should == "pass< cheeky "
19
+ AutoExcerpt.new("pass< cheeky ", {:strip_html => true, :allowed_tags => %w(cheeky) }).should == "pass< cheeky"
20
+ AutoExcerpt.new("pass< cheeky ", {:strip_html => true, :allowed_tags => %w(cheeky) }).should == "pass< cheeky"
19
21
  end
20
22
 
21
23
  it "should treat quotes, less thans and shashes as tag word terminators to be conservative" do
@@ -30,6 +32,7 @@ describe "HTML stripper", :shared => true do
30
32
  it "should know the difference between a tag called a and one called alpha" do
31
33
  difference_test = "passed<alpha> the test"
32
34
  AutoExcerpt.new(difference_test, {:strip_html => true, :allowed_tags => %w(a) }).should == "passed the test"
33
- AutoExcerpt.new(difference_test, {:strip_html => true, :allowed_tags => %w(alpha) }).should == difference_test
35
+ AutoExcerpt.new(difference_test, {:strip_html => true, :allowed_tags => %w(alpha) }).should == "passed<alpha> the test</alpha>"
34
36
  end
37
+
35
38
  end
data/spec/spec.opts CHANGED
@@ -1,3 +1,2 @@
1
1
  --colour
2
- --loadby random
3
2
  --backtrace
data/spec/spec_helper.rb CHANGED
@@ -1,12 +1,22 @@
1
1
  require "rubygems"
2
2
  require "spec"
3
- require File.join(File.dirname(__FILE__), *%w[.. lib auto_excerpt])
3
+ require "pp"
4
+ require "webrick/htmlutils"
4
5
 
5
- Spec::Runner.configure do |config|
6
-
6
+ Object.class_eval do
7
+ alias_method :old_pp, :pp
8
+
9
+ def pp(str)
10
+ str = WEBrick::HTMLUtils.escape(str) if str.is_a?(String)
11
+ old_pp(str)
12
+ end
7
13
  end
8
14
 
15
+ require File.join(File.dirname(__FILE__), *%w[.. lib auto_excerpt])
16
+
9
17
  module AutoExcerptHelpers
18
+
19
+
10
20
  def html_excerpt(opts = {})
11
21
  AutoExcerpt.new(HTML_BLOCK, opts)
12
22
  end
@@ -20,8 +30,10 @@ module AutoExcerptHelpers
20
30
  end
21
31
 
22
32
  def stripped_text(t)
23
- t.gsub(AutoExcerpt::HTMLTAGS, "")
33
+ t.gsub(/<[^>]*(>+|\s*\z)/m, "")
24
34
  end
35
+
36
+ CRAP_HTML = ""
25
37
 
26
38
  NORMAL_TEXT = %{Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
27
39
 
@@ -43,4 +55,8 @@ module AutoExcerptHelpers
43
55
 
44
56
  <p>Use the validation tool on your basic style sheets if your having a hard time figuring out what may be causing an issue. At this stage in development they are helpful tools for just that. By no means should you be running them as the final judge on your styles, or checking everyone else&rsquo;s sites to &lsquo;see if it validates&rsquo; so you can feel all professional, or posting the &lsquo;valid CSS&rsquo; emblem at the bottom of your web pages like it&rsquo;s a flag on the moon.</p>
45
57
  }
46
- end
58
+ end
59
+
60
+ Spec::Runner.configure do |config|
61
+ config.include AutoExcerptHelpers
62
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auto_excerpt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kabari Hendrick
@@ -9,10 +9,29 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-20 00:00:00 -06:00
12
+ date: 2010-01-26 00:00:00 -06:00
13
13
  default_executable:
14
- dependencies: []
15
-
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rspec
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.2.9
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: yard
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
16
35
  description: Create excerpts from html formatted text. HTML tags are automatically closed.
17
36
  email: kabari@gmail.com
18
37
  executables: []
@@ -32,7 +51,7 @@ files:
32
51
  - browser_test/browser_test.rb
33
52
  - lib/auto_excerpt.rb
34
53
  - spec/auto_excerpt_spec.rb
35
- - spec/shared_strip_tags.rb
54
+ - spec/shared/strip_html_spec.rb
36
55
  - spec/spec.opts
37
56
  - spec/spec_helper.rb
38
57
  has_rdoc: true
@@ -65,5 +84,5 @@ specification_version: 3
65
84
  summary: Create excerpts from html formatted text.
66
85
  test_files:
67
86
  - spec/auto_excerpt_spec.rb
68
- - spec/shared_strip_tags.rb
87
+ - spec/shared/strip_html_spec.rb
69
88
  - spec/spec_helper.rb