projects
/
blerg.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
93ac209
)
Whoops, searching and replacing *globally* is important.
author
Chip Black
<bytex64@bytex64.net>
Thu, 13 Jan 2011 09:59:39 +0000
(
01:59
-0800)
committer
Chip Black
<bytex64@bytex64.net>
Thu, 13 Jan 2011 09:59:39 +0000
(
01:59
-0800)
www/js/blerg.js
patch
|
blob
|
history
diff --git
a/www/js/blerg.js
b/www/js/blerg.js
index
dcb5679
..
4d56790
100644
(file)
--- 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.recInt = parseInt(record.record);
// Sanitize HTML input
- record.data = record.data.replace(
'&', '&').replace('<', '<').replace('>', '>
');
+ record.data = record.data.replace(
/&/g, '&').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<a href="$2">$2</a>');
// Turn markdown links into links
// Turn HTTP URLs into links
record.data = record.data.replace(/(\s|^)(https?:\/\/[a-zA-Z0-9.-]*[a-zA-Z0-9](\/([^\s"]*[^.!,;?()\s])?)?)/g, '$1<a href="$2">$2</a>');
// Turn markdown links into links
- record.data = record.data.replace(/(\s|^)\[([^\]]+)\]\((https?:\/\/[a-zA-Z0-9.-]*[a-zA-Z0-9](\/[^)"]*?)?)\)/, '$1<a href="$3">$2</a>');
+ record.data = record.data.replace(/(\s|^)\[([^\]]+)\]\((https?:\/\/[a-zA-Z0-9.-]*[a-zA-Z0-9](\/[^)"]*?)?)\)/
g
, '$1<a href="$3">$2</a>');
// Turn *foo* into italics and **foo** into bold
// Turn *foo* into italics and **foo** into bold
- record.data = record.data.replace(/(\s)\*\*([^*]+)\*\*(\s)/, '$1<b>$2</b>$3');
- record.data = record.data.replace(/(\s)\*([^*]+)\*(\s)/, '$1<i>$2</i>$3');
+ record.data = record.data.replace(/(\s)\*\*([^*]+)\*\*(\s)/
g
, '$1<b>$2</b>$3');
+ record.data = record.data.replace(/(\s)\*([^*]+)\*(\s)/
g
, '$1<i>$2</i>$3');
// Turn refs and tags into links
record.data = record.data.replace(/(\s|^)#(\w+)/g, '$1<a href="#tag/$2">#$2</a>');
// Turn refs and tags into links
record.data = record.data.replace(/(\s|^)#(\w+)/g, '$1<a href="#tag/$2">#$2</a>');