From 9d89e61785366745577ee18cc20c553e4fd70a7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?syuilo=E2=AD=90=EF=B8=8F?= Date: Sat, 31 Dec 2016 18:41:52 +0900 Subject: [PATCH] Refactor: Better argument name --- src/web/app/common/scripts/text-compiler.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/web/app/common/scripts/text-compiler.js b/src/web/app/common/scripts/text-compiler.js index e08ef7441..62636939b 100644 --- a/src/web/app/common/scripts/text-compiler.js +++ b/src/web/app/common/scripts/text-compiler.js @@ -1,8 +1,8 @@ const riot = require('riot'); -module.exports = function(tokens, canBreak, escape) { - if (canBreak == null) { - canBreak = true; +module.exports = function(tokens, shouldBreak, escape) { + if (shouldBreak == null) { + shouldBreak = true; } if (escape == null) { escape = true; @@ -17,10 +17,10 @@ module.exports = function(tokens, canBreak, escape) { return token.content .replace(/>/g, '>') .replace(/' : ' '); + .replace(/(\r\n|\n|\r)/g, shouldBreak ? '
' : ' '); } else { return token.content - .replace(/(\r\n|\n|\r)/g, canBreak ? '
' : ' '); + .replace(/(\r\n|\n|\r)/g, shouldBreak ? '
' : ' '); } case 'bold': return '' + token.bold + '';