Added [sjis]...[/sjis] tag
This commit is contained in:
parent
87681f8c0d
commit
36d2842b6e
3 changed files with 26 additions and 0 deletions
|
@ -113,3 +113,16 @@ ul.comments {
|
|||
#global-comment-list .post-small .link {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.sjis {
|
||||
font-family: 'MS PGothic', 'MS Pゴシック', 'IPAMonaPGothic', 'Trebuchet MS', Verdana, Futura, Arial, Helvetica, sans-serif;
|
||||
border: solid 4px #ccc;
|
||||
color: #111;
|
||||
font-size: 12pt;
|
||||
line-height: 1;
|
||||
margin: 0;
|
||||
padding: 4px;
|
||||
overflow: auto;
|
||||
white-space: pre;
|
||||
word-wrap: normal;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -229,6 +229,10 @@
|
|||
<td><code>[spoiler]Lelouch survives[/spoiler]</td>
|
||||
<td>marks text as spoiler and hides it</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>[sjis](´・ω・`)[/sjis]</td>
|
||||
<td>adds SJIS art</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue