« get me outta code hell

Split along \r too - scratchrlol - Simple HTML-based Scratch client
summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2018-11-15 17:40:56 -0400
committerFlorrie <towerofnix@gmail.com>2018-11-15 17:40:56 -0400
commit2bcafc451ff8c930909ec8bf6ccef2dc706b627b (patch)
tree70a238e7812c8969e06da1888a76bfbbc43d07ff
parent3546621b3f523948a7b16407c173ccbb48f26c30 (diff)
Split along \r too
Some old projects (e.g. 38201) use \r instead of \n as the line
separator character. This commit acknowledges that in the longField
function.
-rwxr-xr-xindex.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/index.js b/index.js
index b396421..1619d6a 100755
--- a/index.js
+++ b/index.js
@@ -95,7 +95,7 @@ const templates = {
   forumThread: (name, id) => `<a href="/topics/${id}">${filterHTML(name.trim())}</a>`,
 
   longField: text => {
-    return text.split('\n')
+    return text.split(/\r\n|\r|\n/g)
       .map(filterHTML)
       .reduce((arr, l, i, lines) =>
         [...arr.slice(0, -1), ...l.trim().length