[ Index ]
 

Code source de FCKeditor 2.4

Accdez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/editor/_source/internals/ -> fckxhtmlentities.js (source)

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


Gnr le : Sun Feb 25 15:28:05 2007 par Balluche grce PHPXref 0.7