auto_excerpt 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ *.php
2
+ *.zip
3
+ extra
data/CHANGELOG ADDED
File without changes
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Kabari Hendrick
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.textile ADDED
@@ -0,0 +1,57 @@
1
+ h1. AutoExcerpt
2
+
3
+ Creates Automatic excerpts of html formatted text.
4
+
5
+ pre. AutoExcerpt.new("<span>This is <strong>some</strong> fancy html formatted text homie</span>", {:words => 5})
6
+ # => "<span>This is <strong>some</strong> fancy html...</span>"
7
+
8
+ h3. Features
9
+
10
+ * 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.
12
+ * HTML can be stripped
13
+ * HTML tags are automatically closed.
14
+
15
+ h3. Options
16
+
17
+ *:characters*
18
+ The number of characters to display from the text.
19
+ Default: 150 (does not need to be reset to 0 if you choose another option)
20
+
21
+ *:words*, *:sentences*, *:paragraphs*
22
+ The number of [which] to display from the text.
23
+
24
+ *:ending*
25
+ 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
+ Default: "..."
27
+
28
+ pre. AutoExcerpt.new("This is cool stuff man!", :ending => ". Srsly!", :words => 3)
29
+ # => "This is cool. Srsly!"
30
+
31
+ *:strip_html*
32
+ Strips HTML tags from the excerpt that is displayed.
33
+ Default: false
34
+
35
+ *:strip_paragraphs*
36
+ Strip all paragraph tags from the html.
37
+ Default: false
38
+
39
+ *:skip_characters*, *:skip_words*, *:skip_sentences*, *:skip_paragraphs*
40
+ The number of [which] to skip at the beginning of the html when returned.
41
+ Default 0
42
+
43
+ h2. Help out on Github!
44
+
45
+ * Fork the project.
46
+ * Make your feature addition or bug fix.
47
+ * Commit, do not mess with Rakefile, Version, or LICENSE.
48
+ * Send me a pull request :)
49
+ * Thanks for helping out!
50
+
51
+ h2. Credits
52
+
53
+ This is based on the rss_auto_excerpt plugin for Textpattern by the great "Rob Sable":http://www.wilshireone.com.
54
+
55
+ h3. Copyright
56
+
57
+ Copyright (c) 2010 Kabari Hendrick. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,35 @@
1
+ require "spec/rake/spectask"
2
+
3
+ task :default => :spec
4
+
5
+ begin
6
+ require 'jeweler'
7
+ Jeweler::Tasks.new do |gemspec|
8
+ gemspec.name = "auto_excerpt"
9
+ gemspec.summary = "Create excerpts from html formatted text."
10
+ gemspec.description = "Create excerpts from html formatted text. HTML tags are automatically closed."
11
+ gemspec.email = "kabari@gmail.com"
12
+ gemspec.homepage = "http://github.com/kabari/auto_excerpt"
13
+ gemspec.authors = ["Kabari Hendrick"]
14
+ end
15
+ Jeweler::GemcutterTasks.new
16
+ rescue LoadError
17
+ puts "Jeweler not available. Install it with: sudo gem install jeweler"
18
+ end
19
+
20
+
21
+ desc "spec"
22
+ Spec::Rake::SpecTask.new do |t|
23
+ t.libs << "spec"
24
+ t.spec_files = FileList['spec/**/*_spec.rb']
25
+ end
26
+
27
+
28
+ begin
29
+ require 'yard'
30
+ YARD::Rake::YardocTask.new
31
+ rescue LoadError
32
+ task :yardoc do
33
+ abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
34
+ end
35
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.6.2
@@ -0,0 +1,55 @@
1
+ #
2
+ # This is a small Sinatra app to test that the html created by the excerpt
3
+ # is valid. It was the easiest way to test if all the tags
4
+ # were really closed or not.
5
+ #
6
+ require "rubygems"
7
+ require "sinatra"
8
+ require File.expand_path(File.join(File.dirname(__FILE__), *%w[.. lib auto_excerpt]))
9
+
10
+ set_option(:port,8030)
11
+
12
+ HTML_BLOCK = %Q{
13
+ <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. When you&rsquo;re building a new site it&rsquo;s great to use the validation tool <a href="http://jigsaw.w3.org/css-validator/">found here</a> to review your style sheets and get rid of any errors, especially ones that may be giving you a couple layout problems. After that, the validation service doesn&rsquo;t mean about how good your <span class="caps">CSS</span> is, or how special you are, or how valid your stuff is. It is <strong>not</strong> at all the same as validating your <acronym title="hypertext markup language">HTML</acronym> or <acronym title="extensible hypertext markup language">XHTML</acronym>; style sheets don&rsquo;t have DOCTYPE&rsquo;s. </p>
14
+
15
+ <p>So all those hacks which you will definitely need t use, and those special CSS3 properties you want to start using now will give you errors. These errors don&rsquo;t mean your <span class="caps">CSS</span> is flawed, or that it won&rsquo;t work, they are just arbitrary errors thrown out because there isn&rsquo;t a solid example for the validation service to run against other than the CSS2 property list. </p>
16
+
17
+ <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>
18
+ }
19
+
20
+ get '/' do
21
+ erb <<-HTML
22
+ <h3>180 characters</h3>
23
+ <%= AutoExcerpt.new(HTML_BLOCK, {:characters => 180}) %>
24
+ <h3>80 Words</h3>
25
+ <%= AutoExcerpt.new(HTML_BLOCK, {:words => 80}) %>
26
+ <h3>3 Sentences</h3>
27
+ <%= AutoExcerpt.new(HTML_BLOCK, {:sentences => 3}) %>
28
+ <h3>2 Paragraphs</h3>
29
+ <%= AutoExcerpt.new(HTML_BLOCK, {:paragraphs => 2}) %>
30
+ <h3>No Paragraphs</h3>
31
+ <%= AutoExcerpt.new(HTML_BLOCK, {:characters => 5000, :strip_paras => true}) %>
32
+ HTML
33
+ end
34
+
35
+ use_in_file_templates!
36
+
37
+ __END__
38
+
39
+ ## layout
40
+
41
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
42
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
43
+
44
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
45
+ <head>
46
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
47
+
48
+ <title>Testing AutoExcerpt Class</title>
49
+
50
+ </head>
51
+
52
+ <body>
53
+ <%= yield %>
54
+ </body>
55
+ </html>
@@ -0,0 +1,151 @@
1
+ class String
2
+ def clean # remove all double-spaces, tabs, and new lines from string
3
+ strip.gsub(/\s{2,}|[\n\r\t]/, ' ')
4
+ end
5
+
6
+ def clean! # ditto, but replaces the original string
7
+ replace(clean)
8
+ end
9
+ end
10
+
11
+ # TODO allow for default options to be set.
12
+ class AutoExcerpt < String
13
+ VERSION = '0.6'
14
+
15
+ DEFAULTS = {
16
+ :characters => 0,
17
+ :words => 0,
18
+ :sentences => 0,
19
+ :paragraphs => 0,
20
+ :skip_characters => 0,
21
+ :skip_words => 0,
22
+ :skip_sentences => 0,
23
+ :skip_paragraphs => 0,
24
+ :ending => '...',
25
+ :strip_html => false, #:allowed_tags => [],
26
+ :strip_breaks_tabs => false,
27
+ :strip_paragraphs => false
28
+ }.freeze
29
+
30
+ # TODO add and allowwed tags option
31
+ HTMLTAGS = /<(.|\n)+?>/
32
+ PUNCTUATION_MARKS = /\!\s|\.\s|\?\s/
33
+ NO_CLOSE = %w( br hr img input ) # tags that do not have opposite closing tags
34
+
35
+ # @param [String] text The text to be excerpted
36
+ # @param [Hash] settings The settings for creating the excerpt
37
+ # @option settings [Integer] :characters (0)
38
+ #
39
+ #
40
+ def initialize(text, settings = {})
41
+ @settings = DEFAULTS.dup.merge(settings)
42
+
43
+ # make our copy
44
+ @body = text.dup.strip
45
+ @excerpt = ""
46
+ @body.gsub!(HTMLTAGS, "") if @settings[:strip_html]
47
+ @body.clean! if @settings[:strip_breaks_tabs]
48
+ # TODO replace this with better regex
49
+ @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
53
+ @sencount = @body.split(PUNCTUATION_MARKS).size
54
+ @pghcount = @body.split("</p>").size
55
+ @settings[:characters] = 150 if @settings.values_at(:characters, :words, :sentences, :paragraphs).all?{|val| val.zero? }
56
+
57
+ create_excerpt
58
+ super(@excerpt)
59
+ end
60
+
61
+
62
+ protected
63
+ attr_reader :charcount, :wordcount, :sencount, :pghcount
64
+ attr_accessor :settings, :body, :excerpt
65
+
66
+ # close html tags
67
+ # TODO make this work with new strip_html method. Improve regex
68
+ 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] || []
74
+
75
+ opentags.each do |ot|
76
+ if closedtags.include?(ot)
77
+ closedtags.delete_at(closedtags.index(ot))
78
+ else
79
+ tags << ot
80
+ end
81
+ end
82
+
83
+ tags.each do |tag|
84
+ tagstoclose << "</#{tag.strip.downcase}>" unless NO_CLOSE.include?(tag)
85
+ end
86
+
87
+ text << (@settings[:ending] || "") + tagstoclose
88
+ @excerpt = text
89
+ end
90
+
91
+ def create_excerpt #:nodoc:
92
+ return characters unless @settings[:characters].zero?
93
+ return words unless @settings[:words].zero?
94
+ return sentences unless @settings[:sentences].zero?
95
+ return paragraphs unless @settings[:paragraphs].zero?
96
+ end
97
+
98
+ def non_excerpted_text
99
+ @settings[:ending] = nil
100
+ close_tags(@body)
101
+ end
102
+
103
+ # limit by characters
104
+ def characters
105
+ 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(" ")
109
+ close_tags(text)
110
+ end
111
+
112
+ # limit by words
113
+ def words
114
+ return non_excerpted_text if @wordcount < @settings[:words]
115
+ text = @body.split(" ").slice(@settings[:skip_words], @settings[:words]).join(" ")
116
+ close_tags(text)
117
+ end
118
+
119
+ # limit by sentences
120
+ def sentences
121
+ return non_excerpted_text if @sencount < @settings[:sentences]
122
+ text = @body.split(PUNCTUATION_MARKS).slice(@settings[:skip_sentences], @settings[:sentences]).join(". ")
123
+ close_tags(text)
124
+ end
125
+
126
+ # limit by paragraphs
127
+ def paragraphs
128
+ return non_excerpted_text if @pghcount < @settings[:paragraphs]
129
+ text = @body.split("</p>").slice(@settings[:skip_paragraphs], @settings[:paragraphs])
130
+ @settings[:ending] = nil
131
+ # text.last.replace(text.last.rstrip.concat(@settings.delete(:ending)))
132
+ text = text.join("</p>")
133
+ close_tags(text)
134
+ end
135
+
136
+ # Removes HTML tags from a string. Allows you to specify some tags to be kept.
137
+ # @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
151
+ end
@@ -0,0 +1,61 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
2
+ # require File.join(File.dirname(__FILE__), "shared_strip_tags")
3
+
4
+ # I definitely need more tests
5
+ describe AutoExcerpt do
6
+ include AutoExcerptHelpers
7
+
8
+ it "should limit characters" do
9
+ text = html_excerpt({:characters => 5})
10
+ 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
+
21
+ it "should limit words" do
22
+ text = html_excerpt({:words => 5})
23
+ stripped_text(text).split(" ").length.should eql(5)
24
+
25
+ text = heavy_excerpt({:words => 5})
26
+ stripped_text(text).split(" ").length.should eql(5)
27
+
28
+ end
29
+
30
+ it "should limit sentences" do
31
+ 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
38
+
39
+ it "should limit paragraphs" do
40
+ text = html_excerpt({:paragraphs => 1})
41
+ stripped_text(text).split("</p>").length.should eql(1)
42
+ stripped_text(text).split("</p>").last[-3..-1].should_not == '...'
43
+ end
44
+
45
+
46
+ it "should close the effin B tag" do
47
+ t = %{
48
+ <strong>
49
+ left a greeting on Kroogi page of <a href="http://localhost:3000/user/sasha/" frwrd_type="user" title="sasha">sasha</a>
50
+ </strong>
51
+ crap
52
+ <br />
53
+ <br />crap<b>dddd
54
+ <a href="/activity/read_and_frwd/1251?type=comment">(Open)</a>
55
+ }
56
+ text = AutoExcerpt.new(t,{:characters => 270})
57
+ text.match(/(<(\/|)b>)/).captures.length.should eql(2)
58
+ end
59
+
60
+ # it_should_behave_like "HTML stripper"
61
+ end
@@ -0,0 +1,35 @@
1
+ describe "HTML stripper", :shared => true do
2
+ before(:all) do
3
+ @html = "foo < BAR> <><a href=\"www.beer.com\">xyzzy</a>>><br /><p><br/><p><br///><p></><br ///><p></br><p></ br> <cheeky"
4
+ end
5
+
6
+ it "should strip html tags" do
7
+ AutoExcerpt.new(@html, {:strip_html => true}).should == "foo xyzzy "
8
+ end
9
+ # cheeky keeper
10
+ it "should allow given tags" do
11
+ AutoExcerpt.new(@html, {:strip_html => true, :allowed_tags => %w(bar br ) }).should == "foo < BAR> xyzzy<br /><br/><br///><br ///></br></ br> "
12
+ end
13
+
14
+ it "should treat unclosed tags at the end of the document as tags to be safe" do
15
+ AutoExcerpt.new(@html, {:strip_html => true, :allowed_tags => %w(cheeky monkey) }).should == "foo xyzzy <cheeky"
16
+ 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
+ end
20
+
21
+ it "should treat quotes, less thans and shashes as tag word terminators to be conservative" do
22
+ q_test_html = "pass<img'foo' >"
23
+ dbq_test_html = "pass<img\"foo\""
24
+ lt_test_html = "pass<img<foo\" "
25
+ AutoExcerpt.new(q_test_html, {:strip_html => true, :allowed_tags => %w(img) }).should == q_test_html
26
+ AutoExcerpt.new(dbq_test_html, {:strip_html => true, :allowed_tags => %w(img) }).should == dbq_test_html
27
+ AutoExcerpt.new(lt_test_html, {:strip_html => true, :allowed_tags => %w(img) }).should == "pass<img" # treats foo as new tag
28
+ end
29
+
30
+ it "should know the difference between a tag called a and one called alpha" do
31
+ difference_test = "passed<alpha> the test"
32
+ 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
34
+ end
35
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1,3 @@
1
+ --colour
2
+ --loadby random
3
+ --backtrace
@@ -0,0 +1,46 @@
1
+ require "rubygems"
2
+ require "spec"
3
+ require File.join(File.dirname(__FILE__), *%w[.. lib auto_excerpt])
4
+
5
+ Spec::Runner.configure do |config|
6
+
7
+ end
8
+
9
+ module AutoExcerptHelpers
10
+ def html_excerpt(opts = {})
11
+ AutoExcerpt.new(HTML_BLOCK, opts)
12
+ end
13
+
14
+ def normal_excerpt(opts = {})
15
+ AutoExcerpt.new(NORMAL_TEXT, opts)
16
+ end
17
+
18
+ def heavy_excerpt(opts = {})
19
+ AutoExcerpt.new(HEAVY_HTML_BLOCK, opts)
20
+ end
21
+
22
+ def stripped_text(t)
23
+ t.gsub(AutoExcerpt::HTMLTAGS, "")
24
+ end
25
+
26
+ 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
+
28
+ 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.
29
+ }
30
+
31
+ HTML_BLOCK = <<-HTML
32
+ <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. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor <strong>incididunt</strong> 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.
33
+ </p>
34
+
35
+ <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. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
36
+ </p>
37
+ HTML
38
+
39
+ HEAVY_HTML_BLOCK = %Q{
40
+ <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. When you&rsquo;re building a new site it&rsquo;s great to use the validation tool <a href="http://jigsaw.w3.org/css-validator/">found here</a> to review your style sheets and get rid of any errors, especially ones that may be giving you a couple layout problems. After that, the validation service doesn&rsquo;t mean about how good your <span class="caps">CSS</span> is, or how special you are, or how valid your stuff is. It is <strong>not</strong> at all the same as validating your <acronym title="hypertext markup language">HTML</acronym> or <acronym title="extensible hypertext markup language">XHTML</acronym>; style sheets don&rsquo;t have DOCTYPE&rsquo;s. </p>
41
+
42
+ <p>So all those hacks which you will definitely need t use, and those special CSS3 properties you want to start using now will give you errors. These errors don&rsquo;t mean your <span class="caps">CSS</span> is flawed, or that it won&rsquo;t work, they are just arbitrary errors thrown out because there isn&rsquo;t a solid example for the validation service to run against other than the CSS2 property list. </p>
43
+
44
+ <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
+ }
46
+ end
metadata ADDED
@@ -0,0 +1,69 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: auto_excerpt
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.6.2
5
+ platform: ruby
6
+ authors:
7
+ - Kabari Hendrick
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-01-20 00:00:00 -06:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Create excerpts from html formatted text. HTML tags are automatically closed.
17
+ email: kabari@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - LICENSE
24
+ - README.textile
25
+ files:
26
+ - .gitignore
27
+ - CHANGELOG
28
+ - LICENSE
29
+ - README.textile
30
+ - Rakefile
31
+ - VERSION
32
+ - browser_test/browser_test.rb
33
+ - lib/auto_excerpt.rb
34
+ - spec/auto_excerpt_spec.rb
35
+ - spec/shared_strip_tags.rb
36
+ - spec/spec.opts
37
+ - spec/spec_helper.rb
38
+ has_rdoc: true
39
+ homepage: http://github.com/kabari/auto_excerpt
40
+ licenses: []
41
+
42
+ post_install_message:
43
+ rdoc_options:
44
+ - --charset=UTF-8
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: "0"
52
+ version:
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: "0"
58
+ version:
59
+ requirements: []
60
+
61
+ rubyforge_project:
62
+ rubygems_version: 1.3.5
63
+ signing_key:
64
+ specification_version: 3
65
+ summary: Create excerpts from html formatted text.
66
+ test_files:
67
+ - spec/auto_excerpt_spec.rb
68
+ - spec/shared_strip_tags.rb
69
+ - spec/spec_helper.rb