0
0

Use nyaize package for nya filter 📦

This commit is contained in:
syuilo 2017-01-04 15:32:04 +09:00
parent 1de54209d0
commit 39eabbd2c0
3 changed files with 4 additions and 4 deletions

View File

@ -149,6 +149,7 @@ const aliasifyConfig = {
'chart.js': './node_modules/chart.js/src/chart.js',
'textarea-caret-position': './node_modules/textarea-caret/index.js',
'misskey-text': './src/common/text/index.js',
'nyaize': './node_modules/nyaize/built/index.js',
'strength.js': './node_modules/syuilo-password-strength/strength.js',
'cropper': './node_modules/cropperjs/dist/cropper.js',
'Sortable': './node_modules/sortablejs/Sortable.js',

View File

@ -102,6 +102,7 @@
"ms": "0.7.2",
"multer": "1.2.1",
"nprogress": "0.2.0",
"nyaize": "0.0.2",
"page": "1.7.1",
"prominence": "0.2.0",
"pug": "2.0.0-beta6",

View File

@ -1,4 +1,5 @@
const riot = require('riot');
const nyaize = require('nyaize').default;
module.exports = function(tokens, shouldBreak, escape) {
if (shouldBreak == null) {
@ -34,10 +35,7 @@ module.exports = function(tokens, shouldBreak, escape) {
}).join('');
if (me && me.data && me.data.nya) {
text = text.replace(/な/g, 'にゃ')
.replace(/ニャ/g, 'にゃ')
.replace(/にゃでにゃで/g, 'なでなで')
.replace(/ニャデニャデ/g, 'ナデナデ');
text = nyaize(text);
}
return text;