diff options
author | mensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2008-11-13 09:49:11 +0000 |
---|---|---|
committer | mensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2008-11-13 09:49:11 +0000 |
commit | e44a7e37b6c7b5961adaffc62b9042b8d442938e (patch) | |
tree | 95b67c356e93163467db2451f2b8cce84ed5d582 /includes/js/dojox/highlight | |
parent | a62b9742ee5e28bcec6872d88f50f25b820914f6 (diff) | |
download | semanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.gz semanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.bz2 |
New feature: basic Ajax suggestion for tags and implementation of Dojo toolkit
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@151 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'includes/js/dojox/highlight')
51 files changed, 3150 insertions, 0 deletions
diff --git a/includes/js/dojox/highlight/README b/includes/js/dojox/highlight/README new file mode 100644 index 0000000..cdaed12 --- /dev/null +++ b/includes/js/dojox/highlight/README @@ -0,0 +1,31 @@ +------------------------------------------------------------------------------- +dojox.highlight +------------------------------------------------------------------------------- +Version 1.0 +Release date: 11/25/2007 +------------------------------------------------------------------------------- +Project state: +beta +------------------------------------------------------------------------------- +Credits + Ivan Sagalaev (softwaremaniacs.org) Author + Peter Higgins (dante) Dojo port +------------------------------------------------------------------------------- +Project description + +A syntax highlighting engine for the Dojo Toolkit +------------------------------------------------------------------------------- +Dependencies: + +dojo base only. +------------------------------------------------------------------------------- +Documentation + +------------------------------------------------------------------------------- +Installation instructions + +simply get the dojox/highlight folder (and dojox/highlight.js) from the +dojox SVN repository, and include in your page via + +dojo.require("dojox.highlight"); + diff --git a/includes/js/dojox/highlight/_base.js b/includes/js/dojox/highlight/_base.js new file mode 100644 index 0000000..46b5267 --- /dev/null +++ b/includes/js/dojox/highlight/_base.js @@ -0,0 +1,406 @@ +if(!dojo._hasResource["dojox.highlight._base"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojox.highlight._base"] = true; +dojo.provide("dojox.highlight._base"); + +// +// dojox.highlight - syntax highlighting with language auto-detection +// released under CLA by the Dojo Toolkit +// orig BSD release available from: http://softwaremaniacs.org/soft/highlight/ +// + +(function(){ + var dh = dojox.highlight, + C_NUMBER_RE = '\\b(0x[A-Za-z0-9]+|\\d+(\\.\\d+)?)'; + + // constants + + dh.constants = { + IDENT_RE: '[a-zA-Z][a-zA-Z0-9_]*', + UNDERSCORE_IDENT_RE: '[a-zA-Z_][a-zA-Z0-9_]*', + NUMBER_RE: '\\b\\d+(\\.\\d+)?', + C_NUMBER_RE: C_NUMBER_RE, + // Common modes + APOS_STRING_MODE: { + className: 'string', + begin: '\'', end: '\'', + illegal: '\\n', + contains: ['escape'], + relevance: 0 + }, + QUOTE_STRING_MODE: { + className: 'string', + begin: '"', + end: '"', + illegal: '\\n', + contains: ['escape'], + relevance: 0 + }, + BACKSLASH_ESCAPE: { + className: 'escape', + begin: '\\\\.', end: '^', + relevance: 0 + }, + C_LINE_COMMENT_MODE: { + className: 'comment', + begin: '//', end: '$', + relevance: 0 + }, + C_BLOCK_COMMENT_MODE: { + className: 'comment', + begin: '/\\*', end: '\\*/' + }, + HASH_COMMENT_MODE: { + className: 'comment', + begin: '#', end: '$' + }, + C_NUMBER_MODE: { + className: 'number', + begin: C_NUMBER_RE, end: '^', + relevance: 0 + } + }; + + // utilities + + function esc(value){ + return value.replace(/&/gm, '&').replace(/</gm, '<').replace(/>/gm, '>'); + } + + function verifyText(block){ + return dojo.every(block.childNodes, function(node){ + return node.nodeType == 3 || String(node.nodeName).toLowerCase() == 'br'; + }); + } + + function blockText(block){ + var result = []; + dojo.forEach(block.childNodes, function(node){ + if(node.nodeType == 3){ + result.push(node.nodeValue); + }else if(String(node.nodeName).toLowerCase() == 'br'){ + result.push("\n"); + }else{ + throw 'Complex markup'; + } + }); + return result.join(""); + } + + function buildKeywordGroups(mode){ + if(!mode.keywordGroups){ + for(var key in mode.keywords){ + var kw = mode.keywords[key]; + if(kw instanceof Object){ // dojo.isObject? + mode.keywordGroups = mode.keywords; + }else{ + mode.keywordGroups = {keyword: mode.keywords}; + } + break; + } + } + } + + function buildKeywords(lang){ + if(lang.defaultMode && lang.modes){ + buildKeywordGroups(lang.defaultMode); + dojo.forEach(lang.modes, buildKeywordGroups); + } + } + + // main object + + var Highlighter = function(langName, textBlock){ + // initialize the state + this.langName = langName; + this.lang = dh.languages[langName]; + this.modes = [this.lang.defaultMode]; + this.relevance = 0; + this.keywordCount = 0; + this.result = []; + + // build resources lazily + if(!this.lang.defaultMode.illegalRe){ + this.buildRes(); + buildKeywords(this.lang); + } + + // run the algorithm + try{ + this.highlight(textBlock); + this.result = this.result.join(""); + }catch(e){ + if(e == 'Illegal'){ + this.relevance = 0; + this.keywordCount = 0; + this.result = esc(textBlock); + }else{ + throw e; + } + } + }; + + dojo.extend(Highlighter, { + buildRes: function(){ + dojo.forEach(this.lang.modes, function(mode){ + if(mode.begin){ + mode.beginRe = this.langRe('^' + mode.begin); + } + if(mode.end){ + mode.endRe = this.langRe('^' + mode.end); + } + if(mode.illegal){ + mode.illegalRe = this.langRe('^(?:' + mode.illegal + ')'); + } + }, this); + this.lang.defaultMode.illegalRe = this.langRe('^(?:' + this.lang.defaultMode.illegal + ')'); + }, + + subMode: function(lexeme){ + var classes = this.modes[this.modes.length - 1].contains; + if(classes){ + var modes = this.lang.modes; + for(var i = 0; i < classes.length; ++i){ + var className = classes[i]; + for(var j = 0; j < modes.length; ++j){ + var mode = modes[j]; + if(mode.className == className && mode.beginRe.test(lexeme)){ return mode; } + } + } + } + return null; + }, + + endOfMode: function(lexeme){ + for(var i = this.modes.length - 1; i >= 0; --i){ + var mode = this.modes[i]; + if(mode.end && mode.endRe.test(lexeme)){ return this.modes.length - i; } + if(!mode.endsWithParent){ break; } + } + return 0; + }, + + isIllegal: function(lexeme){ + var illegalRe = this.modes[this.modes.length - 1].illegalRe; + return illegalRe && illegalRe.test(lexeme); + }, + + + langRe: function(value, global){ + var mode = 'm' + (this.lang.case_insensitive ? 'i' : '') + (global ? 'g' : ''); + return new RegExp(value, mode); + }, + + buildTerminators: function(){ + var mode = this.modes[this.modes.length - 1], + terminators = {}; + if(mode.contains){ + dojo.forEach(this.lang.modes, function(lmode){ + if(dojo.indexOf(mode.contains, lmode.className) >= 0){ + terminators[lmode.begin] = 1; + } + }); + } + for(var i = this.modes.length - 1; i >= 0; --i){ + var m = this.modes[i]; + if(m.end){ terminators[m.end] = 1; } + if(!m.endsWithParent){ break; } + } + if(mode.illegal){ terminators[mode.illegal] = 1; } + var t = []; + for(i in terminators){ t.push(i); } + mode.terminatorsRe = this.langRe("(" + t.join("|") + ")"); + }, + + eatModeChunk: function(value, index){ + var mode = this.modes[this.modes.length - 1]; + + // create terminators lazily + if(!mode.terminatorsRe){ + this.buildTerminators(); + } + + value = value.substr(index); + var match = mode.terminatorsRe.exec(value); + if(!match){ + return { + buffer: value, + lexeme: "", + end: true + }; + } + return { + buffer: match.index ? value.substr(0, match.index) : "", + lexeme: match[0], + end: false + }; + }, + + keywordMatch: function(mode, match){ + var matchStr = match[0]; + if(this.lang.case_insensitive){ matchStr = matchStr.toLowerCase(); } + for(var className in mode.keywordGroups){ + if(matchStr in mode.keywordGroups[className]){ return className; } + } + return ""; + }, + + buildLexemes: function(mode){ + var lexemes = {}; + dojo.forEach(mode.lexems, function(lexeme){ + lexemes[lexeme] = 1; + }); + var t = []; + for(var i in lexemes){ t.push(i); } + mode.lexemsRe = this.langRe("(" + t.join("|") + ")", true); + }, + + processKeywords: function(buffer){ + var mode = this.modes[this.modes.length - 1]; + if(!mode.keywords || !mode.lexems){ + return esc(buffer); + } + + // create lexemes lazily + if(!mode.lexemsRe){ + this.buildLexemes(mode); + } + + mode.lexemsRe.lastIndex = 0; + var result = [], lastIndex = 0, + match = mode.lexemsRe.exec(buffer); + while(match){ + result.push(esc(buffer.substr(lastIndex, match.index - lastIndex))); + var keywordM = this.keywordMatch(mode, match); + if(keywordM){ + ++this.keywordCount; + result.push('<span class="'+ keywordM +'">' + esc(match[0]) + '</span>'); + }else{ + result.push(esc(match[0])); + } + lastIndex = mode.lexemsRe.lastIndex; + match = mode.lexemsRe.exec(buffer); + } + result.push(esc(buffer.substr(lastIndex, buffer.length - lastIndex))); + return result.join(""); + }, + + processModeInfo: function(buffer, lexeme, end) { + var mode = this.modes[this.modes.length - 1]; + if(end){ + this.result.push(this.processKeywords(mode.buffer + buffer)); + return; + } + if(this.isIllegal(lexeme)){ throw 'Illegal'; } + var newMode = this.subMode(lexeme); + if(newMode){ + mode.buffer += buffer; + this.result.push(this.processKeywords(mode.buffer)); + if(newMode.excludeBegin){ + this.result.push(lexeme + '<span class="' + newMode.className + '">'); + newMode.buffer = ''; + }else{ + this.result.push('<span class="' + newMode.className + '">'); + newMode.buffer = lexeme; + } + this.modes.push(newMode); + this.relevance += typeof newMode.relevance == "number" ? newMode.relevance : 1; + return; + } + var endLevel = this.endOfMode(lexeme); + if(endLevel){ + mode.buffer += buffer; + if(mode.excludeEnd){ + this.result.push(this.processKeywords(mode.buffer) + '</span>' + lexeme); + }else{ + this.result.push(this.processKeywords(mode.buffer + lexeme) + '</span>'); + } + while(endLevel > 1){ + this.result.push('</span>'); + --endLevel; + this.modes.pop(); + } + this.modes.pop(); + this.modes[this.modes.length - 1].buffer = ''; + return; + } + }, + + highlight: function(value){ + var index = 0; + this.lang.defaultMode.buffer = ''; + do{ + var modeInfo = this.eatModeChunk(value, index); + this.processModeInfo(modeInfo.buffer, modeInfo.lexeme, modeInfo.end); + index += modeInfo.buffer.length + modeInfo.lexeme.length; + }while(!modeInfo.end); + if(this.modes.length > 1){ + throw 'Illegal'; + } + } + }); + + // more utilities + + function replaceText(node, className, text){ + if(String(node.tagName).toLowerCase() == "code" && String(node.parentNode.tagName).toLowerCase() == "pre"){ + // See these 4 lines? This is IE's notion of "node.innerHTML = text". Love this browser :-/ + var container = document.createElement('div'), + environment = node.parentNode.parentNode; + container.innerHTML = '<pre><code class="' + className + '">' + text + '</code></pre>'; + environment.replaceChild(container.firstChild, node.parentNode); + }else{ + node.className = className; + node.innerHTML = text; + } + } + + function highlightLanguage(block, lang){ + var highlight = new Highlighter(lang, blockText(block)); + replaceText(block, block.className, highlight.result); + } + + function highlightAuto(block){ + var result = "", langName = "", bestRelevance = 2, + textBlock = blockText(block); + for(var key in dh.languages){ + if(!dh.languages[key].defaultMode){ continue; } // skip internal members + var highlight = new Highlighter(key, textBlock), + relevance = highlight.keywordCount + highlight.relevance; + if(!result || relevance > relevanceMax){ + relevanceMax = relevance; + result = highlight.result; + langName = highlight.langName; + } + } + if(result){ + replaceText(block, langName, result); + } + } + + // the public API + + dh.init = function(/* DomNode */ block){ + // summary: the main (only required) public API. highlight a node. + if(dojo.hasClass(block,"no-highlight")){ return; } + if(!verifyText(block)){ return; } + + var classes = block.className.split(/\s+/), + flag = dojo.some(classes, function(className){ + if(className.charAt(0) != "_" && dh.languages[className]){ + highlightLanguage(block, className); + return true; // stop iterations + } + return false; // continue iterations + }); + if(!flag){ + highlightAuto(block); + } + }; + + // pseudo object for markup creation + dh.Code = function(params, node){ + dh.init(node); + }; +})(); + +} diff --git a/includes/js/dojox/highlight/languages/_all.js b/includes/js/dojox/highlight/languages/_all.js new file mode 100644 index 0000000..5097046 --- /dev/null +++ b/includes/js/dojox/highlight/languages/_all.js @@ -0,0 +1,11 @@ +if(!dojo._hasResource["dojox.highlight.languages._all"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojox.highlight.languages._all"] = true; +dojo.provide("dojox.highlight.languages._all"); + +/* groups of similar languages */ +dojo.require("dojox.highlight.languages._static"); +dojo.require("dojox.highlight.languages._dynamic"); +dojo.require("dojox.highlight.languages._www"); + + +} diff --git a/includes/js/dojox/highlight/languages/_dynamic.js b/includes/js/dojox/highlight/languages/_dynamic.js new file mode 100644 index 0000000..a3b510b --- /dev/null +++ b/includes/js/dojox/highlight/languages/_dynamic.js @@ -0,0 +1,11 @@ +if(!dojo._hasResource["dojox.highlight.languages._dynamic"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojox.highlight.languages._dynamic"] = true; +dojo.provide("dojox.highlight.languages._dynamic"); + +/* common scripted languages */ +dojo.require("dojox.highlight.languages.python"); +// dojo.require("dojox.highlight.languages.perl"); +// dojo.require("dojox.highlight.languages.php"); +// dojo.require("dojox.highlight.languages.ruby"); + +} diff --git a/includes/js/dojox/highlight/languages/_static.js b/includes/js/dojox/highlight/languages/_static.js new file mode 100644 index 0000000..85212b4 --- /dev/null +++ b/includes/js/dojox/highlight/languages/_static.js @@ -0,0 +1,10 @@ +if(!dojo._hasResource["dojox.highlight.languages._static"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojox.highlight.languages._static"] = true; +dojo.provide("dojox.highlight.languages._static"); + +/* common static languages */ +dojo.require("dojox.highlight.languages.cpp") +// dojo.require("dojox.highlight.languages.java"); +dojo.require("dojox.highlight.languages.delphi"); + +} diff --git a/includes/js/dojox/highlight/languages/_www.js b/includes/js/dojox/highlight/languages/_www.js new file mode 100644 index 0000000..a04f073 --- /dev/null +++ b/includes/js/dojox/highlight/languages/_www.js @@ -0,0 +1,12 @@ +if(!dojo._hasResource["dojox.highlight.languages._www"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojox.highlight.languages._www"] = true; +dojo.provide("dojox.highlight.languages._www"); + +/* common web-centric languages */ +dojo.require("dojox.highlight.languages.xml"); +dojo.require("dojox.highlight.languages.html"); +dojo.require("dojox.highlight.languages.css"); +dojo.require("dojox.highlight.languages.django"); +dojo.require("dojox.highlight.languages.javascript"); + +} diff --git a/includes/js/dojox/highlight/languages/cpp.js b/includes/js/dojox/highlight/languages/cpp.js new file mode 100644 index 0000000..1e9edf2 --- /dev/null +++ b/includes/js/dojox/highlight/languages/cpp.js @@ -0,0 +1,53 @@ +if(!dojo._hasResource["dojox.highlight.languages.cpp"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojox.highlight.languages.cpp"] = true; +dojo.provide("dojox.highlight.languages.cpp"); + +dojo.require("dojox.highlight._base"); + +(function(){ + var dh = dojox.highlight, dhc = dh.constants; + dh.languages.cpp = { + // summary: C++ highlight definitions + defaultMode: { + lexems: [dhc.UNDERSCORE_IDENT_RE], + illegal: '</', + contains: ['comment', 'string', 'number', 'preprocessor'], + keywords: { + 'false': 1, 'int': 1, 'float': 1, 'while': 1, 'private': 1, + 'char': 1, 'catch': 1, 'export': 1, 'virtual': 1, + 'operator': 2, 'sizeof': 2, 'dynamic_cast': 2, 'typedef': 2, + 'const_cast': 2, 'const': 1, 'struct': 1, 'for': 1, + 'static_cast': 2, 'union': 1, 'namespace': 1, 'unsigned': 1, + 'long': 1, 'throw': 1, 'volatile': 2, 'static': 1, + 'protected': 1, 'bool': 1, 'template': 1, 'mutable': 1, + 'if': 1, 'public': 1, 'friend': 2, 'do': 1, 'return': 1, + 'goto': 1, 'auto': 1, 'void': 2, 'enum': 1, 'else': 1, + 'break': 1, 'new': 1, 'extern': 1, 'using': 1, 'true': 1, + 'class': 1, 'asm': 1, 'case': 1, 'typeid': 1, 'short': 1, + 'reinterpret_cast': 2, 'default': 1, 'double': 1, + 'register': 1, 'explicit': 1, 'signed': 1, 'typename': 1, + 'try': 1, 'this': 1, 'switch': 1, 'continue': 1, 'wchar_t': 1, + 'inline': 1, 'delete': 1 + } + }, + modes: [ + dhc.C_LINE_COMMENT_MODE, + dhc.C_BLOCK_COMMENT_MODE, + dhc.C_NUMBER_MODE, + dhc.QUOTE_STRING_MODE, + dhc.BACKSLASH_ESCAPE, + { + className: 'string', + begin: '\'', + end: '[^\\\\]\'', + illegal: '[^\\\\][^\']' + }, + { + className: 'preprocessor', + begin: '#', end: '$' + } + ] + }; +})(); + +} diff --git a/includes/js/dojox/highlight/languages/css.js b/includes/js/dojox/highlight/languages/css.js new file mode 100644 index 0000000..7dfead0 --- /dev/null +++ b/includes/js/dojox/highlight/languages/css.js @@ -0,0 +1,96 @@ +if(!dojo._hasResource["dojox.highlight.languages.css"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojox.highlight.languages.css"] = true; +dojo.provide("dojox.highlight.languages.css"); + +dojo.require("dojox.highlight._base"); +dojo.require("dojox.highlight.languages.html"); + +(function(){ + var dh = dojox.highlight, dhc = dh.constants, dhl = dh.languages; + dhl.css = { + defaultMode: { + contains: ['id', 'class', 'attr_selector', 'rules', 'comment'], + keywords: dhl.html.HTML_TAGS, + lexems: [dhc.IDENT_RE], + illegal: '=' + }, + case_insensitive: true, + modes: [ + { + className: 'id', + begin: '\\#[A-Za-z0-9_-]+', end: '^' + }, + { + className: 'class', + begin: '\\.[A-Za-z0-9_-]+', end: '^', + relevance: 0 + }, + { + className: 'attr_selector', + begin: '\\[', end: '\\]', + illegal: '$' + }, + { + className: 'rules', + begin: '{', end: '}', + lexems: ['[A-Za-z-]+'], + keywords: { + 'play-during': 1, 'counter-reset': 1, + 'counter-increment': 1, 'min-height': 1, 'quotes': 1, + 'border-top': 1, 'pitch': 1, 'font': 1, 'pause': 1, + 'list-style-image': 1, 'border-width': 1, 'cue': 1, + 'outline-width': 1, 'border-left': 1, 'elevation': 1, + 'richness': 1, 'speech-rate': 1, 'border-bottom': 1, + 'border-spacing': 1, 'background': 1, 'list-style-type': 1, + 'text-align': 1, 'page-break-inside': 1, 'orphans': 1, + 'page-break-before': 1, 'text-transform': 1, + 'line-height': 1, 'padding-left': 1, 'font-size': 1, + 'right': 1, 'word-spacing': 1, 'padding-top': 1, + 'outline-style': 1, 'bottom': 1, 'content': 1, + 'border-right-style': 1, 'padding-right': 1, + 'border-left-style': 1, 'voice-family': 1, + 'background-color': 1, 'border-bottom-color': 1, + 'outline-color': 1, 'unicode-bidi': 1, 'max-width': 1, + 'font-family': 1, 'caption-side': 1, + 'border-right-width': 1, 'pause-before': 1, + 'border-top-style': 1, 'color': 1, 'border-collapse': 1, + 'border-bottom-width': 1, 'float': 1, 'height': 1, + 'max-height': 1, 'margin-right': 1, 'border-top-width': 1, + 'speak': 1, 'speak-header': 1, 'top': 1, 'cue-before': 1, + 'min-width': 1, 'width': 1, 'font-variant': 1, + 'border-top-color': 1, 'background-position': 1, + 'empty-cells': 1, 'direction': 1, 'border-right': 1, + 'visibility': 1, 'padding': 1, 'border-style': 1, + 'background-attachment': 1, 'overflow': 1, + 'border-bottom-style': 1, 'cursor': 1, 'margin': 1, + 'display': 1, 'border-left-width': 1, 'letter-spacing': 1, + 'vertical-align': 1, 'clip': 1, 'border-color': 1, + 'list-style': 1, 'padding-bottom': 1, 'pause-after': 1, + 'speak-numeral': 1, 'margin-left': 1, 'widows': 1, + 'border': 1, 'font-style': 1, 'border-left-color': 1, + 'pitch-range': 1, 'background-repeat': 1, + 'table-layout': 1, 'margin-bottom': 1, + 'speak-punctuation': 1, 'font-weight': 1, + 'border-right-color': 1, 'page-break-after': 1, + 'position': 1, 'white-space': 1, 'text-indent': 1, + 'background-image': 1, 'volume': 1, 'stress': 1, + 'outline': 1, 'clear': 1, 'z-index': 1, + 'text-decoration': 1, 'margin-top': 1, 'azimuth': 1, + 'cue-after': 1, 'left': 1, 'list-style-position': 1 + }, + contains: ['comment', 'value'] + }, + dhc.C_BLOCK_COMMENT_MODE, + { + className: 'value', + begin: ':', + end: ';', + endsWithParent: true, + excludeBegin: true, + excludeEnd: true + } + ] + }; +})(); + +} diff --git a/includes/js/dojox/highlight/languages/delphi.js b/includes/js/dojox/highlight/languages/delphi.js new file mode 100644 index 0000000..ac97409 --- /dev/null +++ b/includes/js/dojox/highlight/languages/delphi.js @@ -0,0 +1,122 @@ +if(!dojo._hasResource["dojox.highlight.languages.delphi"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojox.highlight.languages.delphi"] = true; +dojo.provide("dojox.highlight.languages.delphi"); + +dojo.require("dojox.highlight._base"); + +(function(){ + var DELPHI_KEYWORDS = { + 'and': 1, 'safecall': 1, 'cdecl': 1, 'then': 1, 'string': 1, + 'exports': 1, 'library': 1, 'not': 1, 'pascal': 1, 'set': 1, + 'virtual': 1, 'file': 1, 'in': 1, 'array': 1, 'label': 1, 'packed': 1, + 'end.': 1, 'index': 1, 'while': 1, 'const': 1, 'raise': 1, 'for': 1, + 'to': 1, 'implementation': 1, 'with': 1, 'except': 1, 'overload': 1, + 'destructor': 1, 'downto': 1, 'finally': 1, 'program': 1, 'exit': 1, + 'unit': 1, 'inherited': 1, 'override': 1, 'if': 1, 'type': 1, + 'until': 1, 'function': 1, 'do': 1, 'begin': 1, 'repeat': 1, 'goto': 1, + 'nil': 1, 'far': 1, 'initialization': 1, 'object': 1, 'else': 1, + 'var': 1, 'uses': 1, 'external': 1, 'resourcestring': 1, + 'interface': 1, 'end': 1, 'finalization': 1, 'class': 1, 'asm': 1, + 'mod': 1, 'case': 1, 'on': 1, 'shr': 1, 'shl': 1, 'of': 1, + 'register': 1, 'xorwrite': 1, 'threadvar': 1, 'try': 1, 'record': 1, + 'near': 1, 'stored': 1, 'constructor': 1, 'stdcall': 1, 'inline': 1, + 'div': 1, 'out': 1, 'or': 1, 'procedure': 1 + }; + var DELPHI_CLASS_KEYWORDS = { + 'safecall': 1, 'stdcall': 1, 'pascal': 1, 'stored': 1, 'const': 1, + 'implementation': 1, 'finalization': 1, 'except': 1, 'to': 1, + 'finally': 1, 'program': 1, 'inherited': 1, 'override': 1, 'then': 1, + 'exports': 1, 'string': 1, 'read': 1, 'not': 1, 'mod': 1, 'shr': 1, + 'try': 1, 'div': 1, 'shl': 1, 'set': 1, 'library': 1, 'message': 1, + 'packed': 1, 'index': 1, 'for': 1, 'near': 1, 'overload': 1, + 'label': 1, 'downto': 1, 'exit': 1, 'public': 1, 'goto': 1, + 'interface': 1, 'asm': 1, 'on': 1, 'of': 1, 'constructor': 1, 'or': 1, + 'private': 1, 'array': 1, 'unit': 1, 'raise': 1, 'destructor': 1, + 'var': 1, 'type': 1, 'until': 1, 'function': 1, 'else': 1, + 'external': 1, 'with': 1, 'case': 1, 'default': 1, 'record': 1, + 'while': 1, 'protected': 1, 'property': 1, 'procedure': 1, + 'published': 1, 'and': 1, 'cdecl': 1, 'do': 1, 'threadvar': 1, + 'file': 1, 'in': 1, 'if': 1, 'end': 1, 'virtual': 1, 'write': 1, + 'far': 1, 'out': 1, 'begin': 1, 'repeat': 1, 'nil': 1, + 'initialization': 1, 'object': 1, 'uses': 1, 'resourcestring': 1, + 'class': 1, 'register': 1, 'xorwrite': 1, 'inline': 1 + }; + + var dh = dojox.highlight, dhc = dh.constants; + dh.languages.delphi = { + defaultMode: { + lexems: [dhc.IDENT_RE], + illegal: '("|\\$[G-Zg-z]|\\/\\*|</)', + contains: ['comment', 'string', 'number', 'function', 'class'], + keywords: DELPHI_KEYWORDS + }, + case_insensitive: true, + modes: [ + { + className: 'comment', + begin: '{', end: '}' + }, + { + className: 'comment', + begin: '\\(\\*', end: '\\*\\)', + relevance: 10 + }, + dhc.C_LINE_COMMENT_MODE, + { + className: 'number', + begin: dhc.NUMBER_RE, end: '^', + relevance: 0 + }, + { + className: 'string', + begin: '\'', end: '\'', + contains: ['quote'], + relevance: 0 + }, + { + className: 'string', + begin: '(#\\d+)+', end: '^' + }, + { + className: 'quote', + begin: '\'\'', end: '^' + }, + { + className: 'function', + begin: 'function', end: '[:;]', + lexems: [dhc.IDENT_RE], + keywords: {'function': 1}, + contains: ['title', 'params', 'comment'], + relevance: 0 + }, + { + className: 'function', + begin: '(procedure|constructor|destructor)', end: ';', + lexems: [dhc.IDENT_RE], + keywords: {'constructor': 1, 'destructor': 1, 'procedure': 1}, + contains: ['title', 'params', 'comment'], + relevance: 10 + }, + { + className: 'title', + begin: dhc.IDENT_RE, end: '^' + }, + { + className: 'params', + begin: '\\(', end: '\\)', + lexems: [dhc.IDENT_RE], + keywords: DELPHI_KEYWORDS, + contains: ['string'] + }, + { + className: 'class', + begin: '=\\s*class', end: 'end;', + lexems: [dhc.IDENT_RE], + keywords: DELPHI_CLASS_KEYWORDS, + contains: ['string', 'comment', 'function'] + } + ] + }; +})(); + +} diff --git a/includes/js/dojox/highlight/languages/django.js b/includes/js/dojox/highlight/languages/django.js new file mode 100644 index 0000000..26d483c --- /dev/null +++ b/includes/js/dojox/highlight/languages/django.js @@ -0,0 +1,97 @@ +if(!dojo._hasResource["dojox.highlight.languages.django"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojox.highlight.languages.django"] = true; +dojo.provide("dojox.highlight.languages.django"); + +dojo.require("dojox.highlight._base"); +dojo.require("dojox.highlight.languages.xml"); +dojo.require("dojox.highlight.languages.html"); + +(function(){ + var dh = dojox.highlight, dhc = dh.constants, dhl = dh.languages, x = dhl.xml, h = dhl.html; + dhl.django = { + defaultMode: { + contains: ['tag', 'comment', 'doctype', 'template_comment', 'template_tag', 'variable'] + }, + case_insensitive: true, + modes: [ + x.XML_COMMENT, + h.HTML_DOCTYPE, + { + className: 'tag', + lexems: [dhc.IDENT_RE], + keywords: h.HTML_TAGS, + begin: '<[A-Za-z/]', end: '>', + contains: ['attribute', 'template_comment', 'template_tag', 'variable'] + }, + x.XML_ATTR, + h.HTML_ATTR, + { + className: 'value', + begin: '"', end: '"', + contains: ['template_comment', 'template_tag', 'variable'] + }, + h.HTML_VALUE, + { + className: 'template_comment', + begin: '\\{\\%\\s*comment\\s*\\%\\}', + end: '\\{\\%\\s*endcomment\\s*\\%\\}' + }, + { + className: 'template_comment', + begin: '\\{#', end: '#\\}' + }, + { + className: 'template_tag', + begin: '\\{\\%', end: '\\%\\}', + lexems: [dhc.IDENT_RE], + keywords: { + 'comment': 1, 'endcomment': 1, 'load': 1, + 'templatetag': 1, 'ifchanged': 1, 'endifchanged': 1, + 'if': 1, 'endif': 1, 'firstof': 1, 'for': 1, + 'endfor': 1, 'in': 1, 'ifnotequal': 1, + 'endifnotequal': 1, 'widthratio': 1, 'extends': 1, + 'include': 1, 'spaceless': 1, 'endspaceless': 1, + 'regroup': 1, 'by': 1, 'as': 1, 'ifequal': 1, + 'endifequal': 1, 'ssi': 1, 'now': 1, 'with': 1, + 'cycle': 1, 'url': 1, 'filter': 1, 'endfilter': 1, + 'debug': 1, 'block': 1, 'endblock': 1, 'else': 1 + }, + contains: ['filter'] + }, + { + className: 'variable', + begin: '\\{\\{', end: '\\}\\}', + contains: ['filter'] + }, + { + className: 'filter', + begin: '\\|[A-Za-z]+\\:?', end: '^', excludeEnd: true, + lexems: [dhc.IDENT_RE], + keywords: { + 'truncatewords': 1, 'removetags': 1, 'linebreaksbr': 1, + 'yesno': 1, 'get_digit': 1, 'timesince': 1, 'random': 1, + 'striptags': 1, 'filesizeformat': 1, 'escape': 1, + 'linebreaks': 1, 'length_is': 1, 'ljust': 1, 'rjust': 1, + 'cut': 1, 'urlize': 1, 'fix_ampersands': 1, 'title': 1, + 'floatformat': 1, 'capfirst': 1, 'pprint': 1, + 'divisibleby': 1, 'add': 1, 'make_list': 1, + 'unordered_list': 1, 'urlencode': 1, 'timeuntil': 1, + 'urlizetrunc': 1, 'wordcount': 1, 'stringformat': 1, + 'linenumbers': 1, 'slice': 1, 'date': 1, 'dictsort': 1, + 'dictsortreversed': 1, 'default_if_none': 1, + 'pluralize': 1, 'lower': 1, 'join': 1, 'center': 1, + 'default': 1, 'truncatewords_html': 1, 'upper': 1, + 'length': 1, 'phone2numeric': 1, 'wordwrap': 1, 'time': 1, + 'addslashes': 1, 'slugify': 1, 'first': 1 + }, + contains: ['argument'] + }, + { + className: 'argument', + begin: '"', end: '"' + } + ] + }; +})(); + +} diff --git a/includes/js/dojox/highlight/languages/html.js b/includes/js/dojox/highlight/languages/html.js new file mode 100644 index 0000000..0a6cc46 --- /dev/null +++ b/includes/js/dojox/highlight/languages/html.js @@ -0,0 +1,70 @@ +if(!dojo._hasResource["dojox.highlight.languages.html"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojox.highlight.languages.html"] = true; +dojo.provide("dojox.highlight.languages.html"); + +dojo.require("dojox.highlight._base"); +dojo.require("dojox.highlight.languages.xml"); + +(function(){ + var HTML_TAGS = { + 'code': 1, 'kbd': 1, 'font': 1, 'noscript': 1, 'style': 1, 'img': 1, + 'title': 1, 'menu': 1, 'tt': 1, 'tr': 1, 'param': 1, 'li': 1, 'tfoot': 1, + 'th': 1, 'input': 1, 'td': 1, 'dl': 1, 'blockquote': 1, 'fieldset': 1, + 'big': 1, 'dd': 1, 'abbr': 1, 'optgroup': 1, 'dt': 1, 'button': 1, + 'isindex': 1, 'p': 1, 'small': 1, 'div': 1, 'dir': 1, 'em': 1, 'frame': 1, + 'meta': 1, 'sub': 1, 'bdo': 1, 'label': 1, 'acronym': 1, 'sup': 1, + 'body': 1, 'xml': 1, 'basefont': 1, 'base': 1, 'br': 1, 'address': 1, + 'strong': 1, 'legend': 1, 'ol': 1, 'script': 1, 'caption': 1, 's': 1, + 'col': 1, 'h2': 1, 'h3': 1, 'h1': 1, 'h6': 1, 'h4': 1, 'h5': 1, 'table': 1, + 'select': 1, 'noframes': 1, 'span': 1, 'area': 1, 'dfn': 1, 'strike': 1, + 'cite': 1, 'thead': 1, 'head': 1, 'option': 1, 'form': 1, 'hr': 1, + 'var': 1, 'link': 1, 'b': 1, 'colgroup': 1, 'ul': 1, 'applet': 1, 'del': 1, + 'iframe': 1, 'pre': 1, 'frameset': 1, 'ins': 1, 'tbody': 1, 'html': 1, + 'samp': 1, 'map': 1, 'object': 1, 'a': 1, 'xmlns': 1, 'center': 1, + 'textarea': 1, 'i': 1, 'q': 1, 'u': 1 + }; + var HTML_DOCTYPE = { + className: 'doctype', + begin: '<!DOCTYPE', end: '>', + relevance: 10 + }; + var HTML_ATTR = { + className: 'attribute', + begin: ' [a-zA-Z]+', end: '^' + }; + var HTML_VALUE = { + className: 'value', + begin: '[a-zA-Z0-9]+', end: '^' + }; + + var dh = dojox.highlight, dhc = dh.constants, dhl = dh.languages, x = dhl.xml; + dhl.html = { + defaultMode: { + contains: ['tag', 'comment', 'doctype'] + }, + case_insensitive: true, + modes: [ + x.XML_COMMENT, + HTML_DOCTYPE, + { + className: 'tag', + lexems: [dhc.IDENT_RE], + keywords: HTML_TAGS, + begin: '<[A-Za-z/]', end: '>', + contains: ['attribute'], + illegal: '[\\+\\.]' + }, + x.XML_ATTR, + HTML_ATTR, + x.XML_VALUE, + HTML_VALUE + ], + // exporting constants + HTML_TAGS: HTML_TAGS, + HTML_DOCTYPE: HTML_DOCTYPE, + HTML_ATTR: HTML_ATTR, + HTML_VALUE: HTML_VALUE + }; +})(); + +} diff --git a/includes/js/dojox/highlight/languages/javascript.js b/includes/js/dojox/highlight/languages/javascript.js new file mode 100644 index 0000000..587cb07 --- /dev/null +++ b/includes/js/dojox/highlight/languages/javascript.js @@ -0,0 +1,55 @@ +if(!dojo._hasResource["dojox.highlight.languages.javascript"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojox.highlight.languages.javascript"] = true; +dojo.provide("dojox.highlight.languages.javascript"); + +dojo.require("dojox.highlight._base"); + +(function(){ + var dh = dojox.highlight, dhc = dh.constants; + dh.languages.javascript = { + defaultMode: { + lexems: [dhc.UNDERSCORE_IDENT_RE], + contains: ['string', 'comment', 'number', 'regexp', 'function'], + keywords: { + 'keyword': { + 'in': 1, 'if': 1, 'for': 1, 'while': 1, 'finally': 1, 'var': 1, + 'new': 1, 'function': 1, 'do': 1, 'return': 1, 'void': 1, + 'else': 1, 'break': 1, 'catch': 1, 'instanceof': 1, 'with': 1, + 'throw': 1, 'case': 1, 'default': 1, 'try': 1, 'this': 1, + 'switch': 1, 'continue': 1, 'typeof': 1, 'delete': 1 + }, + 'literal': {'true': 1, 'false': 1, 'null': 1} + } + }, + modes: [ + dhc.C_LINE_COMMENT_MODE, + dhc.C_BLOCK_COMMENT_MODE, + dhc.C_NUMBER_MODE, + dhc.APOS_STRING_MODE, + dhc.QUOTE_STRING_MODE, + dhc.BACKSLASH_ESCAPE, + { + className: 'regexp', + begin: '/.*?[^\\\\/]/[gim]*', end: '^' + }, + { + className: 'function', + begin: 'function\\b', end: '{', + lexems: [dhc.UNDERSCORE_IDENT_RE], + keywords: {'function': 1}, + contains: ['title', 'params'] + }, + { + className: 'title', + begin: dhc.UNDERSCORE_IDENT_RE, end: '^' + }, + { + className: 'params', + begin: '\\(', end: '\\)', + contains: ['string', 'comment'] + } + ] + }; +})(); + +} diff --git a/includes/js/dojox/highlight/languages/pygments/_html.js b/includes/js/dojox/highlight/languages/pygments/_html.js new file mode 100644 index 0000000..64b3bfa --- /dev/null +++ b/includes/js/dojox/highlight/languages/pygments/_html.js @@ -0,0 +1,25 @@ +if(!dojo._hasResource["dojox.highlight.languages.pygments._html"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojox.highlight.languages.pygments._html"] = true; +dojo.provide("dojox.highlight.languages.pygments._html"); + +// html-related constants + +dojox.highlight.languages.pygments._html.tags = { + "code": 1, "kbd": 1, "font": 1, "noscript": 1, "style": 1, "img": 1, + "title": 1, "menu": 1, "tt": 1, "tr": 1, "param": 1, "li": 1, "tfoot": 1, + "th": 1, "input": 1, "td": 1, "dl": 1, "blockquote": 1, "fieldset": 1, + "big": 1, "dd": 1, "abbr": 1, "optgroup": 1, "dt": 1, "button": 1, + "isindex": 1, "p": 1, "small": 1, "div": 1, "dir": 1, "em": 1, "frame": 1, + "meta": 1, "sub": 1, "bdo": 1, "label": 1, "acronym": 1, "sup": 1, + "body": 1, "xml": 1, "basefont": 1, "base": 1, "br": 1, "address": 1, + "strong": 1, "legend": 1, "ol": 1, "script": 1, "caption": 1, "s": 1, + "col": 1, "h2": 1, "h3": 1, "h1": 1, "h6": 1, "h4": 1, "h5": 1, "table": 1, + "select": 1, "noframes": 1, "span": 1, "area": 1, "dfn": 1, "strike": 1, + "cite": 1, "thead": 1, "head": 1, "option": 1, "form": 1, "hr": 1, + "var": 1, "link": 1, "b": 1, "colgroup": 1, "ul": 1, "applet": 1, "del": 1, + "iframe": 1, "pre": 1, "frameset": 1, "ins": 1, "tbody": 1, "html": 1, + "samp": 1, "map": 1, "object": 1, "a": 1, "xmlns": 1, "center": 1, + "textarea": 1, "i": 1, "q": 1, "u": 1 +}; + +} diff --git a/includes/js/dojox/highlight/languages/pygments/_www.js b/includes/js/dojox/highlight/languages/pygments/_www.js new file mode 100644 index 0000000..648ed6e --- /dev/null +++ b/includes/js/dojox/highlight/languages/pygments/_www.js @@ -0,0 +1,12 @@ +if(!dojo._hasResource["dojox.highlight.languages.pygments._www"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojox.highlight.languages.pygments._www"] = true; +dojo.provide("dojox.highlight.languages.pygments._www"); + +/* common web-centric languages */ +dojo.require("dojox.highlight.languages.pygments.xml"); +dojo.require("dojox.highlight.languages.pygments.html"); +dojo.require("dojox.highlight.languages.pygments.css"); +//dojo.require("dojox.highlight.languages.pygments.django"); +dojo.require("dojox.highlight.languages.pygments.javascript"); + +} diff --git a/includes/js/dojox/highlight/languages/pygments/css.js b/includes/js/dojox/highlight/languages/pygments/css.js new file mode 100644 index 0000000..bfb0680 --- /dev/null +++ b/includes/js/dojox/highlight/languages/pygments/css.js @@ -0,0 +1,211 @@ +if(!dojo._hasResource["dojox.highlight.languages.pygments.css"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojox.highlight.languages.pygments.css"] = true; +dojo.provide("dojox.highlight.languages.pygments.css"); + +dojo.require("dojox.highlight._base"); +dojo.require("dojox.highlight.languages.pygments._html"); + +(function(){ + var dh = dojox.highlight, dhl = dh.languages; + dhl.css = { + defaultMode: { + lexems: ["\\b[a-zA-Z0-9]+\\b", "\\b@media\b"], + keywords: { + "keyword": { + "@media": 1 + }, + "name tag": dhl.pygments._html.tags + }, + contains: [ + "comment", + "string single", "string double", + "punctuation", + "name decorator", "name class", "name function", + "_content" + ] + }, + modes: [ + // comments + { + className: "comment", + begin: "/\\*", end: "\\*/", + relevance: 0 + }, + { + className: "comment preproc", + begin: "@[a-z][a-zA-Z]*", end: "^" + }, + { + className: "comment preproc", + begin: "\\!important\\b", end: "^" + }, + + // numbers + { + className: "number", + begin: "\\#[a-fA-F0-9]{3}\\b", end: "^", + relevance: 0 + }, + { + className: "number", + begin: "\\#[a-fA-F0-9]{6}\\b", end: "^", + relevance: 0 + }, + { + className: "number", + begin: "[\\.\\-]?[0-9]*[\\.]?[0-9]+(em|px|\\%|pt|pc|in|mm|cm|ex)", end: "^", + relevance: 0 + }, + { + className: "number", + begin: "\\-?[0-9]+", end: "^", + relevance: 0 + }, + + // strings + { + className: "string single", + begin: "'", end: "'", + illegal: "\\n", + relevance: 0 + }, + { + className: "string double", + begin: '"', + end: '"', + illegal: "\\n", + relevance: 0 + }, + + // operators + { + className: "operator", + begin: "[~\\^\\*!%&\\[\\]\\(\\)<>\\|+=@:;,./?-]", end: "^", + relevance: 0 + }, + + // punctuations + { + className: "punctuation", + begin: "[\\[\\]();]+", end: "^", + relevance: 0 + }, + + // names + { + className: "name decorator", + begin: "\\:[a-zA-Z0-9_\\-]+\\b", end: "^" + }, + { + className: "name class", + begin: "\\.[a-zA-Z0-9_\\-]+\\b", end: "^" + }, + { + className: "name function", + begin: "\\#[a-zA-Z0-9_\\-]+\\b", end: "^" + }, + { + className: "_content", + begin: "\\{", end: "\\}", + lexems: ["\\b[a-zA-Z\\-]+\\b"], + keywords: { + "keyword": { + "azimuth": 1, "background-attachment": 1, "background-color": 1, + "background-image": 1, "background-position": 1, "background-repeat": 1, + "background": 1, "border-bottom-color": 1, "border-bottom-style": 1, + "border-bottom-width": 1, "border-left-color": 1, "border-left-style": 1, + "border-left-width": 1, "border-right": 1, "border-right-color": 1, + "border-right-style": 1, "border-right-width": 1, "border-top-color": 1, + "border-top-style": 1, "border-top-width": 1, "border-bottom": 1, + "border-collapse": 1, "border-left": 1, "border-width": 1, "border-color": 1, + "border-spacing": 1, "border-style": 1, "border-top": 1, "border": 1, "caption-side": 1, + "clear": 1, "clip": 1, "color": 1, "content": 1, "counter-increment": 1, "counter-reset": 1, + "cue-after": 1, "cue-before": 1, "cue": 1, "cursor": 1, "direction": 1, "display": 1, + "elevation": 1, "empty-cells": 1, "float": 1, "font-family": 1, "font-size": 1, + "font-size-adjust": 1, "font-stretch": 1, "font-style": 1, "font-variant": 1, + "font-weight": 1, "font": 1, "height": 1, "letter-spacing": 1, "line-height": 1, + "list-style-type": 1, "list-style-image": 1, "list-style-position": 1, + "list-style": 1, "margin-bottom": 1, "margin-left": 1, "margin-right": 1, + "margin-top": 1, "margin": 1, "marker-offset": 1, "marks": 1, "max-height": 1, "max-width": 1, + "min-height": 1, "min-width": 1, "opacity": 1, "orphans": 1, "outline": 1, "outline-color": 1, + "outline-style": 1, "outline-width": 1, "overflow": 1, "padding-bottom": 1, + "padding-left": 1, "padding-right": 1, "padding-top": 1, "padding": 1, "page": 1, + "page-break-after": 1, "page-break-before": 1, "page-break-inside": 1, + "pause-after": 1, "pause-before": 1, "pause": 1, "pitch": 1, "pitch-range": 1, + "play-during": 1, "position": 1, "quotes": 1, "richness": 1, "right": 1, "size": 1, + "speak-header": 1, "speak-numeral": 1, "speak-punctuation": 1, "speak": 1, + "speech-rate": 1, "stress": 1, "table-layout": 1, "text-align": 1, "text-decoration": 1, + "text-indent": 1, "text-shadow": 1, "text-transform": 1, "top": 1, "unicode-bidi": 1, + "vertical-align": 1, "visibility": 1, "voice-family": 1, "volume": 1, "white-space": 1, + "widows": 1, "width": 1, "word-spacing": 1, "z-index": 1, "bottom": 1, "left": 1, + "above": 1, "absolute": 1, "always": 1, "armenian": 1, "aural": 1, "auto": 1, "avoid": 1, "baseline": 1, + "behind": 1, "below": 1, "bidi-override": 1, "blink": 1, "block": 1, "bold": 1, "bolder": 1, "both": 1, + "capitalize": 1, "center-left": 1, "center-right": 1, "center": 1, "circle": 1, + "cjk-ideographic": 1, "close-quote": 1, "collapse": 1, "condensed": 1, "continuous": 1, + "crop": 1, "crosshair": 1, "cross": 1, "cursive": 1, "dashed": 1, "decimal-leading-zero": 1, + "decimal": 1, "default": 1, "digits": 1, "disc": 1, "dotted": 1, "double": 1, "e-resize": 1, "embed": 1, + "extra-condensed": 1, "extra-expanded": 1, "expanded": 1, "fantasy": 1, "far-left": 1, + "far-right": 1, "faster": 1, "fast": 1, "fixed": 1, "georgian": 1, "groove": 1, "hebrew": 1, "help": 1, + "hidden": 1, "hide": 1, "higher": 1, "high": 1, "hiragana-iroha": 1, "hiragana": 1, "icon": 1, + "inherit": 1, "inline-table": 1, "inline": 1, "inset": 1, "inside": 1, "invert": 1, "italic": 1, + "justify": 1, "katakana-iroha": 1, "katakana": 1, "landscape": 1, "larger": 1, "large": 1, + "left-side": 1, "leftwards": 1, "level": 1, "lighter": 1, "line-through": 1, "list-item": 1, + "loud": 1, "lower-alpha": 1, "lower-greek": 1, "lower-roman": 1, "lowercase": 1, "ltr": 1, + "lower": 1, "low": 1, "medium": 1, "message-box": 1, "middle": 1, "mix": 1, "monospace": 1, + "n-resize": 1, "narrower": 1, "ne-resize": 1, "no-close-quote": 1, "no-open-quote": 1, + "no-repeat": 1, "none": 1, "normal": 1, "nowrap": 1, "nw-resize": 1, "oblique": 1, "once": 1, + "open-quote": 1, "outset": 1, "outside": 1, "overline": 1, "pointer": 1, "portrait": 1, "px": 1, + "relative": 1, "repeat-x": 1, "repeat-y": 1, "repeat": 1, "rgb": 1, "ridge": 1, "right-side": 1, + "rightwards": 1, "s-resize": 1, "sans-serif": 1, "scroll": 1, "se-resize": 1, + "semi-condensed": 1, "semi-expanded": 1, "separate": 1, "serif": 1, "show": 1, "silent": 1, + "slow": 1, "slower": 1, "small-caps": 1, "small-caption": 1, "smaller": 1, "soft": 1, "solid": 1, + "spell-out": 1, "square": 1, "static": 1, "status-bar": 1, "super": 1, "sw-resize": 1, + "table-caption": 1, "table-cell": 1, "table-column": 1, "table-column-group": 1, + "table-footer-group": 1, "table-header-group": 1, "table-row": 1, + "table-row-group": 1, "text": 1, "text-bottom": 1, "text-top": 1, "thick": 1, "thin": 1, + "transparent": 1, "ultra-condensed": 1, "ultra-expanded": 1, "underline": 1, + "upper-alpha": 1, "upper-latin": 1, "upper-roman": 1, "uppercase": 1, "url": 1, + "visible": 1, "w-resize": 1, "wait": 1, "wider": 1, "x-fast": 1, "x-high": 1, "x-large": 1, "x-loud": 1, + "x-low": 1, "x-small": 1, "x-soft": 1, "xx-large": 1, "xx-small": 1, "yes": 1 + }, + "name builtin": { + "indigo": 1, "gold": 1, "firebrick": 1, "indianred": 1, "yellow": 1, "darkolivegreen": 1, + "darkseagreen": 1, "mediumvioletred": 1, "mediumorchid": 1, "chartreuse": 1, + "mediumslateblue": 1, "black": 1, "springgreen": 1, "crimson": 1, "lightsalmon": 1, "brown": 1, + "turquoise": 1, "olivedrab": 1, "cyan": 1, "silver": 1, "skyblue": 1, "gray": 1, "darkturquoise": 1, + "goldenrod": 1, "darkgreen": 1, "darkviolet": 1, "darkgray": 1, "lightpink": 1, "teal": 1, + "darkmagenta": 1, "lightgoldenrodyellow": 1, "lavender": 1, "yellowgreen": 1, "thistle": 1, + "violet": 1, "navy": 1, "orchid": 1, "blue": 1, "ghostwhite": 1, "honeydew": 1, "cornflowerblue": 1, + "darkblue": 1, "darkkhaki": 1, "mediumpurple": 1, "cornsilk": 1, "red": 1, "bisque": 1, "slategray": 1, + "darkcyan": 1, "khaki": 1, "wheat": 1, "deepskyblue": 1, "darkred": 1, "steelblue": 1, "aliceblue": 1, + "gainsboro": 1, "mediumturquoise": 1, "floralwhite": 1, "coral": 1, "purple": 1, "lightgrey": 1, + "lightcyan": 1, "darksalmon": 1, "beige": 1, "azure": 1, "lightsteelblue": 1, "oldlace": 1, + "greenyellow": 1, "royalblue": 1, "lightseagreen": 1, "mistyrose": 1, "sienna": 1, + "lightcoral": 1, "orangered": 1, "navajowhite": 1, "lime": 1, "palegreen": 1, "burlywood": 1, + "seashell": 1, "mediumspringgreen": 1, "fuchsia": 1, "papayawhip": 1, "blanchedalmond": 1, + "peru": 1, "aquamarine": 1, "white": 1, "darkslategray": 1, "ivory": 1, "dodgerblue": 1, + "lemonchiffon": 1, "chocolate": 1, "orange": 1, "forestgreen": 1, "slateblue": 1, "olive": 1, + "mintcream": 1, "antiquewhite": 1, "darkorange": 1, "cadetblue": 1, "moccasin": 1, + "limegreen": 1, "saddlebrown": 1, "darkslateblue": 1, "lightskyblue": 1, "deeppink": 1, + "plum": 1, "aqua": 1, "darkgoldenrod": 1, "maroon": 1, "sandybrown": 1, "magenta": 1, "tan": 1, + "rosybrown": 1, "pink": 1, "lightblue": 1, "palevioletred": 1, "mediumseagreen": 1, + "dimgray": 1, "powderblue": 1, "seagreen": 1, "snow": 1, "mediumblue": 1, "midnightblue": 1, + "paleturquoise": 1, "palegoldenrod": 1, "whitesmoke": 1, "darkorchid": 1, "salmon": 1, + "lightslategray": 1, "lawngreen": 1, "lightgreen": 1, "tomato": 1, "hotpink": 1, + "lightyellow": 1, "lavenderblush": 1, "linen": 1, "mediumaquamarine": 1, "green": 1, + "blueviolet": 1, "peachpuff": 1 + } + }, + contains: [ + "comment", "comment preproc", + "number", + "string single", "string double", + "punctuation", + "name decorator", "name class", "name function" + ] + } + ] + }; +})(); + +} diff --git a/includes/js/dojox/highlight/languages/pygments/html.js b/includes/js/dojox/highlight/languages/pygments/html.js new file mode 100644 index 0000000..e0e7475 --- /dev/null +++ b/includes/js/dojox/highlight/languages/pygments/html.js @@ -0,0 +1,101 @@ +if(!dojo._hasResource["dojox.highlight.languages.pygments.html"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojox.highlight.languages.pygments.html"] = true; +dojo.provide("dojox.highlight.languages.pygments.html"); + +dojo.require("dojox.highlight._base"); +dojo.require("dojox.highlight.languages.pygments._html"); + +(function(){ + var dh = dojox.highlight, dhl = dh.languages, tags = [], + ht = dhl.pygments._html.tags; + + for(var key in ht){ + tags.push(key); + } + tags = "\\b(" + tags.join("|") + ")\\b"; + + dhl.html = { + case_insensitive: true, + defaultMode: { + contains: [ + "name entity", + "comment", "comment preproc", + "_script", "_style", "_tag" + ] + }, + modes: [ + // comments + { + className: "comment", + begin: "<!--", end: "-->" + }, + { + className: "comment preproc", + begin: "\\<\\!\\[CDATA\\[", end: "\\]\\]\\>" + }, + { + className: "comment preproc", + begin: "\\<\\!", end: "\\>" + }, + + // strings + { + className: "string", + begin: "'", end: "'", + illegal: "\\n", + relevance: 0 + }, + { + className: "string", + begin: '"', + end: '"', + illegal: "\\n", + relevance: 0 + }, + + // names + { + className: "name entity", + begin: "\\&[a-z]+;", end: "^" + }, + { + className: "name tag", + begin: tags, end: "^", + relevance: 5 + }, + { + className: "name attribute", + begin: "\\b[a-z0-9_\\:\\-]+\\s*=", end: "^", + relevance: 0 + }, + + { + className: "_script", + begin: "\\<script\\b", end: "\\</script\\>", + relevance: 5 + }, + { + className: "_style", + begin: "\\<style\\b", end: "\\</style\\>", + relevance: 5 + }, + + { + className: "_tag", + begin: "\\<(?!/)", end: "\\>", + contains: ["name tag", "name attribute", "string", "_value"] + }, + { + className: "_tag", + begin: "\\</", end: "\\>", + contains: ["name tag"] + }, + { + className: "_value", + begin: "[^\\s\\>]+", end: "^" + } + ] + }; +})(); + +} diff --git a/includes/js/dojox/highlight/languages/pygments/javascript.js b/includes/js/dojox/highlight/languages/pygments/javascript.js new file mode 100644 index 0000000..d6c0a6b --- /dev/null +++ b/includes/js/dojox/highlight/languages/pygments/javascript.js @@ -0,0 +1,152 @@ +if(!dojo._hasResource["dojox.highlight.languages.pygments.javascript"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojox.highlight.languages.pygments.javascript"] = true; +dojo.provide("dojox.highlight.languages.pygments.javascript"); + +dojo.require("dojox.highlight._base"); + +(function(){ + var dh = dojox.highlight, dhc = dh.constants; + dh.languages.javascript = { + defaultMode: { + lexems: ["\\b[a-zA-Z]+"], + keywords: { + "keyword": { + "for": 1, "in": 1, "while": 1, "do": 1, "break": 1, "return": 1, + "continue": 1, "if": 1, "else": 1, "throw": 1, "try": 1, + "catch": 1, "var": 1, "with": 1, "const": 1, "label": 1, + "function": 1, "new": 1, "typeof": 1, "instanceof": 1 + }, + "keyword constant": { + "true": 1, "false": 1, "null": 1, "NaN": 1, "Infinity": 1, "undefined": 1 + }, + "name builtin": { + "Array": 1, "Boolean": 1, "Date": 1, "Error": 1, "Function": 1, "Math": 1, + "netscape": 1, "Number": 1, "Object": 1, "Packages": 1, "RegExp": 1, + "String": 1, "sun": 1, "decodeURI": 1, "decodeURIComponent": 1, + "encodeURI": 1, "encodeURIComponent": 1, "Error": 1, "eval": 1, + "isFinite": 1, "isNaN": 1, "parseFloat": 1, "parseInt": 1, "document": 1, + "window": 1 + }, + "name builtin pseudo": { + "this": 1 + } + }, + contains: [ + "comment single", "comment multiline", + "number integer", "number oct", "number hex", "number float", + "string single", "string double", "string regex", + "operator", + "punctuation", + //"name variable", + "_function" + ] + }, + modes: [ + // comments + { + className: "comment single", + begin: "//", end: "$", + relevance: 0 + }, + { + className: "comment multiline", + begin: "/\\*", end: "\\*/" + }, + + // numbers + { + className: "number integer", + begin: "0|([1-9][0-9]*)", end: "^", + relevance: 0 + }, + { + className: "number oct", + begin: "0[0-9]+", end: "^", + relevance: 0 + }, + { + className: "number hex", + begin: "0x[0-9a-fA-F]+", end: "^", + relevance: 0 + }, + { + className: "number float", + begin: "([1-9][0-9]*\\.[0-9]*([eE][\\+-]?[0-9]+)?)|(\\.[0-9]+([eE][\\+-]?[0-9]+)?)|([0-9]+[eE][\\+-]?[0-9]+)", end: "^", + relevance: 0 + }, + + // strings + { + className: "string single", + begin: "'", end: "'", + illegal: "\\n", + contains: ["string escape"], + relevance: 0 + }, + { + className: "string double", + begin: '"', + end: '"', + illegal: "\\n", + contains: ["string escape"], + relevance: 0 + }, + { + className: "string escape", + begin: "\\\\.", end: "^", + relevance: 0 + }, + { + className: "string regex", + begin: "/.*?[^\\\\/]/[gim]*", end: "^" + }, + + // operators + { + className: "operator", + begin: "\\|\\||&&|\\+\\+|--|-=|\\+=|/=|\\*=|==|[-\\+\\*/=\\?:~\\^]", end: "^", + relevance: 0 + }, + + // punctuations + { + className: "punctuation", + begin: "[{}\\(\\)\\[\\]\\.;]", end: "^", + relevance: 0 + }, + + // functions + { + className: "_function", + begin: "function\\b", end: "{", + lexems: [dhc.UNDERSCORE_IDENT_RE], + keywords: { + keyword: { + "function": 1 + } + }, + contains: ["name function", "_params"], + relevance: 5 + }, + { + className: "name function", + begin: dhc.UNDERSCORE_IDENT_RE, end: '^' + }, + { + className: "_params", + begin: "\\(", end: "\\)", + contains: ["comment single", "comment multiline"] + } + /* + // names + { + className: "name variable", + begin: "\\b[$a-zA-Z_][$a-zA-Z0-9_]*", end: "^", + relevance: 0 + } + */ + ] + }; +})(); + +} diff --git a/includes/js/dojox/highlight/languages/pygments/xml.js b/includes/js/dojox/highlight/languages/pygments/xml.js new file mode 100644 index 0000000..5eb4832 --- /dev/null +++ b/includes/js/dojox/highlight/languages/pygments/xml.js @@ -0,0 +1,79 @@ +if(!dojo._hasResource["dojox.highlight.languages.pygments.xml"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojox.highlight.languages.pygments.xml"] = true; +dojo.provide("dojox.highlight.languages.pygments.xml"); + +dojo.require("dojox.highlight._base"); +dojox.highlight.languages.pygments.xml = {a: 1}; +dojox.highlight.languages.xml = { + defaultMode: { + contains: [ + "name entity", + "comment", "comment preproc", + "_tag" + ] + }, + modes: [ + // comments + { + className: "comment", + begin: "<!--", end: "-->" + }, + { + className: "comment preproc", + begin: "\\<\\!\\[CDATA\\[", end: "\\]\\]\\>" + }, + { + className: "comment preproc", + begin: "\\<\\!", end: "\\>" + }, + { + className: "comment preproc", + begin: "\\<\\?", end: "\\?\\>", + relevance: 5 + }, + + // strings + { + className: "string", + begin: "'", end: "'", + illegal: "\\n", + relevance: 0 + }, + { + className: "string", + begin: '"', + end: '"', + illegal: "\\n", + relevance: 0 + }, + + // names + { + className: "name entity", + begin: "\\&[a-z]+;", end: "^" + }, + { + className: "name tag", + begin: "\\b[a-z0-9_\\:\\-]+\\b", end: "^" + }, + { + className: "name attribute", + begin: "\\b[a-z0-9_\\:\\-]+=", end: "^", + relevance: 0 + }, + + + { + className: "_tag", + begin: "\\<", end: "\\>", + contains: ["name tag", "name attribute", "string"] + }, + { + className: "_tag", + begin: "\\</", end: "\\>", + contains: ["name tag"] + } + ] +}; + +} diff --git a/includes/js/dojox/highlight/languages/python.js b/includes/js/dojox/highlight/languages/python.js new file mode 100644 index 0000000..eaffd1f --- /dev/null +++ b/includes/js/dojox/highlight/languages/python.js @@ -0,0 +1,102 @@ +if(!dojo._hasResource["dojox.highlight.languages.python"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojox.highlight.languages.python"] = true; +dojo.provide("dojox.highlight.languages.python"); + +dojo.require("dojox.highlight._base"); + +(function(){ + var dh = dojox.highlight, dhc = dh.constants; + dh.languages.python = { + // summary: Python highlight definitions + defaultMode: { + lexems: [dhc.UNDERSCORE_IDENT_RE], + illegal: '(</|->)', + contains: ['comment', 'string', 'function', 'class', 'number', 'decorator'], + keywords: {'and': 1, 'elif': 1, 'is': 1, 'global': 1, 'as': 1, 'in': 1, 'if': 1, + 'from': 1, 'raise': 1, 'for': 1, 'except': 1, 'finally': 1, 'print': 1, + 'import': 1, 'pass': 1, 'None': 1, 'return': 1, 'exec': 1, 'else': 1, + 'break': 1, 'not': 1, 'with': 1, 'class': 1, 'assert': 1, 'yield': 1, + 'try': 1, 'while': 1, 'continue': 1, 'del': 1, 'or': 1, 'def': 1, 'lambda': 1} + }, + modes: [ + { + className: 'function', + lexems: [dhc.UNDERSCORE_IDENT_RE], + begin: '\\bdef ', end: ':', + illegal: '$', + keywords: {'def': 1}, + contains: ['title', 'params'], + relevance: 10 + }, + { + className: 'class', + lexems: [dhc.UNDERSCORE_IDENT_RE], + begin: '\\bclass ', end: ':', + illegal: '[${]', + keywords: {'class': 1}, + contains: ['title', 'params',], + relevance: 10 + }, + { + className: 'title', + begin: dhc.UNDERSCORE_IDENT_RE, end: '^' + }, + { + className: 'params', + begin: '\\(', end: '\\)', + contains: ['string'] + }, + dhc.HASH_COMMENT_MODE, + dhc.C_NUMBER_MODE, + { + className: 'string', + begin: '\'\'\'', end: '\'\'\'', + relevance: 10 + }, + { + className: 'string', + begin: '"""', end: '"""', + relevance: 10 + }, + dhc.APOS_STRING_MODE, + dhc.QUOTE_STRING_MODE, + dhc.BACKSLASH_ESCAPE, + { + className: 'string', + begin: 'r\'', end: '\'', + relevance: 10 + }, + { + className: 'string', + begin: 'r"', end: '"', + relevance: 10 + }, + { + className: 'string', + begin: 'u\'', end: '(^|[^\\\\])\'', + relevance: 10 + }, + { + className: 'string', + begin: 'u"', end: '(^|[^\\\\])"', + relevance: 10 + }, + { + className: 'string', + begin: 'ur\'', end: '\'', + relevance: 10 + }, + { + className: 'string', + begin: 'ur"', end: '"', + relevance: 10 + }, + { + className: 'decorator', + begin: '@', end: '$' + } + ] + }; +})(); + +} diff --git a/includes/js/dojox/highlight/languages/sql.js b/includes/js/dojox/highlight/languages/sql.js new file mode 100644 index 0000000..0e1ca9c --- /dev/null +++ b/includes/js/dojox/highlight/languages/sql.js @@ -0,0 +1,101 @@ +if(!dojo._hasResource["dojox.highlight.languages.sql"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojox.highlight.languages.sql"] = true; +dojo.provide("dojox.highlight.languages.sql"); + +dojo.require("dojox.highlight._base"); + +(function(){ + var SQL_KEYWORDS = { + 'all': 1, 'partial': 1, 'global': 1, 'month': 1, + 'current_timestamp': 1, 'using': 1, 'go': 1, 'revoke': 1, + 'smallint': 1, 'indicator': 1, 'end-exec': 1, 'disconnect': 1, + 'zone': 1, 'with': 1, 'character': 1, 'assertion': 1, 'to': 1, + 'add': 1, 'current_user': 1, 'usage': 1, 'input': 1, 'local': 1, + 'alter': 1, 'match': 1, 'collate': 1, 'real': 1, 'then': 1, + 'rollback': 1, 'get': 1, 'read': 1, 'timestamp': 1, 'session_user': 1, + 'not': 1, 'integer': 1, 'bit': 1, 'unique': 1, 'day': 1, 'minute': 1, + 'desc': 1, 'insert': 1, 'execute': 1, 'like': 1, 'level': 1, + 'decimal': 1, 'drop': 1, 'continue': 1, 'isolation': 1, 'found': 1, + 'where': 1, 'constraints': 1, 'domain': 1, 'right': 1, 'national': 1, + 'some': 1, 'module': 1, 'transaction': 1, 'relative': 1, 'second': 1, + 'connect': 1, 'escape': 1, 'close': 1, 'system_user': 1, 'for': 1, + 'deferred': 1, 'section': 1, 'cast': 1, 'current': 1, 'sqlstate': 1, + 'allocate': 1, 'intersect': 1, 'deallocate': 1, 'numeric': 1, + 'public': 1, 'preserve': 1, 'full': 1, 'goto': 1, 'initially': 1, + 'asc': 1, 'no': 1, 'key': 1, 'output': 1, 'collation': 1, 'group': 1, + 'by': 1, 'union': 1, 'session': 1, 'both': 1, 'last': 1, 'language': 1, + 'constraint': 1, 'column': 1, 'of': 1, 'space': 1, 'foreign': 1, + 'deferrable': 1, 'prior': 1, 'connection': 1, 'unknown': 1, + 'action': 1, 'commit': 1, 'view': 1, 'or': 1, 'first': 1, 'into': 1, + 'float': 1, 'year': 1, 'primary': 1, 'cascaded': 1, 'except': 1, + 'restrict': 1, 'set': 1, 'references': 1, 'names': 1, 'table': 1, + 'outer': 1, 'open': 1, 'select': 1, 'size': 1, 'are': 1, 'rows': 1, + 'from': 1, 'prepare': 1, 'distinct': 1, 'leading': 1, 'create': 1, + 'only': 1, 'next': 1, 'inner': 1, 'authorization': 1, 'schema': 1, + 'corresponding': 1, 'option': 1, 'declare': 1, 'precision': 1, + 'immediate': 1, 'else': 1, 'timezone_minute': 1, 'external': 1, + 'varying': 1, 'translation': 1, 'true': 1, 'case': 1, 'exception': 1, + 'join': 1, 'hour': 1, 'default': 1, 'double': 1, 'scroll': 1, + 'value': 1, 'cursor': 1, 'descriptor': 1, 'values': 1, 'dec': 1, + 'fetch': 1, 'procedure': 1, 'delete': 1, 'and': 1, 'false': 1, + 'int': 1, 'is': 1, 'describe': 1, 'char': 1, 'as': 1, 'at': 1, 'in': 1, + 'varchar': 1, 'null': 1, 'trailing': 1, 'any': 1, 'absolute': 1, + 'current_time': 1, 'end': 1, 'grant': 1, 'privileges': 1, 'when': 1, + 'cross': 1, 'check': 1, 'write': 1, 'current_date': 1, 'pad': 1, + 'begin': 1, 'temporary': 1, 'exec': 1, 'time': 1, 'update': 1, + 'catalog': 1, 'user': 1, 'sql': 1, 'date': 1, 'on': 1, 'identity': 1, + 'timezone_hour': 1, 'natural': 1, 'whenever': 1, 'interval': 1, + 'work': 1, 'order': 1, 'cascade': 1, 'diagnostics': 1, 'nchar': 1, + 'having': 1, 'left': 1 + }; + + var dh = dojox.highlight, dhc = dh.constants; + dh.languages.sql = { + // summary: SQL highlight definitions + case_insensitive: true, + defaultMode: { + lexems: [dhc.IDENT_RE], + contains: ['string', 'number', 'comment'], + keywords: { + 'keyword': SQL_KEYWORDS, + 'aggregate': {'count': 1, 'sum': 1, 'min': 1, 'max': 1, 'avg': 1} + } + }, + modes: [ + dhc.C_NUMBER_MODE, + dhc.C_BLOCK_COMMENT_MODE, + { + className: 'comment', + begin: '--', end: '$' + }, + { + className: 'string', + begin: '\'', end: '\'', + contains: ['escape', 'squote'], + relevance: 0 + }, + { + className: 'squote', + begin: '\'\'', end: '^' + }, + { + className: 'string', + begin: '"', end: '"', + contains: [ 'escape', 'dquote'], + relevance: 0 + }, + { + className: 'dquote', + begin: '""', end: '^' + }, + { + className: 'string', + begin: '`', end: '`', + contains: ['escape'] + }, + dhc.BACKSLASH_ESCAPE + ] + }; +})(); + +} diff --git a/includes/js/dojox/highlight/languages/xml.js b/includes/js/dojox/highlight/languages/xml.js new file mode 100644 index 0000000..67dd81d --- /dev/null +++ b/includes/js/dojox/highlight/languages/xml.js @@ -0,0 +1,69 @@ +if(!dojo._hasResource["dojox.highlight.languages.xml"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojox.highlight.languages.xml"] = true; +dojo.provide("dojox.highlight.languages.xml"); + +dojo.require("dojox.highlight._base"); + +(function(){ + var XML_COMMENT = { + className: 'comment', + begin: '<!--', end: '-->' + }; + + var XML_ATTR = { + className: 'attribute', + begin: ' [a-zA-Z-]+=', end: '^', + contains: ['value'] + }; + + var XML_VALUE = { + className: 'value', + begin: '"', end: '"' + }; + + var dh = dojox.highlight, dhc = dh.constants; + dh.languages.xml = { + defaultMode: { + contains: ['pi', 'comment', 'cdata', 'tag'] + }, + case_insensitive: true, + modes: [ + { + className: 'pi', + begin: '<\\?', end: '\\?>', + relevance: 10 + }, + XML_COMMENT, + { + className: 'cdata', + begin: '<\\!\\[CDATA\\[', end: '\\]\\]>' + }, + { + className: 'tag', + begin: '</?', end: '>', + contains: ['title', 'tag_internal'], + relevance: 1.5 + }, + { + className: 'title', + begin: '[A-Za-z:_][A-Za-z0-9\\._:-]+', end: '^', + relevance: 0 + }, + { + className: 'tag_internal', + begin: '^', endsWithParent: true, + contains: ['attribute'], + relevance: 0, + illegal: '[\\+\\.]' + }, + XML_ATTR, + XML_VALUE + ], + // exporting constants + XML_COMMENT: XML_COMMENT, + XML_ATTR: XML_ATTR, + XML_VALUE: XML_VALUE + }; +})(); + +} diff --git a/includes/js/dojox/highlight/resources/highlight.css b/includes/js/dojox/highlight/resources/highlight.css new file mode 100644 index 0000000..45a61a3 --- /dev/null +++ b/includes/js/dojox/highlight/resources/highlight.css @@ -0,0 +1,51 @@ + +.string, +.function .title, +.class .title, +.tag .attribute .value, +.css .rules .value, +.preprocessor, +.ruby .symbol, +.ruby .instancevar, +.ruby .class .parent, +.built_in, +.sql .aggregate, +.django .template_tag, +.django .variable, +.smalltalk .class { + color: #800; +} +.comment, +.java .annotation, +.template_comment { + color: #888; +} +.number, +.regexp, +.javascript .literal, +.smalltalk .symbol, +.smalltalk .char { + color: #080; +} +.javadoc, +.ruby .string, +.python .decorator, +.django .filter .argument, +.smalltalk .localvars, +.smalltalk .array, +.css .attr_selector, +.xml .pi { + color: #88F; +} +.keyword, +.css .id, +.phpdoc, +.function .title, +.class .title, +.vbscript .built_in, +.sql .aggregate, +.rsl .built_in, +.smalltalk .class, +.xml .tag .title { + font-weight: bold; +} diff --git a/includes/js/dojox/highlight/resources/highlight.css.commented.css b/includes/js/dojox/highlight/resources/highlight.css.commented.css new file mode 100644 index 0000000..eddef1f --- /dev/null +++ b/includes/js/dojox/highlight/resources/highlight.css.commented.css @@ -0,0 +1,58 @@ +/* +You can use this file as is or as a starting point for you own styling +*/ + +.string, +.function .title, +.class .title, +.tag .attribute .value, +.css .rules .value, +.preprocessor, +.ruby .symbol, +.ruby .instancevar, +.ruby .class .parent, +.built_in, +.sql .aggregate, +.django .template_tag, +.django .variable, +.smalltalk .class { + color: #800; +} + +.comment, +.java .annotation, +.template_comment { + color: #888; +} + +.number, +.regexp, +.javascript .literal, +.smalltalk .symbol, +.smalltalk .char { + color: #080; +} + +.javadoc, +.ruby .string, +.python .decorator, +.django .filter .argument, +.smalltalk .localvars, +.smalltalk .array, +.css .attr_selector, +.xml .pi { + color: #88F; +} + +.keyword, +.css .id, +.phpdoc, +.function .title, +.class .title, +.vbscript .built_in, +.sql .aggregate, +.rsl .built_in, +.smalltalk .class, +.xml .tag .title { + font-weight: bold; +} diff --git a/includes/js/dojox/highlight/resources/pygments/autumn.css b/includes/js/dojox/highlight/resources/pygments/autumn.css new file mode 100644 index 0000000..b1846f4 --- /dev/null +++ b/includes/js/dojox/highlight/resources/pygments/autumn.css @@ -0,0 +1,22 @@ + +code .comment {color: #aaa; font-style: italic} +code .comment.preproc {color: #4c8317; font-style: normal} +code .comment.special {color: #00a} +code .keyword {color: #00a} +code .keyword.type {color: #0aa} +code .operator.word {color: #00a} +code .name.builtin {color: #0aa} +code .name.function {color: #0a0} +code .name.class {color: #0a0; text-decoration: underline} +code .name.namespace {color: #0aa; text-decoration: underline} +code .name.exception {color: #D2413A; font-weight: bold} +code .name.variable {color: #a00} +code .name.constant {color: #a00} +code .name.entity {color: #800; font-weight: bold} +code .name.attribute {color: #1e90ff} +code .name.tag {color: #1e90ff; font-weight: bold} +code .name.decorator {color: #888} +code .string {color: #a50} +code .string.regex {color: #099} +code .string.symbol {color: #00a} +code .number {color: #099} diff --git a/includes/js/dojox/highlight/resources/pygments/autumn.css.commented.css b/includes/js/dojox/highlight/resources/pygments/autumn.css.commented.css new file mode 100644 index 0000000..3deb7c4 --- /dev/null +++ b/includes/js/dojox/highlight/resources/pygments/autumn.css.commented.css @@ -0,0 +1,28 @@ +/* Pygments autumn style */ + +code .comment {color: #aaa; font-style: italic} +code .comment.preproc {color: #4c8317; font-style: normal} +code .comment.special {color: #00a} + +code .keyword {color: #00a} +code .keyword.type {color: #0aa} + +code .operator.word {color: #00a} + +code .name.builtin {color: #0aa} +code .name.function {color: #0a0} +code .name.class {color: #0a0; text-decoration: underline} +code .name.namespace {color: #0aa; text-decoration: underline} +code .name.exception {color: #D2413A; font-weight: bold} +code .name.variable {color: #a00} +code .name.constant {color: #a00} +code .name.entity {color: #800; font-weight: bold} +code .name.attribute {color: #1e90ff} +code .name.tag {color: #1e90ff; font-weight: bold} +code .name.decorator {color: #888} + +code .string {color: #a50} +code .string.regex {color: #099} +code .string.symbol {color: #00a} + +code .number {color: #099} diff --git a/includes/js/dojox/highlight/resources/pygments/borland.css b/includes/js/dojox/highlight/resources/pygments/borland.css new file mode 100644 index 0000000..85fb11f --- /dev/null +++ b/includes/js/dojox/highlight/resources/pygments/borland.css @@ -0,0 +1,11 @@ + +code .comment {color: #080; font-style: italic} +code .comment.preproc {color: #008080; font-style: normal} +code .comment.special {font-weight: bold; font-style: normal} +code .keyword {color: #000080; font-weight: bold} +code .operator.word {font-weight: bold} +code .name.attribute {color: #f00} +code .name.tag {color: #000080; font-weight: bold} +code .string {color: #00f} +code .string.char {color: #800080} +code .number {color: #00f} diff --git a/includes/js/dojox/highlight/resources/pygments/borland.css.commented.css b/includes/js/dojox/highlight/resources/pygments/borland.css.commented.css new file mode 100644 index 0000000..9fb9d19 --- /dev/null +++ b/includes/js/dojox/highlight/resources/pygments/borland.css.commented.css @@ -0,0 +1,17 @@ +/* Pygments borland style */ + +code .comment {color: #080; font-style: italic} +code .comment.preproc {color: #008080; font-style: normal} +code .comment.special {font-weight: bold; font-style: normal} + +code .keyword {color: #000080; font-weight: bold} + +code .operator.word {font-weight: bold} + +code .name.attribute {color: #f00} +code .name.tag {color: #000080; font-weight: bold} + +code .string {color: #00f} +code .string.char {color: #800080} + +code .number {color: #00f} diff --git a/includes/js/dojox/highlight/resources/pygments/colorful.css b/includes/js/dojox/highlight/resources/pygments/colorful.css new file mode 100644 index 0000000..06de503 --- /dev/null +++ b/includes/js/dojox/highlight/resources/pygments/colorful.css @@ -0,0 +1,37 @@ + +code .comment {color: #888} +code .comment.preproc {color: #579} +code .comment.special {color: #c00; font-weight: bold} +code .keyword {color: #080; font-weight: bold} +code .keyword.pseudo {color: #038} +code .keyword.type {color: #339} +code .operator {color: #333} +code .operator.word {color: #000; font-weight: bold} +code .name.builtin {color: #007020} +code .name.function {color: #06b; font-weight: bold} +code .name.class {color: #b06; font-weight: bold} +code .name.namespace {color: #0e84b5; font-weight: bold} +code .name.exception {color: #f00; font-weight: bold} +code .name.variable {color: #963} +code .name.variable.instance {color: #33b} +code .name.variable.class {color: #369} +code .name.variable.global {color: #d70; font-weight: bold} +code .name.constant {color: #036; font-weight: bold} +code .name.label {color: #970; font-weight: bold} +code .name.entity {color: #800; font-weight: bold} +code .name.attribute {color: #00c} +code .name.tag {color: #070} +code .name.decorator {color: #555; font-weight: bold} +code .string {background-color: #fff0f0} +code .string.char {color: #04d; background-color: transparent} +code .string.doc {color: #d42; background-color: transparent} +code .string.interpol {background-color: #eee} +code .string.escape {color: #666; font-weight: bold} +code .string.regex {color: #000; background-color: #fff0f0} +code .string.symbol {color: #a60; background-color: transparent} +code .string.other {color: #d20} +code .number {color: #60e} +code .number.integer {color: #00d} +code .number.float {color: #60e} +code .number.hex {color: #058} +code .number.oct {color: #40e} diff --git a/includes/js/dojox/highlight/resources/pygments/colorful.css.commented.css b/includes/js/dojox/highlight/resources/pygments/colorful.css.commented.css new file mode 100644 index 0000000..d63728a --- /dev/null +++ b/includes/js/dojox/highlight/resources/pygments/colorful.css.commented.css @@ -0,0 +1,43 @@ +/* Pygments colorful style */ + +code .comment {color: #888} +code .comment.preproc {color: #579} +code .comment.special {color: #c00; font-weight: bold} + +code .keyword {color: #080; font-weight: bold} +code .keyword.pseudo {color: #038} +code .keyword.type {color: #339} + +code .operator {color: #333} +code .operator.word {color: #000; font-weight: bold} + +code .name.builtin {color: #007020} +code .name.function {color: #06b; font-weight: bold} +code .name.class {color: #b06; font-weight: bold} +code .name.namespace {color: #0e84b5; font-weight: bold} +code .name.exception {color: #f00; font-weight: bold} +code .name.variable {color: #963} +code .name.variable.instance {color: #33b} +code .name.variable.class {color: #369} +code .name.variable.global {color: #d70; font-weight: bold} +code .name.constant {color: #036; font-weight: bold} +code .name.label {color: #970; font-weight: bold} +code .name.entity {color: #800; font-weight: bold} +code .name.attribute {color: #00c} +code .name.tag {color: #070} +code .name.decorator {color: #555; font-weight: bold} + +code .string {background-color: #fff0f0} +code .string.char {color: #04d; background-color: transparent} +code .string.doc {color: #d42; background-color: transparent} +code .string.interpol {background-color: #eee} +code .string.escape {color: #666; font-weight: bold} +code .string.regex {color: #000; background-color: #fff0f0} +code .string.symbol {color: #a60; background-color: transparent} +code .string.other {color: #d20} + +code .number {color: #60e} +code .number.integer {color: #00d} +code .number.float {color: #60e} +code .number.hex {color: #058} +code .number.oct {color: #40e} diff --git a/includes/js/dojox/highlight/resources/pygments/default.css b/includes/js/dojox/highlight/resources/pygments/default.css new file mode 100644 index 0000000..f0b5f05 --- /dev/null +++ b/includes/js/dojox/highlight/resources/pygments/default.css @@ -0,0 +1,28 @@ + +code {background-color: #f8f8f8} +code .comment {color: #408080; font-style: italic} +code .comment.preproc {color: #bc7a00; font-style: normal} +code .keyword {color: #008000; font-weight: bold} +code .keyword.pseudo {font-weight: normal} +code .operator {color: #666} +code .operator.word {color: #a2f} +code .name.builtin {color: #008000} +code .name.function {color: #00f} +code .name.class {color: #00f; font-weight: bold} +code .name.namespace {color: #00f; font-weight: bold} +code .name.exception {color: #d2413a; font-weight: bold} +code .name.variable {color: #19177c} +code .name.constant {color: #800} +code .name.label {color: #a0a000} +code .name.entity {color: #999; font-weight: bold} +code .name.attribute {color: #7d9029} +code .name.tag {color: #008000; font-weight: bold} +code .name.decorator {color: #a2f} +code .string {color: #ba2121} +code .string.doc {font-style: italic} +code .string.interpol {color: #b68; font-weight: bold} +code .string.escape {color: #b62; font-weight: bold} +code .string.regex {color: #b68} +code .string.symbol {color: #19177c} +code .string.other {color: #008000} +code .number {color: #666} diff --git a/includes/js/dojox/highlight/resources/pygments/default.css.commented.css b/includes/js/dojox/highlight/resources/pygments/default.css.commented.css new file mode 100644 index 0000000..9c13e30 --- /dev/null +++ b/includes/js/dojox/highlight/resources/pygments/default.css.commented.css @@ -0,0 +1,35 @@ +/* Pygments default style */ + +code {background-color: #f8f8f8} + +code .comment {color: #408080; font-style: italic} +code .comment.preproc {color: #bc7a00; font-style: normal} + +code .keyword {color: #008000; font-weight: bold} +code .keyword.pseudo {font-weight: normal} + +code .operator {color: #666} +code .operator.word {color: #a2f} + +code .name.builtin {color: #008000} +code .name.function {color: #00f} +code .name.class {color: #00f; font-weight: bold} +code .name.namespace {color: #00f; font-weight: bold} +code .name.exception {color: #d2413a; font-weight: bold} +code .name.variable {color: #19177c} +code .name.constant {color: #800} +code .name.label {color: #a0a000} +code .name.entity {color: #999; font-weight: bold} +code .name.attribute {color: #7d9029} +code .name.tag {color: #008000; font-weight: bold} +code .name.decorator {color: #a2f} + +code .string {color: #ba2121} +code .string.doc {font-style: italic} +code .string.interpol {color: #b68; font-weight: bold} +code .string.escape {color: #b62; font-weight: bold} +code .string.regex {color: #b68} +code .string.symbol {color: #19177c} +code .string.other {color: #008000} + +code .number {color: #666} diff --git a/includes/js/dojox/highlight/resources/pygments/emacs.css b/includes/js/dojox/highlight/resources/pygments/emacs.css new file mode 100644 index 0000000..8c815ed --- /dev/null +++ b/includes/js/dojox/highlight/resources/pygments/emacs.css @@ -0,0 +1,29 @@ + +code {background-color: #f8f8f8} +code .comment {color: #080; font-style: italic} +code .comment.preproc {font-style: normal} +code .comment.special {font-style: normal; font-weight: bold} +code .keyword {color: #a2f; font-weight: bold} +code .keyword.pseudo {font-weight: normal} +code .operator {color: #666} +code .operator.word {color: #a2f; font-weight: bold} +code .name.builtin {color: #a2f} +code .name.function {color: #00a000} +code .name.class {color: #00f} +code .name.namespace {color: #00f; font-weight: bold} +code .name.exception {color: #d2413a; font-weight: bold} +code .name.variable {color: #b8860b} +code .name.constant {color: #800} +code .name.label {color: #a0a000} +code .name.entity {color: #999; font-weight: bold} +code .name.attribute {color: #b44} +code .name.tag {color: #008000; font-weight: bold} +code .name.decorator {color: #a2f} +code .string {color: #b44} +code .string.doc {font-style: italic} +code .string.interpol {color: #b68; font-weight: bold} +code .string.escape {color: #b62; font-weight: bold} +code .string.regex {color: #b68} +code .string.symbol {color: #b8860b} +code .string.other {color: #008000} +code .number {color: #666} diff --git a/includes/js/dojox/highlight/resources/pygments/emacs.css.commented.css b/includes/js/dojox/highlight/resources/pygments/emacs.css.commented.css new file mode 100644 index 0000000..ed391e1 --- /dev/null +++ b/includes/js/dojox/highlight/resources/pygments/emacs.css.commented.css @@ -0,0 +1,36 @@ +/* Pygments emacs style */ + +code {background-color: #f8f8f8} + +code .comment {color: #080; font-style: italic} +code .comment.preproc {font-style: normal} +code .comment.special {font-style: normal; font-weight: bold} + +code .keyword {color: #a2f; font-weight: bold} +code .keyword.pseudo {font-weight: normal} + +code .operator {color: #666} +code .operator.word {color: #a2f; font-weight: bold} + +code .name.builtin {color: #a2f} +code .name.function {color: #00a000} +code .name.class {color: #00f} +code .name.namespace {color: #00f; font-weight: bold} +code .name.exception {color: #d2413a; font-weight: bold} +code .name.variable {color: #b8860b} +code .name.constant {color: #800} +code .name.label {color: #a0a000} +code .name.entity {color: #999; font-weight: bold} +code .name.attribute {color: #b44} +code .name.tag {color: #008000; font-weight: bold} +code .name.decorator {color: #a2f} + +code .string {color: #b44} +code .string.doc {font-style: italic} +code .string.interpol {color: #b68; font-weight: bold} +code .string.escape {color: #b62; font-weight: bold} +code .string.regex {color: #b68} +code .string.symbol {color: #b8860b} +code .string.other {color: #008000} + +code .number {color: #666} diff --git a/includes/js/dojox/highlight/resources/pygments/friendly.css b/includes/js/dojox/highlight/resources/pygments/friendly.css new file mode 100644 index 0000000..c4d392a --- /dev/null +++ b/includes/js/dojox/highlight/resources/pygments/friendly.css @@ -0,0 +1,29 @@ + +code {background-color: #f8f8f8} +code .comment {color: #60a0b0; font-style: italic} +code .comment.preproc {color: #007020; font-style: normal} +code .comment.special {background-color: #fff0f0; font-style: normal} +code .keyword {color: #007020; font-weight: bold} +code .keyword.pseudo {font-weight: normal} +code .operator {color: #666} +code .operator.word {color: #007020; font-weight: bold} +code .name.builtin {color: #007020} +code .name.function {color: #06287e} +code .name.class {color: #0e84b5; font-weight: bold} +code .name.namespace {color: #0e84b5; font-weight: bold} +code .name.exception {color: #007020} +code .name.variable {color: #bb60d5} +code .name.constant {color: #60add5} +code .name.label {color: #002070; font-weight: bold} +code .name.entity {color: #d55537; font-weight: bold} +code .name.attribute {color: #4070a0} +code .name.tag {color: #062873; font-weight: bold} +code .name.decorator {color: #555; font-weight: bold} +code .string {color: #4070a0} +code .string.doc {font-style: italic} +code .string.interpol {color: #70a0d0; font-style: italic} +code .string.escape {color: #4070a0; font-weight: bold} +code .string.regex {color: #235388} +code .string.symbol {color: #517918} +code .string.other {color: #c65d09} +code .number {color: #40a070} diff --git a/includes/js/dojox/highlight/resources/pygments/friendly.css.commented.css b/includes/js/dojox/highlight/resources/pygments/friendly.css.commented.css new file mode 100644 index 0000000..7a1c36f --- /dev/null +++ b/includes/js/dojox/highlight/resources/pygments/friendly.css.commented.css @@ -0,0 +1,36 @@ +/* Pygments friendly style */ + +code {background-color: #f8f8f8} + +code .comment {color: #60a0b0; font-style: italic} +code .comment.preproc {color: #007020; font-style: normal} +code .comment.special {background-color: #fff0f0; font-style: normal} + +code .keyword {color: #007020; font-weight: bold} +code .keyword.pseudo {font-weight: normal} + +code .operator {color: #666} +code .operator.word {color: #007020; font-weight: bold} + +code .name.builtin {color: #007020} +code .name.function {color: #06287e} +code .name.class {color: #0e84b5; font-weight: bold} +code .name.namespace {color: #0e84b5; font-weight: bold} +code .name.exception {color: #007020} +code .name.variable {color: #bb60d5} +code .name.constant {color: #60add5} +code .name.label {color: #002070; font-weight: bold} +code .name.entity {color: #d55537; font-weight: bold} +code .name.attribute {color: #4070a0} +code .name.tag {color: #062873; font-weight: bold} +code .name.decorator {color: #555; font-weight: bold} + +code .string {color: #4070a0} +code .string.doc {font-style: italic} +code .string.interpol {color: #70a0d0; font-style: italic} +code .string.escape {color: #4070a0; font-weight: bold} +code .string.regex {color: #235388} +code .string.symbol {color: #517918} +code .string.other {color: #c65d09} + +code .number {color: #40a070} diff --git a/includes/js/dojox/highlight/resources/pygments/fruity.css b/includes/js/dojox/highlight/resources/pygments/fruity.css new file mode 100644 index 0000000..019fa02 --- /dev/null +++ b/includes/js/dojox/highlight/resources/pygments/fruity.css @@ -0,0 +1,14 @@ + +code {background-color: #111; color: #fff} +code .comment {color: #080; background-color: #0f140f; font-style: italic} +code .comment.preproc {color: #ff0007; font-weight: bold} +code .keyword {color: #fb660a; font-weight: bold} +code .keyword.pseudo {font-weight: normal} +code .keyword.type {color: #cdcaa9; font-weight: bold} +code .name.function {color: #ff0086; font-weight: bold} +code .name.variable {color: #fb660a} +code .name.constant {color: #0086d2} +code .name.attribute {color: #ff0086; font-weight: bold} +code .name.tag {color: #fb660a; font-weight: bold} +code .string {color: #0086d2} +code .number {color: #0086f7; font-weight: bold} diff --git a/includes/js/dojox/highlight/resources/pygments/fruity.css.commented.css b/includes/js/dojox/highlight/resources/pygments/fruity.css.commented.css new file mode 100644 index 0000000..adf0b59 --- /dev/null +++ b/includes/js/dojox/highlight/resources/pygments/fruity.css.commented.css @@ -0,0 +1,20 @@ +/* Pygments fruity style */ + +code {background-color: #111; color: #fff} + +code .comment {color: #080; background-color: #0f140f; font-style: italic} +code .comment.preproc {color: #ff0007; font-weight: bold} + +code .keyword {color: #fb660a; font-weight: bold} +code .keyword.pseudo {font-weight: normal} +code .keyword.type {color: #cdcaa9; font-weight: bold} + +code .name.function {color: #ff0086; font-weight: bold} +code .name.variable {color: #fb660a} +code .name.constant {color: #0086d2} +code .name.attribute {color: #ff0086; font-weight: bold} +code .name.tag {color: #fb660a; font-weight: bold} + +code .string {color: #0086d2} + +code .number {color: #0086f7; font-weight: bold} diff --git a/includes/js/dojox/highlight/resources/pygments/manni.css b/includes/js/dojox/highlight/resources/pygments/manni.css new file mode 100644 index 0000000..0cbf7e6 --- /dev/null +++ b/includes/js/dojox/highlight/resources/pygments/manni.css @@ -0,0 +1,30 @@ + +code {background-color: #f0f3f3} +code .comment {color: #09f; font-style: italic} +code .comment.preproc {color: #099; font-style: normal} +code .comment.special {font-weight: bold} +code .keyword {color: #069; font-weight: bold} +code .keyword.pseudo {font-weight: normal} +code .keyword.type {color: #078} +code .operator {color: #555} +code .operator.word {color: #000; font-weight: bold} +code .name.builtin {color: #366} +code .name.function {color: #c0f} +code .name.class {color: #0a8; font-weight: bold} +code .name.namespace {color: #0cf; font-weight: bold} +code .name.exception {color: #c00; font-weight: bold} +code .name.variable {color: #033} +code .name.constant {color: #360} +code .name.label {color: #99f} +code .name.entity {color: #999; font-weight: bold} +code .name.attribute {color: #309} +code .name.tag {color: #309; font-weight: bold} +code .name.decorator {color: #99f} +code .string {color: #c30} +code .string.doc {font-style: italic} +code .string.interpol {color: #a00} +code .string.escape {color: #c30; font-weight: bold} +code .string.regex {color: #3aa} +code .string.symbol {color: #fc3} +code .string.other {color: #c30} +code .number {color: #f60} diff --git a/includes/js/dojox/highlight/resources/pygments/manni.css.commented.css b/includes/js/dojox/highlight/resources/pygments/manni.css.commented.css new file mode 100644 index 0000000..d9ba41a --- /dev/null +++ b/includes/js/dojox/highlight/resources/pygments/manni.css.commented.css @@ -0,0 +1,37 @@ +/* Pygments manni style */ + +code {background-color: #f0f3f3} + +code .comment {color: #09f; font-style: italic} +code .comment.preproc {color: #099; font-style: normal} +code .comment.special {font-weight: bold} + +code .keyword {color: #069; font-weight: bold} +code .keyword.pseudo {font-weight: normal} +code .keyword.type {color: #078} + +code .operator {color: #555} +code .operator.word {color: #000; font-weight: bold} + +code .name.builtin {color: #366} +code .name.function {color: #c0f} +code .name.class {color: #0a8; font-weight: bold} +code .name.namespace {color: #0cf; font-weight: bold} +code .name.exception {color: #c00; font-weight: bold} +code .name.variable {color: #033} +code .name.constant {color: #360} +code .name.label {color: #99f} +code .name.entity {color: #999; font-weight: bold} +code .name.attribute {color: #309} +code .name.tag {color: #309; font-weight: bold} +code .name.decorator {color: #99f} + +code .string {color: #c30} +code .string.doc {font-style: italic} +code .string.interpol {color: #a00} +code .string.escape {color: #c30; font-weight: bold} +code .string.regex {color: #3aa} +code .string.symbol {color: #fc3} +code .string.other {color: #c30} + +code .number {color: #f60} diff --git a/includes/js/dojox/highlight/resources/pygments/murphy.css b/includes/js/dojox/highlight/resources/pygments/murphy.css new file mode 100644 index 0000000..971b505 --- /dev/null +++ b/includes/js/dojox/highlight/resources/pygments/murphy.css @@ -0,0 +1,37 @@ + +code .comment {color: #666; font-style: italic} +code .comment.preproc {color: #579; font-style: normal} +code .comment.special {color: #c00; font-weight: bold} +code .keyword {color: #289; font-weight: bold} +code .keyword.pseudo {color: #08f} +code .keyword.type {color: #66f} +code .operator {color: #333} +code .operator.word {color: #000; font-weight: bold} +code .name.builtin {color: #072} +code .name.function {color: #5ed; font-weight: bold} +code .name.class {color: #e9e; font-weight: bold} +code .name.namespace {color: #0e84b5; font-weight: bold} +code .name.exception {color: #f00; font-weight: bold} +code .name.variable {color: #036} +code .name.variable.instance {color: #aaf} +code .name.variable.class {color: #ccf} +code .name.variable.global {color: #f84} +code .name.constant {color: #5ed; font-weight: bold} +code .name.label {color: #970; font-weight: bold} +code .name.entity {color: #800} +code .name.attribute {color: #007} +code .name.tag {color: #070} +code .name.decorator {color: #555; font-weight: bold} +code .string {background-color: #e0e0ff} +code .string.char {color: #88f; background-color: transparent} +code .string.doc {color: #d42; background-color: transparent} +code .string.interpol {background-color: #eee} +code .string.escape {color: #666; font-weight: bold} +code .string.regex {color: #000; background-color: #e0e0ff} +code .string.symbol {color: #fc8; background-color: transparent} +code .string.other {color: #f88} +code .number {color: #60e; font-weight: bold} +code .number.integer {color: #66f; font-weight: bold} +code .number.float {color: #60e; font-weight: bold} +code .number.hex {color: #058; font-weight: bold} +code .number.oct {color: #40e; font-weight: bold} diff --git a/includes/js/dojox/highlight/resources/pygments/murphy.css.commented.css b/includes/js/dojox/highlight/resources/pygments/murphy.css.commented.css new file mode 100644 index 0000000..bea43b5 --- /dev/null +++ b/includes/js/dojox/highlight/resources/pygments/murphy.css.commented.css @@ -0,0 +1,43 @@ +/* Pygments murphy style */ + +code .comment {color: #666; font-style: italic} +code .comment.preproc {color: #579; font-style: normal} +code .comment.special {color: #c00; font-weight: bold} + +code .keyword {color: #289; font-weight: bold} +code .keyword.pseudo {color: #08f} +code .keyword.type {color: #66f} + +code .operator {color: #333} +code .operator.word {color: #000; font-weight: bold} + +code .name.builtin {color: #072} +code .name.function {color: #5ed; font-weight: bold} +code .name.class {color: #e9e; font-weight: bold} +code .name.namespace {color: #0e84b5; font-weight: bold} +code .name.exception {color: #f00; font-weight: bold} +code .name.variable {color: #036} +code .name.variable.instance {color: #aaf} +code .name.variable.class {color: #ccf} +code .name.variable.global {color: #f84} +code .name.constant {color: #5ed; font-weight: bold} +code .name.label {color: #970; font-weight: bold} +code .name.entity {color: #800} +code .name.attribute {color: #007} +code .name.tag {color: #070} +code .name.decorator {color: #555; font-weight: bold} + +code .string {background-color: #e0e0ff} +code .string.char {color: #88f; background-color: transparent} +code .string.doc {color: #d42; background-color: transparent} +code .string.interpol {background-color: #eee} +code .string.escape {color: #666; font-weight: bold} +code .string.regex {color: #000; background-color: #e0e0ff} +code .string.symbol {color: #fc8; background-color: transparent} +code .string.other {color: #f88} + +code .number {color: #60e; font-weight: bold} +code .number.integer {color: #66f; font-weight: bold} +code .number.float {color: #60e; font-weight: bold} +code .number.hex {color: #058; font-weight: bold} +code .number.oct {color: #40e; font-weight: bold} diff --git a/includes/js/dojox/highlight/resources/pygments/native.css b/includes/js/dojox/highlight/resources/pygments/native.css new file mode 100644 index 0000000..47c361d --- /dev/null +++ b/includes/js/dojox/highlight/resources/pygments/native.css @@ -0,0 +1,21 @@ + +code {background-color: #202020; color: #d0d0d0} +code .comment {color: #999; font-style: italic} +code .comment.preproc {color: #cd2828; font-style: normal; font-weight: bold} +code .comment.special {color: #e50808; font-style: normal; font-weight: bold; background-color: #520000} +code .keyword {color: #6ab825; font-weight: bold} +code .keyword.pseudo {font-weight: normal} +code .operator.word {color: #6ab825; font-weight: bold} +code .name.builtin {color: #24909d} +code .name.function {color: #40ffff} +code .name.class {color: #447fcf; text-decoration: underline} +code .name.namespace {color: #447fcf; text-decoration: underline} +code .name.exception {color: #bbb} +code .name.variable {color: #40ffff} +code .name.constant {color: #40ffff} +code .name.attribute {color: #bbb} +code .name.tag {color: #6ab825; font-weight: bold} +code .name.decorator {color: #ffa500} +code .string {color: #ed9d13} +code .string.other {color: #ffa500} +code .number {color: #3677a9} diff --git a/includes/js/dojox/highlight/resources/pygments/native.css.commented.css b/includes/js/dojox/highlight/resources/pygments/native.css.commented.css new file mode 100644 index 0000000..6d3306c --- /dev/null +++ b/includes/js/dojox/highlight/resources/pygments/native.css.commented.css @@ -0,0 +1,28 @@ +/* Pygments native style */ + +code {background-color: #202020; color: #d0d0d0} + +code .comment {color: #999; font-style: italic} +code .comment.preproc {color: #cd2828; font-style: normal; font-weight: bold} +code .comment.special {color: #e50808; font-style: normal; font-weight: bold; background-color: #520000} + +code .keyword {color: #6ab825; font-weight: bold} +code .keyword.pseudo {font-weight: normal} + +code .operator.word {color: #6ab825; font-weight: bold} + +code .name.builtin {color: #24909d} +code .name.function {color: #40ffff} +code .name.class {color: #447fcf; text-decoration: underline} +code .name.namespace {color: #447fcf; text-decoration: underline} +code .name.exception {color: #bbb} +code .name.variable {color: #40ffff} +code .name.constant {color: #40ffff} +code .name.attribute {color: #bbb} +code .name.tag {color: #6ab825; font-weight: bold} +code .name.decorator {color: #ffa500} + +code .string {color: #ed9d13} +code .string.other {color: #ffa500} + +code .number {color: #3677a9} diff --git a/includes/js/dojox/highlight/resources/pygments/pastie.css b/includes/js/dojox/highlight/resources/pygments/pastie.css new file mode 100644 index 0000000..d5e20e3 --- /dev/null +++ b/includes/js/dojox/highlight/resources/pygments/pastie.css @@ -0,0 +1,30 @@ + +code .comment {color: #888} +code .comment.preproc {color: #c00; font-weight: bold} +code .comment.special {color: #c00; font-weight: bold; background-color: #fff0f0} +code .keyword {color: #008800; font-weight: bold} +code .keyword.pseudo {font-weight: normal} +code .keyword.type {color: #888} +code .operator.word {color: #080} +code .name.builtin {color: #038} +code .name.function {color: #06b; font-weight: bold} +code .name.class {color: #b06; font-weight: bold} +code .name.namespace {color: #b06; font-weight: bold} +code .name.exception {color: #b06; font-weight: bold} +code .name.variable {color: #369} +code .name.variable.class {color: #369} +code .name.variable.instance {color: #33b} +code .name.variable.global {color: #d70} +code .name.constant {color: #036; font-weight: bold} +code .name.label {color: #369; font-style: italic} +code .name.attribute {color: #369} +code .name.tag {color: #b06; font-weight: bold} +code .name.decorator {color: #555} +code .name.property {color: #369; font-weight: bold} +code .string {color: #d20; background-color: #fff0f0} +code .string.interpol {color: #33b} +code .string.escape {color: #04d} +code .string.regex {color: #080; background-color: #fff0f0} +code .string.symbol {color: #a60} +code .string.other {color: #2b2; background-color: #f0fff0} +code .number {color: #00d; font-weight: bold} diff --git a/includes/js/dojox/highlight/resources/pygments/pastie.css.commented.css b/includes/js/dojox/highlight/resources/pygments/pastie.css.commented.css new file mode 100644 index 0000000..5b11cae --- /dev/null +++ b/includes/js/dojox/highlight/resources/pygments/pastie.css.commented.css @@ -0,0 +1,36 @@ +/* Pygments pastie style */ + +code .comment {color: #888} +code .comment.preproc {color: #c00; font-weight: bold} +code .comment.special {color: #c00; font-weight: bold; background-color: #fff0f0} + +code .keyword {color: #008800; font-weight: bold} +code .keyword.pseudo {font-weight: normal} +code .keyword.type {color: #888} + +code .operator.word {color: #080} + +code .name.builtin {color: #038} +code .name.function {color: #06b; font-weight: bold} +code .name.class {color: #b06; font-weight: bold} +code .name.namespace {color: #b06; font-weight: bold} +code .name.exception {color: #b06; font-weight: bold} +code .name.variable {color: #369} +code .name.variable.class {color: #369} +code .name.variable.instance {color: #33b} +code .name.variable.global {color: #d70} +code .name.constant {color: #036; font-weight: bold} +code .name.label {color: #369; font-style: italic} +code .name.attribute {color: #369} +code .name.tag {color: #b06; font-weight: bold} +code .name.decorator {color: #555} +code .name.property {color: #369; font-weight: bold} + +code .string {color: #d20; background-color: #fff0f0} +code .string.interpol {color: #33b} +code .string.escape {color: #04d} +code .string.regex {color: #080; background-color: #fff0f0} +code .string.symbol {color: #a60} +code .string.other {color: #2b2; background-color: #f0fff0} + +code .number {color: #00d; font-weight: bold} diff --git a/includes/js/dojox/highlight/resources/pygments/perldoc.css b/includes/js/dojox/highlight/resources/pygments/perldoc.css new file mode 100644 index 0000000..e9253e6 --- /dev/null +++ b/includes/js/dojox/highlight/resources/pygments/perldoc.css @@ -0,0 +1,23 @@ + +code {background-color: #eed} +code .comment {color: #228b22} +code .comment.preproc {color: #1e889b} +code .comment.special {color: #8b008b; font-weight: bold} +code .keyword {color: #8b008b; font-weight: bold} +code .keyword.type {color: #a7a7a7} +code .operator.word {color: #8b008b} +code .name.builtin {color: #658b00} +code .name.function {color: #008b45} +code .name.class {color: #008b45; font-weight: bold} +code .name.namespace {color: #008b45; text-decoration: underline} +code .name.exception {color: #008b45; font-weight: bold} +code .name.variable {color: #00688b} +code .name.constant {color: #00688b} +code .name.attribute {color: #658b00} +code .name.tag {color: #8b008b; font-weight: bold} +code .name.decorator {color: #707a7c} +code .string {color: #cd5555} +code .string.regex {color: #1c7e71} +code .string.other {color: #cb6c20} +code .string.heredoc {color: #1c7e71; font-style: italic} +code .number {color: #b452cd} diff --git a/includes/js/dojox/highlight/resources/pygments/perldoc.css.commented.css b/includes/js/dojox/highlight/resources/pygments/perldoc.css.commented.css new file mode 100644 index 0000000..2a56e2f --- /dev/null +++ b/includes/js/dojox/highlight/resources/pygments/perldoc.css.commented.css @@ -0,0 +1,30 @@ +/* Pygments perldoc style */ + +code {background-color: #eed} + +code .comment {color: #228b22} +code .comment.preproc {color: #1e889b} +code .comment.special {color: #8b008b; font-weight: bold} + +code .keyword {color: #8b008b; font-weight: bold} +code .keyword.type {color: #a7a7a7} + +code .operator.word {color: #8b008b} + +code .name.builtin {color: #658b00} +code .name.function {color: #008b45} +code .name.class {color: #008b45; font-weight: bold} +code .name.namespace {color: #008b45; text-decoration: underline} +code .name.exception {color: #008b45; font-weight: bold} +code .name.variable {color: #00688b} +code .name.constant {color: #00688b} +code .name.attribute {color: #658b00} +code .name.tag {color: #8b008b; font-weight: bold} +code .name.decorator {color: #707a7c} + +code .string {color: #cd5555} +code .string.regex {color: #1c7e71} +code .string.other {color: #cb6c20} +code .string.heredoc {color: #1c7e71; font-style: italic} + +code .number {color: #b452cd} diff --git a/includes/js/dojox/highlight/resources/pygments/trac.css b/includes/js/dojox/highlight/resources/pygments/trac.css new file mode 100644 index 0000000..2085719 --- /dev/null +++ b/includes/js/dojox/highlight/resources/pygments/trac.css @@ -0,0 +1,20 @@ + +code .comment {color: #998; font-style: italic} +code .comment.preproc {color: #999; font-style: normal; font-weight: bold} +code .comment.special {color: #999; font-weight: bold} +code .keyword {font-weight: bold} +code .keyword.type {color: #458} +code .operator {font-weight: bold} +code .name.builtin {color: #999} +code .name.function {color: #900; font-weight: bold} +code .name.class {color: #458; font-weight: bold} +code .name.namespace {color: #555} +code .name.exception {color: #900; font-weight: bold} +code .name.variable {color: #008080} +code .name.constant {color: #008080} +code .name.entity {color: #800080} +code .name.attribute {color: #008080} +code .name.tag {color: #000080} +code .string {color: #b84} +code .string.regex {color: #808000} +code .number {color: #099} diff --git a/includes/js/dojox/highlight/resources/pygments/trac.css.commented.css b/includes/js/dojox/highlight/resources/pygments/trac.css.commented.css new file mode 100644 index 0000000..127b1fb --- /dev/null +++ b/includes/js/dojox/highlight/resources/pygments/trac.css.commented.css @@ -0,0 +1,26 @@ +/* Pygments trac style */ + +code .comment {color: #998; font-style: italic} +code .comment.preproc {color: #999; font-style: normal; font-weight: bold} +code .comment.special {color: #999; font-weight: bold} + +code .keyword {font-weight: bold} +code .keyword.type {color: #458} + +code .operator {font-weight: bold} + +code .name.builtin {color: #999} +code .name.function {color: #900; font-weight: bold} +code .name.class {color: #458; font-weight: bold} +code .name.namespace {color: #555} +code .name.exception {color: #900; font-weight: bold} +code .name.variable {color: #008080} +code .name.constant {color: #008080} +code .name.entity {color: #800080} +code .name.attribute {color: #008080} +code .name.tag {color: #000080} + +code .string {color: #b84} +code .string.regex {color: #808000} + +code .number {color: #099} diff --git a/includes/js/dojox/highlight/tests/test_highlight.html b/includes/js/dojox/highlight/tests/test_highlight.html new file mode 100644 index 0000000..93b1534 --- /dev/null +++ b/includes/js/dojox/highlight/tests/test_highlight.html @@ -0,0 +1,327 @@ +<!DOCTYPE html> +<head> + <title>dojox.highlight - syntax highlighting | The Dojo Toolkit</title> + <style type="text/css"> + @import "../../../dijit/tests/css/dijitTests.css"; + + /* a sample set of definitions to use as a foundation to color your code */ + @import "../resources/highlight.css"; + + /* additional styling for this test case */ + pre code[class]:after { + content: 'highlight: ' attr(class); + display: block; text-align: right; + font-size: smaller; + color: #CCC; background: white; + border-top: solid 1px; + padding-top: 0.5em; + } + + pre code { + display: block; + } + + code { + background: #F0F0F0; + } + + pre code, + .ruby .subst { + color: black; + } + </style> + + <script type="text/javascript" djConfig="parseOnLoad: true, isDebug: true" src="../../../dojo/dojo.js"></script> + <script type="text/javascript" src="../_base.js"></script> + + <script type="text/javascript"> + // initHighlightOnLoad is deprecated. + // if parseOnLoad==true, the onLoad init stuff is run. + // if parseOnLoad==false, you can call dojox.highlight.init(domNode) + // + // utilizing the dojo build system, the dojox.highlight engine + // will "do it's best" based on the language maps available + // at the time of construction. + // + dojo.require("dojox.highlight"); + + // several layer-like files have been provided grouping + // similar langauges, and a catch all language module + // dojox.highlight.languages._all is available for "best results" + + // we need some language definitions: + dojo.require("dojox.highlight.languages._all"); + //dojo.require("dojox.highlight.languages._static"); + //dojo.require("dojox.highlight.languages._dynamic"); + //dojo.require("dojox.highlight.languages._www"); + + var lazyCode = function(){ + + dojo.query("code").forEach(dojox.highlight.init); + + dojo.xhrGet({ + url: "../../../dojo/_base.js", + load: function(data){ + var n = dojo.byId("foobar"), + c = document.createElement('div'), + e = n.parentNode.parentNode; + c.innerHTML = '<pre><code class="javascript">' + data.replace(/\</gi,"<") + '</code></pre>'; + e.replaceChild(c.firstChild, n.parentNode); + dojo.query("pre > code", e).forEach(dojox.highlight.init); + } + }); + }; + dojo.addOnLoad(lazyCode); + + </script> +</head> +<body> + +<h1 class="testTitle">dojox.highlight</h1> + +<p>client-side syntax highlighting for a number of languages.</p> + +<p><em>NOTE:</em> All languages listed here have working language definitions, though +not all exist in the release or dojo subversion. The missing packs are not publically available. +<span style="display:none">based on</span> +</p> + +<h2>Examples:</h2> + +<p>Some Python code:</p> + +<pre><code>@requires_authorization +def somefunc(param1, param2): + '''A docstring''' + if param1 > param2: # interesting + print 'Gre\'ater' + print '' + return param2 - param1 + 1 + +class SomeClass:<br> pass +</code></pre> +<!-- + +<p>Short sample of Ruby:</p> + FIXME: example needed +--> + +<!-- + + <p>A bit of Perl:</p> + FIXME: example needed +--> + +<p>A chunk of PHP: </p> + +<pre><code class="php"> +$opAr = array ( "-a|--append", // a or append toggle, nothing extra + "-i|--input:", // i or input with next input being needed + "-l|--list:", // l with input needed + //"--foo", // broken + "-f:", // f with no input + "--wot:" // wot with input, no short + ); + + +$op = bgetop($opAr); +if (is_array($op)) { print_r($op); } + +/* here is the code: */ + +function bgetop($opAr=array(),$unknown=true) { + +$argv = $_SERVER['argv']; +$argc = $_SERVER['argc']; +$argPos = 1; // zero is program running + +// foreach arg +while ($argPos<$argc) { + $arg = $argv[$argPos]; + if ($arg{0}=="-") { + if ($arg{1}=="-") { + $var = substr($arg,2,strlen($arg)); + } else { $var = $arg{1}; } + foreach ($opAr as $opk => $opv) { + if (!isset($return[$var])) { + if (strpos($opv,$arg) !== FALSE) { + // this is where the -f -foo fix needs to be, + // the partial string exists in this record, + // but we need to determine if it's accurate + // somehow (i'm thinking: eregi?) + if ($accurate=1) { + // we foudn the key + if (strpos($opv,':') !== FALSE) { + // next value is the one to use, + // then skip it in the parser. + if (isset($argv[$argPos+1])) { + $return[$var] = $argv[++$argPos]; + } else { + $return[$var] = FALSE; + } + } else { + // just set the toggle + $return[$var] = TRUE; + } + // don't check this opAr value again + unset($opAr[$opk]); + } + } // if accurate + } // !isset already + } // foreach opAr + } else { // we weren't expecting a non-hyphened argument, possibly just a filename, or whatnot + if ($unknown) { $return['unknown'][]=$arg; } + } + $argPos++; +} // while argPos < argc + +if (is_array($return)) { +return $return; +} else { return 0; } + +} // end function bgetop + +</code></pre> + +<p>A custom XML document:</p> + +<pre><code><?xml version="1.0"?> +<response value="ok"> + <text>Ok</text> + <comment/> + <ns:description><![CDATA[ + CDATA is <not> magical. + ]]></ns:description> +</response> +</code></pre> + +<p>Some HTML code:</p> + +<pre><code><head> + <title>Title</title> +<body> + <p class="something">Something</p> + <p class=something>Something</p> + <!-- comment --> + <p class>Something</p> + <p class="something" title="p">Something</p> +</body> +</code></pre> + +<p>HTML with Django templates:</p> + +<pre><code>{% if articles|length %} +{% for article in articles %} + +{# Striped table #} +<tr class="{% cycle odd,even %}"> + <td>{{ article|default:"Hi... "|escape }}</td> + <td>{{ article.date|date:"d.m.Y" }}</td> +</tr> + +{% endfor %} +{% endif %} + +{% comment %} +Comments may be long and +multiline. +{% endcomment %} +</code></pre> + +<p>Some CSS code:</p> + +<pre><code>body, +html { + font: Tahoma, Arial, san-serif; +} + +#content { + width: 100%; /* css comment */ + height: 100% +} + +p[lang=ru] { + color: red; +} +</pre></code> + +<p>Explicit Python highlight:</p> + +<pre><code class="python">for x in [1, 2, 3]: + count(x) +</code></pre> + +<p>Disabled highlighting:</p> + +<pre><code class="no-highlight"><div id="contents"> + <p>Hello, World! +</div> +</code></pre> + +<p>Normal dojo-looking code</p> + +<pre><code> +dojo.provide("some.object"); +dojo.declare("some.object",null,{ + param: "value", + _myMethod: function(/* Event */e){ + this.inherited(arguments); + }, + // comments + _another: function(){ + dojo.addClass("foo","hovered"); + } +}); +dojo.addOnLoad(function(){ + // + // comments with <HTML> inline + var d = dojo; + d.mixin(d,{ + foo: function(e){ + d.bar(e); + }, + bar: function(e){ + alert(e); + } + }); +}); +</code></pre> + +<p>Lazy, xhr'd code:</p> + +<pre><code id="foobar"></code></pre> + +<hr> + +<p>Text with inlined JavaScript code: <code class="javascript">dojo.forEach(a, function(x){ console.log(x); });</code> — that was the inlined sample.</p> + +<hr> + +<p>Markuped code (python), no language was specified:</p> + +<pre><code dojoType="dojo.highlight.Code">@requires_authorization +def somefunc(param1, param2): + '''A docstring''' + if param1 > param2: # interesting + print 'Gre\'ater' + print '' + return param2 - param1 + 1 + +class SomeClass:<br> pass +</code></pre> + +<p>Markuped code, "python" was specified:</p> + +<pre><code dojoType="dojo.highlight.Code" class="python">@requires_authorization +def somefunc(param1, param2): + '''A docstring''' + if param1 > param2: # interesting + print 'Gre\'ater' + print '' + return param2 - param1 + 1 + +class SomeClass:<br> pass +</code></pre> + + +</body><html> diff --git a/includes/js/dojox/highlight/tests/test_pygments.html b/includes/js/dojox/highlight/tests/test_pygments.html new file mode 100644 index 0000000..6bdced6 --- /dev/null +++ b/includes/js/dojox/highlight/tests/test_pygments.html @@ -0,0 +1,142 @@ +<!DOCTYPE html> +<html> +<head> + <title>dojox.highlight.pygments - syntax highlighting | The Dojo Toolkit</title> + <style type="text/css"> + @import "../../../dijit/tests/css/dijitTests.css"; + + /* CSS rules for debugging */ + + pre code[class]:after { + content: 'highlight: ' attr(class); + display: block; text-align: right; + font-size: smaller; + color: #CCC; background: white; + border-top: solid 1px; + padding-top: 0.5em; + } + + pre code { + display: block; + } + </style> + + <!-- a sample set of definitions to use as a foundation to color your code --> + <link rel="stylesheet" type="text/css" href="../resources/pygments/default.css" /> + + <script type="text/javascript" djConfig="parseOnLoad: true, isDebug: true" src="../../../dojo/dojo.js"></script> + <!-- + <script type="text/javascript" src="../_base.js"></script> + <script type="text/javascript" src="../languages/pygments/xml.js"></script> + <script type="text/javascript" src="../languages/pygments/html.js"></script> + <script type="text/javascript" src="../languages/pygments/css.js"></script> + <script type="text/javascript" src="../languages/pygments/javascript.js"></script> + --> + + <script type="text/javascript"> + dojo.require("dojox.highlight"); + /* + dojo.require("dojox.highlight.languages.pygments.xml"); + dojo.require("dojox.highlight.languages.pygments.html"); + dojo.require("dojox.highlight.languages.pygments.css"); + dojo.require("dojox.highlight.languages.pygments.javascript"); + */ + dojo.require("dojox.highlight.languages.pygments._www"); + dojo.require("dojo.parser"); + + dojo.addOnLoad(function(){ + var sel = dojo.byId("theme"), + sty = dojo.query("link[rel='stylesheet']", document.head)[0]; + dojo.query("option[value='default']", sel)[0].selected = "selected"; + dojo.connect(sel, "onchange", function(){ + sty.href = "../resources/pygments/" + sel.value + ".css"; + }); + }); + </script> +</head> +<body> +<h1>Test Pygments-based highlighting</h1> + +<p>Current theme from the pygments set: +<select id="theme"> + <option value="autumn">Autumn</option> + <option value="borland">Borland</option> + <option value="colorful">Colorful</option> + <option value="default">Default</option> + <option value="emacs">Emacs</option> + <option value="friendly">Friendly</option> + <option value="fruity">Fruity</option> + <option value="manni">Manni</option> + <option value="murphy">Murphy</option> + <option value="native">Native</option> + <option value="pastie">Pastie</option> + <option value="perldoc">Perldoc</option> + <option value="trac">Trac</option> +</select> +</p> + +<p>Javascript:</p> + +<pre><code dojoType="dojox.highlight.Code">function initHighlight(block) { + if (block.className.search(/\bno\-highlight\b/) != -1) + return false; + try { + blockText(block); + } catch (e) { + if (e == 'Complex markup') + return; + }//try + var classes = block.className.split(/\s+/); + for (var i = 0; i < classes.length; i++) { + if (LANGUAGES[classes[i]]) { + highlightLanguage(block, classes[i]); + return; + }//if + }//for + highlightAuto(block); +}//initHighlight</code></pre> + +<p>Some CSS code:</p> + +<pre><code dojoType="dojox.highlight.Code">body, +html { + font: Tahoma, Arial, sans-serif; +} + +#content { + width: 100%; /* test comment */ + height: 100% +} + +p[lang=ru] { + color: red; +} +</pre></code> + +<p>Some HTML code:</p> + +<pre><code dojoType="dojox.highlight.Code"><head> + <title>Title</title> +<body> + <p class="something">Something</p> + <p class=something>Something</p> + <!-- comment --> + <p class>Something</p> + <p class="something" title="p">Something</p> +</body> +</code></pre> + +<p>A custom XML document:</p> + +<pre><code dojoType="dojox.highlight.Code"><?xml version="1.0"?> +<response value="ok"> + <text>Ok</text> + <comment/> + <ns:description><![CDATA[ + CDATA is <not> magical. + ]]></ns:description> +</response> +</code></pre> + +</body> +</html> |