diff --git a/public_html/js/Util/Misc.js b/public_html/js/Util/Misc.js index 29ea091f..c3958111 100644 --- a/public_html/js/Util/Misc.js +++ b/public_html/js/Util/Misc.js @@ -198,6 +198,11 @@ App.Util.Misc = function(_, jQuery, marked, promise) { text = text.replace(/^#/g, '%%%#'); //fix \ before ~ being stripped away text = text.replace(/\\~/g, '%%%T'); + //post, user and tags premalinks + text = text.replace(/(^|^\(|(?:[^\]])\(|[\s<>\[\]\)])([+#@][a-zA-Z0-9_-]+)/g, '$1[$2]($2)'); + text = text.replace(/\]\(@(\d+)\)/g, '](#/post/$1)'); + text = text.replace(/\]\(+([a-zA-Z0-9_-]+)\)/g, '](#/user/$1)'); + text = text.replace(/\]\(#([a-zA-Z0-9_-]+)\)/g, '](#/posts/query=$1)'); return text; }; @@ -215,12 +220,6 @@ App.Util.Misc = function(_, jQuery, marked, promise) { //strike-through text = text.replace(/(^|[^\\])(~~|~)([^~]+)\2/g, '$1$3'); text = text.replace(/\\~/g, '~'); - //post premalinks - text = text.replace(/(^|[\s<>\(\)\[\]])@(\d+)/g, '$1@$2'); - //user permalinks - text = text.replace(/(^|[\s<>\(\)\[\]])\+([a-zA-Z0-9_-]+)/g, '$1+$2'); - //tag permalinks - text = text.replace(/(^|[\s<>\(\)\[\]])\#([^\s<>/\\]+)/g, '$1#$2'); return text; };