From c2805e03c84b6e598556fd06d1ede7aaeea7ce9c Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 6 Mar 2012 16:17:54 -0800 Subject: Squashed commit FileIO-Build-Candidate into Master Fixing issues with HTML and CSS URLs. Adjusted RegEx logic. Also code a mirror update and undo/redo changes were merged into this request. Signed-off-by: Valerio Virgillito <valerio@motorola.com> --- imports/codemirror/mode/clike/clike.js | 19 +- imports/codemirror/mode/clike/index.html | 2 +- imports/codemirror/mode/clojure/clojure.js | 2 +- imports/codemirror/mode/clojure/index.html | 0 imports/codemirror/mode/coffeescript/LICENSE | 0 .../codemirror/mode/coffeescript/coffeescript.js | 90 ++-- imports/codemirror/mode/coffeescript/index.html | 0 imports/codemirror/mode/css/css.js | 0 imports/codemirror/mode/css/index.html | 0 imports/codemirror/mode/diff/diff.css | 0 imports/codemirror/mode/diff/diff.js | 0 imports/codemirror/mode/diff/index.html | 0 imports/codemirror/mode/ecl/ecl.js | 203 +++++++ imports/codemirror/mode/ecl/index.html | 42 ++ imports/codemirror/mode/gfm/gfm.js | 2 +- imports/codemirror/mode/gfm/index.html | 0 imports/codemirror/mode/go/go.js | 170 ++++++ imports/codemirror/mode/go/index.html | 72 +++ imports/codemirror/mode/groovy/groovy.js | 0 imports/codemirror/mode/groovy/index.html | 0 imports/codemirror/mode/haskell/haskell.js | 0 imports/codemirror/mode/haskell/index.html | 0 .../codemirror/mode/htmlembedded/htmlembedded.js | 0 imports/codemirror/mode/htmlembedded/index.html | 0 imports/codemirror/mode/htmlmixed/htmlmixed.js | 0 imports/codemirror/mode/htmlmixed/index.html | 0 imports/codemirror/mode/javascript/index.html | 0 imports/codemirror/mode/javascript/javascript.js | 4 +- imports/codemirror/mode/jinja2/index.html | 0 imports/codemirror/mode/jinja2/jinja2.js | 0 imports/codemirror/mode/less/index.html | 588 +++++++++++++++++++++ imports/codemirror/mode/less/less.js | 189 +++++++ imports/codemirror/mode/lua/index.html | 0 imports/codemirror/mode/lua/lua.js | 0 imports/codemirror/mode/markdown/index.html | 0 imports/codemirror/mode/markdown/markdown.js | 82 ++- imports/codemirror/mode/mysql/index.html | 41 ++ imports/codemirror/mode/mysql/mysql.js | 188 +++++++ imports/codemirror/mode/ntriples/index.html | 0 imports/codemirror/mode/ntriples/ntriples.js | 0 imports/codemirror/mode/pascal/LICENSE | 0 imports/codemirror/mode/pascal/index.html | 0 imports/codemirror/mode/pascal/pascal.js | 48 +- imports/codemirror/mode/perl/LICENSE | 0 imports/codemirror/mode/perl/index.html | 0 imports/codemirror/mode/perl/perl.js | 2 +- imports/codemirror/mode/php/index.html | 0 imports/codemirror/mode/php/php.js | 78 ++- imports/codemirror/mode/plsql/index.html | 0 imports/codemirror/mode/plsql/plsql.js | 0 imports/codemirror/mode/properties/index.html | 40 ++ imports/codemirror/mode/properties/properties.css | 3 + imports/codemirror/mode/properties/properties.js | 57 ++ imports/codemirror/mode/python/LICENSE.txt | 0 imports/codemirror/mode/python/index.html | 0 imports/codemirror/mode/python/python.js | 41 +- imports/codemirror/mode/r/LICENSE | 0 imports/codemirror/mode/r/index.html | 0 imports/codemirror/mode/r/r.js | 0 imports/codemirror/mode/rpm/changes/changes.js | 0 imports/codemirror/mode/rpm/changes/index.html | 0 imports/codemirror/mode/rpm/spec/index.html | 0 imports/codemirror/mode/rpm/spec/spec.css | 0 imports/codemirror/mode/rpm/spec/spec.js | 2 +- imports/codemirror/mode/rst/index.html | 0 imports/codemirror/mode/rst/rst.js | 0 imports/codemirror/mode/ruby/LICENSE | 0 imports/codemirror/mode/ruby/index.html | 0 imports/codemirror/mode/ruby/ruby.js | 17 +- imports/codemirror/mode/rust/index.html | 6 +- imports/codemirror/mode/rust/rust.js | 51 +- imports/codemirror/mode/scheme/index.html | 0 imports/codemirror/mode/smalltalk/index.html | 0 imports/codemirror/mode/smalltalk/smalltalk.js | 32 +- imports/codemirror/mode/sparql/index.html | 0 imports/codemirror/mode/sparql/sparql.js | 0 imports/codemirror/mode/stex/index.html | 2 +- imports/codemirror/mode/stex/stex.js | 0 imports/codemirror/mode/tiddlywiki/index.html | 0 imports/codemirror/mode/tiddlywiki/tiddlywiki.css | 0 imports/codemirror/mode/tiddlywiki/tiddlywiki.js | 0 imports/codemirror/mode/velocity/index.html | 0 imports/codemirror/mode/velocity/velocity.js | 0 imports/codemirror/mode/verilog/index.html | 210 ++++++++ imports/codemirror/mode/verilog/verilog.js | 194 +++++++ imports/codemirror/mode/xml/index.html | 0 imports/codemirror/mode/xml/xml.js | 35 +- imports/codemirror/mode/xmlpure/index.html | 0 imports/codemirror/mode/xmlpure/xmlpure.js | 5 + imports/codemirror/mode/yaml/index.html | 0 imports/codemirror/mode/yaml/yaml.js | 0 91 files changed, 2294 insertions(+), 223 deletions(-) mode change 100755 => 100644 imports/codemirror/mode/clike/clike.js mode change 100755 => 100644 imports/codemirror/mode/clike/index.html mode change 100755 => 100644 imports/codemirror/mode/clojure/clojure.js mode change 100755 => 100644 imports/codemirror/mode/clojure/index.html mode change 100755 => 100644 imports/codemirror/mode/coffeescript/LICENSE mode change 100755 => 100644 imports/codemirror/mode/coffeescript/coffeescript.js mode change 100755 => 100644 imports/codemirror/mode/coffeescript/index.html mode change 100755 => 100644 imports/codemirror/mode/css/css.js mode change 100755 => 100644 imports/codemirror/mode/css/index.html mode change 100755 => 100644 imports/codemirror/mode/diff/diff.css mode change 100755 => 100644 imports/codemirror/mode/diff/diff.js mode change 100755 => 100644 imports/codemirror/mode/diff/index.html create mode 100644 imports/codemirror/mode/ecl/ecl.js create mode 100644 imports/codemirror/mode/ecl/index.html mode change 100755 => 100644 imports/codemirror/mode/gfm/gfm.js mode change 100755 => 100644 imports/codemirror/mode/gfm/index.html create mode 100644 imports/codemirror/mode/go/go.js create mode 100644 imports/codemirror/mode/go/index.html mode change 100755 => 100644 imports/codemirror/mode/groovy/groovy.js mode change 100755 => 100644 imports/codemirror/mode/groovy/index.html mode change 100755 => 100644 imports/codemirror/mode/haskell/haskell.js mode change 100755 => 100644 imports/codemirror/mode/haskell/index.html mode change 100755 => 100644 imports/codemirror/mode/htmlembedded/htmlembedded.js mode change 100755 => 100644 imports/codemirror/mode/htmlembedded/index.html mode change 100755 => 100644 imports/codemirror/mode/htmlmixed/htmlmixed.js mode change 100755 => 100644 imports/codemirror/mode/htmlmixed/index.html mode change 100755 => 100644 imports/codemirror/mode/javascript/index.html mode change 100755 => 100644 imports/codemirror/mode/javascript/javascript.js mode change 100755 => 100644 imports/codemirror/mode/jinja2/index.html mode change 100755 => 100644 imports/codemirror/mode/jinja2/jinja2.js create mode 100644 imports/codemirror/mode/less/index.html create mode 100644 imports/codemirror/mode/less/less.js mode change 100755 => 100644 imports/codemirror/mode/lua/index.html mode change 100755 => 100644 imports/codemirror/mode/lua/lua.js mode change 100755 => 100644 imports/codemirror/mode/markdown/index.html mode change 100755 => 100644 imports/codemirror/mode/markdown/markdown.js create mode 100644 imports/codemirror/mode/mysql/index.html create mode 100644 imports/codemirror/mode/mysql/mysql.js mode change 100755 => 100644 imports/codemirror/mode/ntriples/index.html mode change 100755 => 100644 imports/codemirror/mode/ntriples/ntriples.js mode change 100755 => 100644 imports/codemirror/mode/pascal/LICENSE mode change 100755 => 100644 imports/codemirror/mode/pascal/index.html mode change 100755 => 100644 imports/codemirror/mode/pascal/pascal.js mode change 100755 => 100644 imports/codemirror/mode/perl/LICENSE mode change 100755 => 100644 imports/codemirror/mode/perl/index.html mode change 100755 => 100644 imports/codemirror/mode/perl/perl.js mode change 100755 => 100644 imports/codemirror/mode/php/index.html mode change 100755 => 100644 imports/codemirror/mode/php/php.js mode change 100755 => 100644 imports/codemirror/mode/plsql/index.html mode change 100755 => 100644 imports/codemirror/mode/plsql/plsql.js create mode 100755 imports/codemirror/mode/properties/index.html create mode 100755 imports/codemirror/mode/properties/properties.css create mode 100755 imports/codemirror/mode/properties/properties.js mode change 100755 => 100644 imports/codemirror/mode/python/LICENSE.txt mode change 100755 => 100644 imports/codemirror/mode/python/index.html mode change 100755 => 100644 imports/codemirror/mode/python/python.js mode change 100755 => 100644 imports/codemirror/mode/r/LICENSE mode change 100755 => 100644 imports/codemirror/mode/r/index.html mode change 100755 => 100644 imports/codemirror/mode/r/r.js mode change 100755 => 100644 imports/codemirror/mode/rpm/changes/changes.js mode change 100755 => 100644 imports/codemirror/mode/rpm/changes/index.html mode change 100755 => 100644 imports/codemirror/mode/rpm/spec/index.html mode change 100755 => 100644 imports/codemirror/mode/rpm/spec/spec.css mode change 100755 => 100644 imports/codemirror/mode/rpm/spec/spec.js mode change 100755 => 100644 imports/codemirror/mode/rst/index.html mode change 100755 => 100644 imports/codemirror/mode/rst/rst.js mode change 100755 => 100644 imports/codemirror/mode/ruby/LICENSE mode change 100755 => 100644 imports/codemirror/mode/ruby/index.html mode change 100755 => 100644 imports/codemirror/mode/ruby/ruby.js mode change 100755 => 100644 imports/codemirror/mode/rust/index.html mode change 100755 => 100644 imports/codemirror/mode/rust/rust.js mode change 100755 => 100644 imports/codemirror/mode/scheme/index.html mode change 100755 => 100644 imports/codemirror/mode/smalltalk/index.html mode change 100755 => 100644 imports/codemirror/mode/smalltalk/smalltalk.js mode change 100755 => 100644 imports/codemirror/mode/sparql/index.html mode change 100755 => 100644 imports/codemirror/mode/sparql/sparql.js mode change 100755 => 100644 imports/codemirror/mode/stex/index.html mode change 100755 => 100644 imports/codemirror/mode/stex/stex.js mode change 100755 => 100644 imports/codemirror/mode/tiddlywiki/index.html mode change 100755 => 100644 imports/codemirror/mode/tiddlywiki/tiddlywiki.css mode change 100755 => 100644 imports/codemirror/mode/tiddlywiki/tiddlywiki.js mode change 100755 => 100644 imports/codemirror/mode/velocity/index.html mode change 100755 => 100644 imports/codemirror/mode/velocity/velocity.js create mode 100644 imports/codemirror/mode/verilog/index.html create mode 100644 imports/codemirror/mode/verilog/verilog.js mode change 100755 => 100644 imports/codemirror/mode/xml/index.html mode change 100755 => 100644 imports/codemirror/mode/xml/xml.js mode change 100755 => 100644 imports/codemirror/mode/xmlpure/index.html mode change 100755 => 100644 imports/codemirror/mode/xmlpure/xmlpure.js mode change 100755 => 100644 imports/codemirror/mode/yaml/index.html mode change 100755 => 100644 imports/codemirror/mode/yaml/yaml.js (limited to 'imports/codemirror/mode') diff --git a/imports/codemirror/mode/clike/clike.js b/imports/codemirror/mode/clike/clike.js old mode 100755 new mode 100644 index 69877efd..66443fb8 --- a/imports/codemirror/mode/clike/clike.js +++ b/imports/codemirror/mode/clike/clike.js @@ -59,7 +59,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { escaped = !escaped && next == "\\"; } if (end || !(escaped || multiLineStrings)) - state.tokenize = tokenBase; + state.tokenize = null; return "string"; }; } @@ -68,7 +68,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { var maybeEnd = false, ch; while (ch = stream.next()) { if (ch == "/" && maybeEnd) { - state.tokenize = tokenBase; + state.tokenize = null; break; } maybeEnd = (ch == "*"); @@ -231,19 +231,4 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { } } }); - CodeMirror.defineMIME("text/x-groovy", { - name: "clike", - keywords: words("abstract as assert boolean break byte case catch char class const continue def default " + - "do double else enum extends final finally float for goto if implements import " + - "in instanceof int interface long native new package property private protected public " + - "return short static strictfp super switch synchronized this throw throws transient " + - "try void volatile while"), - atoms: words("true false null"), - hooks: { - "@": function(stream, state) { - stream.eatWhile(/[\w\$_]/); - return "meta"; - } - } - }); }()); diff --git a/imports/codemirror/mode/clike/index.html b/imports/codemirror/mode/clike/index.html old mode 100755 new mode 100644 index 5e375ef4..5c327451 --- a/imports/codemirror/mode/clike/index.html +++ b/imports/codemirror/mode/clike/index.html @@ -96,6 +96,6 @@ void* zmq_thread_init(void* zmq_context, int signal_fd) { <p><strong>MIME types defined:</strong> <code>text/x-csrc</code> (C code), <code>text/x-c++src</code> (C++ code), <code>text/x-java</code> (Java - code), <code>text/x-groovy</code> (Groovy code).</p> + code).</p> </body> </html> diff --git a/imports/codemirror/mode/clojure/clojure.js b/imports/codemirror/mode/clojure/clojure.js old mode 100755 new mode 100644 index a951589e..cce7ce37 --- a/imports/codemirror/mode/clojure/clojure.js +++ b/imports/codemirror/mode/clojure/clojure.js @@ -103,7 +103,7 @@ CodeMirror.defineMode("clojure", function (config, mode) { return { indentStack: null, indentation: 0, - mode: false, + mode: false }; }, diff --git a/imports/codemirror/mode/clojure/index.html b/imports/codemirror/mode/clojure/index.html old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/coffeescript/LICENSE b/imports/codemirror/mode/coffeescript/LICENSE old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/coffeescript/coffeescript.js b/imports/codemirror/mode/coffeescript/coffeescript.js old mode 100755 new mode 100644 index d4d57239..4f2bd66d --- a/imports/codemirror/mode/coffeescript/coffeescript.js +++ b/imports/codemirror/mode/coffeescript/coffeescript.js @@ -4,17 +4,17 @@ */ CodeMirror.defineMode('coffeescript', function(conf) { var ERRORCLASS = 'error'; - + function wordRegexp(words) { return new RegExp("^((" + words.join(")|(") + "))\\b"); } - + var singleOperators = new RegExp("^[\\+\\-\\*/%&|\\^~<>!\?]"); var singleDelimiters = new RegExp('^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]'); var doubleOperators = new RegExp("^((\->)|(\=>)|(\\+\\+)|(\\+\\=)|(\\-\\-)|(\\-\\=)|(\\*\\*)|(\\*\\=)|(\\/\\/)|(\\/\\=)|(==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//))"); var doubleDelimiters = new RegExp("^((\\.\\.)|(\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))"); var tripleDelimiters = new RegExp("^((\\.\\.\\.)|(//=)|(>>=)|(<<=)|(\\*\\*=))"); - var identifiers = new RegExp("^[_A-Za-z][_A-Za-z0-9]*"); + var identifiers = new RegExp("^[_A-Za-z$][_A-Za-z$0-9]*"); var wordOperators = wordRegexp(['and', 'or', 'not', 'is', 'isnt', 'in', @@ -57,15 +57,21 @@ CodeMirror.defineMode('coffeescript', function(conf) { if (stream.eatSpace()) { return null; } - + var ch = stream.peek(); - - // Handle comments + + // Handle multi line comments + if (stream.match("###")) { + state.tokenize = longComment; + return state.tokenize(stream, state); + } + + // Single line comment if (ch === '#') { stream.skipToEnd(); return 'comment'; } - + // Handle number literals if (stream.match(/^-?[0-9\.]/, false)) { var floatLiteral = false; @@ -79,7 +85,12 @@ CodeMirror.defineMode('coffeescript', function(conf) { if (stream.match(/^-?\.\d+/)) { floatLiteral = true; } + if (floatLiteral) { + // prevent from getting extra . on 1.. + if (stream.peek() == "."){ + stream.backUp(1); + } return 'number'; } // Integers @@ -100,7 +111,7 @@ CodeMirror.defineMode('coffeescript', function(conf) { return 'number'; } } - + // Handle strings if (stream.match(stringPrefixes)) { state.tokenize = tokenFactory(stream.current(), 'string'); @@ -115,7 +126,7 @@ CodeMirror.defineMode('coffeescript', function(conf) { stream.backUp(1); } } - + // Handle operators and delimiters if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) { return 'punctuation'; @@ -128,28 +139,26 @@ CodeMirror.defineMode('coffeescript', function(conf) { if (stream.match(singleDelimiters)) { return 'punctuation'; } - + if (stream.match(constants)) { return 'atom'; } - + if (stream.match(keywords)) { return 'keyword'; } - + if (stream.match(identifiers)) { return 'variable'; } - + // Handle non-detected items stream.next(); return ERRORCLASS; } - + function tokenFactory(delimiter, outclass) { - var delim_re = new RegExp(delimiter); var singleline = delimiter.length == 1; - return function tokenString(stream, state) { while (!stream.eol()) { stream.eatWhile(/[^'"\/\\]/); @@ -158,7 +167,7 @@ CodeMirror.defineMode('coffeescript', function(conf) { if (singleline && stream.eol()) { return outclass; } - } else if (stream.match(delim_re)) { + } else if (stream.match(delimiter)) { state.tokenize = tokenBase; return outclass; } else { @@ -175,7 +184,19 @@ CodeMirror.defineMode('coffeescript', function(conf) { return outclass; }; } - + + function longComment(stream, state) { + while (!stream.eol()) { + stream.eatWhile(/[^#]/); + if (stream.match("###")) { + state.tokenize = tokenBase; + break; + } + stream.eatWhile("#"); + } + return "comment" + } + function indent(stream, state, type) { type = type || 'coffee'; var indentUnit = 0; @@ -194,7 +215,7 @@ CodeMirror.defineMode('coffeescript', function(conf) { type: type }); } - + function dedent(stream, state) { if (state.scopes.length == 1) return; if (state.scopes[0].type === 'coffee') { @@ -233,18 +254,13 @@ CodeMirror.defineMode('coffeescript', function(conf) { return ERRORCLASS; } } - + // Handle properties if (current === '@') { - style = state.tokenize(stream, state); - current = stream.current(); - if (style === 'variable') { - return 'variable-2'; - } else { - return ERRORCLASS; - } + stream.eat('@'); + return 'keyword'; } - + // Handle scope changes. if (current === 'return') { state.dedent += 1; @@ -266,7 +282,7 @@ CodeMirror.defineMode('coffeescript', function(conf) { if (current == 'then'){ dedent(stream, state); } - + if (style === 'dedent') { if (dedent(stream, state)) { @@ -283,7 +299,7 @@ CodeMirror.defineMode('coffeescript', function(conf) { if (state.scopes.length > 1) state.scopes.shift(); state.dedent -= 1; } - + return style; } @@ -297,27 +313,27 @@ CodeMirror.defineMode('coffeescript', function(conf) { dedent: 0 }; }, - + token: function(stream, state) { var style = tokenLexer(stream, state); - + state.lastToken = {style:style, content: stream.current()}; - + if (stream.eol() && stream.lambda) { state.lambda = false; } - + return style; }, - + indent: function(state, textAfter) { if (state.tokenize != tokenBase) { return 0; } - + return state.scopes[0].offset; } - + }; return external; }); diff --git a/imports/codemirror/mode/coffeescript/index.html b/imports/codemirror/mode/coffeescript/index.html old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/css/css.js b/imports/codemirror/mode/css/css.js old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/css/index.html b/imports/codemirror/mode/css/index.html old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/diff/diff.css b/imports/codemirror/mode/diff/diff.css old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/diff/diff.js b/imports/codemirror/mode/diff/diff.js old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/diff/index.html b/imports/codemirror/mode/diff/index.html old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/ecl/ecl.js b/imports/codemirror/mode/ecl/ecl.js new file mode 100644 index 00000000..9c94e670 --- /dev/null +++ b/imports/codemirror/mode/ecl/ecl.js @@ -0,0 +1,203 @@ +CodeMirror.defineMode("ecl", function(config) { + + function words(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } + + function metaHook(stream, state) { + if (!state.startOfLine) return false; + stream.skipToEnd(); + return "meta"; + } + + function tokenAtString(stream, state) { + var next; + while ((next = stream.next()) != null) { + if (next == '"' && !stream.eat('"')) { + state.tokenize = null; + break; + } + } + return "string"; + } + + var indentUnit = config.indentUnit; + var keyword = words("abs acos allnodes ascii asin asstring atan atan2 ave case choose choosen choosesets clustersize combine correlation cos cosh count covariance cron dataset dedup define denormalize distribute distributed distribution ebcdic enth error evaluate event eventextra eventname exists exp failcode failmessage fetch fromunicode getisvalid global graph group hash hash32 hash64 hashcrc hashmd5 having if index intformat isvalid iterate join keyunicode length library limit ln local log loop map matched matchlength matchposition matchtext matchunicode max merge mergejoin min nolocal nonempty normalize parse pipe power preload process project pull random range rank ranked realformat recordof regexfind regexreplace regroup rejected rollup round roundup row rowdiff sample set sin sinh sizeof soapcall sort sorted sqrt stepped stored sum table tan tanh thisnode topn tounicode transfer trim truncate typeof ungroup unicodeorder variance which workunit xmldecode xmlencode xmltext xmlunicode"); + var variable = words("apply assert build buildindex evaluate fail keydiff keypatch loadxml nothor notify output parallel sequential soapcall wait"); + var variable_2 = words("__compressed__ all and any as atmost before beginc++ best between case const counter csv descend encrypt end endc++ endmacro except exclusive expire export extend false few first flat from full function group header heading hole ifblock import in interface joined keep keyed last left limit load local locale lookup macro many maxcount maxlength min skew module named nocase noroot noscan nosort not of only opt or outer overwrite packed partition penalty physicallength pipe quote record relationship repeat return right scan self separator service shared skew skip sql store terminator thor threshold token transform trim true type unicodeorder unsorted validate virtual whole wild within xml xpath"); + var variable_3 = words("ascii big_endian boolean data decimal ebcdic integer pattern qstring real record rule set of string token udecimal unicode unsigned varstring varunicode"); + var builtin = words("checkpoint deprecated failcode failmessage failure global independent onwarning persist priority recovery stored success wait when"); + var blockKeywords = words("catch class do else finally for if switch try while"); + var atoms = words("true false null"); + var hooks = {"#": metaHook}; + var multiLineStrings; + var isOperatorChar = /[+\-*&%=<>!?|\/]/; + + var curPunc; + + function tokenBase(stream, state) { + var ch = stream.next(); + if (hooks[ch]) { + var result = hooks[ch](stream, state); + if (result !== false) return result; + } + if (ch == '"' || ch == "'") { + state.tokenize = tokenString(ch); + return state.tokenize(stream, state); + } + if (/[\[\]{}\(\),;\:\.]/.test(ch)) { + curPunc = ch; + return null + } + if (/\d/.test(ch)) { + stream.eatWhile(/[\w\.]/); + return "number"; + } + if (ch == "/") { + if (stream.eat("*")) { + state.tokenize = tokenComment; + return tokenComment(stream, state); + } + if (stream.eat("/")) { + stream.skipToEnd(); + return "comment"; + } + } + if (isOperatorChar.test(ch)) { + stream.eatWhile(isOperatorChar); + return "operator"; + } + stream.eatWhile(/[\w\$_]/); + var cur = stream.current().toLowerCase(); + if (keyword.propertyIsEnumerable(cur)) { + if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement"; + return "keyword"; + } else if (variable.propertyIsEnumerable(cur)) { + if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement"; + return "variable"; + } else if (variable_2.propertyIsEnumerable(cur)) { + if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement"; + return "variable-2"; + } else if (variable_3.propertyIsEnumerable(cur)) { + if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement"; + return "variable-3"; + } else if (builtin.propertyIsEnumerable(cur)) { + if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement"; + return "builtin"; + } else { //Data types are of from KEYWORD## + var i = cur.length - 1; + while(i >= 0 && (!isNaN(cur[i]) || cur[i] == '_')) + --i; + + if (i > 0) { + var cur2 = cur.substr(0, i + 1); + if (variable_3.propertyIsEnumerable(cur2)) { + if (blockKeywords.propertyIsEnumerable(cur2)) curPunc = "newstatement"; + return "variable-3"; + } + } + } + if (atoms.propertyIsEnumerable(cur)) return "atom"; + return "word"; + } + + function tokenString(quote) { + return function(stream, state) { + var escaped = false, next, end = false; + while ((next = stream.next()) != null) { + if (next == quote && !escaped) {end = true; break;} + escaped = !escaped && next == "\\"; + } + if (end || !(escaped || multiLineStrings)) + state.tokenize = tokenBase; + return "string"; + }; + } + + function tokenComment(stream, state) { + var maybeEnd = false, ch; + while (ch = stream.next()) { + if (ch == "/" && maybeEnd) { + state.tokenize = tokenBase; + break; + } + maybeEnd = (ch == "*"); + } + return "comment"; + } + + function Context(indented, column, type, align, prev) { + this.indented = indented; + this.column = column; + this.type = type; + this.align = align; + this.prev = prev; + } + function pushContext(state, col, type) { + return state.context = new Context(state.indented, col, type, null, state.context); + } + function popContext(state) { + var t = state.context.type; + if (t == ")" || t == "]" || t == "}") + state.indented = state.context.indented; + return state.context = state.context.prev; + } + + // Interface + + return { + startState: function(basecolumn) { + return { + tokenize: null, + context: new Context((basecolumn || 0) - indentUnit, 0, "top", false), + indented: 0, + startOfLine: true + }; + }, + + token: function(stream, state) { + var ctx = state.context; + if (stream.sol()) { + if (ctx.align == null) ctx.align = false; + state.indented = stream.indentation(); + state.startOfLine = true; + } + if (stream.eatSpace()) return null; + curPunc = null; + var style = (state.tokenize || tokenBase)(stream, state); + if (style == "comment" || style == "meta") return style; + if (ctx.align == null) ctx.align = true; + + if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state); + else if (curPunc == "{") pushContext(state, stream.column(), "}"); + else if (curPunc == "[") pushContext(state, stream.column(), "]"); + else if (curPunc == "(") pushContext(state, stream.column(), ")"); + else if (curPunc == "}") { + while (ctx.type == "statement") ctx = popContext(state); + if (ctx.type == "}") ctx = popContext(state); + while (ctx.type == "statement") ctx = popContext(state); + } + else if (curPunc == ctx.type) popContext(state); + else if (ctx.type == "}" || ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement")) + pushContext(state, stream.column(), "statement"); + state.startOfLine = false; + return style; + }, + + indent: function(state, textAfter) { + if (state.tokenize != tokenBase && state.tokenize != null) return 0; + var ctx = state.context, firstChar = textAfter && textAfter.charAt(0); + if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev; + var closing = firstChar == ctx.type; + if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : indentUnit); + else if (ctx.align) return ctx.column + (closing ? 0 : 1); + else return ctx.indented + (closing ? 0 : indentUnit); + }, + + electricChars: "{}" + }; +}); + +CodeMirror.defineMIME("text/x-ecl"); diff --git a/imports/codemirror/mode/ecl/index.html b/imports/codemirror/mode/ecl/index.html new file mode 100644 index 00000000..d6b41f4e --- /dev/null +++ b/imports/codemirror/mode/ecl/index.html @@ -0,0 +1,42 @@ +<!doctype html> +<html> + <head> + <title>CodeMirror: ECL mode</title> + <link rel="stylesheet" href="../../lib/codemirror.css"> + <script src="../../lib/codemirror.js"></script> + <script src="ecl.js"></script> + <link rel="stylesheet" href="../../doc/docs.css"> + <style>.CodeMirror {border: 1px solid black;}</style> + </head> + <body> + <h1>CodeMirror: ECL mode</h1> + <form><textarea id="code" name="code"> +/* +sample useless code to demonstrate ecl syntax highlighting +this is a multiline comment! +*/ + +// this is a singleline comment! + +import ut; +r := + record + string22 s1 := '123'; + integer4 i1 := 123; + end; +#option('tmp', true); +d := dataset('tmp::qb', r, thor); +output(d); +</textarea></form> + <script> + var editor = CodeMirror.fromTextArea(document.getElementById("code"), { + tabMode: "indent", + matchBrackets: true, + }); + </script> + + <p>Based on CodeMirror's clike mode. For more information see <a href="http://hpccsystems.com">HPCC Systems</a> web site.</p> + <p><strong>MIME types defined:</strong> <code>text/x-ecl</code>.</p> + + </body> +</html> diff --git a/imports/codemirror/mode/gfm/gfm.js b/imports/codemirror/mode/gfm/gfm.js old mode 100755 new mode 100644 index 1e9d7d87..01afed7b --- a/imports/codemirror/mode/gfm/gfm.js +++ b/imports/codemirror/mode/gfm/gfm.js @@ -8,7 +8,7 @@ CodeMirror.defineMode("gfm", function(config, parserConfig) { "c++": "text/x-c++src", java: "text/x-java", csharp: "text/x-csharp", - "c#": "text/x-csharp", + "c#": "text/x-csharp" }; // make this lazy so that we don't need to load GFM last diff --git a/imports/codemirror/mode/gfm/index.html b/imports/codemirror/mode/gfm/index.html old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/go/go.js b/imports/codemirror/mode/go/go.js new file mode 100644 index 00000000..00e5d6c2 --- /dev/null +++ b/imports/codemirror/mode/go/go.js @@ -0,0 +1,170 @@ +CodeMirror.defineMode("go", function(config, parserConfig) { + var indentUnit = config.indentUnit; + + var keywords = { + "break":true, "case":true, "chan":true, "const":true, "continue":true, + "default":true, "defer":true, "else":true, "fallthrough":true, "for":true, + "func":true, "go":true, "goto":true, "if":true, "import":true, + "interface":true, "map":true, "package":true, "range":true, "return":true, + "select":true, "struct":true, "switch":true, "type":true, "var":true, + "bool":true, "byte":true, "complex64":true, "complex128":true, + "float32":true, "float64":true, "int8":true, "int16":true, "int32":true, + "int64":true, "string":true, "uint8":true, "uint16":true, "uint32":true, + "uint64":true, "int":true, "uint":true, "uintptr":true + }; + + var atoms = { + "true":true, "false":true, "iota":true, "nil":true, "append":true, + "cap":true, "close":true, "complex":true, "copy":true, "imag":true, + "len":true, "make":true, "new":true, "panic":true, "print":true, + "println":true, "real":true, "recover":true + }; + + var blockKeywords = { + "else":true, "for":true, "func":true, "if":true, "interface":true, + "select":true, "struct":true, "switch":true + }; + + var isOperatorChar = /[+\-*&^%:=<>!|\/]/; + + var curPunc; + + function tokenBase(stream, state) { + var ch = stream.next(); + if (ch == '"' || ch == "'" || ch == "`") { + state.tokenize = tokenString(ch); + return state.tokenize(stream, state); + } + if (/[\d\.]/.test(ch)) { + if (ch == ".") { + stream.match(/^[0-9]+([eE][\-+]?[0-9]+)?/); + } else if (ch == "0") { + stream.match(/^[xX][0-9a-fA-F]+/) || stream.match(/^0[0-7]+/); + } else { + stream.match(/^[0-9]*\.?[0-9]*([eE][\-+]?[0-9]+)?/); + } + return "number"; + } + if (/[\[\]{}\(\),;\:\.]/.test(ch)) { + curPunc = ch; + return null + } + if (ch == "/") { + if (stream.eat("*")) { + state.tokenize = tokenComment; + return tokenComment(stream, state); + } + if (stream.eat("/")) { + stream.skipToEnd(); + return "comment"; + } + } + if (isOperatorChar.test(ch)) { + stream.eatWhile(isOperatorChar); + return "operator"; + } + stream.eatWhile(/[\w\$_]/); + var cur = stream.current(); + if (keywords.propertyIsEnumerable(cur)) { + if (cur == "case" || cur == "default") curPunc = "case"; + return "keyword"; + } + if (atoms.propertyIsEnumerable(cur)) return "atom"; + return "word"; + } + + function tokenString(quote) { + return function(stream, state) { + var escaped = false, next, end = false; + while ((next = stream.next()) != null) { + if (next == quote && !escaped) {end = true; break;} + escaped = !escaped && next == "\\"; + } + if (end || !(escaped || quote == "`")) + state.tokenize = tokenBase; + return "string"; + }; + } + + function tokenComment(stream, state) { + var maybeEnd = false, ch; + while (ch = stream.next()) { + if (ch == "/" && maybeEnd) { + state.tokenize = tokenBase; + break; + } + maybeEnd = (ch == "*"); + } + return "comment"; + } + + function Context(indented, column, type, align, prev) { + this.indented = indented; + this.column = column; + this.type = type; + this.align = align; + this.prev = prev; + } + function pushContext(state, col, type) { + return state.context = new Context(state.indented, col, type, null, state.context); + } + function popContext(state) { + var t = state.context.type; + if (t == ")" || t == "]" || t == "}") + state.indented = state.context.indented; + return state.context = state.context.prev; + } + + // Interface + + return { + startState: function(basecolumn) { + return { + tokenize: null, + context: new Context((basecolumn || 0) - indentUnit, 0, "top", false), + indented: 0, + startOfLine: true + }; + }, + + token: function(stream, state) { + var ctx = state.context; + if (stream.sol()) { + if (ctx.align == null) ctx.align = false; + state.indented = stream.indentation(); + state.startOfLine = true; + if (ctx.type == "case") ctx.type = "}"; + } + if (stream.eatSpace()) return null; + curPunc = null; + var style = (state.tokenize || tokenBase)(stream, state); + if (style == "comment") return style; + if (ctx.align == null) ctx.align = true; + + if (curPunc == "{") pushContext(state, stream.column(), "}"); + else if (curPunc == "[") pushContext(state, stream.column(), "]"); + else if (curPunc == "(") pushContext(state, stream.column(), ")"); + else if (curPunc == "case") ctx.type = "case" + else if (curPunc == "}" && ctx.type == "}") ctx = popContext(state); + else if (curPunc == ctx.type) popContext(state); + state.startOfLine = false; + return style; + }, + + indent: function(state, textAfter) { + if (state.tokenize != tokenBase && state.tokenize != null) return 0; + var ctx = state.context, firstChar = textAfter && textAfter.charAt(0); + if (ctx.type == "case" && /^(?:case|default)\b/.test(textAfter)) { + state.context.type = "}"; + return ctx.indented; + } + var closing = firstChar == ctx.type; + if (ctx.align) return ctx.column + (closing ? 0 : 1); + else return ctx.indented + (closing ? 0 : indentUnit); + }, + + electricChars: "{}:" + }; +}); + +CodeMirror.defineMIME("text/x-go", "go"); diff --git a/imports/codemirror/mode/go/index.html b/imports/codemirror/mode/go/index.html new file mode 100644 index 00000000..9cdad1ad --- /dev/null +++ b/imports/codemirror/mode/go/index.html @@ -0,0 +1,72 @@ +<!doctype html> +<html> + <head> + <title>CodeMirror: Go mode</title> + <link rel="stylesheet" href="../../lib/codemirror.css"> + <link rel="stylesheet" href="../../theme/elegant.css"> + <script src="../../lib/codemirror.js"></script> + <script src="go.js"></script> + <link rel="stylesheet" href="../../doc/docs.css"> + <style>.CodeMirror {border:1px solid #999; background:#ffc}</style> + </head> + <body> + <h1>CodeMirror: Go mode</h1> + +<form><textarea id="code" name="code"> +// Prime Sieve in Go. +// Taken from the Go specification. +// Copyright © The Go Authors. + +package main + +import "fmt" + +// Send the sequence 2, 3, 4, ... to channel 'ch'. +func generate(ch chan<- int) { + for i := 2; ; i++ { + ch <- i // Send 'i' to channel 'ch' + } +} + +// Copy the values from channel 'src' to channel 'dst', +// removing those divisible by 'prime'. +func filter(src <-chan int, dst chan<- int, prime int) { + for i := range src { // Loop over values received from 'src'. + if i%prime != 0 { + dst <- i // Send 'i' to channel 'dst'. + } + } +} + +// The prime sieve: Daisy-chain filter processes together. +func sieve() { + ch := make(chan int) // Create a new channel. + go generate(ch) // Start generate() as a subprocess. + for { + prime := <-ch + fmt.Print(prime, "\n") + ch1 := make(chan int) + go filter(ch, ch1, prime) + ch = ch1 + } +} + +func main() { + sieve() +} +</textarea></form> + + <script> + var editor = CodeMirror.fromTextArea(document.getElementById("code"), { + theme: "elegant", + matchBrackets: true, + indentUnit: 8, + tabSize: 8, + indentWithTabs: true, + mode: "text/x-go" + }); + </script> + + <p><strong>MIME type:</strong> <code>text/x-go</code></p> + </body> +</html> diff --git a/imports/codemirror/mode/groovy/groovy.js b/imports/codemirror/mode/groovy/groovy.js old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/groovy/index.html b/imports/codemirror/mode/groovy/index.html old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/haskell/haskell.js b/imports/codemirror/mode/haskell/haskell.js old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/haskell/index.html b/imports/codemirror/mode/haskell/index.html old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/htmlembedded/htmlembedded.js b/imports/codemirror/mode/htmlembedded/htmlembedded.js old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/htmlembedded/index.html b/imports/codemirror/mode/htmlembedded/index.html old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/htmlmixed/htmlmixed.js b/imports/codemirror/mode/htmlmixed/htmlmixed.js old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/htmlmixed/index.html b/imports/codemirror/mode/htmlmixed/index.html old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/javascript/index.html b/imports/codemirror/mode/javascript/index.html old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/javascript/javascript.js b/imports/codemirror/mode/javascript/javascript.js old mode 100755 new mode 100644 index be2a0698..b9388bc9 --- a/imports/codemirror/mode/javascript/javascript.js +++ b/imports/codemirror/mode/javascript/javascript.js @@ -69,7 +69,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { else if (state.reAllowed) { nextUntilUnescaped(stream, "/"); stream.eatWhile(/[gimy]/); // 'y' is "sticky" option in Mozilla - return ret("regexp", "string"); + return ret("regexp", "string-2"); } else { stream.eatWhile(isOperatorChar); @@ -230,7 +230,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { if (atomicTypes.hasOwnProperty(type)) return cont(maybeoperator); if (type == "function") return cont(functiondef); if (type == "keyword c") return cont(maybeexpression); - if (type == "(") return cont(pushlex(")"), expression, expect(")"), poplex, maybeoperator); + if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeoperator); if (type == "operator") return cont(expression); if (type == "[") return cont(pushlex("]"), commasep(expression, "]"), poplex, maybeoperator); if (type == "{") return cont(pushlex("}"), commasep(objprop, "}"), poplex, maybeoperator); diff --git a/imports/codemirror/mode/jinja2/index.html b/imports/codemirror/mode/jinja2/index.html old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/jinja2/jinja2.js b/imports/codemirror/mode/jinja2/jinja2.js old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/less/index.html b/imports/codemirror/mode/less/index.html new file mode 100644 index 00000000..bd3ef198 --- /dev/null +++ b/imports/codemirror/mode/less/index.html @@ -0,0 +1,588 @@ +<!doctype html> +<html> + <head> + <title>CodeMirror: LESS mode</title> + <link rel="stylesheet" href="../../lib/codemirror.css"> + <script src="../../lib/codemirror.js"></script> + <script src="less.js"></script> + <style>.CodeMirror {background: #f8f8f8; border: 1px solid #ddd;}</style> + <link rel="stylesheet" href="../../doc/docs.css"> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + </head> + <body> + <h1>CodeMirror: LESS mode</h1> + <form><textarea id="code" name="code"> +/* Some LESS code */ + +video { + background-image:url('paper.gif'); +} + +.pre_class { + width: 500px; + height: 250px; + background-image: url(sheep.png), url(betweengrassandsky.png); + background-position: center bottom, left top; + background-repeat: no-repeat; +} + +@color: #4D926F; + +#header { + color: @color; + color: #000000; +} +h2 { + color: @color; +} + +.rounded-corners (@radius: 5px) { + border-radius: @radius; + -webkit-border-radius: @radius; + -moz-border-radius: @radius; +} + +#header { + .rounded-corners; +} +#footer { + .rounded-corners(10px); +} + +.box-shadow (@x: 0, @y: 0, @blur: 1px, @alpha) { + @val: @x @y @blur rgba(0, 0, 0, @alpha); + + box-shadow: @val; + -webkit-box-shadow: @val; + -moz-box-shadow: @val; +} +.box { @base: #f938ab; + color: saturate(@base, 5%); + border-color: lighten(@base, 30%); + div { .box-shadow(0, 0, 5px, 0.4) } +} + +@import url("something.css"); + +@light-blue: hsl(190, 50%, 65%); +@light-yellow: desaturate(#fefec8, 10%); +@dark-yellow: desaturate(darken(@light-yellow, 10%), 40%); +@darkest: hsl(20, 0%, 15%); +@dark: hsl(190, 20%, 30%); +@medium: hsl(10, 60%, 30%); +@light: hsl(90, 40%, 20%); +@lightest: hsl(90, 20%, 90%); +@highlight: hsl(80, 50%, 90%); +@blue: hsl(210, 60%, 20%); +@alpha-blue: hsla(210, 60%, 40%, 0.5); + +.box-shadow (@x, @y, @blur, @alpha) { + @value: @x @y @blur rgba(0, 0, 0, @alpha); + box-shadow: @value; + -moz-box-shadow: @value; + -webkit-box-shadow: @value; +} +.border-radius (@radius) { + border-radius: @radius; + -moz-border-radius: @radius; + -webkit-border-radius: @radius; +} + +.border-radius (@radius, bottom) { + border-top-right-radius: 0; + border-top-left-radius: 0; + -moz-border-top-right-radius: 0; + -moz-border-top-left-radius: 0; + -webkit-border-top-left-radius: 0; + -webkit-border-top-right-radius: 0; +} +.border-radius (@radius, right) { + border-bottom-left-radius: 0; + border-top-left-radius: 0; + -moz-border-bottom-left-radius: 0; + -moz-border-top-left-radius: 0; + -webkit-border-bottom-left-radius: 0; + -webkit-border-top-left-radius: 0; +} +.box-shadow-inset (@x, @y, @blur, @color) { + box-shadow: @x @y @blur @color inset; + -moz-box-shadow: @x @y @blur @color inset; + -webkit-box-shadow: @x @y @blur @color inset; +} +.code () { + font-family: 'Bitstream Vera Sans Mono', + 'DejaVu Sans Mono', + 'Monaco', + Courier, + monospace !important; +} +.wrap () { + text-wrap: wrap; + white-space: pre-wrap; /* css-3 */ + white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ + white-space: -pre-wrap; /* Opera 4-6 */ + white-space: -o-pre-wrap; /* Opera 7 */ + word-wrap: break-word; /* Internet Explorer 5.5+ */ +} + +html { margin: 0 } +body { + background-color: @darkest; + margin: 0 auto; + font-family: Arial, sans-serif; + font-size: 100%; + overflow-x: hidden; +} +nav, header, footer, section, article { + display: block; +} +a { + color: #b83000; +} +h1 a { + color: black; + text-decoration: none; +} +a:hover { + text-decoration: underline; +} +h1, h2, h3, h4 { + margin: 0; + font-weight: normal; +} +ul, li { + list-style-type: none; +} +code { .code; } +code { + .string, .regexp { color: @dark } + .keyword { font-weight: bold } + .comment { color: rgba(0, 0, 0, 0.5) } + .number { color: @blue } + .class, .special { color: rgba(0, 50, 100, 0.8) } +} +pre { + padding: 0 30px; + .wrap; +} +blockquote { + font-style: italic; +} +body > footer { + text-align: left; + margin-left: 10px; + font-style: italic; + font-size: 18px; + color: #888; +} + +#logo { + margin-top: 30px; + margin-bottom: 30px; + display: block; + width: 199px; + height: 81px; + background: url(/images/logo.png) no-repeat; +} +nav { + margin-left: 15px; +} +nav a, #dropdown li { + display: inline-block; + color: white; + line-height: 42px; + margin: 0; + padding: 0px 15px; + text-shadow: -1px -1px 1px rgba(0, 0, 0, 0.5); + text-decoration: none; + border: 2px solid transparent; + border-width: 0 2px; + &:hover { + .dark-red; + text-decoration: none; + } +} +.dark-red { + @red: @medium; + border: 2px solid darken(@red, 25%); + border-left-color: darken(@red, 15%); + border-right-color: darken(@red, 15%); + border-bottom: 0; + border-top: 0; + background-color: darken(@red, 10%); +} + +.content { + margin: 0 auto; + width: 980px; +} + +#menu { + position: absolute; + width: 100%; + z-index: 3; + clear: both; + display: block; + background-color: @blue; + height: 42px; + border-top: 2px solid lighten(@alpha-blue, 20%); + border-bottom: 2px solid darken(@alpha-blue, 25%); + .box-shadow(0, 1px, 8px, 0.6); + -moz-box-shadow: 0 0 0 #000; // Because firefox sucks. + + &.docked { + background-color: hsla(210, 60%, 40%, 0.4); + } + &:hover { + background-color: @blue; + } + + #dropdown { + margin: 0 0 0 117px; + padding: 0; + padding-top: 5px; + display: none; + width: 190px; + border-top: 2px solid @medium; + color: @highlight; + border: 2px solid darken(@medium, 25%); + border-left-color: darken(@medium, 15%); + border-right-color: darken(@medium, 15%); + border-top-width: 0; + background-color: darken(@medium, 10%); + ul { + padding: 0px; + } + li { + font-size: 14px; + display: block; + text-align: left; + padding: 0; + border: 0; + a { + display: block; + padding: 0px 15px; + text-decoration: none; + color: white; + &:hover { + background-color: darken(@medium, 15%); + text-decoration: none; + } + } + } + .border-radius(5px, bottom); + .box-shadow(0, 6px, 8px, 0.5); + } +} + +#main { + margin: 0 auto; + width: 100%; + background-color: @light-blue; + border-top: 8px solid darken(@light-blue, 5%); + + #intro { + background-color: lighten(@light-blue, 25%); + float: left; + margin-top: -8px; + margin-right: 5px; + + height: 380px; + position: relative; + z-index: 2; + font-family: 'Droid Serif', 'Georgia'; + width: 395px; + padding: 45px 20px 23px 30px; + border: 2px dashed darken(@light-blue, 10%); + .box-shadow(1px, 0px, 6px, 0.5); + border-bottom: 0; + border-top: 0; + #download { color: transparent; border: 0; float: left; display: inline-block; margin: 15px 0 15px -5px; } + #download img { display: inline-block} + #download-info { + code { + font-size: 13px; + } + color: @blue + #333; display: inline; float: left; margin: 36px 0 0 15px } + } + h2 { + span { + color: @medium; + } + color: @blue; + margin: 20px 0; + font-size: 24px; + line-height: 1.2em; + } + h3 { + color: @blue; + line-height: 1.4em; + margin: 30px 0 15px 0; + font-size: 1em; + text-shadow: 0px 0px 0px @lightest; + span { color: @medium } + } + #example { + p { + font-size: 18px; + color: @blue; + font-weight: bold; + text-shadow: 0px 1px 1px @lightest; + } + pre { + margin: 0; + text-shadow: 0 -1px 1px @darkest; + margin-top: 20px; + background-color: desaturate(@darkest, 8%); + border: 0; + width: 450px; + color: lighten(@lightest, 2%); + background-repeat: repeat; + padding: 15px; + border: 1px dashed @lightest; + line-height: 15px; + .box-shadow(0, 0px, 15px, 0.5); + .code; + .border-radius(2px); + code .attribute { color: hsl(40, 50%, 70%) } + code .variable { color: hsl(120, 10%, 50%) } + code .element { color: hsl(170, 20%, 50%) } + + code .string, .regexp { color: hsl(75, 50%, 65%) } + code .class { color: hsl(40, 40%, 60%); font-weight: normal } + code .id { color: hsl(50, 40%, 60%); font-weight: normal } + code .comment { color: rgba(255, 255, 255, 0.2) } + code .number, .color { color: hsl(10, 40%, 50%) } + code .class, code .mixin, .special { color: hsl(190, 20%, 50%) } + #time { color: #aaa } + } + float: right; + font-size: 12px; + margin: 0; + margin-top: 15px; + padding: 0; + width: 500px; + } +} + + +.page { + .content { + width: 870px; + padding: 45px; + } + margin: 0 auto; + font-family: 'Georgia', serif; + font-size: 18px; + line-height: 26px; + padding: 0 60px; + code { + font-size: 16px; + } + pre { + border-width: 1px; + border-style: dashed; + padding: 15px; + margin: 15px 0; + } + h1 { + text-align: left; + font-size: 40px; + margin-top: 15px; + margin-bottom: 35px; + } + p + h1 { margin-top: 60px } + h2, h3 { + margin: 30px 0 15px 0; + } + p + h2, pre + h2, code + h2 { + border-top: 6px solid rgba(255, 255, 255, 0.1); + padding-top: 30px; + } + h3 { + margin: 15px 0; + } +} + + +#docs { + @bg: lighten(@light-blue, 5%); + border-top: 2px solid lighten(@bg, 5%); + color: @blue; + background-color: @light-blue; + .box-shadow(0, -2px, 5px, 0.2); + + h1 { + font-family: 'Droid Serif', 'Georgia', serif; + padding-top: 30px; + padding-left: 45px; + font-size: 44px; + text-align: left; + margin: 30px 0 !important; + text-shadow: 0px 1px 1px @lightest; + font-weight: bold; + } + .content { + clear: both; + border-color: transparent; + background-color: lighten(@light-blue, 25%); + .box-shadow(0, 5px, 5px, 0.4); + } + pre { + @background: lighten(@bg, 30%); + color: lighten(@blue, 10%); + background-color: @background; + border-color: lighten(@light-blue, 25%); + border-width: 2px; + code .attribute { color: hsl(40, 50%, 30%) } + code .variable { color: hsl(120, 10%, 30%) } + code .element { color: hsl(170, 20%, 30%) } + + code .string, .regexp { color: hsl(75, 50%, 35%) } + code .class { color: hsl(40, 40%, 30%); font-weight: normal } + code .id { color: hsl(50, 40%, 30%); font-weight: normal } + code .comment { color: rgba(0, 0, 0, 0.4) } + code .number, .color { color: hsl(10, 40%, 30%) } + code .class, code .mixin, .special { color: hsl(190, 20%, 30%) } + } + pre code { font-size: 15px } + p + h2, pre + h2, code + h2 { border-top-color: rgba(0, 0, 0, 0.1) } +} + +td { + padding-right: 30px; +} +#synopsis { + .box-shadow(0, 5px, 5px, 0.2); +} +#synopsis, #about { + h2 { + font-size: 30px; + padding: 10px 0; + } + h1 + h2 { + margin-top: 15px; + } + h3 { font-size: 22px } + + .code-example { + border-spacing: 0; + border-width: 1px; + border-style: dashed; + padding: 0; + pre { border: 0; margin: 0 } + td { + border: 0; + margin: 0; + background-color: desaturate(darken(@darkest, 5%), 20%); + vertical-align: top; + padding: 0; + } + tr { padding: 0 } + } + .css-output { + td { + border-left: 0; + } + } + .less-example { + //border-right: 1px dotted rgba(255, 255, 255, 0.5) !important; + } + .css-output, .less-example { + width: 390px; + } + pre { + padding: 20px; + line-height: 20px; + font-size: 14px; + } +} +#about, #synopsis, #guide { + a { + text-decoration: none; + color: @light-yellow; + border-bottom: 1px dashed rgba(255, 255, 255, 0.2); + &:hover { + text-decoration: none; + border-bottom: 1px dashed @light-yellow; + } + } + @bg: desaturate(darken(@darkest, 5%), 20%); + text-shadow: 0 -1px 1px lighten(@bg, 5%); + color: @highlight; + background-color: @bg; + .content { + background-color: desaturate(@darkest, 20%); + clear: both; + .box-shadow(0, 5px, 5px, 0.4); + } + h1, h2, h3 { + color: @dark-yellow; + } + pre { + code .attribute { color: hsl(40, 50%, 70%) } + code .variable { color: hsl(120, 10%, 50%) } + code .element { color: hsl(170, 20%, 50%) } + + code .string, .regexp { color: hsl(75, 50%, 65%) } + code .class { color: hsl(40, 40%, 60%); font-weight: normal } + code .id { color: hsl(50, 40%, 60%); font-weight: normal } + code .comment { color: rgba(255, 255, 255, 0.2) } + code .number, .color { color: hsl(10, 40%, 50%) } + code .class, code .mixin, .special { color: hsl(190, 20%, 50%) } + background-color: @bg; + border-color: darken(@light-yellow, 5%); + } + code { + color: darken(@dark-yellow, 5%); + .string, .regexp { color: desaturate(@light-blue, 15%) } + .keyword { color: hsl(40, 40%, 60%); font-weight: normal } + .comment { color: rgba(255, 255, 255, 0.2) } + .number { color: lighten(@blue, 10%) } + .class, .special { color: hsl(190, 20%, 50%) } + } +} +#guide { + background-color: @darkest; + .content { + background-color: transparent; + } + +} + +#about { + background-color: @darkest !important; + .content { + background-color: desaturate(lighten(@darkest, 3%), 5%); + } +} +#synopsis { + background-color: desaturate(lighten(@darkest, 3%), 5%) !important; + .content { + background-color: desaturate(lighten(@darkest, 3%), 5%); + } + pre {} +} +#synopsis, #guide { + .content { + .box-shadow(0, 0px, 0px, 0.0); + } +} +#about footer { + margin-top: 30px; + padding-top: 30px; + border-top: 6px solid rgba(0, 0, 0, 0.1); + text-align: center; + font-size: 16px; + color: rgba(255, 255, 255, 0.35); + #copy { font-size: 12px } + text-shadow: -1px -1px 1px rgba(0, 0, 0, 0.02); +} +</textarea></form> + <script> + var editor = CodeMirror.fromTextArea(document.getElementById("code"), {}); + </script> + + <p><strong>MIME types defined:</strong> <code>text/less</code>.</p> + </body> +</html> diff --git a/imports/codemirror/mode/less/less.js b/imports/codemirror/mode/less/less.js new file mode 100644 index 00000000..dc584f02 --- /dev/null +++ b/imports/codemirror/mode/less/less.js @@ -0,0 +1,189 @@ +CodeMirror.defineMode("less", function(config) { + var indentUnit = config.indentUnit, type; + function ret(style, tp) {type = tp; return style;} + //html5 tags + var tags = ["a","abbr","acronym","address","applet","area","article","aside","audio","b","base","basefont","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","command","datalist","dd","del","details","dfn","dir","div","dl","dt","em","embed","fieldset","figcaption","figure","font","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","keygen","kbd","label","legend","li","link","map","mark","menu","meta","meter","nav","noframes","noscript","object","ol","optgroup","option","output","p","param","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strike","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","tt","u","ul","var","video","wbr"]; + + function inTagsArray(val){ + for(var i=0; i<tags.length; i++){ + if(val === tags[i]){ + return true; + } + } + } + + function tokenBase(stream, state) { + var ch = stream.next(); + + if (ch == "@") {stream.eatWhile(/[\w\-]/); return ret("meta", stream.current());} + else if (ch == "/" && stream.eat("*")) { + state.tokenize = tokenCComment; + return tokenCComment(stream, state); + } + else if (ch == "<" && stream.eat("!")) { + state.tokenize = tokenSGMLComment; + return tokenSGMLComment(stream, state); + } + else if (ch == "=") ret(null, "compare"); + else if ((ch == "~" || ch == "|") && stream.eat("=")) return ret(null, "compare"); + else if (ch == "\"" || ch == "'") { + state.tokenize = tokenString(ch); + return state.tokenize(stream, state); + } + else if (ch == "/") { // lesscss e.g.: .png will not be parsed as a class + if(stream.eat("/")){ + state.tokenize = tokenSComment + return tokenSComment(stream, state); + }else{ + stream.eatWhile(/[\a-zA-Z0-9\-_.]/); + if(stream.peek() == ")" || stream.peek() == "/")return ret("string", "string");//let url(/images/logo.png) without quotes return as string + return ret("number", "unit"); + } + } + else if (ch == "!") { + stream.match(/^\s*\w*/); + return ret("keyword", "important"); + } + else if (/\d/.test(ch)) { + stream.eatWhile(/[\w.%]/); + return ret("number", "unit"); + } + else if (/[,+>*\/]/.test(ch)) {//removed . dot character original was [,.+>*\/] + return ret(null, "select-op"); + } + else if (/[;{}:\[\]()]/.test(ch)) { //added () char for lesscss original was [;{}:\[\]] + if(ch == ":"){ + stream.eatWhile(/[active|hover|link|visited]/); + if( stream.current().match(/active|hover|link|visited/)){ + return ret("tag", "tag"); + }else{ + return ret(null, ch); + } + }else{ + return ret(null, ch); + } + } + else if (ch == ".") { // lesscss + stream.eatWhile(/[\a-zA-Z0-9\-_]/); + return ret("tag", "tag"); + } + else if (ch == "#") { // lesscss + stream.match(/([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/); + if(stream.current().length >1){ + if(stream.current().match(/([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/) != null){ + return ret("number", "unit"); + }else{ + stream.eatWhile(/[\w\-]/); + return ret("atom", "tag"); + } + }else{ + stream.eatWhile(/[\w\-]/); + return ret("atom", "tag"); + } + } + else if (ch == "&") { + stream.eatWhile(/[\w\-]/); + return ret(null, ch); + } + else { + stream.eatWhile(/[\w\\\-_.%]/); + if( stream.eat("(") ){ // lesscss + return ret(null, ch); + }else if( stream.current().match(/\-\d|\-.\d/) ){ // lesscss match e.g.: -5px -0.4 etc... + return ret("number", "unit"); + }else if( inTagsArray(stream.current()) ){ // lesscss match html tags + return ret("tag", "tag"); + }else if( (stream.peek() == ")" || stream.peek() == "/") && stream.current().indexOf('.') !== -1){ + return ret("string", "string");//let url(logo.png) without quotes and froward slash return as string + }else{ + return ret("variable", "variable"); + } + } + + } + + function tokenSComment(stream, state) {// SComment = Slash comment + stream.skipToEnd(); + state.tokenize = tokenBase; + return ret("comment", "comment"); + } + + function tokenCComment(stream, state) { + var maybeEnd = false, ch; + while ((ch = stream.next()) != null) { + if (maybeEnd && ch == "/") { + state.tokenize = tokenBase; + break; + } + maybeEnd = (ch == "*"); + } + return ret("comment", "comment"); + } + + function tokenSGMLComment(stream, state) { + var dashes = 0, ch; + while ((ch = stream.next()) != null) { + if (dashes >= 2 && ch == ">") { + state.tokenize = tokenBase; + break; + } + dashes = (ch == "-") ? dashes + 1 : 0; + } + return ret("comment", "comment"); + } + + function tokenString(quote) { + return function(stream, state) { + var escaped = false, ch; + while ((ch = stream.next()) != null) { + if (ch == quote && !escaped) + break; + escaped = !escaped && ch == "\\"; + } + if (!escaped) state.tokenize = tokenBase; + return ret("string", "string"); + }; + } + + return { + startState: fu