From 94e983a5ccd7924325e15149d00a65091730c4f0 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 e08ef74417..62636939bf 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 + '';