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
erp_app-3.0.7 public/javascripts/erp_app/codemirror/lib/runmode.js
erp_app-3.0.6 public/javascripts/erp_app/codemirror/lib/runmode.js
erp_app-3.0.5 public/javascripts/erp_app/codemirror/lib/runmode.js
erp_app-3.0.4 public/javascripts/erp_app/codemirror/lib/runmode.js
erp_app-3.0.3 public/javascripts/erp_app/codemirror/lib/runmode.js
erp_app-3.0.2 public/javascripts/erp_app/codemirror/lib/runmode.js
erp_app-3.0.1 public/javascripts/erp_app/codemirror/lib/runmode.js
erp_app-3.0.0 public/javascripts/erp_app/codemirror/lib/runmode.js
AmberRack-0.1.0 public/CodeMirror/lib/runmode.js
AmberRack-0.1.0 app/javascripts/lib/CodeMirror/lib/runmode.js
amber-rails-0.1.0 app/assets/javascripts/codemirror/runmode.js
page_engine-0.0.5 vendor/assets/javascripts/codemirror/runmode.js
codemirror-rails-0.3.0 vendor/assets/javascripts/codemirror/runmode.js
liquid_cms-0.3.2.0 lib/generators/liquid_cms/templates/public/cms/codemirror/lib/runmode.js
liquid_cms-0.2.2.0 generators/liquid_cms/templates/public/cms/codemirror/lib/runmode.js
jtalk-rails-0.1.0 app/assets/javascripts/codemirror/runmode.js
page_engine-0.0.4 vendor/assets/javascripts/codemirror/runmode.js
codemirror-rails-0.2.3 vendor/assets/javascripts/codemirror/runmode.js
codemirror-rails-0.2.2 ./vendor/assets/javascripts/codemirror/runmode.js
codemirror-rails-0.2.1 ./vendor/assets/javascripts/codemirror/runmode.js