aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2019-09-21 16:09:13 -0500
committerJesús <heckyel@hyperbola.info>2019-09-21 16:09:13 -0500
commit5c2d616e0c5fa2a334c8defe46389753ef7b180b (patch)
tree70a55f89ec1caa1b071e0676bc44751594b2f525
parent3530f2f8f64de9da13b944171f22b67e9ea80edf (diff)
downloadematrix-5c2d616e0c5fa2a334c8defe46389753ef7b180b.tar.lz
ematrix-5c2d616e0c5fa2a334c8defe46389753ef7b180b.tar.xz
ematrix-5c2d616e0c5fa2a334c8defe46389753ef7b180b.zip
Improve filter and syntax
-rw-r--r--js/i18n.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/js/i18n.js b/js/i18n.js
index da7d469..3a6b0e2 100644
--- a/js/i18n.js
+++ b/js/i18n.js
@@ -43,12 +43,10 @@
// used to check the source text. The above comment is kept just
// in case.
- let reSafeTags =
- /^([\s\S]*?)<(b|blockquote|code|em|i|kbd|span|sup)>(.+?)<\/\2>([\s\S]*)$/;
+ let reSafeTags = /^([\s\S]*?)<(b|blockquote|code|em|i|kbd|span|sup)>(.+?)<\/\2>([\s\S]*)$/;
let reSafeInput = /^([\s\S]*?)<(input type="[^"]+")>(.*?)([\s\S]*)$/;
let reInput = /^input type=(['"])([a-z]+)\1$/;
- let reSafeLink =
- /^([\s\S]*?)<(a href=['"]https?:\/\/[^'" <>]+['"])>(.+?)<\/a>([\s\S]*)$/;
+ let reSafeLink = /^([\s\S]*?)<(a href=['"]https?:\/\/[^'" <>]+['"])>(.+?)<\/a>([\s\S]*)$/;
let reLink = /^a href=(['"])(https?:\/\/[^'"]+)\1$/;
var safeTextToTagNode = function(text) {
@@ -106,7 +104,8 @@
.replace(/&lsquo;/g, '‘')
.replace(/&rsquo;/g, '’')
.replace(/&lt;/g, '<')
- .replace(/&gt;/g, '>');
+ .replace(/&gt;/g, '>')
+ .replace(/&apos;/g, '\'');
}
return document.createTextNode(text);
};