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