~ubuntu-branches/ubuntu/natty/moin/natty-updates

« back to all changes in this revision

Viewing changes to MoinMoin/web/static/htdocs/applets/FCKeditor/editor/_source/internals/fckxhtmlentities.js

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2008-06-22 21:17:13 UTC
  • mto: This revision was merged to the branch mainline in revision 18.
  • Revision ID: james.westby@ubuntu.com-20080622211713-inlv5k4eifxckelr
Import upstream version 1.7.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
3
 
 * Copyright (C) 2003-2010 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
 
                        '\u2308':'lceil',
137
 
                        '\u2309':'rceil',
138
 
                        '\u230a':'lfloor',
139
 
                        '\u230b':'rfloor',
140
 
                        '\u2329':'lang',
141
 
                        '\u232a':'rang',
142
 
                        '◊':'loz',
143
 
                        '♠':'spades',
144
 
                        '♣':'clubs',
145
 
                        '♥':'hearts',
146
 
                        '♦':'diams',
147
 
 
148
 
                        // Other Special Characters
149
 
 
150
 
                        '"':'quot',
151
 
                //      '&':'amp',              // This entity is automatically handled by the XHTML parser.
152
 
                //      '<':'lt',               // This entity is automatically handled by the XHTML parser.
153
 
                        '>':'gt',                       // Opera and Safari don't encode it in their implementation
154
 
                        'ˆ':'circ',
155
 
                        '˜':'tilde',
156
 
                        ' ':'ensp',
157
 
                        ' ':'emsp',
158
 
                        ' ':'thinsp',
159
 
                        '‌':'zwnj',
160
 
                        '‍':'zwj',
161
 
                        '‎':'lrm',
162
 
                        '‏':'rlm',
163
 
                        '–':'ndash',
164
 
                        '—':'mdash',
165
 
                        '‘':'lsquo',
166
 
                        '’':'rsquo',
167
 
                        '‚':'sbquo',
168
 
                        '“':'ldquo',
169
 
                        '”':'rdquo',
170
 
                        '„':'bdquo',
171
 
                        '†':'dagger',
172
 
                        '‡':'Dagger',
173
 
                        '‰':'permil',
174
 
                        '‹':'lsaquo',
175
 
                        '›':'rsaquo',
176
 
                        '€':'euro'
177
 
                } ;
178
 
 
179
 
                // Process Base Entities.
180
 
                for ( e in FCKXHtmlEntities.Entities )
181
 
                        sChars += e ;
182
 
 
183
 
                // Include Latin Letters Entities.
184
 
                if ( FCKConfig.IncludeLatinEntities )
185
 
                {
186
 
                        oEntities = {
187
 
                                'À':'Agrave',
188
 
                                'Á':'Aacute',
189
 
                                'Â':'Acirc',
190
 
                                'Ã':'Atilde',
191
 
                                'Ä':'Auml',
192
 
                                'Å':'Aring',
193
 
                                'Æ':'AElig',
194
 
                                'Ç':'Ccedil',
195
 
                                'È':'Egrave',
196
 
                                'É':'Eacute',
197
 
                                'Ê':'Ecirc',
198
 
                                'Ë':'Euml',
199
 
                                'Ì':'Igrave',
200
 
                                'Í':'Iacute',
201
 
                                'Î':'Icirc',
202
 
                                'Ï':'Iuml',
203
 
                                'Ð':'ETH',
204
 
                                'Ñ':'Ntilde',
205
 
                                'Ò':'Ograve',
206
 
                                'Ó':'Oacute',
207
 
                                'Ô':'Ocirc',
208
 
                                'Õ':'Otilde',
209
 
                                'Ö':'Ouml',
210
 
                                'Ø':'Oslash',
211
 
                                'Ù':'Ugrave',
212
 
                                'Ú':'Uacute',
213
 
                                'Û':'Ucirc',
214
 
                                'Ü':'Uuml',
215
 
                                'Ý':'Yacute',
216
 
                                'Þ':'THORN',
217
 
                                'ß':'szlig',
218
 
                                'à':'agrave',
219
 
                                'á':'aacute',
220
 
                                'â':'acirc',
221
 
                                'ã':'atilde',
222
 
                                'ä':'auml',
223
 
                                'å':'aring',
224
 
                                'æ':'aelig',
225
 
                                'ç':'ccedil',
226
 
                                'è':'egrave',
227
 
                                'é':'eacute',
228
 
                                'ê':'ecirc',
229
 
                                'ë':'euml',
230
 
                                'ì':'igrave',
231
 
                                'í':'iacute',
232
 
                                'î':'icirc',
233
 
                                'ï':'iuml',
234
 
                                'ð':'eth',
235
 
                                'ñ':'ntilde',
236
 
                                'ò':'ograve',
237
 
                                'ó':'oacute',
238
 
                                'ô':'ocirc',
239
 
                                'õ':'otilde',
240
 
                                'ö':'ouml',
241
 
                                'ø':'oslash',
242
 
                                'ù':'ugrave',
243
 
                                'ú':'uacute',
244
 
                                'û':'ucirc',
245
 
                                'ü':'uuml',
246
 
                                'ý':'yacute',
247
 
                                'þ':'thorn',
248
 
                                'ÿ':'yuml',
249
 
                                'Œ':'OElig',
250
 
                                'œ':'oelig',
251
 
                                'Š':'Scaron',
252
 
                                'š':'scaron',
253
 
                                'Ÿ':'Yuml'
254
 
                        } ;
255
 
 
256
 
                        for ( e in oEntities )
257
 
                        {
258
 
                                FCKXHtmlEntities.Entities[ e ] = oEntities[ e ] ;
259
 
                                sChars += e ;
260
 
                        }
261
 
 
262
 
                        oEntities = null ;
263
 
                }
