erp_app 3.0.10 → 3.0.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. data/lib/erp_app/version.rb +1 -1
  2. data/public/javascripts/erp_app/codemirror/README.md +1 -1
  3. data/public/javascripts/erp_app/codemirror/doc/compress.html +11 -3
  4. data/public/javascripts/erp_app/codemirror/doc/docs.css +16 -5
  5. data/public/javascripts/erp_app/codemirror/doc/internals.html +6 -3
  6. data/public/javascripts/erp_app/codemirror/doc/manual.html +103 -41
  7. data/public/javascripts/erp_app/codemirror/doc/oldrelease.html +43 -5
  8. data/public/javascripts/erp_app/codemirror/doc/reporting.html +6 -3
  9. data/public/javascripts/erp_app/codemirror/doc/upgrade_v2.2.html +7 -4
  10. data/public/javascripts/erp_app/codemirror/keymap/vim.js +10 -6
  11. data/public/javascripts/erp_app/codemirror/lib/codemirror.css +16 -12
  12. data/public/javascripts/erp_app/codemirror/lib/codemirror.js +699 -787
  13. data/public/javascripts/erp_app/codemirror/lib/util/closetag.js +35 -35
  14. data/public/javascripts/erp_app/codemirror/lib/util/dialog.js +4 -1
  15. data/public/javascripts/erp_app/codemirror/lib/util/formatting.js +147 -253
  16. data/public/javascripts/erp_app/codemirror/lib/util/javascript-hint.js +3 -3
  17. data/public/javascripts/erp_app/codemirror/lib/util/loadmode.js +1 -1
  18. data/public/javascripts/erp_app/codemirror/lib/util/multiplex.js +5 -9
  19. data/public/javascripts/erp_app/codemirror/lib/util/overlay.js +3 -1
  20. data/public/javascripts/erp_app/codemirror/lib/util/pig-hint.js +1 -1
  21. data/public/javascripts/erp_app/codemirror/lib/util/runmode-standalone.js +90 -0
  22. data/public/javascripts/erp_app/codemirror/lib/util/runmode.js +8 -4
  23. data/public/javascripts/erp_app/codemirror/lib/util/search.js +4 -4
  24. data/public/javascripts/erp_app/codemirror/lib/util/searchcursor.js +13 -11
  25. data/public/javascripts/erp_app/codemirror/lib/util/simple-hint.js +89 -68
  26. data/public/javascripts/erp_app/codemirror/lib/util/xml-hint.js +8 -8
  27. data/public/javascripts/erp_app/codemirror/mode/clike/clike.js +6 -2
  28. data/public/javascripts/erp_app/codemirror/mode/clike/index.html +1 -0
  29. data/public/javascripts/erp_app/codemirror/mode/clike/scala.html +1 -0
  30. data/public/javascripts/erp_app/codemirror/mode/clojure/clojure.js +8 -9
  31. data/public/javascripts/erp_app/codemirror/mode/clojure/index.html +1 -0
  32. data/public/javascripts/erp_app/codemirror/mode/coffeescript/coffeescript.js +3 -3
  33. data/public/javascripts/erp_app/codemirror/mode/coffeescript/index.html +1 -0
  34. data/public/javascripts/erp_app/codemirror/mode/commonlisp/commonlisp.js +101 -0
  35. data/public/javascripts/erp_app/codemirror/mode/commonlisp/index.html +165 -0
  36. data/public/javascripts/erp_app/codemirror/mode/css/css.js +339 -15
  37. data/public/javascripts/erp_app/codemirror/mode/css/index.html +3 -0
  38. data/public/javascripts/erp_app/codemirror/mode/css/test.js +501 -0
  39. data/public/javascripts/erp_app/codemirror/mode/diff/index.html +1 -0
  40. data/public/javascripts/erp_app/codemirror/mode/ecl/ecl.js +1 -1
  41. data/public/javascripts/erp_app/codemirror/mode/erlang/index.html +1 -0
  42. data/public/javascripts/erp_app/codemirror/mode/gfm/gfm.js +10 -4
  43. data/public/javascripts/erp_app/codemirror/mode/gfm/index.html +1 -0
  44. data/public/javascripts/erp_app/codemirror/mode/go/go.js +2 -2
  45. data/public/javascripts/erp_app/codemirror/mode/go/index.html +1 -0
  46. data/public/javascripts/erp_app/codemirror/mode/groovy/groovy.js +1 -1
  47. data/public/javascripts/erp_app/codemirror/mode/groovy/index.html +1 -0
  48. data/public/javascripts/erp_app/codemirror/mode/haskell/haskell.js +2 -2
  49. data/public/javascripts/erp_app/codemirror/mode/haskell/index.html +1 -0
  50. data/public/javascripts/erp_app/codemirror/mode/haxe/haxe.js +4 -7
  51. data/public/javascripts/erp_app/codemirror/mode/haxe/index.html +1 -0
  52. data/public/javascripts/erp_app/codemirror/mode/htmlembedded/htmlembedded.js +8 -4
  53. data/public/javascripts/erp_app/codemirror/mode/htmlembedded/index.html +1 -0
  54. data/public/javascripts/erp_app/codemirror/mode/htmlmixed/htmlmixed.js +12 -13
  55. data/public/javascripts/erp_app/codemirror/mode/htmlmixed/index.html +1 -0
  56. data/public/javascripts/erp_app/codemirror/mode/javascript/index.html +1 -0
  57. data/public/javascripts/erp_app/codemirror/mode/javascript/javascript.js +3 -3
  58. data/public/javascripts/erp_app/codemirror/mode/jinja2/index.html +1 -0
  59. data/public/javascripts/erp_app/codemirror/mode/less/index.html +124 -2
  60. data/public/javascripts/erp_app/codemirror/mode/less/less.js +94 -60
  61. data/public/javascripts/erp_app/codemirror/mode/lua/index.html +1 -0
  62. data/public/javascripts/erp_app/codemirror/mode/markdown/index.html +3 -0
  63. data/public/javascripts/erp_app/codemirror/mode/markdown/markdown.js +134 -20
  64. data/public/javascripts/erp_app/codemirror/mode/markdown/test.js +1084 -0
  65. data/public/javascripts/erp_app/codemirror/mode/mysql/index.html +1 -0
  66. data/public/javascripts/erp_app/codemirror/mode/ntriples/index.html +1 -0
  67. data/public/javascripts/erp_app/codemirror/mode/ntriples/ntriples.js +4 -4
  68. data/public/javascripts/erp_app/codemirror/mode/ocaml/ocaml.js +1 -1
  69. data/public/javascripts/erp_app/codemirror/mode/pascal/index.html +1 -0
  70. data/public/javascripts/erp_app/codemirror/mode/pascal/pascal.js +1 -1
  71. data/public/javascripts/erp_app/codemirror/mode/perl/index.html +1 -0
  72. data/public/javascripts/erp_app/codemirror/mode/perl/perl.js +71 -71
  73. data/public/javascripts/erp_app/codemirror/mode/php/index.html +1 -0
  74. data/public/javascripts/erp_app/codemirror/mode/php/php.js +7 -9
  75. data/public/javascripts/erp_app/codemirror/mode/pig/index.html +1 -0
  76. data/public/javascripts/erp_app/codemirror/mode/pig/pig.js +3 -3
  77. data/public/javascripts/erp_app/codemirror/mode/plsql/index.html +1 -0
  78. data/public/javascripts/erp_app/codemirror/mode/properties/index.html +1 -0
  79. data/public/javascripts/erp_app/codemirror/mode/python/index.html +1 -0
  80. data/public/javascripts/erp_app/codemirror/mode/python/python.js +1 -1
  81. data/public/javascripts/erp_app/codemirror/mode/r/index.html +1 -0
  82. data/public/javascripts/erp_app/codemirror/mode/rpm/changes/index.html +1 -0
  83. data/public/javascripts/erp_app/codemirror/mode/rpm/spec/index.html +1 -0
  84. data/public/javascripts/erp_app/codemirror/mode/rst/index.html +1 -0
  85. data/public/javascripts/erp_app/codemirror/mode/ruby/index.html +1 -0
  86. data/public/javascripts/erp_app/codemirror/mode/rust/index.html +1 -0
  87. data/public/javascripts/erp_app/codemirror/mode/scheme/index.html +1 -0
  88. data/public/javascripts/erp_app/codemirror/mode/scheme/scheme.js +1 -1
  89. data/public/javascripts/erp_app/codemirror/mode/shell/shell.js +2 -2
  90. data/public/javascripts/erp_app/codemirror/mode/sieve/LICENSE +23 -0
  91. data/public/javascripts/erp_app/codemirror/mode/sieve/index.html +81 -0
  92. data/public/javascripts/erp_app/codemirror/mode/sieve/sieve.js +156 -0
  93. data/public/javascripts/erp_app/codemirror/mode/smalltalk/index.html +1 -0
  94. data/public/javascripts/erp_app/codemirror/mode/smalltalk/smalltalk.js +2 -2
  95. data/public/javascripts/erp_app/codemirror/mode/smarty/index.html +1 -0
  96. data/public/javascripts/erp_app/codemirror/mode/smarty/smarty.js +2 -2
  97. data/public/javascripts/erp_app/codemirror/mode/sparql/index.html +1 -0
  98. data/public/javascripts/erp_app/codemirror/mode/stex/index.html +3 -0
  99. data/public/javascripts/erp_app/codemirror/mode/stex/stex.js +1 -1
  100. data/public/javascripts/erp_app/codemirror/mode/stex/test.js +343 -0
  101. data/public/javascripts/erp_app/codemirror/mode/tiddlywiki/index.html +1 -0
  102. data/public/javascripts/erp_app/codemirror/mode/tiki/index.html +1 -0
  103. data/public/javascripts/erp_app/codemirror/mode/tiki/tiki.js +4 -11
  104. data/public/javascripts/erp_app/codemirror/mode/vb/index.html +1 -0
  105. data/public/javascripts/erp_app/codemirror/mode/vb/vb.js +2 -2
  106. data/public/javascripts/erp_app/codemirror/mode/vbscript/index.html +1 -0
  107. data/public/javascripts/erp_app/codemirror/mode/velocity/index.html +1 -0
  108. data/public/javascripts/erp_app/codemirror/mode/velocity/velocity.js +1 -1
  109. data/public/javascripts/erp_app/codemirror/mode/verilog/index.html +1 -0
  110. data/public/javascripts/erp_app/codemirror/mode/verilog/verilog.js +1 -1
  111. data/public/javascripts/erp_app/codemirror/mode/xml/index.html +2 -1
  112. data/public/javascripts/erp_app/codemirror/mode/xml/xml.js +2 -10
  113. data/public/javascripts/erp_app/codemirror/mode/xquery/index.html +3 -2
  114. data/public/javascripts/erp_app/codemirror/mode/xquery/xquery.js +7 -4
  115. data/public/javascripts/erp_app/codemirror/mode/yaml/index.html +1 -0
  116. data/public/javascripts/erp_app/codemirror/package.json +15 -23
  117. data/public/javascripts/erp_app/codemirror/test/driver.js +109 -22
  118. data/public/javascripts/erp_app/codemirror/test/index.html +129 -16
  119. data/public/javascripts/erp_app/codemirror/test/lint/lint.js +120 -0
  120. data/public/javascripts/erp_app/codemirror/test/lint/parse-js.js +1372 -0
  121. data/public/javascripts/erp_app/codemirror/test/mode_test.css +0 -12
  122. data/public/javascripts/erp_app/codemirror/test/mode_test.js +66 -27
  123. data/public/javascripts/erp_app/codemirror/test/phantom_driver.js +30 -0
  124. data/public/javascripts/erp_app/codemirror/test/run.js +32 -0
  125. data/public/javascripts/erp_app/codemirror/test/test.js +213 -8
  126. data/public/javascripts/erp_app/shared/dynamic_editable_grid.js +33 -27
  127. data/public/javascripts/erp_app/shared/dynamic_editable_grid_loader_panel.js +2 -1
  128. metadata +15 -3
  129. data/public/javascripts/erp_app/codemirror/mode/stex/test.html +0 -263
