Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module ApplicationHelper
- include Twitter::Extractor
- def auto_text_link(text)
- usernames = extract_mentioned_screen_names(text).uniq
- usernames.each do |username|
- text.gsub!("@#{username}","@<a href=\"#\">#{username}</a>")
- end
- auto_link(text, :urls, :rel => "nofollow", :target => "_blank")
- end
- def simple_format_include_spaces(text, html_options={}, options={})
- text = ''.html_safe if text.nil?
- start_tag = tag('p', html_options, true)
- text = sanitize(text) unless options[:sanitize] == false
- text.gsub!(/\r\n?/, "\n") # \r\n and \r -> \n
- text.gsub!(/\n/, '\1<br />') # 1 newline -> br
- text.insert 0, start_tag
- text.html_safe.safe_concat("</p>")
- end
- end
Add Comment
Please, Sign In to add comment