hyde_admin 0.0.1 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +3 -0
  3. data/.idea/hyde_admin.iml +2 -0
  4. data/.idea/vcs.xml +6 -0
  5. data/CHANGELOG.md +35 -0
  6. data/README.md +23 -0
  7. data/TODO.md +3 -0
  8. data/bin/admin_views/admin_layout.html.erb +204 -108
  9. data/bin/admin_views/configuration.erb +13 -0
  10. data/bin/admin_views/dashboard.erb +1 -1
  11. data/bin/admin_views/editor_html.erb +24 -0
  12. data/bin/admin_views/editor_js.erb +120 -0
  13. data/bin/admin_views/files/edit.erb +30 -0
  14. data/bin/admin_views/files/listing.erb +111 -0
  15. data/bin/admin_views/partials/image_element.html.erb +4 -0
  16. data/bin/admin_views/partials/images_page.html.erb +8 -0
  17. data/bin/admin_views/posts/edit.erb +158 -0
  18. data/bin/admin_views/posts/listing.erb +37 -0
  19. data/bin/admin_views/upload_image_form.erb +45 -0
  20. data/bin/fslightbox/fslightbox.js +1 -0
  21. data/bin/hyde_admin +3 -0
  22. data/bin/hyde_admin.ru +306 -56
  23. data/bin/hyde_admin.yml +12 -5
  24. data/bin/hyde_assets/hyde_admin.css +37 -0
  25. data/bin/hyde_assets/hyde_admin.js +24 -0
  26. data/bin/i18n/en.yml +77 -1
  27. data/bin/i18n/fr.yml +77 -1
  28. data/bin/lib/codemirror.css +349 -0
  29. data/bin/lib/codemirror.js +9833 -0
  30. data/bin/mode/css/css.js +864 -0
  31. data/bin/mode/css/gss.html +104 -0
  32. data/bin/mode/css/gss_test.js +17 -0
  33. data/bin/mode/css/index.html +81 -0
  34. data/bin/mode/css/less.html +152 -0
  35. data/bin/mode/css/less_test.js +54 -0
  36. data/bin/mode/css/scss.html +158 -0
  37. data/bin/mode/css/scss_test.js +110 -0
  38. data/bin/mode/css/test.js +217 -0
  39. data/bin/mode/htmlembedded/htmlembedded.js +37 -0
  40. data/bin/mode/htmlembedded/index.html +60 -0
  41. data/bin/mode/htmlmixed/htmlmixed.js +153 -0
  42. data/bin/mode/htmlmixed/index.html +100 -0
  43. data/bin/mode/javascript/index.html +118 -0
  44. data/bin/mode/javascript/javascript.js +959 -0
  45. data/bin/mode/javascript/json-ld.html +72 -0
  46. data/bin/mode/javascript/test.js +521 -0
  47. data/bin/mode/javascript/typescript.html +62 -0
  48. data/bin/mode/markdown/index.html +418 -0
  49. data/bin/mode/markdown/markdown.js +886 -0
  50. data/bin/mode/markdown/test.js +1319 -0
  51. data/bin/mode/ruby/index.html +183 -0
  52. data/bin/mode/ruby/ruby.js +303 -0
  53. data/bin/mode/ruby/test.js +23 -0
  54. data/bin/mode/sass/index.html +68 -0
  55. data/bin/mode/sass/sass.js +459 -0
  56. data/bin/mode/sass/test.js +122 -0
  57. data/bin/mode/spreadsheet/index.html +42 -0
  58. data/bin/mode/spreadsheet/spreadsheet.js +112 -0
  59. data/bin/mode/xml/index.html +61 -0
  60. data/bin/mode/xml/test.js +51 -0
  61. data/bin/mode/xml/xml.js +417 -0
  62. data/bin/mode/yaml/index.html +80 -0
  63. data/bin/mode/yaml/yaml.js +120 -0
  64. data/bin/mode/yaml-frontmatter/index.html +121 -0
  65. data/bin/mode/yaml-frontmatter/yaml-frontmatter.js +72 -0
  66. data/hyde_admin.gemspec +7 -1
  67. data/lib/hyde_admin/version.rb +1 -1
  68. metadata +131 -7
  69. data/bin/admin_views/edit.erb +0 -57
  70. data/bin/admin_views/listing.erb +0 -32
  71. data/bin/hyde_admin.sh +0 -3
