Permalink
Browse files

Upgrade vendored assets to CodeMirror 2.33

  • Loading branch information...
1 parent a0a45d0 commit 06ca66fd04d924e7ccde398695b90b593971627e @fixlr committed Aug 25, 2012
Showing with 954 additions and 665 deletions.
  1. +1 −1 codemirror-rails.gemspec
  2. +2 −2 lib/codemirror/rails/version.rb
  3. +355 −349 vendor/assets/javascripts/codemirror.js
  4. +6 −5 vendor/assets/javascripts/codemirror/keymaps/vim.js
  5. +6 −2 vendor/assets/javascripts/codemirror/modes/clike.js
  6. +1 −1 vendor/assets/javascripts/codemirror/modes/clojure.js
  7. +3 −3 vendor/assets/javascripts/codemirror/modes/coffeescript.js
  8. +52 −2 vendor/assets/javascripts/codemirror/modes/css.js
  9. +1 −1 vendor/assets/javascripts/codemirror/modes/ecl.js
  10. +4 −3 vendor/assets/javascripts/codemirror/modes/gfm.js
  11. +2 −2 vendor/assets/javascripts/codemirror/modes/go.js
  12. +1 −1 vendor/assets/javascripts/codemirror/modes/groovy.js
  13. +2 −2 vendor/assets/javascripts/codemirror/modes/haskell.js
  14. +4 −4 vendor/assets/javascripts/codemirror/modes/haxe.js
  15. +3 −3 vendor/assets/javascripts/codemirror/modes/htmlembedded.js
  16. +1 −1 vendor/assets/javascripts/codemirror/modes/htmlmixed.js
  17. +2 −2 vendor/assets/javascripts/codemirror/modes/javascript.js
  18. +94 −60 vendor/assets/javascripts/codemirror/modes/less.js
  19. +4 −4 vendor/assets/javascripts/codemirror/modes/markdown.js
  20. +4 −4 vendor/assets/javascripts/codemirror/modes/ntriples.js
  21. +1 −1 vendor/assets/javascripts/codemirror/modes/ocaml.js
  22. +1 −1 vendor/assets/javascripts/codemirror/modes/pascal.js
  23. +71 −71 vendor/assets/javascripts/codemirror/modes/perl.js
  24. +3 −3 vendor/assets/javascripts/codemirror/modes/php.js
  25. +3 −3 vendor/assets/javascripts/codemirror/modes/pig.js
  26. +1 −1 vendor/assets/javascripts/codemirror/modes/python.js
  27. +1 −1 vendor/assets/javascripts/codemirror/modes/scheme.js
  28. +1 −1 vendor/assets/javascripts/codemirror/modes/shell.js
  29. +156 −0 vendor/assets/javascripts/codemirror/modes/sieve.js
  30. +2 −2 vendor/assets/javascripts/codemirror/modes/smalltalk.js
  31. +2 −2 vendor/assets/javascripts/codemirror/modes/smarty.js
  32. +1 −1 vendor/assets/javascripts/codemirror/modes/stex.js
  33. +4 −4 vendor/assets/javascripts/codemirror/modes/tiki.js
  34. +1 −1 vendor/assets/javascripts/codemirror/modes/velocity.js
  35. +1 −1 vendor/assets/javascripts/codemirror/modes/verilog.js
  36. +2 −2 vendor/assets/javascripts/codemirror/modes/xml.js
  37. +7 −4 vendor/assets/javascripts/codemirror/modes/xquery.js
  38. +4 −1 vendor/assets/javascripts/codemirror/utils/dialog.js
  39. +1 −1 vendor/assets/javascripts/codemirror/utils/formatting.js
  40. +3 −3 vendor/assets/javascripts/codemirror/utils/javascript-hint.js
  41. +1 −1 vendor/assets/javascripts/codemirror/utils/loadmode.js
  42. +1 −1 vendor/assets/javascripts/codemirror/utils/multiplex.js
  43. +1 −1 vendor/assets/javascripts/codemirror/utils/pig-hint.js
  44. +8 −4 vendor/assets/javascripts/codemirror/utils/runmode.js
  45. +4 −4 vendor/assets/javascripts/codemirror/utils/search.js
  46. +13 −11 vendor/assets/javascripts/codemirror/utils/searchcursor.js
  47. +89 −68 vendor/assets/javascripts/codemirror/utils/simple-hint.js
  48. +8 −8 vendor/assets/javascripts/codemirror/utils/xml-hint.js
  49. +15 −11 vendor/assets/stylesheets/codemirror.css
