AmberRack 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (198) hide show
  1. data/.gitignore +74 -0
  2. data/.rvmrc +4 -0
  3. data/Gemfile +2 -0
  4. data/Gemfile.lock +62 -0
  5. data/README.md +17 -0
  6. data/Rakefile +24 -0
  7. data/amber-rack.gemspec +33 -0
  8. data/app/amber_app.rb +35 -0
  9. data/app/javascripts/Benchfib.deploy.js +159 -0
  10. data/app/javascripts/Benchfib.js +159 -0
  11. data/app/javascripts/Canvas.deploy.js +1464 -0
  12. data/app/javascripts/Canvas.js +1464 -0
  13. data/app/javascripts/Compiler.deploy.js +1587 -0
  14. data/app/javascripts/Compiler.js +1587 -0
  15. data/app/javascripts/Examples.deploy.js +800 -0
  16. data/app/javascripts/Examples.js +800 -0
  17. data/app/javascripts/IDE.deploy.js +3457 -0
  18. data/app/javascripts/IDE.js +3457 -0
  19. data/app/javascripts/IDE.js.bak +3420 -0
  20. data/app/javascripts/JQuery.deploy.js +898 -0
  21. data/app/javascripts/JQuery.js +898 -0
  22. data/app/javascripts/Kernel.deploy.js +6761 -0
  23. data/app/javascripts/Kernel.js +6761 -0
  24. data/app/javascripts/Parser.deploy.js +1655 -0
  25. data/app/javascripts/Parser.js +1655 -0
  26. data/app/javascripts/Raphael-Core.js +0 -0
  27. data/app/javascripts/Raphael-Graph.js +0 -0
  28. data/app/javascripts/SUnit.deploy.js +1059 -0
  29. data/app/javascripts/SUnit.js +1059 -0
  30. data/app/javascripts/application.js +2 -0
  31. data/app/javascripts/boot.js +466 -0
  32. data/app/javascripts/init.js +2 -0
  33. data/app/javascripts/jquery-1.4.4.min.js +167 -0
  34. data/app/javascripts/jquery-ui-1.8.9.custom.min.js +781 -0
  35. data/app/javascripts/jquery.textarea.js +267 -0
  36. data/app/javascripts/jtalk.js +78 -0
  37. data/app/javascripts/lib/CodeMirror/LICENSE +19 -0
  38. data/app/javascripts/lib/CodeMirror/README.md +6 -0
  39. data/app/javascripts/lib/CodeMirror/compress.html +92 -0
  40. data/app/javascripts/lib/CodeMirror/css/baboon.png +0 -0
  41. data/app/javascripts/lib/CodeMirror/css/baboon_vector.svg +153 -0
  42. data/app/javascripts/lib/CodeMirror/css/docs.css +154 -0
  43. data/app/javascripts/lib/CodeMirror/demo/activeline.html +72 -0
  44. data/app/javascripts/lib/CodeMirror/demo/changemode.html +51 -0
  45. data/app/javascripts/lib/CodeMirror/demo/complete.html +79 -0
  46. data/app/javascripts/lib/CodeMirror/demo/complete.js +151 -0
  47. data/app/javascripts/lib/CodeMirror/demo/fullscreen.html +158 -0
  48. data/app/javascripts/lib/CodeMirror/demo/marker.html +53 -0
  49. data/app/javascripts/lib/CodeMirror/demo/mustache.html +57 -0
  50. data/app/javascripts/lib/CodeMirror/demo/preview.html +75 -0
  51. data/app/javascripts/lib/CodeMirror/demo/resize.html +44 -0
  52. data/app/javascripts/lib/CodeMirror/demo/runmode.html +50 -0
  53. data/app/javascripts/lib/CodeMirror/demo/search.html +106 -0
  54. data/app/javascripts/lib/CodeMirror/demo/theme.html +53 -0
  55. data/app/javascripts/lib/CodeMirror/index.html +239 -0
  56. data/app/javascripts/lib/CodeMirror/internals.html +389 -0
  57. data/app/javascripts/lib/CodeMirror/lib/codemirror.css +67 -0
  58. data/app/javascripts/lib/CodeMirror/lib/codemirror.js +2144 -0
  59. data/app/javascripts/lib/CodeMirror/lib/overlay.js +51 -0
  60. data/app/javascripts/lib/CodeMirror/lib/runmode.js +27 -0
  61. data/app/javascripts/lib/CodeMirror/manual.html +854 -0
  62. data/app/javascripts/lib/CodeMirror/mode/clike/clike.js +247 -0
  63. data/app/javascripts/lib/CodeMirror/mode/clike/index.html +102 -0
  64. data/app/javascripts/lib/CodeMirror/mode/css/css.js +124 -0
  65. data/app/javascripts/lib/CodeMirror/mode/css/index.html +56 -0
  66. data/app/javascripts/lib/CodeMirror/mode/diff/diff.css +3 -0
  67. data/app/javascripts/lib/CodeMirror/mode/diff/diff.js +13 -0
  68. data/app/javascripts/lib/CodeMirror/mode/diff/index.html +99 -0
  69. data/app/javascripts/lib/CodeMirror/mode/haskell/haskell.js +242 -0
  70. data/app/javascripts/lib/CodeMirror/mode/haskell/index.html +60 -0
  71. data/app/javascripts/lib/CodeMirror/mode/htmlmixed/htmlmixed.js +79 -0
  72. data/app/javascripts/lib/CodeMirror/mode/htmlmixed/index.html +52 -0
  73. data/app/javascripts/lib/CodeMirror/mode/javascript/index.html +78 -0
  74. data/app/javascripts/lib/CodeMirror/mode/javascript/javascript.js +348 -0
  75. data/app/javascripts/lib/CodeMirror/mode/lua/index.html +72 -0
  76. data/app/javascripts/lib/CodeMirror/mode/lua/lua.js +138 -0
  77. data/app/javascripts/lib/CodeMirror/mode/php/index.html +49 -0
  78. data/app/javascripts/lib/CodeMirror/mode/php/php.js +110 -0
  79. data/app/javascripts/lib/CodeMirror/mode/plsql/index.html +63 -0
  80. data/app/javascripts/lib/CodeMirror/mode/plsql/plsql.js +217 -0
  81. data/app/javascripts/lib/CodeMirror/mode/python/LICENSE.txt +21 -0
  82. data/app/javascripts/lib/CodeMirror/mode/python/index.html +123 -0
  83. data/app/javascripts/lib/CodeMirror/mode/python/python.js +321 -0
  84. data/app/javascripts/lib/CodeMirror/mode/rst/index.html +526 -0
  85. data/app/javascripts/lib/CodeMirror/mode/rst/rst.css +75 -0
  86. data/app/javascripts/lib/CodeMirror/mode/rst/rst.js +333 -0
  87. data/app/javascripts/lib/CodeMirror/mode/scheme/index.html +65 -0
  88. data/app/javascripts/lib/CodeMirror/mode/scheme/scheme.js +181 -0
  89. data/app/javascripts/lib/CodeMirror/mode/smalltalk/index.html +56 -0
  90. data/app/javascripts/lib/CodeMirror/mode/smalltalk/smalltalk.js +134 -0
  91. data/app/javascripts/lib/CodeMirror/mode/sparql/index.html +41 -0
  92. data/app/javascripts/lib/CodeMirror/mode/sparql/sparql.js +143 -0
  93. data/app/javascripts/lib/CodeMirror/mode/stex/index.html +96 -0
  94. data/app/javascripts/lib/CodeMirror/mode/stex/stex.js +167 -0
  95. data/app/javascripts/lib/CodeMirror/mode/xml/index.html +42 -0
  96. data/app/javascripts/lib/CodeMirror/mode/xml/xml.js +231 -0
  97. data/app/javascripts/lib/CodeMirror/mode/yaml/index.html +68 -0
  98. data/app/javascripts/lib/CodeMirror/mode/yaml/yaml.js +95 -0
  99. data/app/javascripts/lib/CodeMirror/oldrelease.html +178 -0
  100. data/app/javascripts/lib/CodeMirror/test/index.html +29 -0
  101. data/app/javascripts/lib/CodeMirror/test/test.js +249 -0
  102. data/app/javascripts/lib/CodeMirror/theme/default.css +18 -0
  103. data/app/javascripts/lib/CodeMirror/theme/elegant.css +9 -0
  104. data/app/javascripts/lib/CodeMirror/theme/jtalk.css +21 -0
  105. data/app/javascripts/lib/CodeMirror/theme/neat.css +8 -0
  106. data/app/javascripts/lib/CodeMirror/theme/night.css +20 -0
  107. data/app/javascripts/lib/jQuery/jquery-1.4.4.min.js +167 -0
  108. data/app/javascripts/lib/jQuery/jquery-ui-1.8.9.custom.min.js +781 -0
  109. data/app/javascripts/lib/jQuery/jquery.textarea.js +267 -0
  110. data/app/smalltalk/Canvas.st +481 -0
  111. data/app/smalltalk/IDE.st +1752 -0
  112. data/config.ru +2 -0
  113. data/lib/amber-rack.rb +4 -0
  114. data/lib/amber-rack/version.rb +3 -0
  115. data/public/CodeMirror/LICENSE +19 -0
  116. data/public/CodeMirror/README.md +6 -0
  117. data/public/CodeMirror/compress.html +92 -0
  118. data/public/CodeMirror/css/baboon.png +0 -0
  119. data/public/CodeMirror/css/baboon_vector.svg +153 -0
  120. data/public/CodeMirror/css/docs.css +154 -0
  121. data/public/CodeMirror/demo/activeline.html +72 -0
  122. data/public/CodeMirror/demo/changemode.html +51 -0
  123. data/public/CodeMirror/demo/complete.html +79 -0
  124. data/public/CodeMirror/demo/complete.js +151 -0
  125. data/public/CodeMirror/demo/fullscreen.html +158 -0
  126. data/public/CodeMirror/demo/marker.html +53 -0
  127. data/public/CodeMirror/demo/mustache.html +57 -0
  128. data/public/CodeMirror/demo/preview.html +75 -0
  129. data/public/CodeMirror/demo/resize.html +44 -0
  130. data/public/CodeMirror/demo/runmode.html +50 -0
  131. data/public/CodeMirror/demo/search.html +106 -0
  132. data/public/CodeMirror/demo/theme.html +53 -0
  133. data/public/CodeMirror/index.html +239 -0
  134. data/public/CodeMirror/internals.html +389 -0
  135. data/public/CodeMirror/lib/codemirror.css +67 -0
  136. data/public/CodeMirror/lib/codemirror.js +2144 -0
  137. data/public/CodeMirror/lib/overlay.js +51 -0
  138. data/public/CodeMirror/lib/runmode.js +27 -0
  139. data/public/CodeMirror/manual.html +854 -0
  140. data/public/CodeMirror/mode/clike/clike.js +247 -0
  141. data/public/CodeMirror/mode/clike/index.html +102 -0
  142. data/public/CodeMirror/mode/css/css.js +124 -0
  143. data/public/CodeMirror/mode/css/index.html +56 -0
  144. data/public/CodeMirror/mode/diff/diff.css +3 -0
  145. data/public/CodeMirror/mode/diff/diff.js +13 -0
  146. data/public/CodeMirror/mode/diff/index.html +99 -0
  147. data/public/CodeMirror/mode/haskell/haskell.js +242 -0
  148. data/public/CodeMirror/mode/haskell/index.html +60 -0
  149. data/public/CodeMirror/mode/htmlmixed/htmlmixed.js +79 -0
  150. data/public/CodeMirror/mode/htmlmixed/index.html +52 -0
  151. data/public/CodeMirror/mode/javascript/index.html +78 -0
  152. data/public/CodeMirror/mode/javascript/javascript.js +348 -0
  153. data/public/CodeMirror/mode/lua/index.html +72 -0
  154. data/public/CodeMirror/mode/lua/lua.js +138 -0
  155. data/public/CodeMirror/mode/php/index.html +49 -0
  156. data/public/CodeMirror/mode/php/php.js +110 -0
  157. data/public/CodeMirror/mode/plsql/index.html +63 -0
  158. data/public/CodeMirror/mode/plsql/plsql.js +217 -0
  159. data/public/CodeMirror/mode/python/LICENSE.txt +21 -0
  160. data/public/CodeMirror/mode/python/index.html +123 -0
  161. data/public/CodeMirror/mode/python/python.js +321 -0
  162. data/public/CodeMirror/mode/rst/index.html +526 -0
  163. data/public/CodeMirror/mode/rst/rst.css +75 -0
  164. data/public/CodeMirror/mode/rst/rst.js +333 -0
  165. data/public/CodeMirror/mode/scheme/index.html +65 -0
  166. data/public/CodeMirror/mode/scheme/scheme.js +181 -0
  167. data/public/CodeMirror/mode/smalltalk/index.html +56 -0
  168. data/public/CodeMirror/mode/smalltalk/smalltalk.js +134 -0
  169. data/public/CodeMirror/mode/sparql/index.html +41 -0
  170. data/public/CodeMirror/mode/sparql/sparql.js +143 -0
  171. data/public/CodeMirror/mode/stex/index.html +96 -0
  172. data/public/CodeMirror/mode/stex/stex.js +167 -0
  173. data/public/CodeMirror/mode/xml/index.html +42 -0
  174. data/public/CodeMirror/mode/xml/xml.js +231 -0
  175. data/public/CodeMirror/mode/yaml/index.html +68 -0
  176. data/public/CodeMirror/mode/yaml/yaml.js +95 -0
  177. data/public/CodeMirror/oldrelease.html +178 -0
  178. data/public/CodeMirror/test/index.html +29 -0
  179. data/public/CodeMirror/test/test.js +249 -0
  180. data/public/CodeMirror/theme/default.css +18 -0
  181. data/public/CodeMirror/theme/elegant.css +9 -0
  182. data/public/CodeMirror/theme/jtalk.css +21 -0
  183. data/public/CodeMirror/theme/neat.css +8 -0
  184. data/public/CodeMirror/theme/night.css +20 -0
  185. data/public/css/jtalk.css +362 -0
  186. data/public/css/style.css +456 -0
  187. data/public/css/sunit.css +66 -0
  188. data/public/ide/fork_me.png +0 -0
  189. data/public/ide/screen2.png +0 -0
  190. data/public/ide/style.css +456 -0
  191. data/public/ide/syntax.css +61 -0
  192. data/public/ide/text_header.png +0 -0
  193. data/public/ide/title_container1.png +0 -0
  194. data/public/images/background_box.png +0 -0
  195. data/public/images/background_header.png +0 -0
  196. data/public/images/balloon_header.png +0 -0
  197. data/views/index.haml +66 -0
  198. metadata +341 -0