@@ -6,7 +6,7 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
6
6
  var keywords = function(){
7
7
  function kw(type) {return {type: type, style: "keyword"};}
8
8
  var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
9
- var operator = kw("operator"), atom = {type: "atom", style: "atom"}, attribute = {type:"attribute", style: "attribute"}
9
+ var operator = kw("operator"), atom = {type: "atom", style: "atom"}, attribute = {type:"attribute", style: "attribute"};
10
10
  var type = kw("typedef");
11
11
  return {
12
12
  "if": A, "while": A, "else": B, "do": B, "try": B,
@@ -219,7 +219,7 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
219
219
  function pushlex(type, info) {
220
220
  var result = function() {
221
221
  var state = cx.state;
222
- state.lexical = new HaxeLexical(state.indented, cx.stream.column(), type, null, state.lexical, info)
222
+ state.lexical = new HaxeLexical(state.indented, cx.stream.column(), type, null, state.lexical, info);
223
223
  };
224
224
  result.lex = true;
225
225
  return result;
@@ -243,7 +243,7 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
243
243
  }
244
244
 
245
245
  function statement(type) {
246
- if (type == "@") return cont(metadef)
246
+ if (type == "@") return cont(metadef);
247
247
  if (type == "var") return cont(pushlex("vardef"), vardef1, expect(";"), poplex);
248
248
  if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex);
249
249
  if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
@@ -297,7 +297,7 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
297
297
  function metadef(type, value) {
298
298
  if(type == ":") return cont(metadef);
299
299
  if(type == "variable") return cont(metadef);
300
- if(type == "(") return cont(pushlex(")"), comasep(metaargs, ")"), poplex, statement)
300
+ if(type == "(") return cont(pushlex(")"), comasep(metaargs, ")"), poplex, statement);
301
301
  }
302
302
  function metaargs(type, value) {
303
303
  if(typ == "variable") return cont();
@@ -421,9 +421,6 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
421
421
  else if (lexical.align) return lexical.column + (closing ? 0 : 1);
422
422
  else return lexical.indented + (closing ? 0 : indentUnit);
423
423
  },
424
- compareStates: function(state1, state2) {
425
- return (state1.localVars == state2.localVars) && (state1.context == state2.context);
426
- },
427
424
 
428
425
  electricChars: "{}"
429
426
  };
@@ -1,6 +1,7 @@
1
1
  <!doctype html>
2
2
  <html>
3
3
  <head>
4
+ <meta charset="utf-8">
4
5
  <title>CodeMirror: Haxe mode</title>
5
6
  <link rel="stylesheet" href="../../lib/codemirror.css">
6
7
  <script src="../../lib/codemirror.js"></script>
@@ -36,7 +36,7 @@ CodeMirror.defineMode("htmlembedded", function(config, parserConfig) {
36
36
  token : parserConfig.startOpen ? scriptingDispatch : htmlDispatch,
37
37
  htmlState : htmlMixedMode.startState(),
38
38
  scriptState : scriptingMode.startState()
39
- }
39
+ };
40
40
  },