@@ -0,0 +1,183 @@
1
+ <!doctype html>
2
+
3
+ <title>CodeMirror: Ruby mode</title>
4
+ <meta charset="utf-8"/>
5
+ <link rel=stylesheet href="../../doc/docs.css">
6
+
7
+ <link rel="stylesheet" href="../../lib/codemirror.css">
8
+ <script src="../../lib/codemirror.js"></script>
9
+ <script src="../../addon/edit/matchbrackets.js"></script>
10
+ <script src="ruby.js"></script>
11
+ <style>
12
+ .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
13
+ .cm-s-default span.cm-arrow { color: red; }
14
+ </style>
15
+ <div id=nav>
16
+ <a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
17
+
18
+ <ul>
19
+ <li><a href="../../index.html">Home</a>
20
+ <li><a href="../../doc/manual.html">Manual</a>
21
+ <li><a href="https://github.com/codemirror/codemirror">Code</a>
22
+ </ul>
23
+ <ul>
24
+ <li><a href="../index.html">Language modes</a>
25
+ <li><a class=active href="#">Ruby</a>
26
+ </ul>
27
+ </div>
28
+
29
+ <article>
30
+ <h2>Ruby mode</h2>
31
+ <form><textarea id="code" name="code">
32
+ # Code from http://sandbox.mc.edu/~bennet/ruby/code/poly_rb.html
33
+ #
34
+ # This program evaluates polynomials. It first asks for the coefficients
35
+ # of a polynomial, which must be entered on one line, highest-order first.
36
+ # It then requests values of x and will compute the value of the poly for
37
+ # each x. It will repeatedly ask for x values, unless you the user enters
38
+ # a blank line. It that case, it will ask for another polynomial. If the
39
+ # user types quit for either input, the program immediately exits.
40
+ #
41
+
42
+ #
43
+ # Function to evaluate a polynomial at x. The polynomial is given
44
+ # as a list of coefficients, from the greatest to the least.
45
+ def polyval(x, coef)
46
+ sum = 0
47
+ coef = coef.clone # Don't want to destroy the original
48
+ while true
49
+ sum += coef.shift # Add and remove the next coef
50
+ break if coef.empty? # If no more, done entirely.
51
+ sum *= x # This happens the right number of times.
52
+ end
53
+ return sum
54
+ end
55
+
56
+ #
57
+ # Function to read a line containing a list of integers and return
58
+ # them as an array of integers. If the string conversion fails, it
59
+ # throws TypeError. If the input line is the word 'quit', then it
60
+ # converts it to an end-of-file exception
61
+ def readints(prompt)
62
+ # Read a line
63
+ print prompt
64
+ line = readline.chomp
65
+ raise EOFError.new if line == 'quit' # You can also use a real EOF.
66
+
67
+ # Go through each item on the line, converting each one and adding it
68
+ # to retval.
69
+ retval = [ ]
70
+ for str in line.split(/\s+/)
71
+ if str =~ /^\-?\d+$/
72
+ retval.push(str.to_i)
73
+ else
74
+ raise TypeError.new
75
+ end
76
+ end
77
+
78
+ return retval
79
+ end
80
+
81
+ #
82
+ # Take a coeff and an exponent and return the string representation, ignoring
83
+ # the sign of the coefficient.
84
+ def term_to_str(coef, exp)
85
+ ret = ""
86
+
87
+ # Show coeff, unless it's 1 or at the right
88
+ coef = coef.abs
89
+ ret = coef.to_s unless coef == 1 && exp > 0
90
+ ret += "x" if exp > 0 # x if exponent not 0
91
+ ret += "^" + exp.to_s if exp > 1 # ^exponent, if > 1.
92
+
93
+ return ret
94
+ end
95
+
96
+ #
97
+ # Create a string of the polynomial in sort-of-readable form.
98
+ def polystr(p)
99
+ # Get the exponent of first coefficient, plus 1.
100
+ exp = p.length
101
+
102
+ # Assign exponents to each term, making pairs of coeff and exponent,
103
+ # Then get rid of the zero terms.
104
+ p = (p.map { |c| exp -= 1; [ c, exp ] }).select { |p| p[0] != 0 }
105
+
106
+ # If there's nothing left, it's a zero
107
+ return "0" if p.empty?
108
+
109
+ # *** Now p is a non-empty list of [ coef, exponent ] pairs. ***
110
+
111
+ # Convert the first term, preceded by a "-" if it's negative.
112
+ result = (if p[0][0] < 0 then "-" else "" end) + term_to_str(*p[0])
113
+
114
+ # Convert the rest of the terms, in each case adding the appropriate
115
+ # + or - separating them.
116
+ for term in p[1...p.length]
117
+ # Add the separator then the rep. of the term.
118
+ result += (if term[0] < 0 then " - " else " + " end) +
119
+ term_to_str(*term)
120
+ end
121
+
122
+ return result
123
+ end
124
+
125
+ #
126
+ # Run until some kind of endfile.
127
+ begin
128
+ # Repeat until an exception or quit gets us out.
129
+ while true
130
+ # Read a poly until it works. An EOF will except out of the
131
+ # program.
132
+ print "\n"
133
+ begin
134
+ poly = readints("Enter a polynomial coefficients: ")
135
+ rescue TypeError
136
+ print "Try again.\n"
137
+ retry
138
+ end
139
+ break if poly.empty?
140
+
141
+ # Read and evaluate x values until the user types a blank line.
142
+ # Again, an EOF will except out of the pgm.
143
+ while true
144
+ # Request an integer.
145
+ print "Enter x value or blank line: "
146
+ x = readline.chomp
147
+ break if x == ''
148
+ raise EOFError.new if x == 'quit'
149
+
150
+ # If it looks bad, let's try again.
151
+ if x !~ /^\-?\d+$/
152
+ print "That doesn't look like an integer. Please try again.\n"
153
+ next
154
+ end
155
+
156
+ # Convert to an integer and print the result.
157
+ x = x.to_i
158
+ print "p(x) = ", polystr(poly), "\n"
159
+ print "p(", x, ") = ", polyval(x, poly), "\n"
160
+ end
161
+ end
162
+ rescue EOFError
163
+ print "\n=== EOF ===\n"
164
+ rescue Interrupt, SignalException
165
+ print "\n=== Interrupted ===\n"
166
+ else
167
+ print "--- Bye ---\n"
168
+ end
169
+ </textarea></form>
170
+ <script>
171
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
172
+ mode: "text/x-ruby",
173
+ matchBrackets: true,
174
+ indentUnit: 4
175
+ });
176
+ </script>
177
+
178
+ <p><strong>MIME types defined:</strong> <code>text/x-ruby</code>.</p>
179
+
180
+ <p>Development of the CodeMirror Ruby mode was kindly sponsored
181
+ by <a href="http://ubalo.com/">Ubalo</a>.</p>
182
+
183
+ </article>
@@ -0,0 +1,303 @@
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: https://codemirror.net/LICENSE
3
+
4
+ (function(mod) {
5
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
6
+ mod(require("../../lib/codemirror"));
7
+ else if (typeof define == "function" && define.amd) // AMD
8
+ define(["../../lib/codemirror"], mod);
9
+ else // Plain browser env
10
+ mod(CodeMirror);
11
+ })(function(CodeMirror) {
12
+ "use strict";
13
+
14
+ function wordObj(words) {
15
+ var o = {};
16
+ for (var i = 0, e = words.length; i < e; ++i) o[words[i]] = true;
17
+ return o;
18
+ }
19
+
20
+ var keywordList = [
21
+ "alias", "and", "BEGIN", "begin", "break", "case", "class", "def", "defined?", "do", "else",
22
+ "elsif", "END", "end", "ensure", "false", "for", "if", "in", "module", "next", "not", "or",
23
+ "redo", "rescue", "retry", "return", "self", "super", "then", "true", "undef", "unless",
24
+ "until", "when", "while", "yield", "nil", "raise", "throw", "catch", "fail", "loop", "callcc",
25
+ "caller", "lambda", "proc", "public", "protected", "private", "require", "load",
26
+ "require_relative", "extend", "autoload", "__END__", "__FILE__", "__LINE__", "__dir__"
27
+ ], keywords = wordObj(keywordList);
28
+
29
+ var indentWords = wordObj(["def", "class", "case", "for", "while", "until", "module", "then",
30
+ "catch", "loop", "proc", "begin"]);
31
+ var dedentWords = wordObj(["end", "until"]);
32
+ var opening = {"[": "]", "{": "}", "(": ")"};
33
+ var closing = {"]": "[", "}": "{", ")": "("};
34
+
35
+ CodeMirror.defineMode("ruby", function(config) {
36
+ var curPunc;
37
+
38
+ function chain(newtok, stream, state) {
39
+ state.tokenize.push(newtok);
40
+ return newtok(stream, state);
41
+ }
42
+
43
+ function tokenBase(stream, state) {
44
+ if (stream.sol() && stream.match("=begin") && stream.eol()) {
45
+ state.tokenize.push(readBlockComment);
46
+ return "comment";
47
+ }
48
+ if (stream.eatSpace()) return null;
49
+ var ch = stream.next(), m;
50
+ if (ch == "`" || ch == "'" || ch == '"') {
51
+ return chain(readQuoted(ch, "string", ch == '"' || ch == "`"), stream, state);
52
+ } else if (ch == "/") {
53
+ if (regexpAhead(stream))
54
+ return chain(readQuoted(ch, "string-2", true), stream, state);
55
+ else
56
+ return "operator";
57
+ } else if (ch == "%") {
58
+ var style = "string", embed = true;
59
+ if (stream.eat("s")) style = "atom";
60
+ else if (stream.eat(/[WQ]/)) style = "string";
61
+ else if (stream.eat(/[r]/)) style = "string-2";
62
+ else if (stream.eat(/[wxq]/)) { style = "string"; embed = false; }
63
+ var delim = stream.eat(/[^\w\s=]/);
64
+ if (!delim) return "operator";
65
+ if (opening.propertyIsEnumerable(delim)) delim = opening[delim];
66
+ return chain(readQuoted(delim, style, embed, true), stream, state);
67
+ } else if (ch == "#") {
68
+ stream.skipToEnd();
69
+ return "comment";
70
+ } else if (ch == "<" && (m = stream.match(/^<([-~])[\`\"\']?([a-zA-Z_?]\w*)[\`\"\']?(?:;|$)/))) {
71
+ return chain(readHereDoc(m[2], m[1]), stream, state);
72
+ } else if (ch == "0") {
73
+ if (stream.eat("x")) stream.eatWhile(/[\da-fA-F]/);
74
+ else if (stream.eat("b")) stream.eatWhile(/[01]/);
75
+ else stream.eatWhile(/[0-7]/);
76
+ return "number";
77
+ } else if (/\d/.test(ch)) {
78
+ stream.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+\-]?[\d_]+)?/);
79
+ return "number";
80
+ } else if (ch == "?") {
81
+ while (stream.match(/^\\[CM]-/)) {}
82
+ if (stream.eat("\\")) stream.eatWhile(/\w/);
83
+ else stream.next();
84
+ return "string";
85
+ } else if (ch == ":") {
86
+ if (stream.eat("'")) return chain(readQuoted("'", "atom", false), stream, state);
87
+ if (stream.eat('"')) return chain(readQuoted('"', "atom", true), stream, state);
88
+
89
+ // :> :>> :< :<< are valid symbols
90
+ if (stream.eat(/[\<\>]/)) {
91
+ stream.eat(/[\<\>]/);
92
+ return "atom";
93
+ }
94
+
95
+ // :+ :- :/ :* :| :& :! are valid symbols
96
+ if (stream.eat(/[\+\-\*\/\&\|\:\!]/)) {
97
+ return "atom";
98
+ }
99
+
100
+ // Symbols can't start by a digit
101
+ if (stream.eat(/[a-zA-Z$@_\xa1-\uffff]/)) {
102
+ stream.eatWhile(/[\w$\xa1-\uffff]/);
103
+ // Only one ? ! = is allowed and only as the last character
104
+ stream.eat(/[\?\!\=]/);
105
+ return "atom";
106
+ }
107
+ return "operator";
108
+ } else if (ch == "@" && stream.match(/^@?[a-zA-Z_\xa1-\uffff]/)) {
109
+ stream.eat("@");
110
+ stream.eatWhile(/[\w\xa1-\uffff]/);
111
+ return "variable-2";
112
+ } else if (ch == "$") {
113
+ if (stream.eat(/[a-zA-Z_]/)) {
114
+ stream.eatWhile(/[\w]/);
115
+ } else if (stream.eat(/\d/)) {
116
+ stream.eat(/\d/);
117
+ } else {
118
+ stream.next(); // Must be a special global like $: or $!
119
+ }
120
+ return "variable-3";
121
+ } else if (/[a-zA-Z_\xa1-\uffff]/.test(ch)) {
122
+ stream.eatWhile(/[\w\xa1-\uffff]/);
123
+ stream.eat(/[\?\!]/);
124
+ if (stream.eat(":")) return "atom";
125
+ return "ident";
126
+ } else if (ch == "|" && (state.varList || state.lastTok == "{" || state.lastTok == "do")) {
127
+ curPunc = "|";
128
+ return null;
129
+ } else if (/[\(\)\[\]{}\\;]/.test(ch)) {
130
+ curPunc = ch;
131
+ return null;
132
+ } else if (ch == "-" && stream.eat(">")) {
133
+ return "arrow";
134
+ } else if (/[=+\-\/*:\.^%<>~|]/.test(ch)) {
135
+ var more = stream.eatWhile(/[=+\-\/*:\.^%<>~|]/);
136
+ if (ch == "." && !more) curPunc = ".";
137
+ return "operator";
138
+ } else {
139
+ return null;
140
+ }
141
+ }
142
+
143
+ function regexpAhead(stream) {
144
+ var start = stream.pos, depth = 0, next, found = false, escaped = false
145
+ while ((next = stream.next()) != null) {
146
+ if (!escaped) {
147
+ if ("[{(".indexOf(next) > -1) {
148
+ depth++
149
+ } else if ("]})".indexOf(next) > -1) {
150
+ depth--
151
+ if (depth < 0) break
152
+ } else if (next == "/" && depth == 0) {
153
+ found = true
154
+ break
155
+ }
156
+ escaped = next == "\\"
157
+ } else {
158
+ escaped = false
159
+ }
160
+ }
161
+ stream.backUp(stream.pos - start)
162
+ return found
163
+ }
164
+
165
+ function tokenBaseUntilBrace(depth) {
166
+ if (!depth) depth = 1;
167
+ return function(stream, state) {
168
+ if (stream.peek() == "}") {
169
+ if (depth == 1) {
170
+ state.tokenize.pop();
171
+ return state.tokenize[state.tokenize.length-1](stream, state);
172
+ } else {
173
+ state.tokenize[state.tokenize.length - 1] = tokenBaseUntilBrace(depth - 1);
174
+ }
175
+ } else if (stream.peek() == "{") {
176
+ state.tokenize[state.tokenize.length - 1] = tokenBaseUntilBrace(depth + 1);
177
+ }
178
+ return tokenBase(stream, state);
179
+ };
180
+ }
181
+ function tokenBaseOnce() {
182
+ var alreadyCalled = false;
183
+ return function(stream, state) {
184
+ if (alreadyCalled) {
185
+ state.tokenize.pop();
186
+ return state.tokenize[state.tokenize.length-1](stream, state);
187
+ }
188
+ alreadyCalled = true;
189
+ return tokenBase(stream, state);
190
+ };
191
+ }
192
+ function readQuoted(quote, style, embed, unescaped) {
193
+ return function(stream, state) {
194
+ var escaped = false, ch;
195
+
196
+ if (state.context.type === 'read-quoted-paused') {
197
+ state.context = state.context.prev;
198
+ stream.eat("}");
199
+ }
200
+
201
+ while ((ch = stream.next()) != null) {
202
+ if (ch == quote && (unescaped || !escaped)) {
203
+ state.tokenize.pop();
204
+ break;
205
+ }
206
+ if (embed && ch == "#" && !escaped) {
207
+ if (stream.eat("{")) {
208
+ if (quote == "}") {
209
+ state.context = {prev: state.context, type: 'read-quoted-paused'};
210
+ }
211
+ state.tokenize.push(tokenBaseUntilBrace());
212
+ break;
213
+ } else if (/[@\$]/.test(stream.peek())) {
214
+ state.tokenize.push(tokenBaseOnce());
215
+ break;
216
+ }
217
+ }
218
+ escaped = !escaped && ch == "\\";
219
+ }
220
+ return style;
221
+ };
222
+ }
223
+ function readHereDoc(phrase, mayIndent) {
224
+ return function(stream, state) {
225
+ if (mayIndent) stream.eatSpace()
226
+ if (stream.match(phrase)) state.tokenize.pop();
227
+ else stream.skipToEnd();
228
+ return "string";
229
+ };
230
+ }
231
+ function readBlockComment(stream, state) {
232
+ if (stream.sol() && stream.match("=end") && stream.eol())
233
+ state.tokenize.pop();
234
+ stream.skipToEnd();
235
+ return "comment";
236
+ }
237
+
238
+ return {
239
+ startState: function() {
240
+ return {tokenize: [tokenBase],
241
+ indented: 0,
242
+ context: {type: "top", indented: -config.indentUnit},
243
+ continuedLine: false,
244
+ lastTok: null,
245
+ varList: false};
246
+ },
247
+
248
+ token: function(stream, state) {
249
+ curPunc = null;
250
+ if (stream.sol()) state.indented = stream.indentation();
251
+ var style = state.tokenize[state.tokenize.length-1](stream, state), kwtype;
252
+ var thisTok = curPunc;
253
+ if (style == "ident") {
254
+ var word = stream.current();
255
+ style = state.lastTok == "." ? "property"
256
+ : keywords.propertyIsEnumerable(stream.current()) ? "keyword"
257
+ : /^[A-Z]/.test(word) ? "tag"
258
+ : (state.lastTok == "def" || state.lastTok == "class" || state.varList) ? "def"
259
+ : "variable";
260
+ if (style == "keyword") {
261
+ thisTok = word;
262
+ if (indentWords.propertyIsEnumerable(word)) kwtype = "indent";
263
+ else if (dedentWords.propertyIsEnumerable(word)) kwtype = "dedent";
264
+ else if ((word == "if" || word == "unless") && stream.column() == stream.indentation())
265
+ kwtype = "indent";
266
+ else if (word == "do" && state.context.indented < state.indented)
267
+ kwtype = "indent";
268
+ }
269
+ }
270
+ if (curPunc || (style && style != "comment")) state.lastTok = thisTok;
271
+ if (curPunc == "|") state.varList = !state.varList;
272
+
273
+ if (kwtype == "indent" || /[\(\[\{]/.test(curPunc))
274
+ state.context = {prev: state.context, type: curPunc || style, indented: state.indented};
275
+ else if ((kwtype == "dedent" || /[\)\]\}]/.test(curPunc)) && state.context.prev)
276
+ state.context = state.context.prev;
277
+
278
+ if (stream.eol())
279
+ state.continuedLine = (curPunc == "\\" || style == "operator");
280
+ return style;
281
+ },
282
+
283
+ indent: function(state, textAfter) {
284
+ if (state.tokenize[state.tokenize.length-1] != tokenBase) return CodeMirror.Pass;
285
+ var firstChar = textAfter && textAfter.charAt(0);
286
+ var ct = state.context;
287
+ var closed = ct.type == closing[firstChar] ||
288
+ ct.type == "keyword" && /^(?:end|until|else|elsif|when|rescue)\b/.test(textAfter);
289
+ return ct.indented + (closed ? 0 : config.indentUnit) +
290
+ (state.continuedLine ? config.indentUnit : 0);
291
+ },
292
+
293
+ electricInput: /^\s*(?:end|rescue|elsif|else|\})$/,
294
+ lineComment: "#",
295
+ fold: "indent"
296
+ };
297
+ });
298
+
299
+ CodeMirror.defineMIME("text/x-ruby", "ruby");
300
+
301
+ CodeMirror.registerHelper("hintWords", "ruby", keywordList);
302
+
303
+ });
@@ -0,0 +1,23 @@
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: https://codemirror.net/LICENSE
3
+
4
+ (function() {
5
+ var mode = CodeMirror.getMode({indentUnit: 2}, "ruby");
6
+ function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
7
+
8
+ MT("divide_equal_operator",
9
+ "[variable bar] [operator /=] [variable foo]");
10
+
11
+ MT("divide_equal_operator_no_spacing",
12
+ "[variable foo][operator /=][number 42]");
13
+
14
+ MT("complex_regexp",
15
+ "[keyword if] [variable cr] [operator =~] [string-2 /(?: \\( #{][tag RE_NOT][string-2 }\\( | #{][tag RE_NOT_PAR_OR][string-2 }* #{][tag RE_OPA_OR][string-2 } )/][variable x]")
16
+
17
+ MT("indented_heredoc",
18
+ "[keyword def] [def x]",
19
+ " [variable y] [operator =] [string <<-FOO]",
20
+ "[string bar]",
21
+ "[string FOO]",
22
+ "[keyword end]")
23
+ })();
@@ -0,0 +1,68 @@
1
+ <!doctype html>
2
+
3
+ <title>CodeMirror: Sass mode</title>
4
+ <meta charset="utf-8"/>
5
+ <link rel=stylesheet href="../../doc/docs.css">
6
+
7
+ <link rel="stylesheet" href="../../lib/codemirror.css">
8
+ <script src="../../lib/codemirror.js"></script>
9
+ <script src="../../addon/edit/matchbrackets.js"></script>
10
+ <script src="../css/css.js"></script>
11
+ <script src="sass.js"></script>
12
+ <style>.CodeMirror {border: 1px solid #ddd; font-size:12px; height: 400px}</style>
13
+ <div id=nav>
14
+ <a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
15
+
16
+ <ul>
17
+ <li><a href="../../index.html">Home</a>
18
+ <li><a href="../../doc/manual.html">Manual</a>
19
+ <li><a href="https://github.com/codemirror/codemirror">Code</a>
20
+ </ul>
21
+ <ul>
22
+ <li><a href="../index.html">Language modes</a>
23
+ <li><a class=active href="#">Sass</a>
24
+ </ul>
25
+ </div>
26
+
27
+ <article>
28
+ <h2>Sass mode</h2>
29
+ <form><textarea id="code" name="code">// Variable Definitions
30
+
31
+ $page-width: 800px
32
+ $sidebar-width: 200px
33
+ $primary-color: #eeeeee
34
+
35
+ // Global Attributes
36
+
37
+ body
38
+ font:
39
+ family: sans-serif
40
+ size: 30em
41
+ weight: bold
42
+
43
+ // Scoped Styles
44
+
45
+ #contents
46
+ width: $page-width
47
+ #sidebar
48
+ float: right
49
+ width: $sidebar-width
50
+ #main
51
+ width: $page-width - $sidebar-width
52
+ background: $primary-color
53
+ h2
54
+ color: blue
55
+
56
+ #footer
57
+ height: 200px
58
+ </textarea></form>
59
+ <script>
60
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
61
+ lineNumbers : true,
62
+ matchBrackets : true,
63
+ mode: "sass"
64
+ });
65
+ </script>
66
+
67
+ <p><strong>MIME types defined:</strong> <code>text/x-sass</code>.</p>
68
+ </article>