client/misc: fix Markdown permalinks

This commit is contained in:
rr- 2016-06-12 18:12:00 +02:00
parent a28b4bdd3e
commit 4295e1c827

View file

@ -111,9 +111,9 @@ function formatMarkdown(text) {
text = text.replace( text = text.replace(
/(^|^\(|(?:[^\]])\(|[\s<>\[\]\)])([+#@][a-zA-Z0-9_-]+)/g, /(^|^\(|(?:[^\]])\(|[\s<>\[\]\)])([+#@][a-zA-Z0-9_-]+)/g,
'$1[$2]($2)'); '$1[$2]($2)');
text = text.replace(/\]\(@(\d+)\)/g, '](#/post/$1)'); 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, '](/user/$1)');
text = text.replace(/\]\(#([a-zA-Z0-9_-]+)\)/g, '](#/posts/query=$1)'); text = text.replace(/\]\(#([a-zA-Z0-9_-]+)\)/g, '](/posts/text=$1)');
return text; return text;
}; };
@ -131,7 +131,7 @@ function formatMarkdown(text) {
//search permalinks //search permalinks
text = text.replace( text = text.replace(
/\[search\]((?:[^\[]|\[(?!\/?search\]))+)\[\/search\]/ig, /\[search\]((?:[^\[]|\[(?!\/?search\]))+)\[\/search\]/ig,
'<a href="#/posts/query=$1"><code>$1</code></a>'); '<a href="/posts/text=$1"><code>$1</code></a>');
//spoilers //spoilers
text = text.replace( text = text.replace(
/\[spoiler\]((?:[^\[]|\[(?!\/?spoiler\]))+)\[\/spoiler\]/ig, /\[spoiler\]((?:[^\[]|\[(?!\/?spoiler\]))+)\[\/spoiler\]/ig,