41
41
 
42
42
  token: function(stream, state) {
@@ -55,12 +55,16 @@ CodeMirror.defineMode("htmlembedded", function(config, parserConfig) {
55
55
  token : state.token,
56
56
  htmlState : CodeMirror.copyState(htmlMixedMode, state.htmlState),
57
57
  scriptState : CodeMirror.copyState(scriptingMode, state.scriptState)
58
- }
58
+ };
59
59
  },
60
60
 
61
+ electricChars: "/{}:",
61
62
 
62
- electricChars: "/{}:"
63
- }
63
+ innerMode: function(state) {
64
+ if (state.token == scriptingDispatch) return {state: state.scriptState, mode: scriptingMode};
65
+ else return {state: state.htmlState, mode: htmlMixedMode};
66
+ }
67
+ };
64
68
  }, "htmlmixed");
65
69
 
66
70
  CodeMirror.defineMIME("application/x-ejs", { name: "htmlembedded", scriptingModeSpec:"javascript"});
@@ -1,6 +1,7 @@
1
1
  <!doctype html>
2
2
  <html>
3
3
  <head>
4
+ <meta charset="utf-8">
4
5
  <title>CodeMirror: Html Embedded Scripts mode</title>
5
6
  <link rel="stylesheet" href="../../lib/codemirror.css">
