summaryrefslogtreecommitdiff
path: root/src/web/app/common/scripts/text-compiler.js
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2016-12-30 11:57:17 +0900
committersyuilo <syuilotan@yahoo.co.jp>2016-12-30 11:57:17 +0900
commitf844a47f1deb885af733220bdd018fb3966c4039 (patch)
treef1a1c46d7cdae8556a6b6104b3e9bf21bd3c82af /src/web/app/common/scripts/text-compiler.js
parent#4 (diff)
downloadmisskey-f844a47f1deb885af733220bdd018fb3966c4039.tar.gz
misskey-f844a47f1deb885af733220bdd018fb3966c4039.tar.bz2
misskey-f844a47f1deb885af733220bdd018fb3966c4039.zip
Add nya filter
Diffstat (limited to 'src/web/app/common/scripts/text-compiler.js')
-rw-r--r--src/web/app/common/scripts/text-compiler.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/web/app/common/scripts/text-compiler.js b/src/web/app/common/scripts/text-compiler.js
index 9915e3335f..41f4966682 100644
--- a/src/web/app/common/scripts/text-compiler.js
+++ b/src/web/app/common/scripts/text-compiler.js
@@ -1,3 +1,5 @@
+const riot = require('riot');
+
module.exports = function(tokens, canBreak, escape) {
if (canBreak == null) {
canBreak = true;
@@ -5,7 +7,10 @@ module.exports = function(tokens, canBreak, escape) {
if (escape == null) {
escape = true;
}
- return tokens.map(function(token) {
+
+ const me = riot.mixin('i').me;
+
+ let text = tokens.map(function(token) {
switch (token.type) {
case 'text':
if (escape) {
@@ -27,4 +32,10 @@ module.exports = function(tokens, canBreak, escape) {
return '<a>' + token.content + '</a>';
}
}).join('');
+
+ if (me && me.data && me.data.nya) {
+ text = text.replace(/な/g, 'にゃ');
+ }
+
+ return text;
}