1
0
Fork 0

Merge pull request #2 from nimdraugsael/master

Links automaking for plain text
This commit is contained in:
Gregory Eremin 2013-07-29 06:54:33 -07:00
commit 490e2a2363
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