@@ -0,0 +1,57 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <title>CodeMirror 2: Overlay Parser Demo</title>
5
+ <link rel="stylesheet" href="../lib/codemirror.css">
6
+ <script src="../lib/codemirror.js"></script>
7
+ <script src="../lib/overlay.js"></script>
8
+ <link rel="stylesheet" href="../theme/default.css">
9
+ <script src="../mode/xml/xml.js"></script>
10
+ <link rel="stylesheet" href="../css/docs.css">
11
+
12
+ <style type="text/css">
13
+ .CodeMirror {border: 1px solid black;}
14
+ .mustache {color: #0ca;}
15
+ </style>
16
+ </head>
17
+ <body>
18
+ <h1>CodeMirror 2: Overlay Parser Demo</h1>
19
+
20
+ <form><textarea id="code" name="code">
21
+ <html>
22
+ <body>
23
+ <h1>{{title}}</h1>
24
+ <p>These are links to {{things}}:</p>
25
+ <ul>{{#links}}
26
+ <li><a href="{{url}}">{{text}}</a></li>
27
+ {{/links}}</ul>
28
+ </body>
29
+ </html>
30
+ </textarea></form>
31
+
32
+ <script>
33
+ CodeMirror.defineMode("mustache", function(config, parserConfig) {
34
+ var mustacheOverlay = {
35
+ token: function(stream, state) {
36
+ if (stream.match("{{")) {
37
+ while ((ch = stream.next()) != null)
38
+ if (ch == "}" && stream.next() == "}") break;
39
+ return "mustache";
40
+ }
41
+ while (stream.next() != null && !stream.match("{{", false)) {}
42
+ return null;
43
+ }
44
+ };
45
+ return CodeMirror.overlayParser(CodeMirror.getMode(config, parserConfig.backdrop || "text/html"), mustacheOverlay);
46
+ });
47
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {mode: "mustache"});
48
+ </script>
49
+
50
+ <p>Demonstration of a mode that parses HTML, highlighting
51
+ the <a href="http://mustache.github.com/">Mustache</a> templating
52
+ directives inside of it by using the code
53
+ in <a href="../lib/overlay.js"><code>overlay.js</code></a>. View
54
+ source to see the 15 lines of code needed to accomplish this.</p>
55
+
56
+ </body>
57
+ </html>
@@ -0,0 +1,75 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <title>CodeMirror 2: HTML5 preview</title>
5
+ <meta charset=utf-8>
6
+ <script src=../lib/codemirror.js></script>
7
+ <script src=../mode/xml/xml.js></script>
8
+ <script src=../mode/javascript/javascript.js></script>
9
+ <script src=../mode/css/css.js></script>
10
+ <script src=../mode/htmlmixed/htmlmixed.js></script>
11
+ <link rel=stylesheet href=../lib/codemirror.css>
12
+ <link rel=stylesheet href=../theme/default.css>
13
+ <link rel=stylesheet href=../css/docs.css>
14
+ <style type=text/css>
15
+ .CodeMirror {
16
+ float: left;
17
+ width: 50%;
18
+ border: 1px solid black;
19
+ }
20
+ iframe {
21
+ width: 49%;
22
+ float: left;
23
+ height: 300px;
24
+ border: 1px solid black;
25
+ border-left: 0px;
26
+ }
27
+ </style>
28
+ </head>
29
+ <body>
30
+ <h1>CodeMirror 2: HTML5 preview</h1>
31
+ <textarea id=code name=code>
32
+ <!doctype html>
33
+ <html>
34
+ <head>
35
+ <title>HTML5 canvas demo</title>
36
+ <meta charset=utf-8>
37
+ </head>
38
+ <body>
39
+ <canvas id=tutorial width=250 height=250></canvas>
40
+ <script>
41
+ var canvas = document.getElementById('tutorial');
42
+ var context = canvas.getContext('2d');
43
+
44
+ context.fillStyle = 'rgb(250,0,0)';
45
+ context.fillRect(10, 10, 55, 50);
46
+
47
+ context.fillStyle = 'rgba(0, 0, 250, 0.5)';
48
+ context.fillRect(30, 30, 55, 50);
49
+ </script>
50
+ </body>
51
+ </html>
52
+ </textarea>
53
+ <iframe id=preview></iframe>
54
+ <script>
55
+ var delay;
56
+ // Initialize CodeMirror editor with a nice html5 canvas demo.
57
+ var editor = CodeMirror.fromTextArea(document.getElementById('code'), {
58
+ mode: 'text/html',
59
+ tabMode: 'indent',
60
+ onChange: function() {
61
+ clearTimeout(delay);
62
+ delay = setTimeout(updatePreview, 300);
63
+ }
64
+ });
65
+
66
+ function updatePreview() {
67
+ var preview = document.getElementById('preview').contentDocument;
68
+ preview.open();
69
+ preview.write(editor.getValue());
70
+ preview.close();
71
+ }
72
+ setTimeout(updatePreview, 300);
73
+ </script>
74
+ </body>
75
+ </html>
@@ -0,0 +1,44 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <title>CodeMirror 2: Autoresize Demo</title>
5
+ <link rel="stylesheet" href="../lib/codemirror.css">
6
+ <script src="../lib/codemirror.js"></script>
7
+ <link rel="stylesheet" href="../theme/default.css">
8
+ <script src="../mode/css/css.js"></script>
9
+ <link rel="stylesheet" href="../css/docs.css">
10
+
11
+ <style type="text/css">
12
+ .CodeMirror {
13
+ border: 1px solid #eee;
14
+ }
15
+ .CodeMirror-scroll {
16
+ height: auto;
17
+ overflow-y: hidden;
18
+ overflow-x: auto;
19
+ }
20
+ </style>
21
+ </head>
22
+ <body>
23
+ <h1>CodeMirror 2: Autoresize demo</h1>
24
+
25
+ <form><textarea id="code" name="code">
26
+ .CodeMirror-scroll {
27
+ height: auto;
28
+ overflow-y: hidden;
29
+ overflow-x: auto;
30
+ }</textarea></form>
31
+
32
+ <p>By setting a single CSS property, CodeMirror can be made to
33
+ automatically resize to fit the content. Use <code>max-height</code>
34
+ to prevent it from growing past a given point (on halfway modern
35
+ browsers).</p>
36
+
37
+ <script>
38
+ CodeMirror.fromTextArea(document.getElementById("code"), {
39
+ lineNumbers: true
40
+ });
41
+ </script>
42
+
43
+ </body>
44
+ </html>
@@ -0,0 +1,50 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <title>CodeMirror 2: Mode Runner Demo</title>
5
+ <link rel="stylesheet" href="../lib/codemirror.css">
6
+ <script src="../lib/codemirror.js"></script>
7
+ <script src="../lib/runmode.js"></script>
8
+ <link rel="stylesheet" href="../theme/default.css">
9
+ <script src="../mode/xml/xml.js"></script>
10
+ <link rel="stylesheet" href="../css/docs.css">
11
+ </head>
12
+ <body>
13
+ <h1>CodeMirror 2: Mode Runner Demo</h1>
14
+
15
+ <textarea id="code" style="width: 90%; height: 7em; border: 1px solid black; padding: .2em .4em;">
16
+ <foobar>
17
+ <blah>Enter your xml here and press the button below to display
18
+ it as highlighted by the CodeMirror XML mode</blah>
19
+ <tag2 foo="2" bar="&amp;quot;bar&amp;quot;"/>
20
+ </foobar></textarea><br>
21
+ <button onclick="doHighlight();">Highlight!</button>
22
+ <pre id="output" class="cm-s-default"></pre>
23
+
24
+ <script>
25
+ function doHighlight() {
26
+ CodeMirror.runMode(document.getElementById("code").value, "application/xml",
27
+ document.getElementById("output"));
28
+ }
29
+ </script>
30
+
31
+ <p>Running a CodeMirror mode outside of the editor.
32
+ The <code>CodeMirror.runMode</code> function, defined
33
+ in <code><a href="../lib/runmode.js">lib/runmode.js</a></code> takes the following arguments:</p>
34
+
35
+ <dl>
36
+ <dt><code>text (string)</code></dt>
37
+ <dd>The document to run through the highlighter.</dd>
38
+ <dt><code>mode (<a href="../manual.html#option_mode">mode spec</a>)</code></dt>
39
+ <dd>The mode to use (must be loaded as normal).</dd>
40
+ <dt><code>output (function or DOM node)</code></dt>
41
+ <dd>If this is a function, it will be called for each token with
42
+ two arguments, the token's text and the token's style class (may
43
+ be <code>null</code> for unstyled tokens). If it is a DOM node,
44
+ the tokens will be converted to <code>span</code> elements as in
45
+ an editor, and inserted into the node
46
+ (through <code>innerHTML</code>).</dd>
47
+ </dl>
48
+
49
+ </body>
50
+ </html>
@@ -0,0 +1,106 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <title>CodeMirror 2: Search/Replace Demo</title>
5
+ <link rel="stylesheet" href="../lib/codemirror.css">
6
+ <script src="../lib/codemirror.js"></script>
7
+ <link rel="stylesheet" href="../theme/default.css">
8
+ <script src="../mode/xml/xml.js"></script>
9
+ <link rel="stylesheet" href="../css/docs.css">
10
+
11
+ <style type="text/css">
12
+ .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
13
+ .searched {background: yellow;}
14
+ </style>
15
+ </head>
16
+ <body>
17
+ <h1>CodeMirror 2: Search/Replace Demo</h1>
18
+
19
+ <form><textarea id="code" name="code">
20
+ <dt id="option_indentWithTabs"><code>indentWithTabs (boolean)</code></dt>
21
+ <dd>Whether, when indenting, the first N*8 spaces should be
22
+ replaced by N tabs. Default is false.</dd>
23
+
24
+ <dt id="option_tabMode"><code>tabMode (string)</code></dt>
25
+ <dd>Determines what happens when the user presses the tab key.
26
+ Must be one of the following:
27
+ <dl>
28
+ <dt><code>"classic" (the default)</code></dt>
29
+ <dd>When nothing is selected, insert a tab. Otherwise,
30
+ behave like the <code>"shift"</code> mode. (When shift is
31
+ held, this behaves like the <code>"indent"</code> mode.)</dd>
32
+ <dt><code>"shift"</code></dt>
33
+ <dd>Indent all selected lines by
34
+ one <a href="#option_indentUnit"><code>indentUnit</code></a>.
35
+ If shift was held while pressing tab, un-indent all selected
36
+ lines one unit.</dd>
37
+ <dt><code>"indent"</code></dt>
38
+ <dd>Indent the line the 'correctly', based on its syntactic
39
+ context. Only works if the
40
+ mode <a href="#indent">supports</a> it.</dd>
41
+ <dt><code>"default"</code></dt>
42
+ <dd>Do not capture tab presses, let the browser apply its
43
+ default behaviour (which usually means it skips to the next
44
+ control).</dd>
45
+ </dl></dd>
46
+
47
+ <dt id="option_enterMode"><code>enterMode (string)</code></dt>
48
+ <dd>Determines whether and how new lines are indented when the
49
+ enter key is pressed. The following modes are supported:
50
+ <dl>
51
+ <dt><code>"indent" (the default)</code></dt>
52
+ <dd>Use the mode's indentation rules to give the new line
53
+ the correct indentation.</dd>
54
+ <dt><code>"keep"</code></dt>
55
+ <dd>Indent the line the same as the previous line.</dd>
56
+ <dt><code>"flat"</code></dt>
57
+ <dd>Do not indent the new line.</dd>
58
+ </dl></dd>
59
+ </textarea></form>
60
+ <button type=button onclick="search()">Search</button>
61
+ <input type=text style="width: 5em" id=query value=indent> or
62
+ <button type=button onclick="replace()">replace</button> it by
63
+ <input type=text style="width: 5em" id=replace>
64
+
65
+ <script>
66
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {mode: "text/html", lineNumbers: true});
67
+
68
+ var lastPos = null, lastQuery = null, marked = [];
69
+
70
+ function unmark() {
71
+ for (var i = 0; i < marked.length; ++i) marked[i]();
72
+ marked.length = 0;
73
+ }
74
+
75
+ function search() {
76
+ unmark();
77
+ var text = document.getElementById("query").value;
78
+ if (!text) return;
79
+ for (var cursor = editor.getSearchCursor(text); cursor.findNext();)
80
+ marked.push(editor.markText(cursor.from(), cursor.to(), "searched"));
81
+
82
+ if (lastQuery != text) lastPos = null;
83
+ var cursor = editor.getSearchCursor(text, lastPos || editor.getCursor());
84
+ if (!cursor.findNext()) {
85
+ cursor = editor.getSearchCursor(text);
86
+ if (!cursor.findNext()) return;
87
+ }
88
+ editor.setSelection(cursor.from(), cursor.to());
89
+ lastQuery = text; lastPos = cursor.to();
90
+ }
91
+
92
+ function replace() {
93
+ unmark();
94
+ var text = document.getElementById("query").value,
95
+ replace = document.getElementById("replace").value;
96
+ if (!text) return;
97
+ for (var cursor = editor.getSearchCursor(text); cursor.findNext();)
98
+ cursor.replace(replace);
99
+ }
100
+ </script>
101
+
102
+ <p>Demonstration of search/replace functionality and marking
103
+ text.</p>
104
+
105
+ </body>
106
+ </html>
@@ -0,0 +1,53 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <title>CodeMirror 2: Theme Demo</title>
5
+ <link rel="stylesheet" href="../lib/codemirror.css">
6
+ <script src="../lib/codemirror.js"></script>
7
+ <link rel="stylesheet" href="../theme/default.css">
8
+ <link rel="stylesheet" href="../theme/neat.css">
9
+ <link rel="stylesheet" href="../theme/elegant.css">
10
+ <link rel="stylesheet" href="../theme/night.css">
11
+ <script src="../mode/javascript/javascript.js"></script>
12
+ <link rel="stylesheet" href="../css/docs.css">
13
+
14
+ <style type="text/css">
15
+ .CodeMirror {border: 1px solid black;}
16
+ </style>
17
+ </head>
18
+ <body>
19
+ <h1>CodeMirror 2: Theme demo</h1>
20
+
21
+ <form><textarea id="code" name="code">
22
+ function findSequence(goal) {
23
+ function find(start, history) {
24
+ if (start == goal)
25
+ return history;
26
+ else if (start > goal)
27
+ return null;
28
+ else
29
+ return find(start + 5, "(" + history + " + 5)") ||
30
+ find(start * 3, "(" + history + " * 3)");
31
+ }
32
+ return find(1, "1");
33
+ }</textarea></form>
34
+
35
+ <p>Select a theme: <select onchange="selectTheme(this)">
36
+ <option selected>default</option>
37
+ <option>night</option>
38
+ <option>neat</option>
39
+ <option>elegant</option>
40
+ </select>
41
+ </p>
42
+
43
+ <script>
44
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
45
+ lineNumbers: true
46
+ });
47
+ function selectTheme(node) {
48
+ var theme = node.options[node.selectedIndex].innerHTML;
49
+ editor.setOption("theme", theme);
50
+ }
51
+ </script>
52
+ </body>
53
+ </html>
@@ -0,0 +1,239 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <title>CodeMirror</title>
5
+ <link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Droid+Sans|Droid+Sans:bold"/>
6
+ <link rel="stylesheet" type="text/css" href="css/docs.css"/>
7
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
8
+ <link rel="alternate" href="http://twitter.com/statuses/user_timeline/242283288.rss" type="application/rss+xml"/>
9
+ </head>
10
+ <body>
11
+
12
+ <h1><span class="logo-braces">{ }</span> <a href="http://codemirror.net/">CodeMirror</a></h1>
13
+
14
+ <pre class="grey">
15
+ <img src="css/baboon.png" class="logo" alt="logo"/>/* In-browser code editing
16
+ made bearable */
17
+ </pre>
18
+
19
+ <div class="clear"><div class="left blk">
20
+
21
+ <p style="margin-top: 0">CodeMirror is a JavaScript library that can
22
+ be used to create a relatively pleasant editor interface for
23
+ code-like content &#x2015; computer programs, HTML markup, and
24
+ similar. If a mode has been written for the language you are
25
+ editing, the code will be coloured, and the editor will optionally
26
+ help you with indentation.</p>
27
+
28
+ <p>This is the project page for CodeMirror 2, the currently more
29
+ actively developed, and recommended
30
+ version. <a href="1/index.html">CodeMirror 1</a> is still available
31
+ from here.</p>
32
+
33
+ <div class="clear"><div class="left1 blk">
34
+
35
+ <h2 style="margin-top: 0">Supported modes:</h2>
36
+
37
+ <ul>
38
+ <li><a href="mode/javascript/index.html">JavaScript</a></li>
39
+ <li><a href="mode/xml/index.html">XML/HTML</a></li>
40
+ <li><a href="mode/css/index.html">CSS</a></li>
41
+ <li><a href="mode/htmlmixed/index.html">HTML mixed-mode</a></li>
42
+ <li><a href="mode/python/index.html">Python</a></li>
43
+ <li><a href="mode/php/index.html">PHP</a></li>
44
+ <li><a href="mode/diff/index.html">diff</a></li>
45
+ <li><a href="mode/clike/index.html">C, Java, C#, and similar</a></li>
46
+ <li><a href="mode/stex/index.html">sTeX, LaTeX</a></li>
47
+ <li><a href="mode/haskell/index.html">Haskell</a></li>
48
+ <li><a href="mode/smalltalk/index.html">Smalltalk</a></li>
49
+ <li><a href="mode/plsql/index.html">PL/SQL</a></li>
50
+ <li><a href="mode/lua/index.html">Lua</a></li>
51
+ <li><a href="mode/scheme/index.html">Scheme</a></li>
52
+ <li><a href="mode/rst/index.html">reStructuredText</a></li>
53
+ <li><a href="mode/yaml/index.html">YAML</a></li>
54
+ <li><a href="mode/sparql/index.html">SPARQL</a></li>
55
+ </ul>
56
+
57
+ </div><div class="left2 blk">
58
+
59
+ <h2 style="margin-top: 0">Usage demos:</h2>
60
+
61
+ <ul>
62
+ <li><a href="demo/complete.html">Autocompletion</a></li>
63
+ <li><a href="demo/mustache.html">Mode overlays</a></li>
64
+ <li><a href="demo/search.html">Search/replace</a></li>
65
+ <li><a href="demo/preview.html">HTML editor with preview</a></li>
66
+ <li><a href="demo/resize.html">Auto-resizing editor</a></li>
67
+ <li><a href="demo/marker.html">Setting breakpoints</a></li>
68
+ <li><a href="demo/activeline.html">Highlighting the current line</a></li>
69
+ <li><a href="demo/theme.html">Theming</a></li>
70
+ <li><a href="demo/runmode.html">Stand-alone highlighting</a></li>
71
+ <li><a href="demo/fullscreen.html">Full-screen editing</a></li>
72
+ <li><a href="demo/changemode.html">Mode auto-changing</a></li>
73
+ </ul>
74
+
75
+ </div></div>
76
+
77
+ <h2 id="code">Getting the code</h2>
78
+
79
+ <p>All of CodeMirror is released under a <a
80
+ href="LICENSE">MIT-style</a> license. To get it, you can download
81
+ the <a href="http://codemirror.net/codemirror.zip">latest
82
+ release</a> or the current <a
83
+ href="http://codemirror.net/codemirror2-latest.zip">development
84
+ snapshot</a> as zip files. To create a custom minified script file,
85
+ you can use the <a href="compress.html">compression API</a>.</p>
86
+
87
+ <p>We use <a href="http://git-scm.com/">git</a> for version control.
88
+ The main repository can be fetched in this way:</p>
89
+
90
+ <pre class="code">git clone http://marijnhaverbeke.nl/git/codemirror2</pre>
91
+
92
+ <p>CodeMirror can also be found on GitHub at <a
93
+ href="http://github.com/marijnh/CodeMirror2">marijnh/CodeMirror2</a>.
94
+ If you plan to hack on the code and contribute patches, the best way
95
+ to do it is to create a GitHub fork, and send pull requests.</p>
96
+
97
+ <h2 id="documention">Documentation</h2>
98
+
99
+ <p>The <a href="manual.html">manual</a> is your first stop for
100
+ learning how to use this library. It starts with a quick explanation
101
+ of how to use the editor, and then describes all of the (many)
102
+ options and methods that CodeMirror exposes.</p>
103
+
104
+ <p>For those who want to learn more about the code, there is
105
+ an <a href="internals.html">overview of the internals</a> available.
106
+ The <a href="http://github.com/marijnh/CodeMirror2">source code</a>
107
+ itself is, for the most part, also well commented.</p>
108
+
109
+ <h2 id="support">Support and bug reports</h2>
110
+
111
+ <p>There is
112
+ a <a href="http://groups.google.com/group/codemirror">Google
113
+ group</a> (a sort of mailing list/newsgroup thing) for discussion
114
+ and news related to CodeMirror. Reporting bugs is best done
115
+ on <a href="http://github.com/marijnh/CodeMirror2/issues">github</a>.
116
+ You can also e-mail me
117
+ directly: <a href="mailto:marijnh@gmail.com">Marijn
118
+ Haverbeke</a>.</p>
119
+
120
+ <h2 id="supported">Supported browsers</h2>
121
+
122
+ <p>The following browsers are able to run CodeMirror:</p>
123
+
124
+ <ul>
125
+ <li>Firefox 2 or higher</li>
126
+ <li>Chrome, any version</li>
127
+ <li>Safari 3 or higher</li>
128
+ <li>Internet Explorer 6 or higher</li>
129
+ <li>Opera 9 or higher (with some key-handling problems on OS X)</li>
130
+ </ul>
131
+
132
+ <p>I am not actively testing against every new browser release, and
133
+ vendors have a habit of introducing bugs all the time, so I am
134
+ relying on the community to tell me when something breaks.
135
+ See <a href="#support">here</a> for information on how to contact
136
+ me.</p>
137
+
138
+ </div>
139
+
140
+ <div class="right blk">
141
+
142
+ <a href="http://codemirror.net/codemirror.zip" class="download">Download the latest release</a>
143
+
144
+ <h2>Make a donation</h2>
145
+
146
+ <ul>
147
+ <li><span onclick="document.getElementById('paypal').submit();" class="quasilink">Paypal</span></li>
148
+ <li><span onclick="document.getElementById('bankinfo').style.display = 'block';" class="quasilink">Bank</span></li>
149
+ </ul>
150
+
151
+ <p id="bankinfo" style="display: none;">
152
+ Bank: <i>Rabobank</i><br/>
153
+ Country: <i>Netherlands</i><br/>
154
+ SWIFT: <i>RABONL2U</i><br/>
155
+ Account: <i>147850770</i><br/>
156
+ Name: <i>Marijn Haverbeke</i><br/>
157
+ IBAN: <i>NL26 RABO 0147 8507 70</i>
158
+ </p>
159
+
160
+ <h2>Releases:</h2>
161
+
162
+ <p class="rel">25-07-2011: <a href="http://codemirror.net/codemirror-2.12.zip">Version 2.12</a>:</p>
163
+ <ul class="rel-note">
164
+ <li>Add a <a href="mode/sparql/index.html">SPARQL</a> mode.</li>
165
+ <li>Fix bug with cursor jumping around in an unfocused editor in IE.</li>
166
+ <li>Allow key and mouse events to bubble out of the editor. Ignore widget clicks.</li>
167
+ <li>Solve cursor flakiness after undo/redo.</li>
168
+ <li>Fix block-reindent ignoring the last few lines.</li>
169
+ <li>Fix parsing of multi-line attrs in XML mode.</li>
170
+ <li>Use <code>innerHTML</code> for HTML-escaping.</li>
171
+ <li>Some fixes to indentation in C-like mode.</li>
172
+ <li>Shrink horiz scrollbars when long lines removed.</li>
173
+ <li>Fix width feedback loop bug that caused the width of an inner DIV to shrink.</li>
174
+ </ul>
175
+
176
+ <p class="rel">04-07-2011: <a href="http://codemirror.net/codemirror-2.11.zip">Version 2.11</a>:</p>
177
+ <ul class="rel-note">
178
+ <li>Add a <a href="mode/scheme/index.html">Scheme mode</a>.</li>
179
+ <li>Add a <code>replace</code> method to search cursors, for cursor-preserving replacements.</li>
180
+ <li>Make the <a href="mode/clike/index.html">C-like mode</a> mode more customizeable.</li>
181
+ <li>Update XML mode to spot mismatched tags.</li>
182
+ <li>Add <code>getStateAfter</code> API and <code>compareState</code> mode API methods for finer-grained mode magic.</li>
183
+ <li>Add a <code>getScrollerElement</code> API method to manipulate the scrolling DIV.</li>
184
+ <li>Fix drag-and-drop for Firefox.</li>
185
+ <li>Add a C# configuration for the <a href="mode/clike/index.html">C-like mode</a>.</li>
186
+ <li>Add <a href="demo/fullscreen.html">full-screen editing</a> and <a href="demo/changemode.html">mode-changing</a> demos.</li>
187
+ </ul>
188
+
189
+ <p class="rel">07-06-2011: <a href="http://codemirror.net/codemirror-2.1.zip">Version 2.1</a>:</p>
190
+ <p class="rel-note">Add
191
+ a <a href="manual.html#option_theme">theme</a> system
192
+ (<a href="demo/theme.html">demo</a>). Note that this is not
193
+ backwards-compatible—you'll have to update your styles and
194
+ modes!</p>
195
+
196
+ <p class="rel">07-06-2011: <a href="http://codemirror.net/codemirror-2.02.zip">Version 2.02</a>:</p>
197
+ <ul class="rel-note">
198
+ <li>Add a <a href="mode/lua/index.html">Lua mode</a>.</li>
199
+ <li>Fix reverse-searching for a regexp.</li>
200
+ <li>Empty lines can no longer break highlighting.</li>
201
+ <li>Rework scrolling model (the outer wrapper no longer does the scrolling).</li>
202
+ <li>Solve horizontal jittering on long lines.</li>
203
+ <li>Add <a href="demo/runmode.html">runmode.js</a>.</li>
204
+ <li>Immediately re-highlight text when typing.</li>
205
+ <li>Fix problem with 'sticking' horizontal scrollbar.</li>
206
+ </ul>
207
+
208
+ <p class="rel">26-05-2011: <a href="http://codemirror.net/codemirror-2.01.zip">Version 2.01</a>:</p>
209
+ <ul class="rel-note">
210
+ <li>Add a <a href="mode/smalltalk/index.html">Smalltalk mode</a>.</li>
211
+ <li>Add a <a href="mode/rst/index.html">reStructuredText mode</a>.</li>
212
+ <li>Add a <a href="mode/python/index.html">Python mode</a>.</li>
213
+ <li>Add a <a href="mode/plsql/index.html">PL/SQL mode</a>.</li>
214
+ <li><code>coordsChar</code> now works</li>
215
+ <li>Fix a problem where <code>onCursorActivity</code> interfered with <code>onChange</code>.</li>
216
+ <li>Fix a number of scrolling and mouse-click-position glitches.</li>
217
+ <li>Pass information about the changed lines to <code>onChange</code>.</li>
218
+ <li>Support cmd-up/down on OS X.</li>
219
+ <li>Add triple-click line selection.</li>
220
+ <li>Don't handle shift when changing the selection through the API.</li>
221
+ <li>Support <code>"nocursor"</code> mode for <code>readOnly</code> option.</li>
222
+ <li>Add an <code>onHighlightComplete</code> option.</li>
223
+ <li>Fix the context menu for Firefox.</li>
224
+ </ul>
225
+
226
+ <p><a href="oldrelease.html">Older releases...</a></p>
227
+
228
+ </div></div>
229
+
230
+ <div style="height: 2em">&nbsp;</div>
231
+
232
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post" id="paypal">
233
+ <input type="hidden" name="cmd" value="_s-xclick"/>
234
+ <input type="hidden" name="hosted_button_id" value="3FVHS5FGUY7CC"/>
235
+ </form>
236
+
237
+ </body>
238
+ </html>
239
+