neuigkeit first words fix

This commit is contained in:
Andreas Stephanides
2014-04-02 14:31:42 +02:00
parent 484776802a
commit c0d30f3e38

View File

@@ -53,7 +53,7 @@ class Neuigkeit < ActiveRecord::Base
self.title self.title
end end
def text_first_words def text_first_words
md = /<p>(?<text>[\w\s,\.!\?]*)/.match self.text md = /<p>(?<text>[^\<\>]*)/.match Sanitize.clean(self.text,:elements=>['p'])
words=md[:text].split(" ") unless md.nil? words=md[:text].split(" ") unless md.nil?
if words.nil? || words.empty? if words.nil? || words.empty?
"...." "...."