From 0118753bdcc31215c2d4433754b35c2cc87e15d1 Mon Sep 17 00:00:00 2001 From: Aleksei Shaikhaleev Date: Mon, 29 Jul 2013 20:12:24 +0700 Subject: [PATCH] Links automaking for plain text --- app/models/paste.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/paste.rb b/app/models/paste.rb index 5cda49d..a0afad4 100644 --- a/app/models/paste.rb +++ b/app/models/paste.rb @@ -40,8 +40,12 @@ class Paste Pygments.highlight(contents, lexer: syntax, options: { linenos: 'table' }) end + def parsed_for_links + contents.gsub(/(https?:\/\/[\S]+)/, '\0') + end + def paragraph - "
#{contents}
" + "
#{parsed_for_links}
" end def html