diff options
Diffstat (limited to 'app/helpers')
| -rw-r--r-- | app/helpers/quotes_helper.rb | 11 |
1 files changed, 11 insertions, 0 deletions
| diff --git a/app/helpers/quotes_helper.rb b/app/helpers/quotes_helper.rb new file mode 100644 index 0000000..3c2acf9 --- /dev/null +++ b/app/helpers/quotes_helper.rb | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | module QuotesHelper | ||
| 2 | def quote_format(text) | ||
| 3 | text = text ? text.to_str : '' | ||
| 4 | text = text.dup if text.frozen? | ||
| 5 | text.gsub!(/\r\n?/, "\n") # \r\n and \r -> \n | ||
| 6 | text.gsub!(/\n/, '<br />') # 1 newline -> br | ||
| 7 | text = sanitize(text) | ||
| 8 | text = auto_link(text, :link => :urls) | ||
| 9 | text | ||
| 10 | end | ||
| 11 | end | ||
