[795] | 1 | /* |
---|
| 2 | * FCKeditor - The text editor for Internet - http://www.fckeditor.net |
---|
| 3 | * Copyright (C) 2003-2007 Frederico Caldeira Knabben |
---|
| 4 | * |
---|
| 5 | * == BEGIN LICENSE == |
---|
| 6 | * |
---|
| 7 | * Licensed under the terms of any of the following licenses at your |
---|
| 8 | * choice: |
---|
| 9 | * |
---|
| 10 | * - GNU General Public License Version 2 or later (the "GPL") |
---|
| 11 | * http://www.gnu.org/licenses/gpl.html |
---|
| 12 | * |
---|
| 13 | * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") |
---|
| 14 | * http://www.gnu.org/licenses/lgpl.html |
---|
| 15 | * |
---|
| 16 | * - Mozilla Public License Version 1.1 or later (the "MPL") |
---|
| 17 | * http://www.mozilla.org/MPL/MPL-1.1.html |
---|
| 18 | * |
---|
| 19 | * == END LICENSE == |
---|
| 20 | * |
---|
| 21 | * This file define the HTML entities handled by the editor. |
---|
| 22 | */ |
---|
| 23 | |
---|
| 24 | var FCKXHtmlEntities = new Object() ; |
---|
| 25 | |
---|
| 26 | FCKXHtmlEntities.Initialize = function() |
---|
| 27 | { |
---|
| 28 | if ( FCKXHtmlEntities.Entities ) |
---|
| 29 | return ; |
---|
| 30 | |
---|
| 31 | var sChars = '' ; |
---|
| 32 | var oEntities, e ; |
---|
| 33 | |
---|
| 34 | if ( FCKConfig.ProcessHTMLEntities ) |
---|
| 35 | { |
---|
| 36 | FCKXHtmlEntities.Entities = { |
---|
| 37 | // Latin-1 Entities |
---|
| 38 | ' ':'nbsp', |
---|
| 39 | '¡':'iexcl', |
---|
| 40 | '¢':'cent', |
---|
| 41 | '£':'pound', |
---|
| 42 | '¤':'curren', |
---|
| 43 | '¥':'yen', |
---|
| 44 | '¦':'brvbar', |
---|
| 45 | '§':'sect', |
---|
| 46 | '¨':'uml', |
---|
| 47 | '©':'copy', |
---|
| 48 | 'ª':'ordf', |
---|
| 49 | '«':'laquo', |
---|
| 50 | '¬':'not', |
---|
| 51 | '':'shy', |
---|
| 52 | '®':'reg', |
---|
| 53 | '¯':'macr', |
---|
| 54 | '°':'deg', |
---|
| 55 | '±':'plusmn', |
---|
| 56 | '²':'sup2', |
---|
| 57 | '³':'sup3', |
---|
| 58 | '´':'acute', |
---|
| 59 | 'µ':'micro', |
---|
| 60 | '¶':'para', |
---|
| 61 | '·':'middot', |
---|
| 62 | '¸':'cedil', |
---|
| 63 | '¹':'sup1', |
---|
| 64 | 'º':'ordm', |
---|
| 65 | '»':'raquo', |
---|
| 66 | '¼':'frac14', |
---|
| 67 | '½':'frac12', |
---|
| 68 | '¾':'frac34', |
---|
| 69 | '¿':'iquest', |
---|
| 70 | '×':'times', |
---|
| 71 | '÷':'divide', |
---|
| 72 | |
---|
| 73 | // Symbols |
---|
| 74 | |
---|
| 75 | 'ƒ':'fnof', |
---|
| 76 | '•':'bull', |
---|
| 77 | '…':'hellip', |
---|
| 78 | '′':'prime', |
---|
| 79 | '″':'Prime', |
---|
| 80 | '‾':'oline', |
---|
| 81 | '⁄':'frasl', |
---|
| 82 | '℘':'weierp', |
---|
| 83 | 'ℑ':'image', |
---|
| 84 | 'ℜ':'real', |
---|
| 85 | '™':'trade', |
---|
| 86 | 'ℵ':'alefsym', |
---|
| 87 | '←':'larr', |
---|
| 88 | '↑':'uarr', |
---|
| 89 | '→':'rarr', |
---|
| 90 | '↓':'darr', |
---|
| 91 | '↔':'harr', |
---|
| 92 | '↵':'crarr', |
---|
| 93 | '⇐':'lArr', |
---|
| 94 | '⇑':'uArr', |
---|
| 95 | '⇒':'rArr', |
---|
| 96 | '⇓':'dArr', |
---|
| 97 | '⇔':'hArr', |
---|
| 98 | '∀':'forall', |
---|
| 99 | '∂':'part', |
---|
| 100 | '∃':'exist', |
---|
| 101 | '∅':'empty', |
---|
| 102 | '∇':'nabla', |
---|
| 103 | '∈':'isin', |
---|
| 104 | '∉':'notin', |
---|
| 105 | '∋':'ni', |
---|
| 106 | '∏':'prod', |
---|
| 107 | '∑':'sum', |
---|
| 108 | '−':'minus', |
---|
| 109 | '∗':'lowast', |
---|
| 110 | '√':'radic', |
---|
| 111 | '∝':'prop', |
---|
| 112 | '∞':'infin', |
---|
| 113 | '∠':'ang', |
---|
| 114 | '∧':'and', |
---|
| 115 | '∨':'or', |
---|
| 116 | '∩':'cap', |
---|
| 117 | '∪':'cup', |
---|
| 118 | '∫':'int', |
---|
| 119 | '∴':'there4', |
---|
| 120 | '∼':'sim', |
---|
| 121 | '≅':'cong', |
---|
| 122 | '≈':'asymp', |
---|
| 123 | '≠':'ne', |
---|
| 124 | '≡':'equiv', |
---|
| 125 | '≤':'le', |
---|
| 126 | '≥':'ge', |
---|
| 127 | '⊂':'sub', |
---|
| 128 | '⊃':'sup', |
---|
| 129 | '⊄':'nsub', |
---|
| 130 | '⊆':'sube', |
---|
| 131 | '⊇':'supe', |
---|
| 132 | '⊕':'oplus', |
---|
| 133 | '⊗':'otimes', |
---|
| 134 | '⊥':'perp', |
---|
| 135 | '⋅':'sdot', |
---|
| 136 | '◊':'loz', |
---|
| 137 | '♠':'spades', |
---|
| 138 | '♣':'clubs', |
---|
| 139 | '♥':'hearts', |
---|
| 140 | '♦':'diams', |
---|
| 141 | |
---|
| 142 | // Other Special Characters |
---|
| 143 | |
---|
| 144 | '"':'quot', |
---|
| 145 | // '&':'amp', // This entity is automatically handled by the XHTML parser. |
---|
| 146 | // '<':'lt', // This entity is automatically handled by the XHTML parser. |
---|
| 147 | // '>':'gt', // This entity is automatically handled by the XHTML parser. |
---|
| 148 | 'ˆ':'circ', |
---|
| 149 | '˜':'tilde', |
---|
| 150 | ' ':'ensp', |
---|
| 151 | ' ':'emsp', |
---|
| 152 | ' ':'thinsp', |
---|
| 153 | '':'zwnj', |
---|
| 154 | '':'zwj', |
---|
| 155 | '':'lrm', |
---|
| 156 | '':'rlm', |
---|
| 157 | '–':'ndash', |
---|
| 158 | '—':'mdash', |
---|
| 159 | '‘':'lsquo', |
---|
| 160 | '’':'rsquo', |
---|
| 161 | '‚':'sbquo', |
---|
| 162 | '“':'ldquo', |
---|
| 163 | '”':'rdquo', |
---|
| 164 | '„':'bdquo', |
---|
| 165 | '†':'dagger', |
---|
| 166 | '‡':'Dagger', |
---|
| 167 | '‰':'permil', |
---|
| 168 | '‹':'lsaquo', |
---|
| 169 | '›':'rsaquo', |
---|
| 170 | '€':'euro' |
---|
| 171 | } ; |
---|
| 172 | |
---|
| 173 | // Process Base Entities. |
---|
| 174 | for ( e in FCKXHtmlEntities.Entities ) |
---|
| 175 | sChars += e ; |
---|
| 176 | |
---|
| 177 | // Include Latin Letters Entities. |
---|
| 178 | if ( FCKConfig.IncludeLatinEntities ) |
---|
| 179 | { |
---|
| 180 | oEntities = { |
---|
| 181 | 'À':'Agrave', |
---|
| 182 | 'Á':'Aacute', |
---|
| 183 | 'Â':'Acirc', |
---|
| 184 | 'Ã':'Atilde', |
---|
| 185 | 'Ä':'Auml', |
---|
| 186 | 'Å':'Aring', |
---|
| 187 | 'Æ':'AElig', |
---|
| 188 | 'Ç':'Ccedil', |
---|
| 189 | 'È':'Egrave', |
---|
| 190 | 'É':'Eacute', |
---|
| 191 | 'Ê':'Ecirc', |
---|
| 192 | 'Ë':'Euml', |
---|
| 193 | 'Ì':'Igrave', |
---|
| 194 | 'Í':'Iacute', |
---|
| 195 | 'Î':'Icirc', |
---|
| 196 | 'Ï':'Iuml', |
---|
| 197 | 'Ð':'ETH', |
---|
| 198 | 'Ñ':'Ntilde', |
---|
| 199 | 'Ò':'Ograve', |
---|
| 200 | 'Ó':'Oacute', |
---|
| 201 | 'Ô':'Ocirc', |
---|
| 202 | 'Õ':'Otilde', |
---|
| 203 | 'Ö':'Ouml', |
---|
| 204 | 'Ø':'Oslash', |
---|
| 205 | 'Ù':'Ugrave', |
---|
| 206 | 'Ú':'Uacute', |
---|
| 207 | 'Û':'Ucirc', |
---|
| 208 | 'Ü':'Uuml', |
---|
| 209 | 'Ý':'Yacute', |
---|
| 210 | 'Þ':'THORN', |
---|
| 211 | 'ß':'szlig', |
---|
| 212 | 'à':'agrave', |
---|
| 213 | 'á':'aacute', |
---|
| 214 | 'â':'acirc', |
---|
| 215 | 'ã':'atilde', |
---|
| 216 | 'ä':'auml', |
---|
| 217 | 'å':'aring', |
---|
| 218 | 'æ':'aelig', |
---|
| 219 | 'ç':'ccedil', |
---|
| 220 | 'è':'egrave', |
---|
| 221 | 'é':'eacute', |
---|
| 222 | 'ê':'ecirc', |
---|
| 223 | 'ë':'euml', |
---|
| 224 | 'ì':'igrave', |
---|
| 225 | 'í':'iacute', |
---|
| 226 | 'î':'icirc', |
---|
| 227 | 'ï':'iuml', |
---|
| 228 | 'ð':'eth', |
---|
| 229 | 'ñ':'ntilde', |
---|
| 230 | 'ò':'ograve', |
---|
| 231 | 'ó':'oacute', |
---|
| 232 | 'ô':'ocirc', |
---|
| 233 | 'õ':'otilde', |
---|
| 234 | 'ö':'ouml', |
---|
| 235 | 'ø':'oslash', |
---|
| 236 | 'ù':'ugrave', |
---|
| 237 | 'ú':'uacute', |
---|
| 238 | 'û':'ucirc', |
---|
| 239 | 'ü':'uuml', |
---|
| 240 | 'ý':'yacute', |
---|
| 241 | 'þ':'thorn', |
---|
| 242 | 'ÿ':'yuml', |
---|
| 243 | 'Œ':'OElig', |
---|
| 244 | 'œ':'oelig', |
---|
| 245 | 'Š':'Scaron', |
---|
| 246 | 'š':'scaron', |
---|
| 247 | 'Ÿ':'Yuml' |
---|
| 248 | } ; |
---|
| 249 | |
---|
| 250 | for ( e in oEntities ) |
---|
| 251 | { |
---|
| 252 | FCKXHtmlEntities.Entities[ e ] = oEntities[ e ] ; |
---|
| 253 | sChars += e ; |
---|
| 254 | } |
---|
| 255 | |
---|
| 256 | oEntities = null ; |
---|
| 257 | } |
---|
| 258 | |
---|
| 259 | // Include Greek Letters Entities. |
---|
| 260 | if ( FCKConfig.IncludeGreekEntities ) |
---|
| 261 | { |
---|
| 262 | oEntities = { |
---|
| 263 | 'Α':'Alpha', |
---|
| 264 | 'Β':'Beta', |
---|
| 265 | 'Γ':'Gamma', |
---|
| 266 | 'Δ':'Delta', |
---|
| 267 | 'Ε':'Epsilon', |
---|
| 268 | 'Ζ':'Zeta', |
---|
| 269 | 'Η':'Eta', |
---|
| 270 | 'Θ':'Theta', |
---|
| 271 | 'Ι':'Iota', |
---|
| 272 | 'Κ':'Kappa', |
---|
| 273 | 'Λ':'Lambda', |
---|
| 274 | 'Μ':'Mu', |
---|
| 275 | 'Ν':'Nu', |
---|
| 276 | 'Ξ':'Xi', |
---|
| 277 | 'Ο':'Omicron', |
---|
| 278 | 'Π':'Pi', |
---|
| 279 | 'Ρ':'Rho', |
---|
| 280 | 'Σ':'Sigma', |
---|
| 281 | 'Τ':'Tau', |
---|
| 282 | 'Υ':'Upsilon', |
---|
| 283 | 'Φ':'Phi', |
---|
| 284 | 'Χ':'Chi', |
---|
| 285 | 'Ψ':'Psi', |
---|
| 286 | 'Ω':'Omega', |
---|
| 287 | 'α':'alpha', |
---|
| 288 | 'β':'beta', |
---|
| 289 | 'γ':'gamma', |
---|
| 290 | 'δ':'delta', |
---|
| 291 | 'ε':'epsilon', |
---|
| 292 | 'ζ':'zeta', |
---|
| 293 | 'η':'eta', |
---|
| 294 | 'θ':'theta', |
---|
| 295 | 'ι':'iota', |
---|
| 296 | 'κ':'kappa', |
---|
| 297 | 'λ':'lambda', |
---|
| 298 | 'μ':'mu', |
---|
| 299 | 'ν':'nu', |
---|
| 300 | 'ξ':'xi', |
---|
| 301 | 'ο':'omicron', |
---|
| 302 | 'π':'pi', |
---|
| 303 | 'ρ':'rho', |
---|
| 304 | 'ς':'sigmaf', |
---|
| 305 | 'σ':'sigma', |
---|
| 306 | 'τ':'tau', |
---|
| 307 | 'υ':'upsilon', |
---|
| 308 | 'φ':'phi', |
---|
| 309 | 'χ':'chi', |
---|
| 310 | 'ψ':'psi', |
---|
| 311 | 'ω':'omega' |
---|
| 312 | } ; |
---|
| 313 | |
---|
| 314 | for ( e in oEntities ) |
---|
| 315 | { |
---|
| 316 | FCKXHtmlEntities.Entities[ e ] = oEntities[ e ] ; |
---|
| 317 | sChars += e ; |
---|
| 318 | } |
---|
| 319 | |
---|
| 320 | oEntities = null ; |
---|
| 321 | } |
---|
| 322 | } |
---|
| 323 | else |
---|
| 324 | { |
---|
| 325 | FCKXHtmlEntities.Entities = {} ; |
---|
| 326 | |
---|
| 327 | // Even if we are not processing the entities, we must render the |
---|
| 328 | // correctly. As we don't want HTML entities, let's use its numeric |
---|
| 329 | // representation ( ). |
---|
| 330 | sChars = ' ' ; |
---|
| 331 | } |
---|
| 332 | |
---|
| 333 | // Create the Regex used to find entities in the text. |
---|
| 334 | var sRegexPattern = '[' + sChars + ']' ; |
---|
| 335 | |
---|
| 336 | if ( FCKConfig.ProcessNumericEntities ) |
---|
| 337 | sRegexPattern = '[^ -~]|' + sRegexPattern ; |
---|
| 338 | |
---|
| 339 | var sAdditional = FCKConfig.AdditionalNumericEntities ; |
---|
| 340 | |
---|
| 341 | if ( sAdditional && sAdditional.length > 0 ) |
---|
| 342 | sRegexPattern += '|' + FCKConfig.AdditionalNumericEntities ; |
---|
| 343 | |
---|
| 344 | FCKXHtmlEntities.EntitiesRegex = new RegExp( sRegexPattern, 'g' ) ; |
---|
| 345 | } |
---|