Merge pull request #2 from nimdraugsael/master
Links automaking for plain text
This commit is contained in:
commit
490e2a2363
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue