1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-16 10:29:54 +00:00

Single quotes should be HTML encoded

As raised here:
https://groups.google.com/d/topic/tiddlywiki/nYvgcImvBt8/discussion
This commit is contained in:
Jermolene 2015-02-20 16:09:38 +00:00
parent 50cf85ae86
commit 1e9e1a1fdc

View File

@ -363,10 +363,10 @@ exports.getRelativeDate = function(delta) {
};
};
// Convert & to "&amp;", < to "&lt;", > to "&gt;" and " to "&quot;"
// Convert & to "&amp;", < to "&lt;", > to "&gt;", " to "&quot;" ' to "&#39;"
exports.htmlEncode = function(s) {
if(s) {
return s.toString().replace(/&/mg,"&amp;").replace(/</mg,"&lt;").replace(/>/mg,"&gt;").replace(/\"/mg,"&quot;");
return s.toString().replace(/&/mg,"&amp;").replace(/</mg,"&lt;").replace(/>/mg,"&gt;").replace(/\"/mg,"&quot;").replace(/\'/mg,"&#39;");
} else {
return "";
}