1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 03:57:21 +00:00

Added support for hexadecimal HTML entities

This commit is contained in:
Jeremy Ruston 2011-12-08 12:45:26 +00:00
parent ef60c9018e
commit a09c43d456
4 changed files with 9 additions and 5 deletions

View File

@ -69,8 +69,12 @@ utils.htmlDecode = function(s)
// Converts all HTML entities to their character equivalents
utils.entityDecode = function(s) {
var e = s.substr(1,s.length-2); // Strip the & and the ;
if(e.charAt(0) == "#") {
return String.fromCharCode(parseInt(e.substr(1),10));
if(e.charAt(0) === "#") {
if(e.charAt(1) === "x" || e.charAt(1) === "X") {
return String.fromCharCode(parseInt(e.substr(2),16));
} else {
return String.fromCharCode(parseInt(e.substr(1),10));
}
} else {
var c = utils.htmlEntities[e];
if(c) {

View File

@ -1 +1 @@
An image <img src="Something.jpg" /> and a couple of &#199; &quot;HTML Entity&quot;
An image <img src="Something.jpg" /> and a couple of &#xc7; &#199; &quot;HTML Entity&quot;

View File

@ -1,3 +1,3 @@
title: Fourth Tiddler
An image [img[Something.jpg]] and a couple of &#199; &quot;HTML Entity&quot;
An image [img[Something.jpg]] and a couple of &#xc7; &#199; &quot;HTML Entity&quot;

View File

@ -1 +1 @@
An image and a couple of Ç "HTML Entity"
An image and a couple of Ç Ç "HTML Entity"