mirror of
https://github.com/twisterarmy/twister-html.git
synced 2025-01-27 07:04:24 +00:00
regulated escaping and reversing html entities...
This commit is contained in:
parent
711e568c0a
commit
1e20dcb994
@ -197,7 +197,7 @@ function htmlFormatMsg( msg, output, mentions ) {
|
||||
if( space != -1 ) url = tmp.substring(0,space); else url = tmp;
|
||||
if( url.length ) {
|
||||
msg = tmp.substr(String(url).length);
|
||||
url = url.replace('&', '&');
|
||||
url = url.replace(/&/g, '&');
|
||||
var extLinkTemplate = $("#external-page-link-template").clone(true);
|
||||
extLinkTemplate.removeAttr("id");
|
||||
|
||||
@ -309,6 +309,7 @@ function _extractUsername(s) {
|
||||
// internal function for htmlFormatMsg
|
||||
function _extractHashtag(s) {
|
||||
var hashtag = "";
|
||||
s = reverseHtmlEntities(s);
|
||||
for( var i = 0; i < s.length; i++ ) {
|
||||
if( " \n\t.,:/?!;'\"()[]{}*".indexOf(s[i]) < 0 ) {
|
||||
hashtag += s[i];
|
||||
@ -320,6 +321,20 @@ function _extractHashtag(s) {
|
||||
}
|
||||
|
||||
function escapeHtmlEntities(str) {
|
||||
return str.replace('&', '&').replace('<', '<').replace('>', '>').replace('"', '"').replace("'", ''');
|
||||
return str
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''');
|
||||
}
|
||||
|
||||
function reverseHtmlEntities(str) {
|
||||
return str
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, "'");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user