Created
September 12, 2015 08:33
-
-
Save maxp/4e27eac2275dac9097fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn autourl-transformer [text state] | |
[(if (:code state) | |
text | |
(string/replace | |
text | |
#"<https?://[-A-Za-z0-9+&@#/%?=~_()|!:,.;]*[-A-Za-z0-9+&@#/%=~_()|]>" | |
#(let [url (subs % 1 (dec (count %)))] | |
(str "<a href=\"" url "\">" url "</a>")))) | |
state]) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment