datagram 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. data/.env.sample +7 -0
  2. data/.gitignore +20 -0
  3. data/.rbenv-version +1 -0
  4. data/Gemfile +12 -0
  5. data/LICENSE.txt +22 -0
  6. data/Procfile +1 -0
  7. data/README.md +29 -0
  8. data/Rakefile +1 -0
  9. data/config.ru +5 -0
  10. data/datagram.gemspec +23 -0
  11. data/db/migrate/1_create_queries.rb +9 -0
  12. data/db/migrate/2_add_name_to_queries.rb +5 -0
  13. data/lib/datagram/version.rb +3 -0
  14. data/lib/datagram.rb +135 -0
  15. data/lib/views/application.coffee +222 -0
  16. data/lib/views/index.haml +47 -0
  17. data/lib/views/layout.haml +17 -0
  18. data/lib/views/style.sass +179 -0
  19. data/public/ace/ace.js +15209 -0
  20. data/public/ace/ext-elastic_tabstops_lite.js +301 -0
  21. data/public/ace/ext-emmet.js +253 -0
  22. data/public/ace/ext-searchbox.js +441 -0
  23. data/public/ace/ext-spellcheck.js +67 -0
  24. data/public/ace/ext-static_highlight.js +96 -0
  25. data/public/ace/ext-textarea.js +492 -0
  26. data/public/ace/ext-whitespace.js +204 -0
  27. data/public/ace/keybinding-emacs.js +962 -0
  28. data/public/ace/keybinding-vim.js +1704 -0
  29. data/public/ace/mode-abap.js +260 -0
  30. data/public/ace/mode-asciidoc.js +372 -0
  31. data/public/ace/mode-c9search.js +182 -0
  32. data/public/ace/mode-c_cpp.js +737 -0
  33. data/public/ace/mode-clojure.js +299 -0
  34. data/public/ace/mode-coffee.js +426 -0
  35. data/public/ace/mode-coldfusion.js +1753 -0
  36. data/public/ace/mode-csharp.js +612 -0
  37. data/public/ace/mode-css.js +773 -0
  38. data/public/ace/mode-curly.js +1950 -0
  39. data/public/ace/mode-dart.js +945 -0
  40. data/public/ace/mode-diff.js +166 -0
  41. data/public/ace/mode-django.js +1969 -0
  42. data/public/ace/mode-dot.js +320 -0
  43. data/public/ace/mode-ftl.js +907 -0
  44. data/public/ace/mode-glsl.js +810 -0
  45. data/public/ace/mode-golang.js +632 -0
  46. data/public/ace/mode-groovy.js +1037 -0
  47. data/public/ace/mode-haml.js +487 -0
  48. data/public/ace/mode-haxe.js +609 -0
  49. data/public/ace/mode-html.js +1881 -0
  50. data/public/ace/mode-jade.js +1951 -0
  51. data/public/ace/mode-java.js +996 -0
  52. data/public/ace/mode-javascript.js +876 -0
  53. data/public/ace/mode-json.js +578 -0
  54. data/public/ace/mode-jsp.js +1351 -0
  55. data/public/ace/mode-jsx.js +635 -0
  56. data/public/ace/mode-latex.js +189 -0
  57. data/public/ace/mode-less.js +807 -0
  58. data/public/ace/mode-liquid.js +862 -0
  59. data/public/ace/mode-lisp.js +138 -0
  60. data/public/ace/mode-livescript.js +288 -0
  61. data/public/ace/mode-logiql.js +664 -0
  62. data/public/ace/mode-lsl.js +828 -0
  63. data/public/ace/mode-lua.js +455 -0
  64. data/public/ace/mode-luapage.js +2340 -0
  65. data/public/ace/mode-lucene.js +64 -0
  66. data/public/ace/mode-makefile.js +313 -0
  67. data/public/ace/mode-markdown.js +2280 -0
  68. data/public/ace/mode-mushcode.js +704 -0
  69. data/public/ace/mode-mushcode_high_rules.js +569 -0
  70. data/public/ace/mode-objectivec.js +659 -0
  71. data/public/ace/mode-ocaml.js +443 -0
  72. data/public/ace/mode-pascal.js +233 -0
  73. data/public/ace/mode-perl.js +316 -0
  74. data/public/ace/mode-pgsql.js +908 -0
  75. data/public/ace/mode-php.js +2291 -0
  76. data/public/ace/mode-powershell.js +618 -0
  77. data/public/ace/mode-python.js +264 -0
  78. data/public/ace/mode-r.js +404 -0
  79. data/public/ace/mode-rdoc.js +184 -0
  80. data/public/ace/mode-rhtml.js +2168 -0
  81. data/public/ace/mode-ruby.js +431 -0
  82. data/public/ace/mode-sass.js +442 -0
  83. data/public/ace/mode-scad.js +670 -0
  84. data/public/ace/mode-scala.js +1025 -0
  85. data/public/ace/mode-scheme.js +144 -0
  86. data/public/ace/mode-scss.js +832 -0
  87. data/public/ace/mode-sh.js +204 -0
  88. data/public/ace/mode-sql.js +118 -0
  89. data/public/ace/mode-stylus.js +483 -0
  90. data/public/ace/mode-svg.js +1442 -0
  91. data/public/ace/mode-tcl.js +319 -0
  92. data/public/ace/mode-tex.js +166 -0
  93. data/public/ace/mode-text.js +0 -0
  94. data/public/ace/mode-textile.js +170 -0
  95. data/public/ace/mode-tmsnippet.js +200 -0
  96. data/public/ace/mode-toml.js +180 -0
  97. data/public/ace/mode-typescript.js +961 -0
  98. data/public/ace/mode-vbscript.js +281 -0
  99. data/public/ace/mode-velocity.js +962 -0
  100. data/public/ace/mode-xml.js +789 -0
  101. data/public/ace/mode-xquery.js +2750 -0
  102. data/public/ace/mode-yaml.js +289 -0
  103. data/public/ace/theme-ambiance.js +202 -0
  104. data/public/ace/theme-chaos.js +182 -0
  105. data/public/ace/theme-chrome.js +161 -0
  106. data/public/ace/theme-clouds.js +135 -0
  107. data/public/ace/theme-clouds_midnight.js +136 -0
  108. data/public/ace/theme-cobalt.js +150 -0
  109. data/public/ace/theme-crimson_editor.js +154 -0
  110. data/public/ace/theme-dawn.js +146 -0
  111. data/public/ace/theme-dreamweaver.js +173 -0
  112. data/public/ace/theme-eclipse.js +122 -0
  113. data/public/ace/theme-github.js +136 -0
  114. data/public/ace/theme-idle_fingers.js +136 -0
  115. data/public/ace/theme-kr.js +143 -0
  116. data/public/ace/theme-merbivore.js +135 -0
  117. data/public/ace/theme-merbivore_soft.js +136 -0
  118. data/public/ace/theme-mono_industrial.js +148 -0
  119. data/public/ace/theme-monokai.js +140 -0
  120. data/public/ace/theme-pastel_on_dark.js +148 -0
  121. data/public/ace/theme-solarized_dark.js +128 -0
  122. data/public/ace/theme-solarized_light.js +131 -0
  123. data/public/ace/theme-terminal.js +154 -0
  124. data/public/ace/theme-textmate.js +0 -0
  125. data/public/ace/theme-tomorrow.js +147 -0
  126. data/public/ace/theme-tomorrow_night.js +147 -0
  127. data/public/ace/theme-tomorrow_night_blue.js +145 -0
  128. data/public/ace/theme-tomorrow_night_bright.js +147 -0
  129. data/public/ace/theme-tomorrow_night_eighties.js +144 -0
  130. data/public/ace/theme-twilight.js +147 -0
  131. data/public/ace/theme-vibrant_ink.js +131 -0
  132. data/public/ace/theme-xcode.js +125 -0
  133. data/public/ace/worker-coffee.js +7091 -0
  134. data/public/ace/worker-css.js +8289 -0
  135. data/public/ace/worker-javascript.js +6496 -0
  136. data/public/ace/worker-json.js +2305 -0
  137. data/public/ace/worker-lua.js +3313 -0
  138. data/public/ace/worker-php.js +6743 -0
  139. data/public/ace/worker-xquery.js +21897 -0
  140. data/public/font/FontAwesome.otf +0 -0
  141. data/public/font/fontawesome-webfont.eot +0 -0
  142. data/public/font/fontawesome-webfont.svg +284 -0
  143. data/public/font/fontawesome-webfont.ttf +0 -0
  144. data/public/font/fontawesome-webfont.woff +0 -0
  145. data/public/font-awesome.css +540 -0
  146. data/public/jquery.js +9597 -0
  147. data/script/migrate.sh +2 -0
  148. metadata +242 -0
@@ -0,0 +1,319 @@
1
+ /* ***** BEGIN LICENSE BLOCK *****
2
+ * Distributed under the BSD license:
3
+ *
4
+ * Copyright (c) 2010, Ajax.org B.V.
5
+ * All rights reserved.
6
+ *
7
+ * Redistribution and use in source and binary forms, with or without
8
+ * modification, are permitted provided that the following conditions are met:
9
+ * * Redistributions of source code must retain the above copyright
10
+ * notice, this list of conditions and the following disclaimer.
11
+ * * Redistributions in binary form must reproduce the above copyright
12
+ * notice, this list of conditions and the following disclaimer in the
13
+ * documentation and/or other materials provided with the distribution.
14
+ * * Neither the name of Ajax.org B.V. nor the
15
+ * names of its contributors may be used to endorse or promote products
16
+ * derived from this software without specific prior written permission.
17
+ *
18
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
22
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+ *
29
+ * ***** END LICENSE BLOCK ***** */
30
+
31
+ define('ace/mode/tcl', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/folding/cstyle', 'ace/mode/tcl_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range'], function(require, exports, module) {
32
+
33
+
34
+ var oop = require("../lib/oop");
35
+ var TextMode = require("./text").Mode;
36
+ var Tokenizer = require("../tokenizer").Tokenizer;
37
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
38
+ var TclHighlightRules = require("./tcl_highlight_rules").TclHighlightRules;
39
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
40
+ var Range = require("../range").Range;
41
+
42
+ var Mode = function() {
43
+ this.$tokenizer = new Tokenizer(new TclHighlightRules().getRules());
44
+ this.$outdent = new MatchingBraceOutdent();
45
+ this.foldingRules = new CStyleFoldMode();
46
+ };
47
+ oop.inherits(Mode, TextMode);
48
+
49
+ (function() {
50
+
51
+ this.lineCommentStart = "#";
52
+
53
+ this.getNextLineIndent = function(state, line, tab) {
54
+ var indent = this.$getIndent(line);
55
+
56
+ var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
57
+ var tokens = tokenizedLine.tokens;
58
+
59
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
60
+ return indent;
61
+ }
62
+
63
+ if (state == "start") {
64
+ var match = line.match(/^.*[\{\(\[]\s*$/);
65
+ if (match) {
66
+ indent += tab;
67
+ }
68
+ }
69
+
70
+ return indent;
71
+ };
72
+
73
+ this.checkOutdent = function(state, line, input) {
74
+ return this.$outdent.checkOutdent(line, input);
75
+ };
76
+
77
+ this.autoOutdent = function(state, doc, row) {
78
+ this.$outdent.autoOutdent(doc, row);
79
+ };
80
+
81
+ }).call(Mode.prototype);
82
+
83
+ exports.Mode = Mode;
84
+ });
85
+
86
+ define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
87
+
88
+
89
+ var oop = require("../../lib/oop");
90
+ var Range = require("../../range").Range;
91
+ var BaseFoldMode = require("./fold_mode").FoldMode;
92
+
93
+ var FoldMode = exports.FoldMode = function(commentRegex) {
94
+ if (commentRegex) {
95
+ this.foldingStartMarker = new RegExp(
96
+ this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
97
+ );
98
+ this.foldingStopMarker = new RegExp(
99
+ this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
100
+ );
101
+ }
102
+ };
103
+ oop.inherits(FoldMode, BaseFoldMode);
104
+
105
+ (function() {
106
+
107
+ this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
108
+ this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
109
+
110
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
111
+ var line = session.getLine(row);
112
+ var match = line.match(this.foldingStartMarker);
113
+ if (match) {
114
+ var i = match.index;
115
+
116
+ if (match[1])
117
+ return this.openingBracketBlock(session, match[1], row, i);
118
+
119
+ return session.getCommentFoldRange(row, i + match[0].length, 1);
120
+ }
121
+
122
+ if (foldStyle !== "markbeginend")
123
+ return;
124
+
125
+ var match = line.match(this.foldingStopMarker);
126
+ if (match) {
127
+ var i = match.index + match[0].length;
128
+
129
+ if (match[1])
130
+ return this.closingBracketBlock(session, match[1], row, i);
131
+
132
+ return session.getCommentFoldRange(row, i, -1);
133
+ }
134
+ };
135
+
136
+ }).call(FoldMode.prototype);
137
+
138
+ });
139
+
140
+ define('ace/mode/tcl_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
141
+
142
+
143
+ var oop = require("../lib/oop");
144
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
145
+
146
+ var TclHighlightRules = function() {
147
+
148
+ this.$rules = {
149
+ "start" : [
150
+ {
151
+ token : "comment",
152
+ regex : "#.*\\\\$",
153
+ next : "commentfollow"
154
+ }, {
155
+ token : "comment",
156
+ regex : "#.*$"
157
+ }, {
158
+ token : "support.function",
159
+ regex : '[\\\\]$',
160
+ next : "splitlineStart"
161
+ }, {
162
+ token : "text",
163
+ regex : '[\\\\](?:["]|[{]|[}]|[[]|[]]|[$]|[\])'
164
+ }, {
165
+ token : "text", // last value before command
166
+ regex : '^|[^{][;][^}]|[/\r/]',
167
+ next : "commandItem"
168
+ }, {
169
+ token : "string", // single line
170
+ regex : '[ ]*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
171
+ }, {
172
+ token : "string", // multi line """ string start
173
+ regex : '[ ]*["]',
174
+ next : "qqstring"
175
+ }, {
176
+ token : "variable.instance",
177
+ regex : "[$]",
178
+ next : "variable"
179
+ }, {
180
+ token : "support.function",
181
+ regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|{\\*}|;|::"
182
+ }, {
183
+ token : "identifier",
184
+ regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
185
+ }, {
186
+ token : "paren.lparen",
187
+ regex : "[[{]",
188
+ next : "commandItem"
189
+ }, {
190
+ token : "paren.lparen",
191
+ regex : "[(]"
192
+ }, {
193
+ token : "paren.rparen",
194
+ regex : "[\\])}]"
195
+ }, {
196
+ token : "text",
197
+ regex : "\\s+"
198
+ }
199
+ ],
200
+ "commandItem" : [
201
+ {
202
+ token : "comment",
203
+ regex : "#.*\\\\$",
204
+ next : "commentfollow"
205
+ }, {
206
+ token : "comment",
207
+ regex : "#.*$",
208
+ next : "start"
209
+ }, {
210
+ token : "string", // single line
211
+ regex : '[ ]*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
212
+ }, {
213
+ token : "variable.instance",
214
+ regex : "[$]",
215
+ next : "variable"
216
+ }, {
217
+ token : "support.function",
218
+ regex : "(?:[:][:])[a-zA-Z0-9_/]+(?:[:][:])",
219
+ next : "commandItem"
220
+ }, {
221
+ token : "support.function",
222
+ regex : "[a-zA-Z0-9_/]+(?:[:][:])",
223
+ next : "commandItem"
224
+ }, {
225
+ token : "support.function",
226
+ regex : "(?:[:][:])",
227
+ next : "commandItem"
228
+ }, {
229
+ token : "paren.rparen",
230
+ regex : "[\\])}]"
231
+ }, {
232
+ token : "support.function",
233
+ regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|{\\*}|;|::"
234
+ }, {
235
+ token : "keyword",
236
+ regex : "[a-zA-Z0-9_/]+",
237
+ next : "start"
238
+ } ],
239
+ "commentfollow" : [
240
+ {
241
+ token : "comment",
242
+ regex : ".*\\\\$",
243
+ next : "commentfollow"
244
+ }, {
245
+ token : "comment",
246
+ regex : '.+',
247
+ next : "start"
248
+ } ],
249
+ "splitlineStart" : [
250
+ {
251
+ token : "text",
252
+ regex : "^.",
253
+ next : "start"
254
+ }],
255
+ "variable" : [
256
+ {
257
+ token : "variable.instance", // variable tcl
258
+ regex : "[a-zA-Z_\\d]+(?:[(][a-zA-Z_\\d]+[)])?",
259
+ next : "start"
260
+ }, {
261
+ token : "variable.instance", // variable tcl with braces
262
+ regex : "{?[a-zA-Z_\\d]+}?",
263
+ next : "start"
264
+ }],
265
+ "qqstring" : [ {
266
+ token : "string", // multi line """ string end
267
+ regex : '(?:[^\\\\]|\\\\.)*?["]',
268
+ next : "start"
269
+ }, {
270
+ token : "string",
271
+ regex : '.+'
272
+ } ]
273
+ };
274
+ };
275
+
276
+ oop.inherits(TclHighlightRules, TextHighlightRules);
277
+
278
+ exports.TclHighlightRules = TclHighlightRules;
279
+ });
280
+
281
+ define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
282
+
283
+
284
+ var Range = require("../range").Range;
285
+
286
+ var MatchingBraceOutdent = function() {};
287
+
288
+ (function() {
289
+
290
+ this.checkOutdent = function(line, input) {
291
+ if (! /^\s+$/.test(line))
292
+ return false;
293
+
294
+ return /^\s*\}/.test(input);
295
+ };
296
+
297
+ this.autoOutdent = function(doc, row) {
298
+ var line = doc.getLine(row);
299
+ var match = line.match(/^(\s*\})/);
300
+
301
+ if (!match) return 0;
302
+
303
+ var column = match[1].length;
304
+ var openBracePos = doc.findMatchingBracket({row: row, column: column});
305
+
306
+ if (!openBracePos || openBracePos.row == row) return 0;
307
+
308
+ var indent = this.$getIndent(doc.getLine(openBracePos.row));
309
+ doc.replace(new Range(row, 0, row, column-1), indent);
310
+ };
311
+
312
+ this.$getIndent = function(line) {
313
+ return line.match(/^\s*/)[0];
314
+ };
315
+
316
+ }).call(MatchingBraceOutdent.prototype);
317
+
318
+ exports.MatchingBraceOutdent = MatchingBraceOutdent;
319
+ });
@@ -0,0 +1,166 @@
1
+ /*
2
+ * tex.js
3
+ *
4
+ * Copyright (C) 2009-11 by RStudio, Inc.
5
+ *
6
+ * The Initial Developer of the Original Code is
7
+ * Ajax.org B.V.
8
+ * Portions created by the Initial Developer are Copyright (C) 2010
9
+ * the Initial Developer. All Rights Reserved.
10
+ *
11
+ * This program is licensed to you under the terms of version 3 of the
12
+ * GNU Affero General Public License. This program is distributed WITHOUT
13
+ * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
14
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
15
+ * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
16
+ *
17
+ */
18
+ define('ace/mode/tex', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/text_highlight_rules', 'ace/mode/tex_highlight_rules', 'ace/mode/matching_brace_outdent'], function(require, exports, module) {
19
+
20
+
21
+ var oop = require("../lib/oop");
22
+ var TextMode = require("./text").Mode;
23
+ var Tokenizer = require("../tokenizer").Tokenizer;
24
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
25
+ var TexHighlightRules = require("./tex_highlight_rules").TexHighlightRules;
26
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
27
+
28
+ var Mode = function(suppressHighlighting) {
29
+ if (suppressHighlighting)
30
+ this.$tokenizer = new Tokenizer(new TextHighlightRules().getRules());
31
+ else
32
+ this.$tokenizer = new Tokenizer(new TexHighlightRules().getRules());
33
+ this.$outdent = new MatchingBraceOutdent();
34
+ };
35
+ oop.inherits(Mode, TextMode);
36
+
37
+ (function() {
38
+ this.getNextLineIndent = function(state, line, tab) {
39
+ return this.$getIndent(line);
40
+ };
41
+
42
+ this.allowAutoInsert = function() {
43
+ return false;
44
+ };
45
+ }).call(Mode.prototype);
46
+
47
+ exports.Mode = Mode;
48
+ });
49
+ define('ace/mode/tex_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
50
+
51
+
52
+ var oop = require("../lib/oop");
53
+ var lang = require("../lib/lang");
54
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
55
+
56
+ var TexHighlightRules = function(textClass) {
57
+
58
+ if (!textClass)
59
+ textClass = "text";
60
+
61
+ this.$rules = {
62
+ "start" : [
63
+ {
64
+ token : "comment",
65
+ regex : "%.*$"
66
+ }, {
67
+ token : textClass, // non-command
68
+ regex : "\\\\[$&%#\\{\\}]"
69
+ }, {
70
+ token : "keyword", // command
71
+ regex : "\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\b",
72
+ next : "nospell"
73
+ }, {
74
+ token : "keyword", // command
75
+ regex : "\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])"
76
+ }, {
77
+ token : "paren.keyword.operator",
78
+ regex : "[[({]"
79
+ }, {
80
+ token : "paren.keyword.operator",
81
+ regex : "[\\])}]"
82
+ }, {
83
+ token : textClass,
84
+ regex : "\\s+"
85
+ }
86
+ ],
87
+ "nospell" : [
88
+ {
89
+ token : "comment",
90
+ regex : "%.*$",
91
+ next : "start"
92
+ }, {
93
+ token : "nospell." + textClass, // non-command
94
+ regex : "\\\\[$&%#\\{\\}]"
95
+ }, {
96
+ token : "keyword", // command
97
+ regex : "\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\b"
98
+ }, {
99
+ token : "keyword", // command
100
+ regex : "\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])",
101
+ next : "start"
102
+ }, {
103
+ token : "paren.keyword.operator",
104
+ regex : "[[({]"
105
+ }, {
106
+ token : "paren.keyword.operator",
107
+ regex : "[\\])]"
108
+ }, {
109
+ token : "paren.keyword.operator",
110
+ regex : "}",
111
+ next : "start"
112
+ }, {
113
+ token : "nospell." + textClass,
114
+ regex : "\\s+"
115
+ }, {
116
+ token : "nospell." + textClass,
117
+ regex : "\\w+"
118
+ }
119
+ ]
120
+ };
121
+ };
122
+
123
+ oop.inherits(TexHighlightRules, TextHighlightRules);
124
+
125
+ exports.TexHighlightRules = TexHighlightRules;
126
+ });
127
+
128
+ define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
129
+
130
+
131
+ var Range = require("../range").Range;
132
+
133
+ var MatchingBraceOutdent = function() {};
134
+
135
+ (function() {
136
+
137
+ this.checkOutdent = function(line, input) {
138
+ if (! /^\s+$/.test(line))
139
+ return false;
140
+
141
+ return /^\s*\}/.test(input);
142
+ };
143
+
144
+ this.autoOutdent = function(doc, row) {
145
+ var line = doc.getLine(row);
146
+ var match = line.match(/^(\s*\})/);
147
+
148
+ if (!match) return 0;
149
+
150
+ var column = match[1].length;
151
+ var openBracePos = doc.findMatchingBracket({row: row, column: column});
152
+
153
+ if (!openBracePos || openBracePos.row == row) return 0;
154
+
155
+ var indent = this.$getIndent(doc.getLine(openBracePos.row));
156
+ doc.replace(new Range(row, 0, row, column-1), indent);
157
+ };
158
+
159
+ this.$getIndent = function(line) {
160
+ return line.match(/^\s*/)[0];
161
+ };
162
+
163
+ }).call(MatchingBraceOutdent.prototype);
164
+
165
+ exports.MatchingBraceOutdent = MatchingBraceOutdent;
166
+ });
File without changes
@@ -0,0 +1,170 @@
1
+ /* ***** BEGIN LICENSE BLOCK *****
2
+ * Distributed under the BSD license:
3
+ *
4
+ * Copyright (c) 2010, Ajax.org B.V.
5
+ * All rights reserved.
6
+ *
7
+ * Redistribution and use in source and binary forms, with or without
8
+ * modification, are permitted provided that the following conditions are met:
9
+ * * Redistributions of source code must retain the above copyright
10
+ * notice, this list of conditions and the following disclaimer.
11
+ * * Redistributions in binary form must reproduce the above copyright
12
+ * notice, this list of conditions and the following disclaimer in the
13
+ * documentation and/or other materials provided with the distribution.
14
+ * * Neither the name of Ajax.org B.V. nor the
15
+ * names of its contributors may be used to endorse or promote products
16
+ * derived from this software without specific prior written permission.
17
+ *
18
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
22
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+ *
29
+ * ***** END LICENSE BLOCK ***** */
30
+
31
+ define('ace/mode/textile', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/textile_highlight_rules', 'ace/mode/matching_brace_outdent'], function(require, exports, module) {
32
+
33
+
34
+ var oop = require("../lib/oop");
35
+ var TextMode = require("./text").Mode;
36
+ var Tokenizer = require("../tokenizer").Tokenizer;
37
+ var TextileHighlightRules = require("./textile_highlight_rules").TextileHighlightRules;
38
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
39
+
40
+ var Mode = function() {
41
+ this.$tokenizer = new Tokenizer(new TextileHighlightRules().getRules());
42
+ this.$outdent = new MatchingBraceOutdent();
43
+ };
44
+ oop.inherits(Mode, TextMode);
45
+
46
+ (function() {
47
+ this.getNextLineIndent = function(state, line, tab) {
48
+ if (state == "intag")
49
+ return tab;
50
+
51
+ return "";
52
+ };
53
+
54
+ this.checkOutdent = function(state, line, input) {
55
+ return this.$outdent.checkOutdent(line, input);
56
+ };
57
+
58
+ this.autoOutdent = function(state, doc, row) {
59
+ this.$outdent.autoOutdent(doc, row);
60
+ };
61
+
62
+ }).call(Mode.prototype);
63
+
64
+ exports.Mode = Mode;
65
+
66
+ });
67
+
68
+ define('ace/mode/textile_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
69
+
70
+
71
+ var oop = require("../lib/oop");
72
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
73
+
74
+ var TextileHighlightRules = function() {
75
+ this.$rules = {
76
+ "start" : [
77
+ {
78
+ token : function(value) {
79
+ if (value.charAt(0) == "h")
80
+ return "markup.heading." + value.charAt(1);
81
+ else
82
+ return "markup.heading";
83
+ },
84
+ regex : "h1|h2|h3|h4|h5|h6|bq|p|bc|pre",
85
+ next : "blocktag"
86
+ },
87
+ {
88
+ token : "keyword",
89
+ regex : "[\\*]+|[#]+"
90
+ },
91
+ {
92
+ token : "text",
93
+ regex : ".+"
94
+ }
95
+ ],
96
+ "blocktag" : [
97
+ {
98
+ token : "keyword",
99
+ regex : "\\. ",
100
+ next : "start"
101
+ },
102
+ {
103
+ token : "keyword",
104
+ regex : "\\(",
105
+ next : "blocktagproperties"
106
+ }
107
+ ],
108
+ "blocktagproperties" : [
109
+ {
110
+ token : "keyword",
111
+ regex : "\\)",
112
+ next : "blocktag"
113
+ },
114
+ {
115
+ token : "string",
116
+ regex : "[a-zA-Z0-9\\-_]+"
117
+ },
118
+ {
119
+ token : "keyword",
120
+ regex : "#"
121
+ }
122
+ ]
123
+ };
124
+ };
125
+
126
+ oop.inherits(TextileHighlightRules, TextHighlightRules);
127
+
128
+ exports.TextileHighlightRules = TextileHighlightRules;
129
+
130
+ });
131
+
132
+ define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
133
+
134
+
135
+ var Range = require("../range").Range;
136
+
137
+ var MatchingBraceOutdent = function() {};
138
+
139
+ (function() {
140
+
141
+ this.checkOutdent = function(line, input) {
142
+ if (! /^\s+$/.test(line))
143
+ return false;
144
+
145
+ return /^\s*\}/.test(input);
146
+ };
147
+
148
+ this.autoOutdent = function(doc, row) {
149
+ var line = doc.getLine(row);
150
+ var match = line.match(/^(\s*\})/);
151
+
152
+ if (!match) return 0;
153
+
154
+ var column = match[1].length;
155
+ var openBracePos = doc.findMatchingBracket({row: row, column: column});
156
+
157
+ if (!openBracePos || openBracePos.row == row) return 0;
158
+
159
+ var indent = this.$getIndent(doc.getLine(openBracePos.row));
160
+ doc.replace(new Range(row, 0, row, column-1), indent);
161
+ };
162
+
163
+ this.$getIndent = function(line) {
164
+ return line.match(/^\s*/)[0];
165
+ };
166
+
167
+ }).call(MatchingBraceOutdent.prototype);
168
+
169
+ exports.MatchingBraceOutdent = MatchingBraceOutdent;
170
+ });