Better HTML emails, smarter email digests, new email section in admin with digest preview

This commit is contained in:
Robin Ward
2013-06-03 16:12:24 -04:00
parent f030d9b420
commit 0b97ea6345
69 changed files with 552 additions and 443 deletions

View File

@ -2,11 +2,13 @@ class ExcerptParser < Nokogiri::XML::SAX::Document
attr_reader :excerpt
def initialize(length,options)
def initialize(length, options=nil)
@length = length
@excerpt = ""
@current_length = 0
options || {}
@strip_links = options[:strip_links] == true
@text_entities = options[:text_entities] == true
end
def self.get_excerpt(html, length, options)
@ -63,7 +65,7 @@ class ExcerptParser < Nokogiri::XML::SAX::Document
if count_it && @current_length + string.length > @length
length = [0, @length - @current_length - 1].max
@excerpt << encode.call(string[0..length]) if truncate
@excerpt << "&hellip;"
@excerpt << (@text_entities ? "..." : "&hellip;")
@excerpt << "</a>" if @in_a
throw :done
end