From 741b63dbb8a2fc2d3fa1e7224fff03dddd045173 Mon Sep 17 00:00:00 2001 From: AurelioAHeckert Date: Tue, 29 Apr 2008 00:39:40 +0000 Subject: [PATCH] ActionItem339: comments respects line breaks and make links on urls --- app/views/content_viewer/_comment.rhtml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/views/content_viewer/_comment.rhtml b/app/views/content_viewer/_comment.rhtml index de0d8f0..18b9f64 100644 --- a/app/views/content_viewer/_comment.rhtml +++ b/app/views/content_viewer/_comment.rhtml @@ -27,6 +27,16 @@ <%= '
' + _('(unauthenticated user)') if ! comment.author %>
- <%= comment.body %> +

+ <%= + comment.body. + gsub( /\n\s*\n/, '

' ). + gsub( /\n/, '
' ). + gsub( /(^|\s)(www\.[^\s])/, '\1http://\2' ). + gsub( /(https?:\/\/([^\s]+))/, + '\2' ) + %>

-- libgit2 0.21.2