diff options
author | Jesús <heckyel@hyperbola.info> | 2019-09-21 16:09:13 -0500 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2019-09-21 16:09:13 -0500 |
commit | 5c2d616e0c5fa2a334c8defe46389753ef7b180b (patch) | |
tree | 70a55f89ec1caa1b071e0676bc44751594b2f525 | |
parent | 3530f2f8f64de9da13b944171f22b67e9ea80edf (diff) | |
download | ematrix-5c2d616e0c5fa2a334c8defe46389753ef7b180b.tar.lz ematrix-5c2d616e0c5fa2a334c8defe46389753ef7b180b.tar.xz ematrix-5c2d616e0c5fa2a334c8defe46389753ef7b180b.zip |
Improve filter and syntax
-rw-r--r-- | js/i18n.js | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -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(/‘/g, '‘') .replace(/’/g, '’') .replace(/</g, '<') - .replace(/>/g, '>'); + .replace(/>/g, '>') + .replace(/'/g, '\''); } return document.createTextNode(text); }; |