From 0f14a23490f539177e41e34a4f150bbb9333b3a0 Mon Sep 17 00:00:00 2001 From: Dom Brassey Date: Mon, 8 Jul 2024 12:25:02 +0100 Subject: [PATCH] fix regex bugs --- index.html | 1 + script/script.js | 1 - script/scriptEventLists.js | 11 ++++++++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index ba5fc13..354a30d 100644 --- a/index.html +++ b/index.html @@ -13,6 +13,7 @@ + diff --git a/script/script.js b/script/script.js index d1f5b6e..c4bdf51 100644 --- a/script/script.js +++ b/script/script.js @@ -100,7 +100,6 @@ function drawDots(schoolYear) { // 6 terms // Draw filled dots (for elapsed days) dotsHtml = ""; - console.log(schoolYear.terms[0].termDaysElapsed); for (let x = 0; x < schoolYear.terms[i].termDaysElapsed; x++) { let date = schoolYear.terms[i].beg; let dateCute = date.toLocaleString("en-US", dotsDateOptions); // Tooltip diff --git a/script/scriptEventLists.js b/script/scriptEventLists.js index 2444255..8e626ad 100644 --- a/script/scriptEventLists.js +++ b/script/scriptEventLists.js @@ -112,10 +112,15 @@ function showEvents(eventsArray) { /<[^>]*>/g, "" ); - // add spaces after periods + // add spaces after '.' (except .com...) eventsArray[i].description = eventsArray[i].description.replace( - /\.(\S)/g, - ". $1" + /\.(?!\s|co\b|org\b|net\b)/g, + ". " + ); + // add spaces after ':' (except '://') + eventsArray[i].description = eventsArray[i].description.replace( + /\:(?!\s|\/\/\b)/g, + ": " ); } // truncate any long titles or desc