Sha256: 8ba392062caffe3cf372966c1e6c1e552230f3890178013a2e138c46a5deef3e
Contents?: true
Size: 951 Bytes
Versions: 22
Compression:
Stored size: 951 Bytes
Contents
CodeMirror.runMode = function(string, modespec, callback) { var mode = CodeMirror.getMode({indentUnit: 2}, modespec); var isNode = callback.nodeType == 1; if (isNode) { var node = callback, accum = []; callback = function(string, style) { if (string == "\n") accum.push("<br>"); else if (style) accum.push("<span class=\"cm-" + CodeMirror.htmlEscape(style) + "\">" + CodeMirror.htmlEscape(string) + "</span>"); else accum.push(CodeMirror.htmlEscape(string)); } } var lines = CodeMirror.splitLines(string), state = CodeMirror.startState(mode); for (var i = 0, e = lines.length; i < e; ++i) { if (i) callback("\n"); var stream = new CodeMirror.StringStream(lines[i]); while (!stream.eol()) { var style = mode.token(stream, state); callback(stream.current(), style); stream.start = stream.pos; } } if (isNode) node.innerHTML = accum.join(""); };
Version data entries
22 entries across 21 versions & 7 rubygems
Version | Path |
---|---|
codemirror-rails-0.2.0 | ./vendor/assets/javascripts/codemirror/runmode.js |
codemirror-rails-0.1.2 | ./vendor/assets/javascripts/codemirror/runmode.js |