1
0
Fork 0

Links automaking for plain text

This commit is contained in:
Aleksei Shaikhaleev 2013-07-29 20:12:24 +07:00
parent 78aed88570
commit 0118753bdc
1 changed files with 5 additions and 1 deletions

View File

@ -40,8 +40,12 @@ class Paste
Pygments.highlight(contents, lexer: syntax, options: { linenos: 'table' }) Pygments.highlight(contents, lexer: syntax, options: { linenos: 'table' })
end end
def parsed_for_links
contents.gsub(/(https?:\/\/[\S]+)/, '<a target="_blank" href="\0">\0</a>')
end
def paragraph def paragraph
"<pre>#{contents}</pre>" "<pre>#{parsed_for_links}</pre>"
end end
def html def html