View
@@ -3,7 +3,7 @@ require File.expand_path('../lib/codemirror/rails/version', __FILE__)
Gem::Specification.new do |s|
s.name = 'codemirror-rails'
s.version = Codemirror::Rails::VERSION
- s.authors = ['Nathan Fixler', 'Robin Bühler']
+ s.authors = ['Nathan Fixler']
s.email = 'nathan@fixler.org'
s.summary = 'Use CodeMirror with Rails 3'
s.description = 'This gem provides CodeMirror assets for your Rails 3 application.'
@@ -1,6 +1,6 @@
module Codemirror
module Rails
- VERSION = '2.32'
- CODEMIRROR_VERSION = '2.32'
+ VERSION = '2.33'
+ CODEMIRROR_VERSION = '2.33'
end
end
Oops, something went wrong.
@@ -70,7 +70,7 @@
for (var prop in o) if (o.hasOwnProperty(prop)) f(prop, o[prop]);
}
function iterList(l, f) {
- for (var i in l) f(l[i]);
+ for (var i = 0; i < l.length; ++i) f(l[i]);
}
function toLetter(ch) {
// T -> t, Shift-T -> T, '*' -> *, "Space" -> " "
@@ -229,7 +229,8 @@
else f(prompt(shortText, ""));
}
function showAlert(cm, text) {
- if (cm.openDialog) cm.openDialog(CodeMirror.htmlEscape(text) + " <button type=button>OK</button>");
+ var esc = text.replace(/[<&]/, function(ch) { return ch == "<" ? "&lt;" : "&amp;"; });
+ if (cm.openDialog) cm.openDialog(esc + " <button type=button>OK</button>");
else alert(text);
}
@@ -502,9 +503,9 @@
setupPrefixBindingForKey(toCombo(ch));
setupPrefixBindingForKey(toCombo(ch.toLowerCase()));
}
- iterList(SPECIAL_SYMBOLS, function (ch) {
- setupPrefixBindingForKey(toCombo(ch));
- });
+ for (var i = 0; i < SPECIAL_SYMBOLS.length; ++i) {
+ setupPrefixBindingForKey(toCombo(SPECIAL_SYMBOLS.charAt(i)));
+ }
setupPrefixBindingForKey("Space");
CodeMirror.keyMap["vim-prefix-y"] = {
@@ -181,14 +181,18 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
return "string";
}
- CodeMirror.defineMIME("text/x-csrc", {
+ function mimes(ms, mode) {
+ for (var i = 0; i < ms.length; ++i) CodeMirror.defineMIME(ms[i], mode);
+ }
+
+ mimes(["text/x-csrc", "text/x-c", "text/x-chdr"], {
name: "clike",
keywords: words(cKeywords),
blockKeywords: words("case do else for if switch while struct"),
atoms: words("null"),
hooks: {"#": cppHook}
});
- CodeMirror.defineMIME("text/x-c++src", {
+ mimes(["text/x-c++src", "text/x-c++hdr"], {
name: "clike",
keywords: words(cKeywords + " asm dynamic_cast namespace reinterpret_cast try bool explicit new " +
"static_cast typeid catch operator template typename class friend private " +
@@ -145,7 +145,7 @@ CodeMirror.defineMode("clojure", function (config, mode) {
} else if (isNumber(ch,stream)){
returnType = NUMBER;
} else if (ch == "(" || ch == "[") {
- var keyWord = ''; var indentTemp = stream.column();
+ var keyWord = '', indentTemp = stream.column(), letter;
/**
Either
(indent-word ..
@@ -187,7 +187,7 @@ CodeMirror.defineMode('coffeescript', function(conf) {
}
if (singleline) {
if (conf.mode.singleLineStringErrors) {
- outclass = ERRORCLASS
+ outclass = ERRORCLASS;
} else {
state.tokenize = tokenBase;
}
@@ -205,7 +205,7 @@ CodeMirror.defineMode('coffeescript', function(conf) {
}
stream.eatWhile("#");
}
- return "comment"
+ return "comment";
}
function indent(stream, state, type) {
@@ -244,7 +244,7 @@ CodeMirror.defineMode('coffeescript', function(conf) {
while (state.scopes[0].offset !== _indent) {
state.scopes.shift();
}
- return false
+ return false;
} else {
state.scopes.shift();
return false;
@@ -1,5 +1,55 @@
CodeMirror.defineMode("css", function(config) {
var indentUnit = config.indentUnit, type;
+
+ var keywords = keySet(["above", "absolute", "activeborder", "activecaption", "afar", "after-white-space", "ahead", "alias", "all", "all-scroll",
+ "alternate", "always", "amharic", "amharic-abegede", "antialiased", "appworkspace", "arabic-indic", "armenian", "asterisks",
+ "auto", "avoid", "background", "backwards", "baseline", "below", "bidi-override", "binary", "bengali", "blink",
+ "block", "block-axis", "bold", "bolder", "border", "border-box", "both", "bottom", "break-all", "break-word", "button",
+ "button-bevel", "buttonface", "buttonhighlight", "buttonshadow", "buttontext", "cambodian", "capitalize", "caps-lock-indicator",
+ "caption", "captiontext", "caret", "cell", "center", "checkbox", "circle", "cjk-earthly-branch", "cjk-heavenly-stem", "cjk-ideographic",
+ "clear", "clip", "close-quote", "col-resize", "collapse", "compact", "condensed", "contain", "content", "content-box", "context-menu",
+ "continuous", "copy", "cover", "crop", "cross", "crosshair", "currentcolor", "cursive", "dashed", "decimal", "decimal-leading-zero", "default",
+ "default-button", "destination-atop", "destination-in", "destination-out", "destination-over", "devanagari", "disc", "discard", "document",
+ "dot-dash", "dot-dot-dash", "dotted", "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out", "element",
+ "ellipsis", "embed", "end", "ethiopic", "ethiopic-abegede", "ethiopic-abegede-am-et", "ethiopic-abegede-gez",
+ "ethiopic-abegede-ti-er", "ethiopic-abegede-ti-et", "ethiopic-halehame-aa-er", "ethiopic-halehame-aa-et",
+ "ethiopic-halehame-am-et", "ethiopic-halehame-gez", "ethiopic-halehame-om-et", "ethiopic-halehame-sid-et",
+ "ethiopic-halehame-so-et", "ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig", "ew-resize", "expanded",
+ "extra-condensed", "extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "footnotes", "forwards", "from", "geometricPrecision",
+ "georgian", "graytext", "groove", "gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hebrew", "help",
+ "hidden", "hide", "higher", "highlight", "highlighttext", "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "icon", "ignore",
+ "inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite", "infobackground", "infotext", "inherit", "initial", "inline",
+ "inline-axis", "inline-block", "inline-table", "inset", "inside", "intrinsic", "invert", "italic", "justify", "kannada", "katakana",
+ "katakana-iroha", "khmer", "landscape", "lao", "large", "larger", "left", "level", "lighter", "line-through", "linear", "lines",
+ "list-item", "listbox", "listitem", "local", "logical", "loud", "lower", "lower-alpha", "lower-armenian", "lower-greek",
+ "lower-hexadecimal", "lower-latin", "lower-norwegian", "lower-roman", "lowercase", "ltr", "malayalam", "match", "media-controls-background",
+ "media-current-time-display", "media-fullscreen-button", "media-mute-button", "media-play-button", "media-return-to-realtime-button",
+ "media-rewind-button", "media-seek-back-button", "media-seek-forward-button", "media-slider", "media-sliderthumb", "media-time-remaining-display",
+ "media-volume-slider", "media-volume-slider-container", "media-volume-sliderthumb", "medium", "menu", "menulist", "menulist-button",
+ "menulist-text", "menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic", "mix", "mongolian", "monospace", "move", "multiple",
+ "myanmar", "n-resize", "narrower", "navy", "ne-resize", "nesw-resize", "no-close-quote", "no-drop", "no-open-quote", "no-repeat", "none",
+ "normal", "not-allowed", "nowrap", "ns-resize", "nw-resize", "nwse-resize", "oblique", "octal", "open-quote", "optimizeLegibility",
+ "optimizeSpeed", "oriya", "oromo", "outset", "outside", "overlay", "overline", "padding", "padding-box", "painted", "paused",
+ "persian", "plus-darker", "plus-lighter", "pointer", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d", "progress",
+ "push-button", "radio", "read-only", "read-write", "read-write-plaintext-only", "relative", "repeat", "repeat-x",
+ "repeat-y", "reset", "reverse", "rgb", "rgba", "ridge", "right", "round", "row-resize", "rtl", "run-in", "running", "s-resize", "sans-serif",
+ "scroll", "scrollbar", "se-resize", "searchfield", "searchfield-cancel-button", "searchfield-decoration", "searchfield-results-button",
+ "searchfield-results-decoration", "semi-condensed", "semi-expanded", "separate", "serif", "show", "sidama", "single",
+ "skip-white-space", "slide", "slider-horizontal", "slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow",
+ "small", "small-caps", "small-caption", "smaller", "solid", "somali", "source-atop", "source-in", "source-out", "source-over",
+ "space", "square", "square-button", "start", "static", "status-bar", "stretch", "stroke", "sub", "subpixel-antialiased", "super",
+ "sw-resize", "table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group",
+ "table-row", "table-row-group", "telugu", "text", "text-bottom", "text-top", "textarea", "textfield", "thai", "thick", "thin",
+ "threeddarkshadow", "threedface", "threedhighlight", "threedlightshadow", "threedshadow", "tibetan", "tigre", "tigrinya-er", "tigrinya-er-abegede",
+ "tigrinya-et", "tigrinya-et-abegede", "to", "top", "transparent", "ultra-condensed", "ultra-expanded", "underline", "up", "upper-alpha", "upper-armenian",
+ "upper-greek", "upper-hexadecimal", "upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url", "vertical", "vertical-text", "visible",
+ "visibleFill", "visiblePainted", "visibleStroke", "visual", "w-resize", "wait", "wave", "white", "wider", "window", "windowframe", "windowtext",
+ "x-large", "x-small", "xor", "xx-large", "xx-small", "yellow", "-wap-marquee", "-webkit-activelink", "-webkit-auto", "-webkit-baseline-middle",
+ "-webkit-body", "-webkit-box", "-webkit-center", "-webkit-control", "-webkit-focus-ring-color", "-webkit-grab", "-webkit-grabbing",
+ "-webkit-gradient", "-webkit-inline-box", "-webkit-left", "-webkit-link", "-webkit-marquee", "-webkit-mini-control", "-webkit-nowrap", "-webkit-pictograph",
+ "-webkit-right", "-webkit-small-control", "-webkit-text", "-webkit-xxx-large", "-webkit-zoom-in", "-webkit-zoom-out"]);
+
+ function keySet(array) { var keys = {}; for (var i = 0; i < array.length; ++i) keys[array[i]] = true; return keys; }
function ret(style, tp) {type = tp; return style;}
function tokenBase(stream, state) {
@@ -34,7 +84,7 @@ CodeMirror.defineMode("css", function(config) {
else if (/[,.+>*\/]/.test(ch)) {
return ret(null, "select-op");
}
- else if (/[;{}:\[\]]/.test(ch)) {
+ else if (/[;{}:\[\]\(\)]/.test(ch)) {
return ret(null, ch);
}
else {
@@ -94,7 +144,7 @@ CodeMirror.defineMode("css", function(config) {
var context = state.stack[state.stack.length-1];
if (type == "hash" && context != "rule") style = "string-2";
else if (style == "variable") {
- if (context == "rule") style = "number";
+ if (context == "rule") style = keywords[stream.current()] ? "keyword" : "number";
else if (!context || context == "@media{") style = "tag";
}
@@ -49,7 +49,7 @@ CodeMirror.defineMode("ecl", function(config) {
}
if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
curPunc = ch;
- return null
+ return null;
}
if (/\d/.test(ch)) {
stream.eatWhile(/[\w\.]/);
@@ -32,14 +32,14 @@ CodeMirror.defineMode("gfm", function(config, parserConfig) {
return function (lang) {
return modes[lang] ? CodeMirror.getMode(config, modes[lang]) : null;
- }
+ };
}());
function markdown(stream, state) {
// intercept fenced code blocks
if (stream.sol() && stream.match(/^```([\w+#]*)/)) {
// try switching mode
- state.localMode = getMode(RegExp.$1)
+ state.localMode = getMode(RegExp.$1);
if (state.localMode)
state.localState = state.localMode.startState();
@@ -103,6 +103,7 @@ CodeMirror.defineMode("gfm", function(config, parserConfig) {
token: function(stream, state) {
/* Parse GFM double bracket links */
+ var ch;
if ((ch = stream.peek()) != undefined && ch == '[') {
stream.next(); // Advance the stream
@@ -140,5 +141,5 @@ CodeMirror.defineMode("gfm", function(config, parserConfig) {
return state.token(stream, state);
}
- }
+ };
}, "markdown");
@@ -47,7 +47,7 @@ CodeMirror.defineMode("go", function(config, parserConfig) {
}
if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
curPunc = ch;
- return null
+ return null;
}
if (ch == "/") {
if (stream.eat("*")) {
@@ -144,7 +144,7 @@ CodeMirror.defineMode("go", function(config, parserConfig) {
if (curPunc == "{") pushContext(state, stream.column(), "}");
else if (curPunc == "[") pushContext(state, stream.column(), "]");
else if (curPunc == "(") pushContext(state, stream.column(), ")");
- else if (curPunc == "case") ctx.type = "case"
+ else if (curPunc == "case") ctx.type = "case";
else if (curPunc == "}" && ctx.type == "}") ctx = popContext(state);
else if (curPunc == ctx.type) popContext(state);
state.startOfLine = false;
@@ -21,7 +21,7 @@ CodeMirror.defineMode("groovy", function(config, parserConfig) {
}
if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
curPunc = ch;
- return null
+ return null;
}
if (/\d/.test(ch)) {
stream.eatWhile(/[\w\.]/);
@@ -128,7 +128,7 @@ CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) {
}
setState(ncomment(type, currNest));
return type;
- }
+ };
}
function stringLiteral(source, setState) {
@@ -170,7 +170,7 @@ CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) {
return function () {
for (var i = 0; i < arguments.length; i++)
wkw[arguments[i]] = t;
- }
+ };
}
setType("keyword")(
@@ -6,7 +6,7 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
var keywords = function(){
function kw(type) {return {type: type, style: "keyword"};}
var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
- var operator = kw("operator"), atom = {type: "atom", style: "atom"}, attribute = {type:"attribute", style: "attribute"}
+ var operator = kw("operator"), atom = {type: "atom", style: "atom"}, attribute = {type:"attribute", style: "attribute"};
var type = kw("typedef");
return {
"if": A, "while": A, "else": B, "do": B, "try": B,
@@ -219,7 +219,7 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
function pushlex(type, info) {
var result = function() {
var state = cx.state;
- state.lexical = new HaxeLexical(state.indented, cx.stream.column(), type, null, state.lexical, info)
+ state.lexical = new HaxeLexical(state.indented, cx.stream.column(), type, null, state.lexical, info);
};
result.lex = true;
return result;
@@ -243,7 +243,7 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
}
function statement(type) {
- if (type == "@") return cont(metadef)
+ if (type == "@") return cont(metadef);
if (type == "var") return cont(pushlex("vardef"), vardef1, expect(";"), poplex);
if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex);
if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
@@ -297,7 +297,7 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
function metadef(type, value) {
if(type == ":") return cont(metadef);
if(type == "variable") return cont(metadef);
- if(type == "(") return cont(pushlex(")"), comasep(metaargs, ")"), poplex, statement)
+ if(type == "(") return cont(pushlex(")"), comasep(metaargs, ")"), poplex, statement);
}
function metaargs(type, value) {
if(typ == "variable") return cont();
@@ -36,7 +36,7 @@ CodeMirror.defineMode("htmlembedded", function(config, parserConfig) {
token : parserConfig.startOpen ? scriptingDispatch : htmlDispatch,
htmlState : htmlMixedMode.startState(),
scriptState : scriptingMode.startState()
- }
+ };
},
token: function(stream, state) {
@@ -55,12 +55,12 @@ CodeMirror.defineMode("htmlembedded", function(config, parserConfig) {
token : state.token,
htmlState : CodeMirror.copyState(htmlMixedMode, state.htmlState),
scriptState : CodeMirror.copyState(scriptingMode, state.scriptState)
- }
+ };
},
electricChars: "/{}:"
- }
+ };
}, "htmlmixed");
CodeMirror.defineMIME("application/x-ejs", { name: "htmlembedded", scriptingModeSpec:"javascript"});
@@ -79,7 +79,7 @@ CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
},
electricChars: "/{}:"
- }
+ };
}, "xml", "javascript", "css");
CodeMirror.defineMIME("text/html", "htmlmixed");
@@ -185,7 +185,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
function pushlex(type, info) {
var result = function() {
var state = cx.state;
- state.lexical = new JSLexical(state.indented, cx.stream.column(), type, null, state.lexical, info)
+ state.lexical = new JSLexical(state.indented, cx.stream.column(), type, null, state.lexical, info);
};
result.lex = true;
return result;
@@ -243,7 +243,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
function maybeoperator(type, value) {
if (type == "operator" && /\+\+|--/.test(value)) return cont(maybeoperator);
- if (type == "operator" || type == ":") return cont(expression);
+ if (type == "operator" && value == "?") return cont(expression, expect(":"), expression);
if (type == ";") return;
if (type == "(") return cont(pushlex(")"), commasep(expression, ")"), poplex, maybeoperator);
if (type == ".") return cont(property, maybeoperator);
Oops, something went wrong.

0 comments on commit 06ca66f

Please sign in to comment.