mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 03:21:12 +08:00
Better HTML emails, smarter email digests, new email section in admin with digest preview
This commit is contained in:
@ -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 << "…"
|
||||
@excerpt << (@text_entities ? "..." : "…")
|
||||
@excerpt << "</a>" if @in_a
|
||||
throw :done
|
||||
end
|
||||
|
Reference in New Issue
Block a user