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', 'chart.js': './node_modules/chart.js/src/chart.js',
'textarea-caret-position': './node_modules/textarea-caret/index.js', 'textarea-caret-position': './node_modules/textarea-caret/index.js',
'misskey-text': './src/common/text/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', 'strength.js': './node_modules/syuilo-password-strength/strength.js',
'cropper': './node_modules/cropperjs/dist/cropper.js', 'cropper': './node_modules/cropperjs/dist/cropper.js',
'Sortable': './node_modules/sortablejs/Sortable.js', 'Sortable': './node_modules/sortablejs/Sortable.js',

View file

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

View file

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