264
 
 
265
 
                // Include Greek Letters Entities.
266
 
                if ( FCKConfig.IncludeGreekEntities )
267
 
                {
268
 
                        oEntities = {
269
 
                                'Α':'Alpha',
270
 
                                'Β':'Beta',
271
 
                                'Γ':'Gamma',
272
 
                                'Δ':'Delta',
273
 
                                'Ε':'Epsilon',
274
 
                                'Ζ':'Zeta',
275
 
                                'Η':'Eta',
276
 
                                'Θ':'Theta',
277
 
                                'Ι':'Iota',
278
 
                                'Κ':'Kappa',
279
 
                                'Λ':'Lambda',
280
 
                                'Μ':'Mu',
281
 
                                'Ν':'Nu',
282
 
                                'Ξ':'Xi',
283
 
                                'Ο':'Omicron',
284
 
                                'Π':'Pi',
285
 
                                'Ρ':'Rho',
286
 
                                'Σ':'Sigma',
287
 
                                'Τ':'Tau',
288
 
                                'Υ':'Upsilon',
289
 
                                'Φ':'Phi',
290
 
                                'Χ':'Chi',
291
 
                                'Ψ':'Psi',
292
 
                                'Ω':'Omega',
293
 
                                'α':'alpha',
294
 
                                'β':'beta',
295
 
                                'γ':'gamma',
296
 
                                'δ':'delta',
297
 
                                'ε':'epsilon',
298
 
                                'ζ':'zeta',
299
 
                                'η':'eta',
300
 
                                'θ':'theta',
301
 
                                'ι':'iota',
302
 
                                'κ':'kappa',
303
 
                                'λ':'lambda',
304
 
                                'μ':'mu',
305
 
                                'ν':'nu',
306
 
                                'ξ':'xi',
307
 
                                'ο':'omicron',
308
 
                                'π':'pi',
309
 
                                'ρ':'rho',
310
 
                                'ς':'sigmaf',
311
 
                                'σ':'sigma',
312
 
                                'τ':'tau',
313
 
                                'υ':'upsilon',
314
 
                                'φ':'phi',
315
 
                                'χ':'chi',
316
 
                                'ψ':'psi',
317
 
                                'ω':'omega',
318
 
                                '\u03d1':'thetasym',
319
 
                                '\u03d2':'upsih',
320
 
                                '\u03d6':'piv'
321
 
                        } ;
322
 
 
323
 
                        for ( e in oEntities )
324
 
                        {
325
 
                                FCKXHtmlEntities.Entities[ e ] = oEntities[ e ] ;
326
 
                                sChars += e ;
327
 
                        }
328
 
 
329
 
                        oEntities = null ;
330
 
                }
331
 
        }
332
 
        else
333
 
        {
334
 
                FCKXHtmlEntities.Entities = {
335
 
                        '>':'gt' // Opera and Safari don't encode it in their implementation
336
 
                } ;
337
 
                sChars = '>';
338
 
 
339
 
                // Even if we are not processing the entities, we must render the &nbsp;
340
 
                // correctly. As we don't want HTML entities, let's use its numeric
341
 
                // representation (&#160).
342
 
                sChars += ' ' ;
343
 
        }
344
 
 
345
 
        // Create the Regex used to find entities in the text.
346
 
        var sRegexPattern = '[' + sChars + ']' ;
347
 
 
348
 
        if ( FCKConfig.ProcessNumericEntities )
349
 
                sRegexPattern = '[^ -~]|' + sRegexPattern ;
350
 
 
351
 
        var sAdditional = FCKConfig.AdditionalNumericEntities ;
352
 
 
353
 
        if ( sAdditional && sAdditional.length > 0 )
354
 
                sRegexPattern += '|' + FCKConfig.AdditionalNumericEntities ;
355
 
 
356
 
        FCKXHtmlEntities.EntitiesRegex = new RegExp( sRegexPattern, 'g' ) ;
357
 
}