6
7
  <script src="../../lib/codemirror.js"></script>
@@ -1,4 +1,4 @@
1
- CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
1
+ CodeMirror.defineMode("htmlmixed", function(config) {
2
2
  var htmlMode = CodeMirror.getMode(config, {name: "xml", htmlMode: true});
3
3
  var jsMode = CodeMirror.getMode(config, "javascript");
4
4
  var cssMode = CodeMirror.getMode(config, "css");
@@ -9,27 +9,28 @@ CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
9
9
  if (/^script$/i.test(state.htmlState.context.tagName)) {
10
10
  state.token = javascript;
11
11
  state.localState = jsMode.startState(htmlMode.indent(state.htmlState, ""));
12
- state.mode = "javascript";
13
12
  }
14
13
  else if (/^style$/i.test(state.htmlState.context.tagName)) {
15
14
  state.token = css;
16
15
  state.localState = cssMode.startState(htmlMode.indent(state.htmlState, ""));
17
- state.mode = "css";
18
16
  }
19
17
  }
20
18
  return style;
21
19
  }
22
20
  function maybeBackup(stream, pat, style) {
23
21
  var cur = stream.current();
24
- var close = cur.search(pat);
22
+ var close = cur.search(pat), m;
25
23
  if (close > -1) stream.backUp(cur.length - close);
24
+ else if (m = cur.match(/<\/?$/)) {
25
+ stream.backUp(cur[0].length);
26
+ if (!stream.match(pat, false)) stream.match(cur[0]);
27
+ }
26
28
  return style;
27
29
  }
28
30
  function javascript(stream, state) {
29
31
  if (stream.match(/^<\/\s*script\s*>/i, false)) {
30
32
  state.token = html;
31
33
  state.localState = null;
32
- state.mode = "html";
33
34
  return html(stream, state);
34
35
  }
35
36
  return maybeBackup(stream, /<\/\s*script\s*>/,
@@ -39,7 +40,6 @@ CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
39
40
  if (stream.match(/^<\/\s*style\s*>/i, false)) {
40
41
  state.token = html;
41
42
  state.localState = null;
42
- state.mode = "html";
43
43
  return html(stream, state);
44
44
  }
45
45
  return maybeBackup(stream, /<\/\s*style\s*>/,
@@ -72,14 +72,13 @@ CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
72
72
  return cssMode.indent(state.localState, textAfter);
73
73
  },
74
74
 
75
- compareStates: function(a, b) {
76
- if (a.mode != b.mode) return false;
77
- if (a.localState) return CodeMirror.Pass;
78
- return htmlMode.compareStates(a.htmlState, b.htmlState);
79
- },
75
+ electricChars: "/{}:",
80
76
 
81
- electricChars: "/{}:"
82
- }
77
+ innerMode: function(state) {
78
+ var mode = state.token == html ? htmlMode : state.token == javascript ? jsMode : cssMode;
79
+ return {state: state.localState || state.htmlState, mode: mode};
80
+ }
81
+ };
83
82
  }, "xml", "javascript", "css");
84
83
 
85
84
  CodeMirror.defineMIME("text/html", "htmlmixed");
@@ -1,6 +1,7 @@
1
1
  <!doctype html>
2
2
  <html>
3
3
  <head>
4
+ <meta charset="utf-8">
4
5
  <title>CodeMirror: HTML mixed mode</title>
5
6
  <link rel="stylesheet" href="../../lib/codemirror.css">
6
7
  <script src="../../lib/codemirror.js"></script>
@@ -1,6 +1,7 @@
1
1
  <!doctype html>
2
2
  <html>
3
3
  <head>
4
+ <meta charset="utf-8">
4
5
  <title>CodeMirror: JavaScript mode</title>
5
6
  <link rel="stylesheet" href="../../lib/codemirror.css">
6
7
  <script src="../../lib/codemirror.js"></script>
@@ -175,8 +175,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
175
175
 
176
176
  var defaultVars = {name: "this", next: {name: "arguments"}};
177
177
  function pushcontext() {
178
- if (!cx.state.context) cx.state.localVars = defaultVars;
179
178
  cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};
179
+ cx.state.localVars = defaultVars;
180
180
  }
