datagram 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.env.sample +7 -0
- data/.gitignore +20 -0
- data/.rbenv-version +1 -0
- data/Gemfile +12 -0
- data/LICENSE.txt +22 -0
- data/Procfile +1 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/config.ru +5 -0
- data/datagram.gemspec +23 -0
- data/db/migrate/1_create_queries.rb +9 -0
- data/db/migrate/2_add_name_to_queries.rb +5 -0
- data/lib/datagram/version.rb +3 -0
- data/lib/datagram.rb +135 -0
- data/lib/views/application.coffee +222 -0
- data/lib/views/index.haml +47 -0
- data/lib/views/layout.haml +17 -0
- data/lib/views/style.sass +179 -0
- data/public/ace/ace.js +15209 -0
- data/public/ace/ext-elastic_tabstops_lite.js +301 -0
- data/public/ace/ext-emmet.js +253 -0
- data/public/ace/ext-searchbox.js +441 -0
- data/public/ace/ext-spellcheck.js +67 -0
- data/public/ace/ext-static_highlight.js +96 -0
- data/public/ace/ext-textarea.js +492 -0
- data/public/ace/ext-whitespace.js +204 -0
- data/public/ace/keybinding-emacs.js +962 -0
- data/public/ace/keybinding-vim.js +1704 -0
- data/public/ace/mode-abap.js +260 -0
- data/public/ace/mode-asciidoc.js +372 -0
- data/public/ace/mode-c9search.js +182 -0
- data/public/ace/mode-c_cpp.js +737 -0
- data/public/ace/mode-clojure.js +299 -0
- data/public/ace/mode-coffee.js +426 -0
- data/public/ace/mode-coldfusion.js +1753 -0
- data/public/ace/mode-csharp.js +612 -0
- data/public/ace/mode-css.js +773 -0
- data/public/ace/mode-curly.js +1950 -0
- data/public/ace/mode-dart.js +945 -0
- data/public/ace/mode-diff.js +166 -0
- data/public/ace/mode-django.js +1969 -0
- data/public/ace/mode-dot.js +320 -0
- data/public/ace/mode-ftl.js +907 -0
- data/public/ace/mode-glsl.js +810 -0
- data/public/ace/mode-golang.js +632 -0
- data/public/ace/mode-groovy.js +1037 -0
- data/public/ace/mode-haml.js +487 -0
- data/public/ace/mode-haxe.js +609 -0
- data/public/ace/mode-html.js +1881 -0
- data/public/ace/mode-jade.js +1951 -0
- data/public/ace/mode-java.js +996 -0
- data/public/ace/mode-javascript.js +876 -0
- data/public/ace/mode-json.js +578 -0
- data/public/ace/mode-jsp.js +1351 -0
- data/public/ace/mode-jsx.js +635 -0
- data/public/ace/mode-latex.js +189 -0
- data/public/ace/mode-less.js +807 -0
- data/public/ace/mode-liquid.js +862 -0
- data/public/ace/mode-lisp.js +138 -0
- data/public/ace/mode-livescript.js +288 -0
- data/public/ace/mode-logiql.js +664 -0
- data/public/ace/mode-lsl.js +828 -0
- data/public/ace/mode-lua.js +455 -0
- data/public/ace/mode-luapage.js +2340 -0
- data/public/ace/mode-lucene.js +64 -0
- data/public/ace/mode-makefile.js +313 -0
- data/public/ace/mode-markdown.js +2280 -0
- data/public/ace/mode-mushcode.js +704 -0
- data/public/ace/mode-mushcode_high_rules.js +569 -0
- data/public/ace/mode-objectivec.js +659 -0
- data/public/ace/mode-ocaml.js +443 -0
- data/public/ace/mode-pascal.js +233 -0
- data/public/ace/mode-perl.js +316 -0
- data/public/ace/mode-pgsql.js +908 -0
- data/public/ace/mode-php.js +2291 -0
- data/public/ace/mode-powershell.js +618 -0
- data/public/ace/mode-python.js +264 -0
- data/public/ace/mode-r.js +404 -0
- data/public/ace/mode-rdoc.js +184 -0
- data/public/ace/mode-rhtml.js +2168 -0
- data/public/ace/mode-ruby.js +431 -0
- data/public/ace/mode-sass.js +442 -0
- data/public/ace/mode-scad.js +670 -0
- data/public/ace/mode-scala.js +1025 -0
- data/public/ace/mode-scheme.js +144 -0
- data/public/ace/mode-scss.js +832 -0
- data/public/ace/mode-sh.js +204 -0
- data/public/ace/mode-sql.js +118 -0
- data/public/ace/mode-stylus.js +483 -0
- data/public/ace/mode-svg.js +1442 -0
- data/public/ace/mode-tcl.js +319 -0
- data/public/ace/mode-tex.js +166 -0
- data/public/ace/mode-text.js +0 -0
- data/public/ace/mode-textile.js +170 -0
- data/public/ace/mode-tmsnippet.js +200 -0
- data/public/ace/mode-toml.js +180 -0
- data/public/ace/mode-typescript.js +961 -0
- data/public/ace/mode-vbscript.js +281 -0
- data/public/ace/mode-velocity.js +962 -0
- data/public/ace/mode-xml.js +789 -0
- data/public/ace/mode-xquery.js +2750 -0
- data/public/ace/mode-yaml.js +289 -0
- data/public/ace/theme-ambiance.js +202 -0
- data/public/ace/theme-chaos.js +182 -0
- data/public/ace/theme-chrome.js +161 -0
- data/public/ace/theme-clouds.js +135 -0
- data/public/ace/theme-clouds_midnight.js +136 -0
- data/public/ace/theme-cobalt.js +150 -0
- data/public/ace/theme-crimson_editor.js +154 -0
- data/public/ace/theme-dawn.js +146 -0
- data/public/ace/theme-dreamweaver.js +173 -0
- data/public/ace/theme-eclipse.js +122 -0
- data/public/ace/theme-github.js +136 -0
- data/public/ace/theme-idle_fingers.js +136 -0
- data/public/ace/theme-kr.js +143 -0
- data/public/ace/theme-merbivore.js +135 -0
- data/public/ace/theme-merbivore_soft.js +136 -0
- data/public/ace/theme-mono_industrial.js +148 -0
- data/public/ace/theme-monokai.js +140 -0
- data/public/ace/theme-pastel_on_dark.js +148 -0
- data/public/ace/theme-solarized_dark.js +128 -0
- data/public/ace/theme-solarized_light.js +131 -0
- data/public/ace/theme-terminal.js +154 -0
- data/public/ace/theme-textmate.js +0 -0
- data/public/ace/theme-tomorrow.js +147 -0
- data/public/ace/theme-tomorrow_night.js +147 -0
- data/public/ace/theme-tomorrow_night_blue.js +145 -0
- data/public/ace/theme-tomorrow_night_bright.js +147 -0
- data/public/ace/theme-tomorrow_night_eighties.js +144 -0
- data/public/ace/theme-twilight.js +147 -0
- data/public/ace/theme-vibrant_ink.js +131 -0
- data/public/ace/theme-xcode.js +125 -0
- data/public/ace/worker-coffee.js +7091 -0
- data/public/ace/worker-css.js +8289 -0
- data/public/ace/worker-javascript.js +6496 -0
- data/public/ace/worker-json.js +2305 -0
- data/public/ace/worker-lua.js +3313 -0
- data/public/ace/worker-php.js +6743 -0
- data/public/ace/worker-xquery.js +21897 -0
- data/public/font/FontAwesome.otf +0 -0
- data/public/font/fontawesome-webfont.eot +0 -0
- data/public/font/fontawesome-webfont.svg +284 -0
- data/public/font/fontawesome-webfont.ttf +0 -0
- data/public/font/fontawesome-webfont.woff +0 -0
- data/public/font-awesome.css +540 -0
- data/public/jquery.js +9597 -0
- data/script/migrate.sh +2 -0
- metadata +242 -0
@@ -0,0 +1,260 @@
|
|
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/abap', ['require', 'exports', 'module' , 'ace/tokenizer', 'ace/mode/abap_highlight_rules', 'ace/mode/folding/coffee', 'ace/range', 'ace/mode/text', 'ace/lib/oop'], function(require, exports, module) {
|
32
|
+
|
33
|
+
|
34
|
+
var Tokenizer = require("../tokenizer").Tokenizer;
|
35
|
+
var Rules = require("./abap_highlight_rules").AbapHighlightRules;
|
36
|
+
var FoldMode = require("./folding/coffee").FoldMode;
|
37
|
+
var Range = require("../range").Range;
|
38
|
+
var TextMode = require("./text").Mode;
|
39
|
+
var oop = require("../lib/oop");
|
40
|
+
|
41
|
+
function Mode() {
|
42
|
+
this.$tokenizer = new Tokenizer(new Rules().getRules());
|
43
|
+
this.foldingRules = new FoldMode();
|
44
|
+
}
|
45
|
+
|
46
|
+
oop.inherits(Mode, TextMode);
|
47
|
+
|
48
|
+
(function() {
|
49
|
+
|
50
|
+
this.getNextLineIndent = function(state, line, tab) {
|
51
|
+
var indent = this.$getIndent(line);
|
52
|
+
return indent;
|
53
|
+
};
|
54
|
+
|
55
|
+
this.toggleCommentLines = function(state, doc, startRow, endRow){
|
56
|
+
var range = new Range(0, 0, 0, 0);
|
57
|
+
for (var i = startRow; i <= endRow; ++i) {
|
58
|
+
var line = doc.getLine(i);
|
59
|
+
if (hereComment.test(line))
|
60
|
+
continue;
|
61
|
+
|
62
|
+
if (commentLine.test(line))
|
63
|
+
line = line.replace(commentLine, '$1');
|
64
|
+
else
|
65
|
+
line = line.replace(indentation, '$&#');
|
66
|
+
|
67
|
+
range.end.row = range.start.row = i;
|
68
|
+
range.end.column = line.length + 1;
|
69
|
+
doc.replace(range, line);
|
70
|
+
}
|
71
|
+
};
|
72
|
+
|
73
|
+
}).call(Mode.prototype);
|
74
|
+
|
75
|
+
exports.Mode = Mode;
|
76
|
+
|
77
|
+
});
|
78
|
+
|
79
|
+
define('ace/mode/abap_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
80
|
+
|
81
|
+
|
82
|
+
var oop = require("../lib/oop");
|
83
|
+
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
84
|
+
|
85
|
+
var AbapHighlightRules = function() {
|
86
|
+
|
87
|
+
var keywordMapper = this.createKeywordMapper({
|
88
|
+
"variable.language": "this",
|
89
|
+
"keyword":
|
90
|
+
"ADD ALIAS ALIASES ASSERT ASSIGN ASSIGNING AT BACK" +
|
91
|
+
" CALL CASE CATCH CHECK CLASS CLEAR CLOSE CNT COLLECT COMMIT COMMUNICATION COMPUTE CONCATENATE CONDENSE CONSTANTS CONTINUE CONTROLS CONVERT CREATE CURRENCY" +
|
92
|
+
" DATA DEFINE DEFINITION DEFERRED DELETE DESCRIBE DETAIL DIVIDE DO" +
|
93
|
+
" ELSE ELSEIF ENDAT ENDCASE ENDCLASS ENDDO ENDEXEC ENDFORM ENDFUNCTION ENDIF ENDIFEND ENDINTERFACE ENDLOOP ENDMETHOD ENDMODULE ENDON ENDPROVIDE ENDSELECT ENDTRY ENDWHILE EVENT EVENTS EXEC EXIT EXPORT EXPORTING EXTRACT" +
|
94
|
+
" FETCH FIELDS FORM FORMAT FREE FROM FUNCTION" +
|
95
|
+
" GENERATE GET" +
|
96
|
+
" HIDE" +
|
97
|
+
" IF IMPORT IMPORTING INDEX INFOTYPES INITIALIZATION INTERFACE INTERFACES INPUT INSERT IMPLEMENTATION" +
|
98
|
+
" LEAVE LIKE LINE LOAD LOCAL LOOP" +
|
99
|
+
" MESSAGE METHOD METHODS MODIFY MODULE MOVE MULTIPLY" +
|
100
|
+
" ON OVERLAY OPTIONAL OTHERS" +
|
101
|
+
" PACK PARAMETERS PERFORM POSITION PROGRAM PROVIDE PUT" +
|
102
|
+
" RAISE RANGES READ RECEIVE RECEIVING REDEFINITION REFERENCE REFRESH REJECT REPLACE REPORT RESERVE RESTORE RETURNING ROLLBACK" +
|
103
|
+
" SCAN SCROLL SEARCH SELECT SET SHIFT SKIP SORT SORTED SPLIT STANDARD STATICS STEP STOP SUBMIT SUBTRACT SUM SUMMARY SUPPRESS" +
|
104
|
+
" TABLES TIMES TRANSFER TRANSLATE TRY TYPE TYPES" +
|
105
|
+
" UNASSIGN ULINE UNPACK UPDATE" +
|
106
|
+
" WHEN WHILE WINDOW WRITE" +
|
107
|
+
" OCCURS STRUCTURE OBJECT PROPERTY" +
|
108
|
+
" CASTING APPEND RAISING VALUE COLOR" +
|
109
|
+
" CHANGING EXCEPTION EXCEPTIONS DEFAULT CHECKBOX COMMENT" +
|
110
|
+
" ID NUMBER FOR TITLE OUTPUT" +
|
111
|
+
" WITH EXIT USING" +
|
112
|
+
" INTO WHERE GROUP BY HAVING ORDER BY SINGLE" +
|
113
|
+
" APPENDING CORRESPONDING FIELDS OF TABLE" +
|
114
|
+
" LEFT RIGHT OUTER INNER JOIN AS CLIENT SPECIFIED BYPASSING BUFFER UP TO ROWS CONNECTING" +
|
115
|
+
" EQ NE LT LE GT GE NOT AND OR XOR IN LIKE BETWEEN",
|
116
|
+
"constant.language":
|
117
|
+
"TRUE FALSE NULL SPACE",
|
118
|
+
"support.type":
|
119
|
+
"c n i p f d t x string xstring decfloat16 decfloat34",
|
120
|
+
"keyword.operator":
|
121
|
+
"abs sign ceil floor trunc frac acos asin atan cos sin tan" +
|
122
|
+
" abapOperator cosh sinh tanh exp log log10 sqrt" +
|
123
|
+
" strlen xstrlen charlen numofchar dbmaxlen lines"
|
124
|
+
}, "text", true, " ");
|
125
|
+
|
126
|
+
var compoundKeywords = "WITH\\W+(?:HEADER\\W+LINE|FRAME|KEY)|NO\\W+STANDARD\\W+PAGE\\W+HEADING|"+
|
127
|
+
"EXIT\\W+FROM\\W+STEP\\W+LOOP|BEGIN\\W+OF\\W+(?:BLOCK|LINE)|BEGIN\\W+OF|"+
|
128
|
+
"END\\W+OF\\W+(?:BLOCK|LINE)|END\\W+OF|NO\\W+INTERVALS|"+
|
129
|
+
"RESPECTING\\W+BLANKS|SEPARATED\\W+BY|USING\\W+(?:EDIT\\W+MASK)|"+
|
130
|
+
"WHERE\\W+(?:LINE)|RADIOBUTTON\\W+GROUP|REF\\W+TO|"+
|
131
|
+
"(?:PUBLIC|PRIVATE|PROTECTED)(?:\\W+SECTION)?|DELETING\\W+(?:TRAILING|LEADING)"+
|
132
|
+
"(?:ALL\\W+OCCURRENCES)|(?:FIRST|LAST)\\W+OCCURRENCE|INHERITING\\W+FROM|"+
|
133
|
+
"LINE-COUNT|ADD-CORRESPONDING|AUTHORITY-CHECK|BREAK-POINT|CLASS-DATA|CLASS-METHODS|"+
|
134
|
+
"CLASS-METHOD|DIVIDE-CORRESPONDING|EDITOR-CALL|END-OF-DEFINITION|END-OF-PAGE|END-OF-SELECTION|"+
|
135
|
+
"FIELD-GROUPS|FIELD-SYMBOLS|FUNCTION-POOL|MOVE-CORRESPONDING|MULTIPLY-CORRESPONDING|NEW-LINE|"+
|
136
|
+
"NEW-PAGE|NEW-SECTION|PRINT-CONTROL|RP-PROVIDE-FROM-LAST|SELECT-OPTIONS|SELECTION-SCREEN|"+
|
137
|
+
"START-OF-SELECTION|SUBTRACT-CORRESPONDING|SYNTAX-CHECK|SYNTAX-TRACE|TOP-OF-PAGE|TYPE-POOL|"+
|
138
|
+
"TYPE-POOLS|LINE-SIZE|LINE-COUNT|MESSAGE-ID|DISPLAY-MODE|READ(?:-ONLY)?|"+
|
139
|
+
"IS\\W+(?:NOT\\W+)?(?:ASSIGNED|BOUND|INITIAL|SUPPLIED)";
|
140
|
+
|
141
|
+
this.$rules = {
|
142
|
+
"start" : [
|
143
|
+
{token : "string", regex : "`", next : "string"},
|
144
|
+
{token : "string", regex : "'", next : "qstring"},
|
145
|
+
{token : "doc.comment", regex : /^\*.+/},
|
146
|
+
{token : "comment", regex : /".+$/},
|
147
|
+
{token : "invalid", regex: "\\.{2,}"},
|
148
|
+
{token : "keyword.operator", regex: /\W[\-+\%=<>*]\W|\*\*|[~:,\.&$]|->*?|=>/},
|
149
|
+
{token : "paren.lparen", regex : "[\\[({]"},
|
150
|
+
{token : "paren.rparen", regex : "[\\])}]"},
|
151
|
+
{token : "constant.numeric", regex: "[+-]?\\d+\\b"},
|
152
|
+
{token : "variable.parameter", regex : /sy|pa?\d\d\d\d\|t\d\d\d\.|innnn/},
|
153
|
+
{token : "keyword", regex : compoundKeywords},
|
154
|
+
{token : "variable.parameter", regex : /\w+-\w+(?:-\w+)*/},
|
155
|
+
{token : keywordMapper, regex : "\\b\\w+\\b"},
|
156
|
+
{caseInsensitive: true}
|
157
|
+
],
|
158
|
+
"qstring" : [
|
159
|
+
{token : "constant.language.escape", regex : "''"},
|
160
|
+
{token : "string", regex : "'", next : "start"},
|
161
|
+
{defaultToken : "string"}
|
162
|
+
],
|
163
|
+
"string" : [
|
164
|
+
{token : "constant.language.escape", regex : "``"},
|
165
|
+
{token : "string", regex : "`", next : "start"},
|
166
|
+
{defaultToken : "string"}
|
167
|
+
]
|
168
|
+
}
|
169
|
+
};
|
170
|
+
oop.inherits(AbapHighlightRules, TextHighlightRules);
|
171
|
+
|
172
|
+
exports.AbapHighlightRules = AbapHighlightRules;
|
173
|
+
});
|
174
|
+
|
175
|
+
define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) {
|
176
|
+
|
177
|
+
|
178
|
+
var oop = require("../../lib/oop");
|
179
|
+
var BaseFoldMode = require("./fold_mode").FoldMode;
|
180
|
+
var Range = require("../../range").Range;
|
181
|
+
|
182
|
+
var FoldMode = exports.FoldMode = function() {};
|
183
|
+
oop.inherits(FoldMode, BaseFoldMode);
|
184
|
+
|
185
|
+
(function() {
|
186
|
+
|
187
|
+
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
188
|
+
var range = this.indentationBlock(session, row);
|
189
|
+
if (range)
|
190
|
+
return range;
|
191
|
+
|
192
|
+
var re = /\S/;
|
193
|
+
var line = session.getLine(row);
|
194
|
+
var startLevel = line.search(re);
|
195
|
+
if (startLevel == -1 || line[startLevel] != "#")
|
196
|
+
return;
|
197
|
+
|
198
|
+
var startColumn = line.length;
|
199
|
+
var maxRow = session.getLength();
|
200
|
+
var startRow = row;
|
201
|
+
var endRow = row;
|
202
|
+
|
203
|
+
while (++row < maxRow) {
|
204
|
+
line = session.getLine(row);
|
205
|
+
var level = line.search(re);
|
206
|
+
|
207
|
+
if (level == -1)
|
208
|
+
continue;
|
209
|
+
|
210
|
+
if (line[level] != "#")
|
211
|
+
break;
|
212
|
+
|
213
|
+
endRow = row;
|
214
|
+
}
|
215
|
+
|
216
|
+
if (endRow > startRow) {
|
217
|
+
var endColumn = session.getLine(endRow).length;
|
218
|
+
return new Range(startRow, startColumn, endRow, endColumn);
|
219
|
+
}
|
220
|
+
};
|
221
|
+
this.getFoldWidget = function(session, foldStyle, row) {
|
222
|
+
var line = session.getLine(row);
|
223
|
+
var indent = line.search(/\S/);
|
224
|
+
var next = session.getLine(row + 1);
|
225
|
+
var prev = session.getLine(row - 1);
|
226
|
+
var prevIndent = prev.search(/\S/);
|
227
|
+
var nextIndent = next.search(/\S/);
|
228
|
+
|
229
|
+
if (indent == -1) {
|
230
|
+
session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
|
231
|
+
return "";
|
232
|
+
}
|
233
|
+
if (prevIndent == -1) {
|
234
|
+
if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
|
235
|
+
session.foldWidgets[row - 1] = "";
|
236
|
+
session.foldWidgets[row + 1] = "";
|
237
|
+
return "start";
|
238
|
+
}
|
239
|
+
} else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
|
240
|
+
if (session.getLine(row - 2).search(/\S/) == -1) {
|
241
|
+
session.foldWidgets[row - 1] = "start";
|
242
|
+
session.foldWidgets[row + 1] = "";
|
243
|
+
return "";
|
244
|
+
}
|
245
|
+
}
|
246
|
+
|
247
|
+
if (prevIndent!= -1 && prevIndent < indent)
|
248
|
+
session.foldWidgets[row - 1] = "start";
|
249
|
+
else
|
250
|
+
session.foldWidgets[row - 1] = "";
|
251
|
+
|
252
|
+
if (indent < nextIndent)
|
253
|
+
return "start";
|
254
|
+
else
|
255
|
+
return "";
|
256
|
+
};
|
257
|
+
|
258
|
+
}).call(FoldMode.prototype);
|
259
|
+
|
260
|
+
});
|
@@ -0,0 +1,372 @@
|
|
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/asciidoc', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/asciidoc_highlight_rules', 'ace/mode/folding/asciidoc'], 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 AsciidocHighlightRules = require("./asciidoc_highlight_rules").AsciidocHighlightRules;
|
38
|
+
var AsciidocFoldMode = require("./folding/asciidoc").FoldMode;
|
39
|
+
|
40
|
+
var Mode = function() {
|
41
|
+
var highlighter = new AsciidocHighlightRules();
|
42
|
+
|
43
|
+
this.$tokenizer = new Tokenizer(highlighter.getRules());
|
44
|
+
this.foldingRules = new AsciidocFoldMode();
|
45
|
+
};
|
46
|
+
oop.inherits(Mode, TextMode);
|
47
|
+
|
48
|
+
(function() {
|
49
|
+
this.getNextLineIndent = function(state, line, tab) {
|
50
|
+
if (state == "listblock") {
|
51
|
+
var match = /^((?:.+)?)([-+*][ ]+)/.exec(line);
|
52
|
+
if (match) {
|
53
|
+
return new Array(match[1].length + 1).join(" ") + match[2];
|
54
|
+
} else {
|
55
|
+
return "";
|
56
|
+
}
|
57
|
+
} else {
|
58
|
+
return this.$getIndent(line);
|
59
|
+
}
|
60
|
+
};
|
61
|
+
}).call(Mode.prototype);
|
62
|
+
|
63
|
+
exports.Mode = Mode;
|
64
|
+
});
|
65
|
+
|
66
|
+
define('ace/mode/asciidoc_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
67
|
+
|
68
|
+
|
69
|
+
var oop = require("../lib/oop");
|
70
|
+
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
71
|
+
|
72
|
+
var AsciidocHighlightRules = function() {
|
73
|
+
var identifierRe = "[a-zA-Z\u00a1-\uffff]+\\b";
|
74
|
+
|
75
|
+
this.$rules = {
|
76
|
+
"start": [
|
77
|
+
{token: "empty", regex: /$/},
|
78
|
+
{token: "literal", regex: /^\.{4,}\s*$/, next: "listingBlock"},
|
79
|
+
{token: "literal", regex: /^-{4,}\s*$/, next: "literalBlock"},
|
80
|
+
{token: "string", regex: /^\+{4,}\s*$/, next: "passthroughBlock"},
|
81
|
+
{token: "keyword", regex: /^={4,}\s*$/},
|
82
|
+
{token: "text", regex: /^\s*$/},
|
83
|
+
{token: "empty", regex: "", next: "dissallowDelimitedBlock"}
|
84
|
+
],
|
85
|
+
|
86
|
+
"dissallowDelimitedBlock": [
|
87
|
+
{include: "paragraphEnd"},
|
88
|
+
{token: "comment", regex: '^//.+$'},
|
89
|
+
{token: "keyword", regex: "^(?:NOTE|TIP|IMPORTANT|WARNING|CAUTION):"},
|
90
|
+
|
91
|
+
{include: "listStart"},
|
92
|
+
{token: "literal", regex: /^\s+.+$/, next: "indentedBlock"},
|
93
|
+
{token: "empty", regex: "", next: "text"}
|
94
|
+
],
|
95
|
+
|
96
|
+
"paragraphEnd": [
|
97
|
+
{token: "doc.comment", regex: /^\/{4,}\s*$/, next: "commentBlock"},
|
98
|
+
{token: "tableBlock", regex: /^\s*[|!]=+\s*$/, next: "tableBlock"},
|
99
|
+
{token: "keyword", regex: /^(?:--|''')\s*$/, next: "start"},
|
100
|
+
{token: "option", regex: /^\[.*\]\s*$/, next: "start"},
|
101
|
+
{token: "pageBreak", regex: /^>{3,}$/, next: "start"},
|
102
|
+
{token: "literal", regex: /^\.{4,}\s*$/, next: "listingBlock"},
|
103
|
+
{token: "titleUnderline", regex: /^(?:={2,}|-{2,}|~{2,}|\^{2,}|\+{2,})\s*$/, next: "start"},
|
104
|
+
{token: "singleLineTitle", regex: /^={1,5}\s+\S.*$/, next: "start"},
|
105
|
+
|
106
|
+
{token: "otherBlock", regex: /^(?:\*{2,}|_{2,})\s*$/, next: "start"},
|
107
|
+
{token: "optionalTitle", regex: /^\.[^.\s].+$/, next: "start"}
|
108
|
+
],
|
109
|
+
|
110
|
+
"listStart": [
|
111
|
+
{token: "keyword", regex: /^\s*(?:\d+\.|[a-zA-Z]\.|[ixvmIXVM]+\)|\*{1,5}|-|\.{1,5})\s/, next: "listText"},
|
112
|
+
{token: "meta.tag", regex: /^.+(?::{2,4}|;;)(?: |$)/, next: "listText"},
|
113
|
+
{token: "support.function.list.callout", regex: /^(?:<\d+>|\d+>|>) /, next: "text"},
|
114
|
+
{token: "keyword", regex: /^\+\s*$/, next: "start"}
|
115
|
+
],
|
116
|
+
|
117
|
+
"text": [
|
118
|
+
{token: ["link", "variable.language"], regex: /((?:https?:\/\/|ftp:\/\/|file:\/\/|mailto:|callto:)[^\s\[]+)(\[.*?\])/},
|
119
|
+
{token: "link", regex: /(?:https?:\/\/|ftp:\/\/|file:\/\/|mailto:|callto:)[^\s\[]+/},
|
120
|
+
{token: "link", regex: /\b[\w\.\/\-]+@[\w\.\/\-]+\b/},
|
121
|
+
{include: "macros"},
|
122
|
+
{include: "paragraphEnd"},
|
123
|
+
{token: "literal", regex:/\+{3,}/, next:"smallPassthrough"},
|
124
|
+
{token: "escape", regex: /\((?:C|TM|R)\)|\.{3}|->|<-|=>|<=|&#(?:\d+|x[a-fA-F\d]+);|(?: |^)--(?=\s+\S)/},
|
125
|
+
{token: "escape", regex: /\\[_*'`+#]|\\{2}[_*'`+#]{2}/},
|
126
|
+
{token: "keyword", regex: /\s\+$/},
|
127
|
+
{token: "text", regex: identifierRe},
|
128
|
+
{token: ["keyword", "string", "keyword"],
|
129
|
+
regex: /(<<[\w\d\-$]+,)(.*?)(>>|$)/},
|
130
|
+
{token: "keyword", regex: /<<[\w\d\-$]+,?|>>/},
|
131
|
+
{token: "constant.character", regex: /\({2,3}.*?\){2,3}/},
|
132
|
+
{token: "keyword", regex: /\[\[.+?\]\]/},
|
133
|
+
{token: "support", regex: /^\[{3}[\w\d =\-]+\]{3}/},
|
134
|
+
|
135
|
+
{include: "quotes"},
|
136
|
+
{token: "empty", regex: /^\s*$/, next: "start"}
|
137
|
+
],
|
138
|
+
|
139
|
+
"listText": [
|
140
|
+
{include: "listStart"},
|
141
|
+
{include: "text"}
|
142
|
+
],
|
143
|
+
|
144
|
+
"indentedBlock": [
|
145
|
+
{token: "literal", regex: /^[\s\w].+$/, next: "indentedBlock"},
|
146
|
+
{token: "literal", regex: "", next: "start"}
|
147
|
+
],
|
148
|
+
|
149
|
+
"listingBlock": [
|
150
|
+
{token: "literal", regex: /^\.{4,}\s*$/, next: "dissallowDelimitedBlock"},
|
151
|
+
{token: "constant.numeric", regex: '<\\d+>'},
|
152
|
+
{token: "literal", regex: '[^<]+'},
|
153
|
+
{token: "literal", regex: '<'}
|
154
|
+
],
|
155
|
+
"literalBlock": [
|
156
|
+
{token: "literal", regex: /^-{4,}\s*$/, next: "dissallowDelimitedBlock"},
|
157
|
+
{token: "constant.numeric", regex: '<\\d+>'},
|
158
|
+
{token: "literal", regex: '[^<]+'},
|
159
|
+
{token: "literal", regex: '<'}
|
160
|
+
],
|
161
|
+
"passthroughBlock": [
|
162
|
+
{token: "literal", regex: /^\+{4,}\s*$/, next: "dissallowDelimitedBlock"},
|
163
|
+
{token: "literal", regex: identifierRe + "|\\d+"},
|
164
|
+
{include: "macros"},
|
165
|
+
{token: "literal", regex: "."}
|
166
|
+
],
|
167
|
+
|
168
|
+
"smallPassthrough": [
|
169
|
+
{token: "literal", regex: /[+]{3,}/, next: "dissallowDelimitedBlock"},
|
170
|
+
{token: "literal", regex: /^\s*$/, next: "dissallowDelimitedBlock"},
|
171
|
+
{token: "literal", regex: identifierRe + "|\\d+"},
|
172
|
+
{include: "macros"}
|
173
|
+
],
|
174
|
+
|
175
|
+
"commentBlock": [
|
176
|
+
{token: "doc.comment", regex: /^\/{4,}\s*$/, next: "dissallowDelimitedBlock"},
|
177
|
+
{token: "doc.comment", regex: '^.*$'}
|
178
|
+
],
|
179
|
+
"tableBlock": [
|
180
|
+
{token: "tableBlock", regex: /^\s*\|={3,}\s*$/, next: "dissallowDelimitedBlock"},
|
181
|
+
{token: "tableBlock", regex: /^\s*!={3,}\s*$/, next: "innerTableBlock"},
|
182
|
+
{token: "tableBlock", regex: /\|/},
|
183
|
+
{include: "text", noEscape: true}
|
184
|
+
],
|
185
|
+
"innerTableBlock": [
|
186
|
+
{token: "tableBlock", regex: /^\s*!={3,}\s*$/, next: "tableBlock"},
|
187
|
+
{token: "tableBlock", regex: /^\s*|={3,}\s*$/, next: "dissallowDelimitedBlock"},
|
188
|
+
{token: "tableBlock", regex: /\!/}
|
189
|
+
],
|
190
|
+
"macros": [
|
191
|
+
{token: "macro", regex: /{[\w\-$]+}/},
|
192
|
+
{token: ["text", "string", "text", "constant.character", "text"], regex: /({)([\w\-$]+)(:)?(.+)?(})/},
|
193
|
+
{token: ["text", "markup.list.macro", "keyword", "string"], regex: /(\w+)(footnote(?:ref)?::?)([^\s\[]+)?(\[.*?\])?/},
|
194
|
+
{token: ["markup.list.macro", "keyword", "string"], regex: /([a-zA-Z\-][\w\.\/\-]*::?)([^\s\[]+)(\[.*?\])?/},
|
195
|
+
{token: ["markup.list.macro", "keyword"], regex: /([a-zA-Z\-][\w\.\/\-]+::?)(\[.*?\])/},
|
196
|
+
{token: "keyword", regex: /^:.+?:(?= |$)/}
|
197
|
+
],
|
198
|
+
|
199
|
+
"quotes": [
|
200
|
+
{token: "string.italic", regex: /__[^_\s].*?__/},
|
201
|
+
{token: "string.italic", regex: quoteRule("_")},
|
202
|
+
|
203
|
+
{token: "keyword.bold", regex: /\*\*[^*\s].*?\*\*/},
|
204
|
+
{token: "keyword.bold", regex: quoteRule("\\*")},
|
205
|
+
|
206
|
+
{token: "literal", regex: quoteRule("\\+")},
|
207
|
+
{token: "literal", regex: /\+\+[^+\s].*?\+\+/},
|
208
|
+
{token: "literal", regex: /\$\$.+?\$\$/},
|
209
|
+
{token: "literal", regex: quoteRule("`")},
|
210
|
+
|
211
|
+
{token: "keyword", regex: quoteRule("^")},
|
212
|
+
{token: "keyword", regex: quoteRule("~")},
|
213
|
+
{token: "keyword", regex: /##?/},
|
214
|
+
{token: "keyword", regex: /(?:\B|^)``|\b''/}
|
215
|
+
]
|
216
|
+
|
217
|
+
};
|
218
|
+
|
219
|
+
function quoteRule(ch) {
|
220
|
+
var prefix = /\w/.test(ch) ? "\\b" : "(?:\\B|^)";
|
221
|
+
return prefix + ch + "[^" + ch + "].*?" + ch + "(?![\\w*])";
|
222
|
+
}
|
223
|
+
|
224
|
+
var tokenMap = {
|
225
|
+
macro: "constant.character",
|
226
|
+
tableBlock: "doc.comment",
|
227
|
+
titleUnderline: "markup.heading",
|
228
|
+
singleLineTitle: "markup.heading",
|
229
|
+
pageBreak: "string",
|
230
|
+
option: "string.regexp",
|
231
|
+
otherBlock: "markup.list",
|
232
|
+
literal: "support.function",
|
233
|
+
optionalTitle: "constant.numeric",
|
234
|
+
escape: "constant.language.escape",
|
235
|
+
link: "markup.underline.list"
|
236
|
+
};
|
237
|
+
|
238
|
+
for (var state in this.$rules) {
|
239
|
+
var stateRules = this.$rules[state];
|
240
|
+
for (var i = stateRules.length; i--; ) {
|
241
|
+
var rule = stateRules[i];
|
242
|
+
if (rule.include || typeof rule == "string") {
|
243
|
+
var args = [i, 1].concat(this.$rules[rule.include || rule]);
|
244
|
+
if (rule.noEscape) {
|
245
|
+
args = args.filter(function(x) {
|
246
|
+
return !x.next;
|
247
|
+
});
|
248
|
+
}
|
249
|
+
stateRules.splice.apply(stateRules, args);
|
250
|
+
} else if (rule.token in tokenMap) {
|
251
|
+
rule.token = tokenMap[rule.token];
|
252
|
+
}
|
253
|
+
}
|
254
|
+
}
|
255
|
+
};
|
256
|
+
oop.inherits(AsciidocHighlightRules, TextHighlightRules);
|
257
|
+
|
258
|
+
exports.AsciidocHighlightRules = AsciidocHighlightRules;
|
259
|
+
});
|
260
|
+
|
261
|
+
define('ace/mode/folding/asciidoc', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) {
|
262
|
+
|
263
|
+
|
264
|
+
var oop = require("../../lib/oop");
|
265
|
+
var BaseFoldMode = require("./fold_mode").FoldMode;
|
266
|
+
var Range = require("../../range").Range;
|
267
|
+
|
268
|
+
var FoldMode = exports.FoldMode = function() {};
|
269
|
+
oop.inherits(FoldMode, BaseFoldMode);
|
270
|
+
|
271
|
+
(function() {
|
272
|
+
this.foldingStartMarker = /^(?:\|={10,}|[\.\/=\-~^+]{4,}\s*$|={1,5} )/;
|
273
|
+
this.singleLineHeadingRe = /^={1,5}(?=\s+\S)/;
|
274
|
+
|
275
|
+
this.getFoldWidget = function(session, foldStyle, row) {
|
276
|
+
var line = session.getLine(row);
|
277
|
+
if (!this.foldingStartMarker.test(line))
|
278
|
+
return ""
|
279
|
+
|
280
|
+
if (line[0] == "=") {
|
281
|
+
if (this.singleLineHeadingRe.test(line))
|
282
|
+
return "start";
|
283
|
+
if (session.getLine(row - 1).length != session.getLine(row).length)
|
284
|
+
return "";
|
285
|
+
return "start";
|
286
|
+
}
|
287
|
+
if (session.bgTokenizer.getState(row) == "dissallowDelimitedBlock")
|
288
|
+
return "end";
|
289
|
+
return "start";
|
290
|
+
};
|
291
|
+
|
292
|
+
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
293
|
+
var line = session.getLine(row);
|
294
|
+
var startColumn = line.length;
|
295
|
+
var maxRow = session.getLength();
|
296
|
+
var startRow = row;
|
297
|
+
var endRow = row;
|
298
|
+
if (!line.match(this.foldingStartMarker))
|
299
|
+
return;
|
300
|
+
|
301
|
+
var token;
|
302
|
+
function getTokenType(row) {
|
303
|
+
token = session.getTokens(row)[0];
|
304
|
+
return token && token.type;
|
305
|
+
}
|
306
|
+
|
307
|
+
var levels = ["=","-","~","^","+"];
|
308
|
+
var heading = "markup.heading";
|
309
|
+
var singleLineHeadingRe = this.singleLineHeadingRe;
|
310
|
+
function getLevel() {
|
311
|
+
var match = token.value.match(singleLineHeadingRe);
|
312
|
+
if (match)
|
313
|
+
return match[0].length;
|
314
|
+
var level = levels.indexOf(token.value[0]) + 1;
|
315
|
+
if (level == 1) {
|
316
|
+
if (session.getLine(row - 1).length != session.getLine(row).length)
|
317
|
+
return Infinity;
|
318
|
+
}
|
319
|
+
return level;
|
320
|
+
}
|
321
|
+
|
322
|
+
if (getTokenType(row) == heading) {
|
323
|
+
var startHeadingLevel = getLevel();
|
324
|
+
while (++row < maxRow) {
|
325
|
+
if (getTokenType(row) != heading)
|
326
|
+
continue;
|
327
|
+
var level = getLevel();
|
328
|
+
if (level <= startHeadingLevel)
|
329
|
+
break;
|
330
|
+
}
|
331
|
+
|
332
|
+
var isSingleLineHeading = token && token.value.match(this.singleLineHeadingRe);
|
333
|
+
endRow = isSingleLineHeading ? row - 1 : row - 2;
|
334
|
+
|
335
|
+
if (endRow > startRow) {
|
336
|
+
while (endRow > startRow && (!getTokenType(endRow) || token.value[0] == "["))
|
337
|
+
endRow--;
|
338
|
+
}
|
339
|
+
|
340
|
+
if (endRow > startRow) {
|
341
|
+
var endColumn = session.getLine(endRow).length;
|
342
|
+
return new Range(startRow, startColumn, endRow, endColumn);
|
343
|
+
}
|
344
|
+
} else {
|
345
|
+
var state = session.bgTokenizer.getState(row);
|
346
|
+
if (state == "dissallowDelimitedBlock") {
|
347
|
+
while (row -- > 0) {
|
348
|
+
if (session.bgTokenizer.getState(row).lastIndexOf("Block") == -1)
|
349
|
+
break;
|
350
|
+
}
|
351
|
+
endRow = row + 1;
|
352
|
+
if (endRow < startRow) {
|
353
|
+
var endColumn = session.getLine(row).length;
|
354
|
+
return new Range(endRow, 5, startRow, startColumn - 5);
|
355
|
+
}
|
356
|
+
} else {
|
357
|
+
while (++row < maxRow) {
|
358
|
+
if (session.bgTokenizer.getState(row) == "dissallowDelimitedBlock")
|
359
|
+
break;
|
360
|
+
}
|
361
|
+
endRow = row;
|
362
|
+
if (endRow > startRow) {
|
363
|
+
var endColumn = session.getLine(row).length;
|
364
|
+
return new Range(startRow, 5, endRow, endColumn - 5);
|
365
|
+
}
|
366
|
+
}
|
367
|
+
}
|
368
|
+
};
|
369
|
+
|
370
|
+
}).call(FoldMode.prototype);
|
371
|
+
|
372
|
+
});
|