source: extensions/FCKEditor/editor/_source/internals/fckregexlib.js @ 3295

Last change on this file since 3295 was 3295, checked in by patdenice, 15 years ago

New extension added:
FCK Editor (2.0.a)

File size: 3.9 KB
Line 
1/*
2 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
3 * Copyright (C) 2003-2009 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 * These are some Regular Expressions used by the editor.
22 */
23
24var FCKRegexLib =
25{
26// This is the Regular expression used by the SetData method for the "'" entity.
27AposEntity              : /'/gi ,
28
29// Used by the Styles combo to identify styles that can't be applied to text.
30ObjectElements  : /^(?:IMG|TABLE|TR|TD|TH|INPUT|SELECT|TEXTAREA|HR|OBJECT|A|UL|OL|LI)$/i ,
31
32// List all named commands (commands that can be interpreted by the browser "execCommand" method.
33NamedCommands   : /^(?:Cut|Copy|Paste|Print|SelectAll|RemoveFormat|Unlink|Undo|Redo|Bold|Italic|Underline|StrikeThrough|Subscript|Superscript|JustifyLeft|JustifyCenter|JustifyRight|JustifyFull|Outdent|Indent|InsertOrderedList|InsertUnorderedList|InsertHorizontalRule)$/i ,
34
35BeforeBody      : /(^[\s\S]*\<body[^\>]*\>)/i,
36AfterBody       : /(\<\/body\>[\s\S]*$)/i,
37
38// Temporary text used to solve some browser specific limitations.
39ToReplace               : /___fcktoreplace:([\w]+)/ig ,
40
41// Get the META http-equiv attribute from the tag.
42MetaHttpEquiv   : /http-equiv\s*=\s*["']?([^"' ]+)/i ,
43
44HasBaseTag              : /<base /i ,
45HasBodyTag              : /<body[\s|>]/i ,
46
47HtmlOpener              : /<html\s?[^>]*>/i ,
48HeadOpener              : /<head\s?[^>]*>/i ,
49HeadCloser              : /<\/head\s*>/i ,
50
51// Temporary classes (Tables without border, Anchors with content) used in IE
52FCK_Class               : /\s*FCK__[^ ]*(?=\s+|$)/ ,
53
54// Validate element names (it must be in lowercase).
55ElementName             : /(^[a-z_:][\w.\-:]*\w$)|(^[a-z_]$)/ ,
56
57// Used in conjunction with the FCKConfig.ForceSimpleAmpersand configuration option.
58ForceSimpleAmpersand : /___FCKAmp___/g ,
59
60// Get the closing parts of the tags with no closing tags, like <br/>... gets the "/>" part.
61SpaceNoClose    : /\/>/g ,
62
63// Empty elements may be <p></p> or even a simple opening <p> (see #211).
64EmptyParagraph  : /^<(p|div|address|h\d|center)(?=[ >])[^>]*>\s*(<\/\1>)?$/ ,
65
66EmptyOutParagraph : /^<(p|div|address|h\d|center)(?=[ >])[^>]*>(?:\s*|&nbsp;)(<\/\1>)?$/ ,
67
68TagBody                 : /></ ,
69
70GeckoEntitiesMarker : /#\?-\:/g ,
71
72// We look for the "src" and href attribute with the " or ' or without one of
73// them. We have to do all in one, otherwise we will have problems with URLs
74// like "thumbnail.php?src=someimage.jpg" (SF-BUG 1554141).
75ProtectUrlsImg  : /<img(?=\s).*?\ssrc=((?:(?:\s*)("|').*?\2)|(?:[^"'][^ >]+))/gi ,
76ProtectUrlsA    : /<a(?=\s).*?\shref=((?:(?:\s*)("|').*?\2)|(?:[^"'][^ >]+))/gi ,
77ProtectUrlsArea : /<area(?=\s).*?\shref=((?:(?:\s*)("|').*?\2)|(?:[^"'][^ >]+))/gi ,
78
79Html4DocType    : /HTML 4\.0 Transitional/i ,
80DocTypeTag              : /<!DOCTYPE[^>]*>/i ,
81HtmlDocType             : /DTD HTML/ ,
82
83// These regex are used to save the original event attributes in the HTML.
84TagsWithEvent   : /<[^\>]+ on\w+[\s\r\n]*=[\s\r\n]*?('|")[\s\S]+?\>/g ,
85EventAttributes : /\s(on\w+)[\s\r\n]*=[\s\r\n]*?('|")([\s\S]*?)\2/g,
86ProtectedEvents : /\s\w+_fckprotectedatt="([^"]+)"/g,
87
88StyleProperties : /\S+\s*:/g,
89
90// [a-zA-Z0-9:]+ seams to be more efficient than [\w:]+
91InvalidSelfCloseTags : /(<(?!base|meta|link|hr|br|param|img|area|input)([a-zA-Z0-9:]+)[^>]*)\/>/gi,
92
93// All variables defined in a style attribute or style definition. The variable
94// name is returned with $2.
95StyleVariableAttName : /#\(\s*("|')(.+?)\1[^\)]*\s*\)/g,
96
97RegExp : /^\/(.*)\/([gim]*)$/,
98
99HtmlTag : /<[^\s<>](?:"[^"]*"|'[^']*'|[^<])*>/
100} ;
Note: See TracBrowser for help on using the repository browser.