From 02b61f4e1986828cd7b86d2bc448ca9534e5d19f Mon Sep 17 00:00:00 2001 From: Chip Black Date: Thu, 13 Jan 2011 01:59:39 -0800 Subject: [PATCH] Whoops, searching and replacing *globally* is important. --- www/js/blerg.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/www/js/blerg.js b/www/js/blerg.js index dcb5679..4d56790 100644 --- a/www/js/blerg.js +++ b/www/js/blerg.js @@ -244,17 +244,17 @@ function mangleRecord(record, template) { record.recInt = parseInt(record.record); // Sanitize HTML input - record.data = record.data.replace('&', '&').replace('<', '<').replace('>', '>'); + record.data = record.data.replace(/&/g, '&').replace(//g, '>'); // Turn HTTP URLs into links record.data = record.data.replace(/(\s|^)(https?:\/\/[a-zA-Z0-9.-]*[a-zA-Z0-9](\/([^\s"]*[^.!,;?()\s])?)?)/g, '$1$2'); // Turn markdown links into links - record.data = record.data.replace(/(\s|^)\[([^\]]+)\]\((https?:\/\/[a-zA-Z0-9.-]*[a-zA-Z0-9](\/[^)"]*?)?)\)/, '$1$2'); + record.data = record.data.replace(/(\s|^)\[([^\]]+)\]\((https?:\/\/[a-zA-Z0-9.-]*[a-zA-Z0-9](\/[^)"]*?)?)\)/g, '$1$2'); // Turn *foo* into italics and **foo** into bold - record.data = record.data.replace(/(\s)\*\*([^*]+)\*\*(\s)/, '$1$2$3'); - record.data = record.data.replace(/(\s)\*([^*]+)\*(\s)/, '$1$2$3'); + record.data = record.data.replace(/(\s)\*\*([^*]+)\*\*(\s)/g, '$1$2$3'); + record.data = record.data.replace(/(\s)\*([^*]+)\*(\s)/g, '$1$2$3'); // Turn refs and tags into links record.data = record.data.replace(/(\s|^)#(\w+)/g, '$1#$2'); -- 2.25.1