Sha256: bac2a230a79222775c714bfeddcd64f934e4e89fa361707c9bb14d368865c18b

Contents?: true

Size: 968 Bytes

Versions: 22

Compression:

Stored size: 968 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, i, stream.start);
      stream.start = stream.pos;
    }
  }
  if (isNode)
    node.innerHTML = accum.join("");
};

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
ledger_web-1.5.2 lib/ledger_web/public/codemirror/lib/util/runmode.js
ledger_web-1.5.1 lib/ledger_web/public/codemirror/lib/util/runmode.js
ledger_web-1.5.0 lib/ledger_web/public/codemirror/lib/util/runmode.js
ledger_web-1.4.11 lib/ledger_web/public/codemirror/lib/util/runmode.js
ledger_web-1.4.10 lib/ledger_web/public/codemirror/lib/util/runmode.js
ledger_web-1.4.9 lib/ledger_web/public/codemirror/lib/util/runmode.js
ledger_web-1.4.8 lib/ledger_web/public/codemirror/lib/util/runmode.js
ledger_web-1.4.7 lib/ledger_web/public/codemirror/lib/util/runmode.js
ledger_web-1.4.6 lib/ledger_web/public/codemirror/lib/util/runmode.js
ledger_web-1.4.4 lib/ledger_web/public/codemirror/lib/util/runmode.js
ledger_web-1.4.3 lib/ledger_web/public/codemirror/lib/util/runmode.js
ledger_web-1.4.2 lib/ledger_web/public/codemirror/lib/util/runmode.js
ledger_web-1.4.1 lib/ledger_web/public/codemirror/lib/util/runmode.js
ledger_web-1.4 lib/ledger_web/public/codemirror/lib/util/runmode.js
codemirror-rails-2.21.1 vendor/assets/javascripts/codemirror/runmode.js
codemirror-rails-2.2.1 vendor/assets/javascripts/codemirror/runmode.js
codemirror-rails-2.21 vendor/assets/javascripts/codemirror/runmode.js
codemirror-rails-2.2 vendor/assets/javascripts/codemirror/runmode.js
ledger_web-1.3 lib/ledger_web/public/codemirror/lib/util/runmode.js
ledger_web-1.2 lib/ledger_web/public/codemirror/lib/util/runmode.js