[Logilogi-svn] SF.net SVN: logilogi: [322] projects/ogog/trunk
Status: Beta
Brought to you by:
wybow
|
From: <wy...@us...> - 2007-05-25 16:41:30
|
Revision: 322
http://logilogi.svn.sourceforge.net/logilogi/?rev=322&view=rev
Author: wybow
Date: 2007-05-25 09:41:16 -0700 (Fri, 25 May 2007)
Log Message:
-----------
Stripping some bottom-links now...
Modified Paths:
--------------
projects/ogog/trunk/app/models/post.rb
projects/ogog/trunk/db/schema.rb
Modified: projects/ogog/trunk/app/models/post.rb
===================================================================
--- projects/ogog/trunk/app/models/post.rb 2007-05-25 15:57:30 UTC (rev 321)
+++ projects/ogog/trunk/app/models/post.rb 2007-05-25 16:41:16 UTC (rev 322)
@@ -45,14 +45,16 @@
# returns the web-url it was saved to
a_i.web_dir
rescue
+ i_p.widths <<
+ i_p.heights << a_i.height
"/images/image_error.jpg"
end
end
- self.body = i_p.add(@@tidy.clean(imageless_body))
- self.snippet = i_p.add(@@tidy.clean(Post.strip_bad_html(imageless_body[0..290])))
+ self.body = i_p.add(@@tidy.clean(Post.strip_crap(imageless_body)))
+ self.snippet = i_p.add(@@tidy.clean(Post.strip_snippet_html(imageless_body[0..290])))
cut_size = 250
while self.snippet.size > 300
- self.snippet = i_p.add(@@tidy.clean(Post.strip_bad_html(imageless_body[0..cut_size])))
+ self.snippet = i_p.add(@@tidy.clean(Post.strip_snippet_html(imageless_body[0..cut_size])))
cut_size -= 40
if cut_size < 0
self.snippet = ''
@@ -60,11 +62,11 @@
end
end
else
- self.body = @@tidy.clean(imageless_body)
- self.snippet = @@tidy.clean(Post.strip_bad_html(imageless_body[0..290]))
+ self.body = @@tidy.clean(Post.strip_crap(imageless_body))
+ self.snippet = @@tidy.clean(Post.strip_snippet_html(imageless_body[0..290]))
cut_size = 270
while self.snippet.size > 300
- self.snippet = @@tidy.clean(Post.strip_bad_html(imageless_body[0..cut_size]))
+ self.snippet = @@tidy.clean(Post.strip_snippet_html(imageless_body[0..cut_size]))
cut_size -= 20
if cut_size < 0
self.snippet = ''
@@ -84,10 +86,20 @@
# Removes all unwanted tags from the snippet.
#
- def self.strip_bad_html(text)
- text.gsub(/\<((\/)\s*?)?(p|table|td|tr).*?\>/,'')
+ def self.strip_snippet_html(text)
+ text.gsub!(/\<((\/)\s*?)?(p|table|td|tr|a href='http:\/\/feeds.feedburner.com).*?\>/,'')
+ Post.strip_crap(text)
end
+ # Removes feedburner image links
+ #
+ def self.strip_crap(text)
+ text.gsub!(/\<a\ href=(\'|\")http:\/\/feeds\.feedburner\.com.*?\<\/a\>/,'')
+ text.gsub!(/\<a\ href=(\'|\")http:\/\/(www)?technorati\.com\/tag\/.*?\<\/a\>/,'')
+ text.gsub!(/(style|width|height)=(\"|\').*?\>/,'')
+ text.strip
+ end
+
# Gets the tags from parsed URI.
#
def self.get_tags(url)
Modified: projects/ogog/trunk/db/schema.rb
===================================================================
--- projects/ogog/trunk/db/schema.rb 2007-05-25 15:57:30 UTC (rev 321)
+++ projects/ogog/trunk/db/schema.rb 2007-05-25 16:41:16 UTC (rev 322)
@@ -6,11 +6,11 @@
create_table "feeds", :force => true do |t|
t.column "user_id", :integer
- t.column "title", :string
- t.column "url", :string, :default => "", :null => false
+ t.column "title", :string, :limit => 300
+ t.column "url", :string, :default => "", :null => false
t.column "tags_string", :string
t.column "site_url", :string
- t.column "status", :integer, :default => 0, :null => false
+ t.column "status", :integer, :default => 0, :null => false
t.column "harvested_publication_time", :datetime
end
@@ -24,12 +24,12 @@
end
create_table "posts", :force => true do |t|
- t.column "feed_id", :integer, :null => false
- t.column "title", :string, :default => "", :null => false
- t.column "snippet", :string, :default => "", :null => false
- t.column "body", :text, :default => "", :null => false
- t.column "url", :string, :default => "", :null => false
- t.column "published_at", :datetime, :null => false
+ t.column "feed_id", :integer, :null => false
+ t.column "title", :string, :limit => 1000, :default => "", :null => false
+ t.column "snippet", :string, :default => "", :null => false
+ t.column "body", :text, :default => "", :null => false
+ t.column "url", :string, :default => "", :null => false
+ t.column "published_at", :datetime, :null => false
end
create_table "taggings", :force => true do |t|
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|