Added [sjis]...[/sjis] tag

This commit is contained in:
rr-
2016-02-29 00:57:09 +01:00
parent 87681f8c0d
commit 36d2842b6e
3 changed files with 26 additions and 0 deletions

View File

@ -193,7 +193,14 @@ App.Util.Misc = function(_, jQuery, marked, promise) {
smartypants: true,
};
var sjis = [];
var preDecorator = function(text) {
text = text.replace(/\[sjis\]((?:[^\[]|\[(?!\/?sjis\]))+)\[\/sjis\]/ig, function(match, capture) {
var ret = '%%%SJIS' + sjis.length;
sjis.push(capture);
return ret;
});
//prevent ^#... from being treated as headers, due to tag permalinks
text = text.replace(/^#/g, '%%%#');
//fix \ before ~ being stripped away
@ -211,6 +218,8 @@ App.Util.Misc = function(_, jQuery, marked, promise) {
text = text.replace(/%%%T/g, '\\~');
text = text.replace(/%%%#/g, '#');
text = text.replace(/%%%SJIS(\d+)/, function(match, capture) { return '<div class="sjis">' + sjis[capture] + '</div>'; });
//search permalinks
text = text.replace(/\[search\]((?:[^\[]|\[(?!\/?search\]))+)\[\/search\]/ig, '<a href="#/posts/query=$1"><code>$1</code></a>');
//spoilers