181
181
  function popcontext() {
182
182
  cx.state.localVars = cx.state.context.vars;
@@ -185,7 +185,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
185
185
  function pushlex(type, info) {
186
186
  var result = function() {
187
187
  var state = cx.state;
188
- state.lexical = new JSLexical(state.indented, cx.stream.column(), type, null, state.lexical, info)
188
+ state.lexical = new JSLexical(state.indented, cx.stream.column(), type, null, state.lexical, info);
189
189
  };
190
190
  result.lex = true;
191
191
  return result;
@@ -243,7 +243,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
243
243
 
244
244
  function maybeoperator(type, value) {
245
245
  if (type == "operator" && /\+\+|--/.test(value)) return cont(maybeoperator);
246
- if (type == "operator" || type == ":") return cont(expression);
246
+ if (type == "operator" && value == "?") return cont(expression, expect(":"), expression);
247
247
  if (type == ";") return;
248
248
  if (type == "(") return cont(pushlex(")"), commasep(expression, ")"), poplex, maybeoperator);
249
249
  if (type == ".") return cont(property, maybeoperator);
@@ -1,6 +1,7 @@
1
1
  <!doctype html>
2
2
  <html>
3
3
  <head>
4
+ <meta charset="utf-8">
4
5
  <title>CodeMirror: Jinja2 mode</title>
5
6
  <link rel="stylesheet" href="../../lib/codemirror.css">
6
7
  <script src="../../lib/codemirror.js"></script>
@@ -1,6 +1,7 @@
1
1
  <!doctype html>
2
2
  <html>
3
3
  <head>
4
+ <meta charset="utf-8">
4
5
  <title>CodeMirror: LESS mode</title>
5
6
  <link rel="stylesheet" href="../../lib/codemirror.css">
6
7
  <script src="../../lib/codemirror.js"></script>
@@ -8,11 +9,132 @@
8
9
  <style>.CodeMirror {background: #f8f8f8; border: 1px solid #ddd; font-size:12px} .CodeMirror-scroll {height: 400px}</style>
9
10
  <link rel="stylesheet" href="../../doc/docs.css">
10
11
  <link rel="stylesheet" href="../../theme/lesser-dark.css">
11
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
12
12
  </head>
13
13
  <body>
14
14
  <h1>CodeMirror: LESS mode</h1>
15
- <form><textarea id="code" name="code">/* Some LESS code */
15
+ <form><textarea id="code" name="code">@media screen and (device-aspect-ratio: 16/9) { … }
16
+ @media screen and (device-aspect-ratio: 32/18) { … }
17
+ @media screen and (device-aspect-ratio: 1280/720) { … }
18
+ @media screen and (device-aspect-ratio: 2560/1440) { … }
19
+
20
+ html:lang(fr-be)
21
+ html:lang(de)
22
+ :lang(fr-be) > q
23
+ :lang(de) > q
24
+
25
+ tr:nth-child(2n+1) /* represents every odd row of an HTML table */
26
+ tr:nth-child(odd) /* same */
27
+ tr:nth-child(2n+0) /* represents every even row of an HTML table */
28
+ tr:nth-child(even) /* same */
29
+
30
+ /* Alternate paragraph colours in CSS */
31
+ p:nth-child(4n+1) { color: navy; }
32
+ p:nth-child(4n+2) { color: green; }
33
+ p:nth-child(4n+3) { color: maroon; }
34
+ p:nth-child(4n+4) { color: purple; }
35
+
36
+ :nth-child(10n-1) /* represents the 9th, 19th, 29th, etc, element */
37
+ :nth-child(10n+9) /* Same */
38
+ :nth-child(10n+-1) /* Syntactically invalid, and would be ignored */
39
+
40
+ :nth-child( 3n + 1 )
41
+ :nth-child( +3n - 2 )
42
+ :nth-child( -n+ 6)
43
+ :nth-child( +6 )
44
+
45
+ html|tr:nth-child(-n+6) /* represents the 6 first rows of XHTML tables */
46
+
47
+ img:nth-of-type(2n+1) { float: right; }
48
+ img:nth-of-type(2n) { float: left; }
49
+
50
+ body > h2:nth-of-type(n+2):nth-last-of-type(n+2)
51
+ body > h2:not(:first-of-type):not(:last-of-type)
52
+
53
+ html|*:not(:link):not(:visited)
54
+ *|*:not(:hover)
55
+ p::first-line { text-transform: uppercase }
56
+
57
+ p { color: red; font-size: 12pt }
58
+ p::first-letter { color: green; font-size: 200% }
59
+ p::first-line { color: blue }
60
+
61
+ p { line-height: 1.1 }
62
+ p::first-letter { font-size: 3em; font-weight: normal }
63
+ span { font-weight: bold }
64
+
65
+ * /* a=0 b=0 c=0 -> specificity = 0 */
66
+ LI /* a=0 b=0 c=1 -> specificity = 1 */
67
+ UL LI /* a=0 b=0 c=2 -> specificity = 2 */
68
+ UL OL+LI /* a=0 b=0 c=3 -> specificity = 3 */
69
+ H1 + *[REL=up] /* a=0 b=1 c=1 -> specificity = 11 */
70
+ UL OL LI.red /* a=0 b=1 c=3 -> specificity = 13 */
71
+ LI.red.level /* a=0 b=2 c=1 -> specificity = 21 */
72
+ #x34y /* a=1 b=0 c=0 -> specificity = 100 */
73
+ #s12:not(FOO) /* a=1 b=0 c=1 -> specificity = 101 */
74
+
75
+ @namespace foo url(http://www.example.com);
76
+ foo|h1 { color: blue } /* first rule */
77
+ foo|* { color: yellow } /* second rule */
78
+ |h1 { color: red } /* ...*/
79
+ *|h1 { color: green }
80
+ h1 { color: green }
81
+
82
+ span[hello="Ocean"][goodbye="Land"]
83
+
84
+ a[rel~="copyright"] { ... }
85
+ a[href="http://www.w3.org/"] { ... }
86
+
87
+ DIALOGUE[character=romeo]
88
+ DIALOGUE[character=juliet]
89
+
90
+ [att^=val]
91
+ [att$=val]
92
+ [att*=val]
93
+
94
+ @namespace foo "http://www.example.com";
95
+ [foo|att=val] { color: blue }
96
+ [*|att] { color: yellow }
97
+ [|att] { color: green }
98
+ [att] { color: green }
99
+
100
+
101
+ *:target { color : red }
102
+ *:target::before { content : url(target.png) }
103
+
104
+ E[foo]{
105
+ padding:65px;
106
+ }
107
+ E[foo] ~ F{
108
+ padding:65px;
109
+ }
110
+ E#myid{
111
+ padding:65px;
112
+ }
113
+ input[type="search"]::-webkit-search-decoration,
114
+ input[type="search"]::-webkit-search-cancel-button {
115
+ -webkit-appearance: none; // Inner-padding issues in Chrome OSX, Safari 5
116
+ }
117
+ button::-moz-focus-inner,
118
+ input::-moz-focus-inner { // Inner padding and border oddities in FF3/4
119
+ padding: 0;
120
+ border: 0;
121
+ }
122
+ .btn {
123
+ // reset here as of 2.0.3 due to Recess property order
124
+ border-color: #ccc;
125
+ border-color: rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);
126
+ }
127
+ fieldset span button, fieldset span input[type="file"] {
128
+ font-size:12px;
129
+ font-family:Arial, Helvetica, sans-serif;
130
+ }
131
+ .el tr:nth-child(even):last-child td:first-child{
132
+ -moz-border-radius-bottomleft:3px;
133
+ -webkit-border-bottom-left-radius:3px;
134
+ border-bottom-left-radius:3px;
135
+ }
136
+
137
+ /* Some LESS code */
16
138
 
17
139
  button {
18
140
  width: 32px;
@@ -1,25 +1,24 @@
1
1
  /*
2
2
  LESS mode - http://www.lesscss.org/
3
- Ported to CodeMirror by Peter Kroon
3
+ Ported to CodeMirror by Peter Kroon <plakroon@gmail.com>
4
+ Report bugs/issues here: https://github.com/marijnh/CodeMirror/issues GitHub: @peterkroon
4
5
  */
5
6
 
6
7
  CodeMirror.defineMode("less", function(config) {
7
8
  var indentUnit = config.indentUnit, type;
8
9
  function ret(style, tp) {type = tp; return style;}
9
- //html5 tags
10
- 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"];
10
+ //html tags
11
+ 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".split(' ');
11
12
 
12
13
  function inTagsArray(val){
13
- for(var i=0; i<tags.length; i++){
14
- if(val === tags[i]){
15
- return true;
16
- }
17
- }
14
+ for(var i=0; i<tags.length; i++)if(val === tags[i])return true;
18
15
  }
19
-
16
+
17
+ var selectors = /(^\:root$|^\:nth\-child$|^\:nth\-last\-child$|^\:nth\-of\-type$|^\:nth\-last\-of\-type$|^\:first\-child$|^\:last\-child$|^\:first\-of\-type$|^\:last\-of\-type$|^\:only\-child$|^\:only\-of\-type$|^\:empty$|^\:link|^\:visited$|^\:active$|^\:hover$|^\:focus$|^\:target$|^\:lang$|^\:enabled^\:disabled$|^\:checked$|^\:first\-line$|^\:first\-letter$|^\:before$|^\:after$|^\:not$|^\:required$|^\:invalid$)/;
18
+
20
19
  function tokenBase(stream, state) {
21
20
  var ch = stream.next();
22
-
21
+
23
22
  if (ch == "@") {stream.eatWhile(/[\w\-]/); return ret("meta", stream.current());}
24
23
  else if (ch == "/" && stream.eat("*")) {
25
24
  state.tokenize = tokenCComment;
@@ -30,19 +29,20 @@ CodeMirror.defineMode("less", function(config) {
30
29
  return tokenSGMLComment(stream, state);
31
30
  }
32
31
  else if (ch == "=") ret(null, "compare");
33
- else if ((ch == "~" || ch == "|") && stream.eat("=")) return ret(null, "compare");
32
+ else if (ch == "|" && stream.eat("=")) return ret(null, "compare");
34
33
  else if (ch == "\"" || ch == "'") {
35
34
  state.tokenize = tokenString(ch);
36
35
  return state.tokenize(stream, state);
37
36
  }
38
- else if (ch == "/") { // lesscss e.g.: .png will not be parsed as a class
37
+ else if (ch == "/") { // e.g.: .png will not be parsed as a class
39
38
  if(stream.eat("/")){
40
39
  state.tokenize = tokenSComment;
41
40
  return tokenSComment(stream, state);
42
41
  }else{
43
- stream.eatWhile(/[\a-zA-Z0-9\-_.\s]/);
44
- if(/\/|\)|#/.test(stream.peek() || stream.eol() || (stream.eatSpace() && stream.peek() == ")")))return ret("string", "string");//let url(/images/logo.png) without quotes return as string
45
- return ret("number", "unit");
42
+ if(type == "string" || type == "(")return ret("string", "string");
43
+ if(state.stack[state.stack.length-1] != undefined)return ret(null, ch);
44
+ stream.eatWhile(/[\a-zA-Z0-9\-_.\s]/);
45
+ if( /\/|\)|#/.test(stream.peek() || (stream.eatSpace() && stream.peek() == ")")) || stream.eol() )return ret("string", "string"); // let url(/images/logo.png) without quotes return as string
46
46
  }
47
47
  }
48
48
  else if (ch == "!") {
@@ -53,30 +53,42 @@ CodeMirror.defineMode("less", function(config) {
53
53
  stream.eatWhile(/[\w.%]/);
54
54
  return ret("number", "unit");
55
55
  }
56
- else if (/[,+<>*\/]/.test(ch)) {//removed . dot character original was [,.+>*\/]
56
+ else if (/[,+<>*\/]/.test(ch)) {
57
+ if(stream.peek() == "=" || type == "a")return ret("string", "string");
57
58
  return ret(null, "select-op");
58
59
  }
59
- else if (/[;{}:\[\]()]/.test(ch)) { //added () char for lesscss original was [;{}:\[\]]
60
- if(ch == ":"){
61
- stream.eatWhile(/[active|hover|link|visited]/);
62
- if( stream.current().match(/active|hover|link|visited/)){
60
+ else if (/[;{}:\[\]()~\|]/.test(ch)) {
61
+ if(ch == ":"){
62
+ stream.eatWhile(/[a-z\\\-]/);
63
+ if( selectors.test(stream.current()) ){
63
64
  return ret("tag", "tag");
65
+ }else if(stream.peek() == ":"){//::-webkit-search-decoration
66
+ stream.next();
67
+ stream.eatWhile(/[a-z\\\-]/);
68
+ if(stream.current().match(/\:\:\-(o|ms|moz|webkit)\-/))return ret("string", "string");
69
+ if( selectors.test(stream.current().substring(1)) )return ret("tag", "tag");
70
+ return ret(null, ch);
64
71
  }else{
65
72
  return ret(null, ch);
66
73
  }
74
+ }else if(ch == "~"){
75
+ if(type == "r")return ret("string", "string");
67
76
  }else{
68
77
  return ret(null, ch);
69
78
  }
70
79
  }
71
- else if (ch == ".") { // lesscss
80
+ else if (ch == ".") {
81
+ if(type == "(" || type == "string")return ret("string", "string"); // allow url(../image.png)
72
82
  stream.eatWhile(/[\a-zA-Z0-9\-_]/);
83
+ if(stream.peek() == " ")stream.eatSpace();
84
+ if(stream.peek() == ")")return ret("number", "unit");//rgba(0,0,0,.25);
73
85
  return ret("tag", "tag");
74
86
  }
75
- else if (ch == "#") { // lesscss
87
+ else if (ch == "#") {
76
88
  //we don't eat white-space, we want the hex color and or id only
77
89
  stream.eatWhile(/[A-Za-z0-9]/);
78
90
  //check if there is a proper hex color length e.g. #eee || #eeeEEE
79
- if(stream.current().length ===4 || stream.current().length ===7){
91
+ if(stream.current().length == 4 || stream.current().length == 7){
80
92
  if(stream.current().match(/[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}/,false) != null){//is there a valid hex color value present in the current stream
81
93
  //when not a valid hex value, parse as id
82
94
  if(stream.current().substring(1) != stream.current().match(/[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}/,false))return ret("atom", "tag");
@@ -96,8 +108,8 @@ CodeMirror.defineMode("less", function(config) {
96
108
  stream.eatWhile(/[\w\\\-]/);
97
109
  return ret("atom", "tag");
98
110
  }
99
- }else{
100
- stream.eatWhile(/[\w\\\-]/);
111
+ }else{//when not a valid hexvalue length
112
+ stream.eatWhile(/[\w\\\-]/);
101
113
  return ret("atom", "tag");
102
114
  }
103
115
  }
@@ -107,39 +119,62 @@ CodeMirror.defineMode("less", function(config) {
107
119
  }
108
120
  else {
109
121
  stream.eatWhile(/[\w\\\-_%.{]/);
110
- if(stream.current().match(/http|https/) != null){
122
+ if(type == "string"){
123
+ return ret("string", "string");
124
+ }else if(stream.current().match(/(^http$|^https$)/) != null){
111
125
  stream.eatWhile(/[\w\\\-_%.{:\/]/);
112
126
  return ret("string", "string");
113
127
  }else if(stream.peek() == "<" || stream.peek() == ">"){
114
128
  return ret("tag", "tag");
115
- }else if( stream.peek().match(/\(/) != null ){// lessc
129
+ }else if( /\(/.test(stream.peek()) ){
116
130
  return ret(null, ch);
117
131
  }else if (stream.peek() == "/" && state.stack[state.stack.length-1] != undefined){ // url(dir/center/image.png)
118
132
  return ret("string", "string");
119
- }else if( stream.current().match(/\-\d|\-.\d/) ){ // lesscss match e.g.: -5px -0.4 etc... only colorize the minus sign
120
- //stream.backUp(stream.current().length-1); //commment out these 2 comment if you want the minus sign to be parsed as null -500px
121
- //return ret(null, ch);
133
+ }else if( stream.current().match(/\-\d|\-.\d/) ){ // match e.g.: -5px -0.4 etc... only colorize the minus sign
134
+ //commment out these 2 comment if you want the minus sign to be parsed as null -500px
135
+ //stream.backUp(stream.current().length-1);
136
+ //return ret(null, ch); //console.log( stream.current() );
122
137
  return ret("number", "unit");
123
- }else if( inTagsArray(stream.current()) ){ // lesscss match html tags
138
+ }else if( inTagsArray(stream.current().toLowerCase()) ){ // match html tags
124
139
  return ret("tag", "tag");
125
140
  }else if( /\/|[\s\)]/.test(stream.peek() || stream.eol() || (stream.eatSpace() && stream.peek() == "/")) && stream.current().indexOf(".") !== -1){
126
- if(stream.current().substring(stream.current().length-1,stream.current().length) == "{"){
127
- stream.backUp(1);
128
- return ret("tag", "tag");
129
- }//end if
130
- if( (stream.eatSpace() && stream.peek().match(/[{<>.a-zA-Z]/) != null) || stream.eol() )return ret("tag", "tag");//e.g. button.icon-plus
131
- return ret("string", "string");//let url(/images/logo.png) without quotes return as string
132
- }else if( stream.eol() ){
133
- if(stream.current().substring(stream.current().length-1,stream.current().length) == "{")stream.backUp(1);
134
- return ret("tag", "tag");
135
- }else{
136
- return ret("variable", "variable");
141
+ if(stream.current().substring(stream.current().length-1,stream.current().length) == "{"){
142
+ stream.backUp(1);
143
+ return ret("tag", "tag");
144
+ }//end if
145
+ stream.eatSpace();
146
+ if( /[{<>.a-zA-Z\/]/.test(stream.peek()) || stream.eol() )return ret("tag", "tag"); // e.g. button.icon-plus
147
+ return ret("string", "string"); // let url(/images/logo.png) without quotes return as string
148
+ }else if( stream.eol() || stream.peek() == "[" || stream.peek() == "#" || type == "tag" ){
149
+ if(stream.current().substring(stream.current().length-1,stream.current().length) == "{")stream.backUp(1);
150
+ return ret("tag", "tag");
151
+ }else if(type == "compare" || type == "a" || type == "("){
152
+ return ret("string", "string");
153
+ }else if(type == "|" || stream.current() == "-" || type == "["){
154
+ return ret(null, ch);
155
+ }else if(stream.peek() == ":") {
156
+ stream.next();
157
+ var t_v = stream.peek() == ":" ? true : false;
158
+ if(!t_v){
159
+ var old_pos = stream.pos;
160
+ var sc = stream.current().length;
161
+ stream.eatWhile(/[a-z\\\-]/);
162
+ var new_pos = stream.pos;
163
+ if(stream.current().substring(sc-1).match(selectors) != null){
164
+ stream.backUp(new_pos-(old_pos-1));
165
+ return ret("tag", "tag");
166
+ } else stream.backUp(new_pos-(old_pos-1));
167
+ }else{
168
+ stream.backUp(1);
169
+ }
170
+ if(t_v)return ret("tag", "tag"); else return ret("variable", "variable");
171
+ }else{
172
+ return ret("variable", "variable");
137
173
  }
138
- }
139
-
174
+ }
140
175
  }
141
-
142
- function tokenSComment(stream, state) {// SComment = Slash comment
176
+
177
+ function tokenSComment(stream, state) { // SComment = Slash comment
143
178
  stream.skipToEnd();
144
179
  state.tokenize = tokenBase;
145
180
  return ret("comment", "comment");
@@ -156,7 +191,7 @@ CodeMirror.defineMode("less", function(config) {
156
191
  }
157
192
  return ret("comment", "comment");
158
193
  }
159
-
194
+
160
195
  function tokenSGMLComment(stream, state) {
161
196
  var dashes = 0, ch;
162
197
  while ((ch = stream.next()) != null) {
@@ -168,7 +203,7 @@ CodeMirror.defineMode("less", function(config) {
168
203
  }
169
204
  return ret("comment", "comment");
170
205
  }
171
-
206
+
172
207
  function tokenString(quote) {
173
208
  return function(stream, state) {
174
209
  var escaped = false, ch;
@@ -181,29 +216,28 @@ CodeMirror.defineMode("less", function(config) {
181
216
  return ret("string", "string");
182
217
  };
183
218
  }
184
-
219
+
185
220
  return {
186
221
  startState: function(base) {
187
222
  return {tokenize: tokenBase,
188
223
  baseIndent: base || 0,
189
224
  stack: []};
190
225
  },
191
-
226
+
192
227
  token: function(stream, state) {
193
228
  if (stream.eatSpace()) return null;
194
229
  var style = state.tokenize(stream, state);
195
-
230
+
196
231
  var context = state.stack[state.stack.length-1];
197
232
  if (type == "hash" && context == "rule") style = "atom";
198
233
  else if (style == "variable") {
199
234
  if (context == "rule") style = null; //"tag"
200
- else if (!context || context == "@media{"){
201
- style = stream.current() == "when" ? "variable" :
202
- stream.string.match(/#/g) != undefined ? null :
203
- /[\s,|\s\)]/.test(stream.peek()) ? "tag" : null;
204
- }
235
+ else if (!context || context == "@media{") {
236
+ style = stream.current() == "when" ? "variable" :
237
+ /[\s,|\s\)|\s]/.test(stream.peek()) ? "tag" : type;
238
+ }
205
239
  }
206
-
240
+
207
241
  if (context == "rule" && /^[\{\};]$/.test(type))
208
242
  state.stack.pop();
209
243
  if (type == "{") {
@@ -215,18 +249,18 @@ CodeMirror.defineMode("less", function(config) {
215
249
  else if (context == "{" && type != "comment") state.stack.push("rule");
216
250
  return style;
217
251
  },
218
-
252
+
219
253
  indent: function(state, textAfter) {
220
254
  var n = state.stack.length;
221
255
  if (/^\}/.test(textAfter))
222
256
  n -= state.stack[state.stack.length-1] == "rule" ? 2 : 1;
223
257
  return state.baseIndent + n * indentUnit;
224
258
  },
225
-
259
+
226
260
  electricChars: "}"
227
261
  };
228
262
  });
229
263
 
230
264
  CodeMirror.defineMIME("text/x-less", "less");
231
265
  if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
232
- CodeMirror.defineMIME("text/css", "less");
266
+ CodeMirror.defineMIME("text/css", "less");