aboutsummaryrefslogtreecommitdiff
path: root/src/java
diff options
context:
space:
mode:
authorGravatar Ugnich Anton2014-04-17 16:37:21 +0700
committerGravatar Ugnich Anton2014-04-17 16:37:21 +0700
commit03896ca1b912786a16017d745d5d49c6ca1e3b94 (patch)
tree6e9760f6be25ba32124f7db48189835200998ece /src/java
parent29a8f0ae0fdc27a03b723c7a9ad3be7f35db7b23 (diff)
Markdown links syntax
Diffstat (limited to 'src/java')
-rw-r--r--src/java/com/juick/http/www/PageTemplates.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java
index cfdc2b0a..d88639a0 100644
--- a/src/java/com/juick/http/www/PageTemplates.java
+++ b/src/java/com/juick/http/www/PageTemplates.java
@@ -408,6 +408,10 @@ public class PageTemplates {
// <a href="http://juick.com/last?page=2" rel="nofollow">juick.com</a>
msg = msg.replaceAll("((?<=\\s)|(?<=\\A))((?:ht|f)tps?://(?:www\\.)?([^\\/\\s\\n\\\"]+)/?[^\\s\\n\\\"]*)", "$1<a href=\"$2\" rel=\"nofollow\">$3</a>");
+ // [link text][http://juick.com/last?page=2]
+ // <a href="http://juick.com/last?page=2" rel="nofollow">link text</a>
+ msg = msg.replaceAll("\\[([^\\]]+)\\]\\[((?:ht|f)tps?://[^\\]]+)\\]", "<a href=\"$2\" rel=\"nofollow\">$1</a>");
+
// #12345
// <a href="http://juick.com/12345">#12345</a>
msg = msg.replaceAll("((?<=\\s)|(?<=\\A)|(?<=\\p{Punct}))#(\\d+)((?=\\s)|(?=\\Z)|(?=\\))|(?=\\.)|(?=\\,))", "$1<a href=\"http://juick.com/$2\">#$2</a>$3");