Merge "Expand highlighting support for syntaxhighlight module"

This commit is contained in:
jenkins-bot 2013-11-01 21:24:06 +00:00 committed by Gerrit Code Review
commit 1ca353a34d
7 changed files with 269 additions and 13 deletions

View file

@ -15,18 +15,23 @@ ve.ce.MWSyntaxHighlightHighlighter = function VeCeMWSyntaxHighlightHighlighter(
// Highlighter rule cache
this.ruleset = {};
this.delimiter = /\n/;
// Properties
// 'languageName' : boolean ;set to false to disable support
this.langSupport = {
'text' : true,
'javascript' : true
};
// Go to the following page for explanations on language rule files
// https://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi/VisualEditor
this.rulePath = ve.init.platform.getModulesUrl() + '/syntaxhighlight/rules/';
this.lang = lang;
this.validators = new ve.ce.MWSyntaxHighlightValidator();
this.roster = this.validators.getRoster();
// Properties
// 'languageName' : [boolean, string];set to false to disable support, string for language name
this.langSupport = {
'text' : [true, 'Plain text'],
'javascript' : [true, 'JavaScript'],
'bf' : [true, 'Brainfuck'],
'ruby' : [true, 'Ruby'],
'python' : [true, 'Python'],
'mysql' : [true, 'MySQL'],
'jquery' : [true, 'jQuery']
};
};
/* Methods */
@ -338,6 +343,21 @@ ve.ce.MWSyntaxHighlightHighlighter.prototype.getSupportedLanguages = function ()
return this.langSupport;
};
/**
* Get the name of this language
*
* @method
* @param {String} (Optional) Language to be referenced
* @returns {String} Language name
*/
ve.ce.MWSyntaxHighlightHighlighter.prototype.getLanguageName = function ( lang ) {
if (lang === undefined){
return this.langSupport[ this.lang ][1];
} else {
return this.langSupport[ lang ][1];
}
};
/**
* Check whether the language is supported
*
@ -355,7 +375,7 @@ ve.ce.MWSyntaxHighlightHighlighter.prototype.isSupportedLanguage = function () {
* @returns {boolean}
*/
ve.ce.MWSyntaxHighlightHighlighter.prototype.isEnabledLanguage = function () {
return this.langSupport[ this.lang ];
return this.langSupport[ this.lang ][0];
};
/**

View file

@ -0,0 +1,12 @@
{
"highlighter" :
[
{
"match" : "/(\\+|-|\\[|\\]|Y|<|>|,|\\.)/g",
"style" : "ve-ce-mwSynHi-symbol"
}
],
"validator" :
[
]
}

View file

@ -0,0 +1,60 @@
{
"highlighter" :
[
{
"match" : "/(\\+|-|\\*|\\/|%|\\!|@|&|\\||\\^|<|>|\\=|,|;|\\?|:|\\.)/g",
"style" : "ve-ce-mwSynHi-symbol"
},
{
"match" : "/[\\W|^]((break|case|catch|const|continue|default|delete|do|else|finally|for|function|get|goto|if|in|instanceof|new|prototype|return|set|static|switch|this|throw|try|typeof|var|void))(?!\\w)/gm",
"style" : "ve-ce-mwSynHi-keyword"
},
{
"match" : "/[\\W|^]((false|null|true|undefined|NaN|Infinity))(?!\\w)/g",
"style" : "ve-ce-mwSynHi-metaconstant"
},
{
"match" : "/[\\W|^]((__proto__|__defineGetter__|__defineSetter__|hasOwnProperty|hasProperty|jQuery|each|size|length|selector|context|eq|index|data|removeData|queue|dequeue|noConflictattr|removeAttr|addClass|hasClass|removeClass|toggleClass|html|text|val|filter|not|slice|add|children|closest|contents|find|next|nextAll|parent|parents|prev|prevAll|siblings|andSelf|end|append|appendTo|prepend|prependTo|after|before|insertAfter|insertBefore|wrap|wrapAll|wrapInner|replaceWith|replaceAll|empty|remove|clone|css|offset|offsetParent|position|scrollTop|scrollLeft|height|width|innerHeight|innerWidth|outerHeight|outerWidth|ready|bind|one|trigger|triggerHandler|unbind|live|die|hover|blur|change|click|dblclick|error|focus|keydown|keypress|keyup|mousedown|mouseenter|mouseleave|mousemove|mouseout|mouseover|mouseup|resize|scroll|select|submit|unload|show|hide|toggle|slideDown|slideUp|slideToggle|fadeIn|fadeOut|fadeTo|animate|stop|ajax|load|get|getJSON|getScript|post|ajaxComplete|ajaxError|ajaxSend|ajaxStart|ajaxStop|ajaxSuccess|ajaxSetup|serialize|serializeArray|support|browser|version|boxModal|extend|grep|makeArray|map|inArray|merge|unique|isArray|isFunction|trim|param))(?!\\w)/g",
"style" : "ve-ce-mwSynHi-magicwords"
},
{
"match" : "/[\\W|^]((Object|Function|Date|Math|String|Number|Boolean|Array))(?!\\w)/g",
"style" : "ve-ce-mwSynHi-typeconstructor"
},
{
"match" : "/[\\W|^]((abstract|boolean|byte|char|class|debugger|double|enum|export|extends|final|float|implements|import|int|interface|long|native|short|super|synchronized|throws|transient|volatile))(?!\\w)/g",
"style" : "ve-ce-mwSynHi-reserved"
},
{
"match" : "/(\\\\)/g",
"style" : "ve-ce-mwSynHi-escape"
},
{
"match" : "/(\\(|\\)|\\[|\\]|\\{|\\})/g",
"style" : "ve-ce-mwSynHi-bracket"
},
{
"match" : "/(['\\\"][^]*?['\\\"])/g",
"style" : "ve-ce-mwSynHi-string"
},
{
"match" : "/\\W([0-9]+)(?!\\w)/g",
"style" : "ve-ce-mwSynHi-number"
},
{
"match" : "/(\\w*)\\(\\)/g",
"style" : "ve-ce-mwSynHi-method"
},
{
"match" : "/(\\/\\/.*$)/gm",
"style" : "ve-ce-mwSynHi-comment-single"
},
{
"match" : "/(\\/\\*[^]*?\\*\\/)/g",
"style" : "ve-ce-mwSynHi-comment-multi"
}
],
"validator" :
[
]
}

View file

@ -0,0 +1,56 @@
{
"highlighter" :
[
{
"match" : "/(\\=|:\\=|\\|\\||\\&\\&|!|=|<=>|>=|>|<=|<|<>|!=|\\||\\&|\\^|~|<<|>>|-|\\+|\\*|/|\\%|\\(|\\)|,|;|)/g",
"style" : "ve-ce-mwSynHi-symbol"
},
{
"match" : "/[\\W|^]((ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|ASC|AS|BDB|BEGIN|BERKELEYDB|BINARY|BTREE|CALL|CASCADED|CASCADE|CHAIN|CHANGE|CHECK|COLUMNS|COLUMN|COMMENT|COMMIT|COMMITTED|CONSTRAINT|CONTAINSSQL|CONSISTENT|CONVERT|CREATE|CROSS|DATA|DATABASES|DECLARE|DEFINER|DELAYED|DELETE|DESCRIBE|DESC|DETERMINISTIC|DISABLE|DISCARD|DISTINCTROW|DISTINCT|DO|DROP|DUMPFILE|DUPLICATEKEY|ENABLE|ENCLOSEDBY|ENGINE|ERRORS|ESCAPEDBY|EXISTS|EXPLAIN|EXTENDED|FIELDS|FIRST|FOREACHROW|FORCE|FOREIGNKEY|FROM|FULL|FUNCTION|GLOBAL|GRANT|GROUPBY|HANDLER|HASH|HAVING|HELP|HIGH_PRIORITY|IFNOTEXISTS|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INTO|INVOKER|ISOLATIONLEVEL|JOIN|KEYS|KEY|KILL|LANGUAGESQL|LAST|LIMIT|LINES|LOAD|LOCAL|LOCK|LOW_PRIORITY|MASTER_SERVER_ID|MATCH|MERGE|MIDDLEINT|MODIFIESSQLDATA|MODIFY|MRG_MYISAM|NATURAL|NEXT|NOSQL|NO|ON|OPTIMIZE|OPTIONALLY|OPTION|ORDERBY|OUTER|OUTFILE|OUT|PARTIAL|PARTITION|PREV|PRIMARYKEY|PRIVILEGES|PROCEDURE|PURGE|QUICK|READSSQLDATA|READ|REFERENCES|RELEASE|RENAME|REORGANIZE|REPEATABLE|REQUIRE|RESTRICT|RETURNS|REVOKE|ROLLBACK|ROUTINE|RTREE|SAVEPOINT|SELECT|SERIALIZABLE|SESSION|SET|SHAREMODE|SHOW|SIMPLE|SNAPSHOT|SOME|SONAME|SQLSECURITY|SQL_BIG_RESULT|SQL_BUFFER_RESULT|SQL_CACHE|SQL_CALC_FOUND_ROWS|SQL_NO_CACHE|SQL_SMALL_RESULT|SSL|START|STARTINGBY|STATUS|STRAIGHT_JOIN|STRIPED|TABLESPACE|TABLES|TABLE|TEMPORARY|TEMPTABLE|TERMINATEDBY|TO|TRANSACTIONS|TRANSACTION|TRIGGER|TYPES|TYPE|UNCOMMITTED|UNDEFINED|UNION|UNLOCK_TABLES|UPDATE|USAGE|USE|USER_RESOURCES|USING|VALUES|VALUE|VIEW|WARNINGS|WHERE|WITHROLLUP|WITH|WORK|WRITE))(?!\\w)/gm",
"style" : "ve-ce-mwSynHi-keyword"
},
{
"match" : "/[\\W|^]((FALSE|NULL|TRUE))(?!\\w)/g",
"style" : "ve-ce-mwSynHi-metaconstant"
},
{
"match" : "/[\\W|^]((ASCII|BIN|BIT_LENGTH|CHAR_LENGTH|CHARACTER_LENGTH|CONCAT_WS|CONCAT|ELT|EXPORT_SET|FIELD|FIND_IN_SET|FORMAT|HEX|INSTR|LCASE|LEFT|LENGTH|LOAD_FILE|LOCATE|LOWER|LPAD|LTRIM|MAKE_SET|MID|OCTET_LENGTH|ORD|POSITION|QUOTE|REPEAT|REVERSE|RIGHT|RPAD|RTRIM|SOUNDEX|SPACE|STRCMP|SUBSTRING_INDEX|SUBSTRING|TRIM|UCASE|UNHEX|UPPER|ABS|ACOS|ASIN|ATAN2|ATAN|CEILING|CEIL|CONV|COS|COT|CRC32|DEGREES|EXP|FLOOR|LN|LOG10|LOG2|LOG|MOD|OCT|PI|POWER|POW|RADIANS|RAND|ROUND|SIGN|SIN|SQRT|TAN|ADDDATE|ADDTIME|CONVERT_TZ|CURDATE|CURRENT_DATE|CURRENT_TIME|CURRENT_TIMESTAMP|CURTIME|DATE_ADD|DATE_FORMAT|DATE_SUB|DATEDIFF|DAYNAME|DAYOFMONTH|DAYOFWEEK|DAYOFYEAR|EXTRACT|FROM_DAYS|FROM_UNIXTIME|GET_FORMAT|LAST_DAY|LOCALTIME|LOCALTIMESTAMP|MAKEDATE|MAKETIME|MONTHNAME|NOW|PERIOD_ADD|PERIOD_DIFF|SEC_TO_TIME|STR_TO_DATE|SUBDATE|SUBTIME|SYSDATE|TIME_FORMAT|TIME_TO_SEC|TIMESTAMPADD|TIMESTAMPDIFF|TO_DAYS|UNIX_TIMESTAMP|UTC_DATE|UTC_TIME|UTC_TIMESTAMP|WEEKDAY|WEEKOFYEAR|YEARWEEK|COALESCE|GREATEST|ISNULL|LEAST|AES_DECRYPT|AES_ENCRYPT|COMPRESS|DECODE|DES_DECRYPT|DES_ENCRYPT|ENCODE|ENCRYPT|MD5|OLD_PASSWORD|PASSWORD|SHA1|SHA|UNCOMPRESS|UNCOMPRESSED_LENGTH|AVG|BIT_AND|BIT_OR|BIT_XOR|COUNT|GROUP_CONCAT|MAX|MIN|STDDEV_POP|STDDEV_SAMP|STDDEV|STD|SUM|VAR_POP|VAR_SAMP|VARIANCE|BENCHMARK|COERCIBILITY|COLLATION|CONNECTION_ID|FOUND_ROWS|LAST_INSERT_ID|ROW_COUNT|SESSION_USER|SYSTEM_USER|USER|VERSION|"CURRENT_USER"|"DATABASE"|"SCHEMA"|"CHARSET"ExtractValue|BIT_COUNT|GET_LOCK|INET_ATON|INET_NTOA|IS_FREE_LOCK|IS_USED_LOCK|MASTER_POS_WAIT|NAME_CONST|RELEASE_LOCK|SLEEP|UpdateXML|UUID|Area|AsBinary|AsText|AsWKB|AsWKT|Boundary|Buffer|Centroid|Contains|ConvexHull|Crosses|Difference|Dimension|Disjoint|Distance|EndPoint|Envelope|Equals|ExteriorRing|GLength|GeomCollFromText|GeomCollFromWKB|GeomFromText|GeomFromWKB|GeometryCollectionFromText|GeometryCollectionFromWKB|GeometryFromText|GeometryFromWKB|GeometryN|GeometryType|InteriorRingN|Intersection|Intersects|IsClosed|IsEmpty|IsRing|IsSimple|LineFromText|LineFromWKB|LineStringFromText|LineStringFromWKB|MBRContains|MBRDisjoint|MBREqual|MBRIntersects|MBROverlaps|MBRTouches|MBRWithin|MLineFromText|MLineFromWKB|MPointFromText|MPointFromWKB|MPolyFromText|MPolyFromWKB|MultiLineStringFromText|MultiLineStringFromWKB|MultiPointFromText|MultiPointFromWKB|MultiPolygonFromText|MultiPolygonFromWKB|NumGeometries|NumInteriorRings|NumPoints|Overlaps|PointFromText|PointFromWKB|PointN|PointOnSurface|PolyFromText|PolyFromWKB|PolygonFromText|PolygonFromWKB|Related|SRID|StartPoint|SymDifference|Touches|Union|Within|X|Y))(?!\\w)/g",
"style" : "ve-ce-mwSynHi-magicwords"
},
{
"match" : "/[\\W|^]((BIGINT|BIT|BLOB|BOOLEAN|BOOL|CHARACTERVARYING|CHARVARYING|DATETIME|DECIMAL|DEC|DOUBLEPRECISION|DOUBLE|ENUM|FIXED|FLOAT|GEOMETRYCOLLECTION|GEOMETRY|INTEGER|INT|LINESTRING|LONGBLOB|LONGTEXT|MEDIUMBLOB|MEDIUMINT|MEDIUMTEXT|MULTIPOINT|MULTILINESTRING|MULTIPOLYGON|NATIONALCHARACTER|NATIONALCHARACTERVARYING|NATIONALCHARVARYING|NATIONALVARCHAR|NCHARVARCHAR|NCHAR|NUMERIC|POINT|POLYGON|REAL|SERIAL|SMALLINT|TEXT|TIMESTAMP|TINYBLOB|TINYINT|TINYTEXT|VARBINARY|VARCHARACTER|VARCHAR))(?!\\w)/g",
"style" : "ve-ce-mwSynHi-typeconstructor"
},
{
"match" : "/[\\W|^]((AUTO_INCREMENT|AVG_ROW_LENGTH|BOTH|CHECKSUM|CONNECTION|DATADIRECTORY|DEFAULTNULL|DELAY_KEY_WRITE|FULLTEXT|INDEXDIRECTORY|INSERT_METHOD|LEADING|MAX_ROWS|MIN_ROWS|NOTNULL|PACK_KEYS|ROW_FORMAT|SERIALDEFAULTVALUE|SIGNED|SPATIAL|TRAILING|UNIQUE|UNSIGNED|ZEROFILL|AND|BETWEEN|CHARACTERSET|COLLATE|DIV|ISNOTNULL|ISNOT|ISNULL|IS|LIKE|NOT|OFFSET|OR|REGEXP|RLIKE|SOUNDSLIKE|XOR|INTERVAL|DAY_HOUR|DAY_MICROSECOND|DAY_MINUTE|DAY_SECOND|HOUR_MICROSECOND|HOUR_MINUTE|HOUR_SECOND|MINUTE_MICROSECOND|MINUTE_SECOND|SECOND_MICROSECOND|YEAR_MONTH))(?!\\w)/g",
"style" : "ve-ce-mwSynHi-reserved"
},
{
"match" : "/(\\\\)/g",
"style" : "ve-ce-mwSynHi-escape"
},
{
"match" : "/(\\(|\\)|\\[|\\]|\\{|\\})/g",
"style" : "ve-ce-mwSynHi-bracket"
},
{
"match" : "/([`'\\\"][^]*?[`'\\\"])/g",
"style" : "ve-ce-mwSynHi-string"
},
{
"match" : "/\\W([0-9]+)(?!\\w)/g",
"style" : "ve-ce-mwSynHi-number"
},
{
"match" : "/([--\\s|#].*$)/gm",
"style" : "ve-ce-mwSynHi-comment-single"
},
{
"match" : "/(\\/\\*[^]*?\\*\\/)/g",
"style" : "ve-ce-mwSynHi-comment-multi"
}
],
"validator" :
[
]
}

View file

@ -0,0 +1,56 @@
{
"highlighter" :
[
{
"match" : "/(<|>|=|!|<\\=|>\\=|~|@|;|,|)/g",
"style" : "ve-ce-mwSynHi-symbol"
},
{
"match" : "/[\\W|^]((and|del|for|is|raise|assert|elif|from|lambda|return|break|else|global|not|try|class|except|if|or|while|continue|exec|import|pass|yield|def|finally|in|print|with|as|nonlocal|__builtin__|__future__|__main__|_winreg|aifc|AL|al|anydbm|array|asynchat|asyncore|atexit|audioop|base64|BaseHTTPServer|Bastion|binascii|binhex|bisect|bsddb|bz2|calendar|cd|cgi|CGIHTTPServer|cgitb|chunk|cmath|cmd|code|codecs|codeop|collections|colorsys|commands|compileall|compiler|ConfigParser|Cookie|cookielib|copy|copy_reg|cPickle|crypt|cStringIO|csv|curses|datetime|dbhash|dbm|decimal|DEVICE|difflib|dircache|dis|distutils|dl|doctest|DocXMLRPCServer|dumbdbm|dummy_thread|dummy_threading|email|encodings|errno|exceptions|fcntl|filecmp|fileinput|FL|fl|flp|fm|fnmatch|formatter|fpectl|fpformat|ftplib|gc|gdbm|getopt|getpass|gettext|GL|gl|glob|gopherlib|grp|gzip|heapq|hmac|hotshot|htmlentitydefs|htmllib|HTMLParser|httplib|imageop|imaplib|imgfile|imghdr|imp|inspect|itertools|jpeg|keyword|linecache|locale|logging|mailbox|mailcap|marshal|math|md5|mhlib|mimetools|mimetypes|MimeWriter|mimify|mmap|msvcrt|multifile|mutex|netrc|new|nis|nntplib|operator|optparse|os|ossaudiodev|parser|pdb|pickle|pickletools|pipes|pkgutil|platform|popen2|poplib|posix|posixfile|pprint|profile|pstats|pty|pwd|py_compile|pyclbr|pydoc|Queue|quopri|random|re|readline|repr|resource|rexec|rfc822|rgbimg|rlcompleter|robotparser|sched|ScrolledText|select|sets|sgmllib|sha|shelve|shlex|shutil|signal|SimpleHTTPServer|SimpleXMLRPCServer|site|smtpd|smtplib|sndhdr|socket|SocketServer|stat|statcache|statvfs|string|StringIO|stringprep|struct|subprocess|sunau|SUNAUDIODEV|sunaudiodev|symbol|sys|syslog|tabnanny|tarfile|telnetlib|tempfile|termios|test|textwrap|thread|threading|time|timeit|Tix|Tkinter|token|tokenize|traceback|tty|turtle|types|unicodedata|unittest|urllib2|urllib|urlparse|user|UserDict|UserList|UserString|uu|warnings|wave|weakref|webbrowser|whichdb|whrandom|winsound|xdrlib|xml|xmllib|xmlrpclib|zipfile|zipimport|zlib|bytes|bytearray|self|any|all))(?!\\w)/gm",
"style" : "ve-ce-mwSynHi-keyword"
},
{
"match" : "/[\\W|^]((False|True|None|NotImplemented|Ellipsis|Exception|StandardError|ArithmeticError|LookupError|EnvironmentError|AssertionError|AttributeError|EOFError|FloatingPointError|IOError|ImportError|IndexError|KeyError|KeyboardInterrupt|MemoryError|NameError|NotImplementedError|OSError|OverflowError|ReferenceError|RuntimeError|StopIteration|SyntaxError|SystemError|SystemExit|TypeError|UnboundlocalError|UnicodeError|UnicodeEncodeError|UnicodeDecodeError|UnicodeTranslateError|ValueError|WindowsError|ZeroDivisionError|Warning|UserWarning|DeprecationWarning|PendingDeprecationWarning|SyntaxWarning|RuntimeWarning|FutureWarning))(?!\\w)/g",
"style" : "ve-ce-mwSynHi-metaconstant"
},
{
"match" : "/[\\W|^]((__import__|abs|basestring|bool|callable|chr|classmethod|cmp|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|isinstance|issubclass|iter|len|list|locals|long|map|max|min|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip))(?!\\w)/g",
"style" : "ve-ce-mwSynHi-magicwords"
},
{
"match" : "/[\\W|^]((__new__|__init__|__del__|__repr__|__str__|__lt__|__le__|__eq__|__ne__|__gt__|__ge__|__cmp__|__rcmp__|__hash__|__nonzero__|__unicode__|__dict__|__setattr__|__delattr__|__getattr__|__getattribute__|__get__|__set__|__delete__|__slots__|__metaclass__|__call__|__len__|__getitem__|__setitem__|__delitem__|__iter__|__contains__|__getslice__|__setslice__|__delslice__|__abs__|__add__|__and__|__coerce__|__div__|__divmod__|__float__|__hex__|__iadd__|__isub__|__imod__|__idiv__|__ipow__|__iand__|__ior__|__ixor__|__ilshift__|__irshift__|__invert__|__int__|__long__|__lshift__|__mod__|__mul__|__neg__|__oct__|__or__|__pos__|__pow__|__radd__|__rdiv__|__rdivmod__|__rmod__|__rpow__|__rlshift__|__rrshift__|__rshift__|__rsub__|__rmul__|__rand__|__rxor__|__ror__|__sub__|__xor__))(?!\\w)/g",
"style" : "ve-ce-mwSynHi-reserved"
},
{
"match" : "/[\\W|^]((Abbrev|ArgumentError|Base64|Benchmark|Benchmark::Tms|Bignum|Binding|CGI|CGI::Cookie|CGI::HtmlExtension|CGI::QueryExtension|CGI::Session|CGI::Session::FileStore|CGI::Session::MemoryStore|Class|Comparable|Complex|ConditionVariable|Continuation|Data|Date|DateTime|Delegator|Dir|EOFError|ERB|ERB::Util|Enumerable|Enumerable::Enumerator|Errno|Exception|FalseClass|File|File::Constants|File::Stat|FileTest|FileUtils|FileUtils::DryRun|FileUtils::NoWrite|FileUtils::StreamUtils_|FileUtils::Verbose|Find|Fixnum|FloatDomainError|Forwardable|GC|Generator|Hash|IO|IOError|Iconv|Iconv::BrokenLibrary|Iconv::Failure|Iconv::IllegalSequence|Iconv::InvalidCharacter|Iconv::InvalidEncoding|Iconv::OutOfRange|IndexError|Interrupt|Kernel|LoadError|LocalJumpError|Logger|Logger::Application|Logger::Error|Logger::Formatter|Logger::LogDevice|Logger::LogDevice::LogDeviceMutex|Logger::Severity|Logger::ShiftingError|Marshal|MatchData|Math|Matrix|Method|Module|Mutex|NameError|NameError::message|NilClass|NoMemoryError|NoMethodError|NotImplementedError|Numeric|Object|ObjectSpace|Observable|PStore|PStore::Error|Pathname|Precision|Proc|Process|Process::GID|Process::Status|Process::Sys|Process::UID|Queue|Range|RangeError|Rational|Regexp|RegexpError|RuntimeError|ScriptError|SecurityError|Set|Shellwords|Signal|SignalException|SimpleDelegator|SingleForwardable|Singleton|SingletonClassMethods|SizedQueue|SortedSet|StandardError|StringIO|StringScanner|StringScanner::Error|Struct|Symbol|SyncEnumerator|SyntaxError|SystemCallError|SystemExit|SystemStackError|Tempfile|Test::Unit::TestCase|Test::Unit|Test|Thread|ThreadError|ThreadGroup|ThreadsWait|Time|TrueClass|TypeError|URI|URI::BadURIError|URI::Error|URI::Escape|URI::FTP|URI::Generic|URI::HTTP|URI::HTTPS|URI::InvalidComponentError|URI::InvalidURIError|URI::LDAP|URI::MailTo|URI::REGEXP|URI::REGEXP::PATTERN|UnboundMethod|Vector|YAML|ZeroDivisionError|Zlib|Zlib::BufError|Zlib::DataError|Zlib::Deflate|Zlib::Error|Zlib::GzipFile|Zlib::GzipFile::CRCError|Zlib::GzipFile::Error|Zlib::GzipFile::LengthError|Zlib::GzipFile::NoFooter|Zlib::GzipReader|Zlib::GzipWriter|Zlib::Inflate|Zlib::MemError|Zlib::NeedDict|Zlib::StreamEnd|Zlib::StreamError|Zlib::VersionError|Zlib::ZStream|HTML::Selector|HashWithIndifferentAccess|Inflector|Inflector::Inflections|Mime|Mime::Type|OCI8AutoRecover|TimeZone|XmlSimple))(?!\\w)/g",
"style" : "ve-ce-mwSynHi-typeconstructor"
},
{
"match" : "/(\\\\)/g",
"style" : "ve-ce-mwSynHi-escape"
},
{
"match" : "/(\\(|\\)|\\[|\\]|\\{|\\})/g",
"style" : "ve-ce-mwSynHi-bracket"
},
{
"match" : "/([`'\\\"][^]*?[`'\\\"])/g",
"style" : "ve-ce-mwSynHi-string"
},
{
"match" : "/\\W([0-9]+)(?!\\w)/g",
"style" : "ve-ce-mwSynHi-number"
},
{
"match" : "/(#.*$)/gm",
"style" : "ve-ce-mwSynHi-comment-single"
},
{
"match" : "/(['\\\"]{3}[^]*?['\\\"]{3})/g",
"style" : "ve-ce-mwSynHi-comment-multi"
}
],
"validator" :
[
]
}

View file

@ -0,0 +1,52 @@
{
"highlighter" :
[
{
"match" : "/(\\(|\\)|\\[|\\]|\\{|\\}|\\%|&|\\*|\\||<|>|/|\\+|-|\\=>|<<)/g",
"style" : "ve-ce-mwSynHi-symbol"
},
{
"match" : "/[\\W|^]((alias|and|begin|break|case|class|def|defined|do|else|elsif|end|ensure|for|if|in|module|while|next|not|or|redo|rescue|yield|retry|super|then|undef|unless|until|when|include))(?!\\w)/gm",
"style" : "ve-ce-mwSynHi-keyword"
},
{
"match" : "/[\\W|^]((__FILE__|__LINE__|false|nil|self|true|return))(?!\\w)/g",
"style" : "ve-ce-mwSynHi-metaconstant"
},
{
"match" : "/[\\W|^]((Array|Float|Integer|String|at_exit|autoload|binding|caller|catch|chop|chop!|chomp|chomp!|eval|exec|exit|exit!|fail|fork|format|gets|global_variables|gsub|gsub!|iterator?|lambda|load|local_variables|loop|open|p|print|printf|proc|putc|puts|raise|rand|readline|readlines|require|select|sleep|split|sprintf|srand|sub|sub!|syscall|system|trace_var|trap|untrace_var))(?!\\w)/g",
"style" : "ve-ce-mwSynHi-magicwords"
},
{
"match" : "/[\\W|^]((Abbrev|ArgumentError|Base64|Benchmark|Benchmark::Tms|Bignum|Binding|CGI|CGI::Cookie|CGI::HtmlExtension|CGI::QueryExtension|CGI::Session|CGI::Session::FileStore|CGI::Session::MemoryStore|Class|Comparable|Complex|ConditionVariable|Continuation|Data|Date|DateTime|Delegator|Dir|EOFError|ERB|ERB::Util|Enumerable|Enumerable::Enumerator|Errno|Exception|FalseClass|File|File::Constants|File::Stat|FileTest|FileUtils|FileUtils::DryRun|FileUtils::NoWrite|FileUtils::StreamUtils_|FileUtils::Verbose|Find|Fixnum|FloatDomainError|Forwardable|GC|Generator|Hash|IO|IOError|Iconv|Iconv::BrokenLibrary|Iconv::Failure|Iconv::IllegalSequence|Iconv::InvalidCharacter|Iconv::InvalidEncoding|Iconv::OutOfRange|IndexError|Interrupt|Kernel|LoadError|LocalJumpError|Logger|Logger::Application|Logger::Error|Logger::Formatter|Logger::LogDevice|Logger::LogDevice::LogDeviceMutex|Logger::Severity|Logger::ShiftingError|Marshal|MatchData|Math|Matrix|Method|Module|Mutex|NameError|NameError::message|NilClass|NoMemoryError|NoMethodError|NotImplementedError|Numeric|Object|ObjectSpace|Observable|PStore|PStore::Error|Pathname|Precision|Proc|Process|Process::GID|Process::Status|Process::Sys|Process::UID|Queue|Range|RangeError|Rational|Regexp|RegexpError|RuntimeError|ScriptError|SecurityError|Set|Shellwords|Signal|SignalException|SimpleDelegator|SingleForwardable|Singleton|SingletonClassMethods|SizedQueue|SortedSet|StandardError|StringIO|StringScanner|StringScanner::Error|Struct|Symbol|SyncEnumerator|SyntaxError|SystemCallError|SystemExit|SystemStackError|Tempfile|Test::Unit::TestCase|Test::Unit|Test|Thread|ThreadError|ThreadGroup|ThreadsWait|Time|TrueClass|TypeError|URI|URI::BadURIError|URI::Error|URI::Escape|URI::FTP|URI::Generic|URI::HTTP|URI::HTTPS|URI::InvalidComponentError|URI::InvalidURIError|URI::LDAP|URI::MailTo|URI::REGEXP|URI::REGEXP::PATTERN|UnboundMethod|Vector|YAML|ZeroDivisionError|Zlib|Zlib::BufError|Zlib::DataError|Zlib::Deflate|Zlib::Error|Zlib::GzipFile|Zlib::GzipFile::CRCError|Zlib::GzipFile::Error|Zlib::GzipFile::LengthError|Zlib::GzipFile::NoFooter|Zlib::GzipReader|Zlib::GzipWriter|Zlib::Inflate|Zlib::MemError|Zlib::NeedDict|Zlib::StreamEnd|Zlib::StreamError|Zlib::VersionError|Zlib::ZStream|HTML::Selector|HashWithIndifferentAccess|Inflector|Inflector::Inflections|Mime|Mime::Type|OCI8AutoRecover|TimeZone|XmlSimple))(?!\\w)/g",
"style" : "ve-ce-mwSynHi-typeconstructor"
},
{
"match" : "/(\\\\)/g",
"style" : "ve-ce-mwSynHi-escape"
},
{
"match" : "/(\\(|\\)|\\[|\\]|\\{|\\})/g",
"style" : "ve-ce-mwSynHi-bracket"
},
{
"match" : "/([`'\\\"][^]*?[`'\\\"])/g",
"style" : "ve-ce-mwSynHi-string"
},
{
"match" : "/\\W([0-9]+)(?!\\w)/g",
"style" : "ve-ce-mwSynHi-number"
},
{
"match" : "/(#.*$)/gm",
"style" : "ve-ce-mwSynHi-comment-single"
},
{
"match" : "/(\\=begin[^]*?\\=end)/g",
"style" : "ve-ce-mwSynHi-comment-multi"
}
],
"validator" :
[
]
}

View file

@ -181,18 +181,18 @@ ve.ui.MWSyntaxHighlightSimpleSurface.prototype.initialize = function () {
this.tokenizer = new ve.dm.MWSyntaxHighlightTokenizer();
this.highlighter = new ve.ce.MWSyntaxHighlightHighlighter(this.lang);
// Check language support
if ( this.highlighter.isSupportedLanguage( this.lang ) ){
if ( !this.highlighter.isEnabledLanguage( this.lang ) ){
this.$.append( this.$$( '<div>' ).text( 'Cannot edit: ' + this.lang + '\nSupport has been disabled.' ) );
if ( this.highlighter.isSupportedLanguage() ){
if ( !this.highlighter.isEnabledLanguage() ){
this.$.append( this.$$( '<div>' ).text( 'Cannot edit: ' + this.highlighter.getLanguageName() + '\nSupport has been disabled.' ) );
} else {
var langList = this.highlighter.getSupportedLanguages(), key, options = '',
self;
// Language dropdown
for (key in langList){
if (key === this.lang){
options += '<option value="'+key+'" selected>'+key.charAt(0).toUpperCase() + key.slice(1)+'</option>';
options += '<option value="'+key+'" selected>'+this.highlighter.getLanguageName()+'</option>';
} else {
options += '<option value="'+key+'">'+key.charAt(0).toUpperCase() + key.slice(1)+'</option>';
options += '<option value="'+key+'">'+this.highlighter.getLanguageName( key )+'</option>';
}
}
this.$langDropdown.html(options);
@ -1368,4 +1368,4 @@ ve.ui.MWSyntaxHighlightSimpleSurface.prototype.searchReplace = function () {
this.pushStack();
this.searchStep();
}
};
};