You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by ja...@apache.org on 2013/11/29 16:14:56 UTC

[1/9] removed codemirror sources and added dependency to the codemirror webjar TODO: Update L&N

Updated Branches:
  refs/heads/develop 5fca08c66 -> 1954841e8


http://git-wip-us.apache.org/repos/asf/marmotta/blob/9c3b63b1/extras/webjars/codemirror/src/main/resources/skwrl.js
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/skwrl.js b/extras/webjars/codemirror/src/main/resources/skwrl.js
deleted file mode 100644
index 7de04c3..0000000
--- a/extras/webjars/codemirror/src/main/resources/skwrl.js
+++ /dev/null
@@ -1,491 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-if (CodeMirror && CodeMirror.defineMode) {
-CodeMirror.defineMode("skwrl", function(config, parserConfig) {
-    var token = {
-        COMMENT: "comment",
-        KWD: "keyword",
-        IDENT: "atom",
-        OP: "operator",
-        BRACKET: "bracket",
-        URL: "link",
-        VAR: "variable-3",
-        PREFIX: "qualifier",
-        DEF: "variable",
-        WARNING: "string-2",
-        ERROR: "error"
-    },
-        predefinedNamespaces = parserConfig.namespaces || {},
-        baseURL = parserConfig.baseURL || null;
-    
-    function log(stream, status, result) {
-        return;
-        if (console && console.log) {
-            console.log(stream.current() + " := " + result + " (-> " + status.current() + ")");
-        }
-    }
-    
-    function getInitialState() {
-        return {
-            tmp: {},
-            namespaces: {},
-            predefinedNamespaces: predefinedNamespaces,
-            lmfBaseURL: baseURL,
-            stack: ['default'],
-            /* STACKING */
-            push: function(next) {
-                this.stack.unshift(next);
-            },
-            pop: function() {
-                if (this.stack.length <= 1) {
-                    return this.current();
-                } else {
-                    return this.stack.shift();
-                }
-            },
-            current: function() {
-                return this.stack[0];
-            },
-            reset: function() {
-                this.stack = ['default'];
-                this.tmp = {};
-            },
-            height: function() {
-                return this.stack.length;
-            },
-            /* PARSING */
-            parser: function(stream, state) {
-                var parser = parsers[this.current()] || parsers['default'];
-                return parser(stream, state);
-            },
-            /* NAMESPACES */
-            addPrefix: function(prefix, namespace) {
-                if (prefix && namespace)
-                    this.namespaces[prefix] = namespace;
-            },
-            getNamespace: function(prefix) {
-                return this.namespaces[prefix] || this.predefinedNamespaces[prefix];
-            }
-        };
-    }
-
-    function tokenError(stream, state) {
-        if (state.current() !== 'error') state.push('error');
-        stream.skipToEnd();
-        return token.ERROR;
-    }
-    
-    function tokenDefault(stream, state) {
-        // @...
-        var kw = stream.match(/^@(\w+)/, true);
-        if (kw) {
-            if (kw[1] == "prefix") {
-                state.push(kw[1]);
-                return token.KWD;
-            } else return token.ERROR;
-        }
-
-        // <URL>
-        if (stream.eat('<')) {
-            state.push('url');
-            return token.BRACKET;
-        }
-               
-        if (stream.eat('(')) {
-            state.tmp['rule'] = 0;
-            state.push('rule');
-            return token.BRACKET;
-        }
-        if (stream.eat(')')) {
-            if (state.current() != 'rule') return token.ERROR;
-            state.pop();
-            return token.BRACKET;
-        }
-        if (stream.eat(/[)(]/)) {
-            return token.BRACKET;
-        }
-
-        // prefix:label
-        if (stream.match(/^\w+:\w*/, false)) {
-            stream.skipTo(":")
-            if (state.current() == 'prefix') {
-                state.tmp["prefix"] = stream.current();
-                return token.PREFIX;
-            } else if (state.current() == 'default') {
-                return token.DEF;
-            } else {
-                px = stream.current();
-                stream.eat(':');
-                if (state.getNamespace(px))
-                    return token.PREFIX;
-                else return token.WARNING;
-            }
-        }
-
-        if (stream.match("->", true)) {
-            return token.DEF;
-        }
-        // OPERATORS
-        if (stream.eat(/[:,]/)) {
-            return token.OP;
-        }
-
-       
-        // IDENT
-        if (state.current() == "prefix") {
-
-        } else {
-            if (stream.match(/^[\w.-]+/, true)) {
-                return token.IDENT;
-            }
-        }
-
-        return tokenError(stream, state);
-    }
-    
-    function tokenRule(stream, state) {
-        if (stream.eat(')')) {
-            state.pop();
-            if (state.tmp['rule'] != 3) return token.ERROR;
-            return token.BRACKET;
-        } else if (state.tmp['rule'] >= 3) {
-            state.tmp['rule'] = 4;
-            stream.skipTo(')') || stream.next();
-            return token.ERROR;
-        } else
-        // <URL>
-        if (stream.eat('<')) {
-            state.push('url');
-            return token.BRACKET;
-        } else if (stream.eat('>')) {
-            state.tmp['rule']++;
-            return token.BRACKET;
-        } else        
-        // $s
-        if (stream.match(/^\$\w+/)) {
-            state.tmp['rule']++;
-            return token.VAR;
-        } else
-        // ns:local
-        if (stream.match(/^\w+:\w*/, false)) {
-            stream.skipTo(':');
-            var px = stream.current();
-            stream.eat(':');
-            if (!stream.match(/^\w+/, false)) {
-                return token.ERROR;
-            } else if (state.getNamespace(px))
-                return token.PREFIX;
-            else return token.WARNING;
-        } else if (stream.match(/^\w+/)) {
-            state.tmp['rule']++;
-            return token.IDENT;
-        } else if (stream.eat(')')) {
-            state.pop();
-            if (state.tmp['rule'] != 3) return token.ERROR;
-            return token.BRACKET;
-        } else {
-            stream.next();
-            return token.ERROR;
-        }
-
-        return tokenError(stream, state);
-    }
-    
-    function tokenPrefix(stream, state) {
-        if (stream.match(/^\w+/, true)) {
-            state.tmp["prefix"] = stream.current();
-            return token.PREFIX;
-        } else if (stream.eat(':')) {
-            return token.OP;
-        } else
-        // <URL>
-        if (stream.eat('<')) {
-            state.push('url');
-            return token.BRACKET;
-        } else if (stream.eat('>')) {
-            if (state.tmp['prefix'] && state.tmp['ns']) {
-                state.addPrefix(state.tmp['prefix'], state.tmp['ns']);
-                state.reset();
-                // End of prefix state:
-                state.pop();
-                return token.BRACKET;
-            } else return token.ERROR;
-        }
-        
-        return tokenError(stream, state);
-    }
-
-    function tokenURL(stream, state) {
-        if (stream.skipTo('>')) {
-            state.pop();
-            var url = stream.current();
-            if (url.search(/\s/) >= 0) {
-                return token.ERROR;
-            }
-            if (state.stack.indexOf("prefix") >= 0) {
-                state.tmp["ns"] = url;
-            }
-            return token.URL;
-        }
-        return tokenError(stream, state);
-    }
-
-    var parsers = {
-        'default': tokenDefault,
-        rule: tokenRule,
-        prefix: tokenPrefix,
-        url: tokenURL,
-        error: tokenError
-    };
-    
-
-
-    return {
-        startState: getInitialState,
-        compareStates: function(state1, state2) {
-            return state1.stack == state2.stack && state1.namespaces == state2.namespaces;
-        },
-        token: function(stream, state) {
-            // parse comments
-            if (state.current() == "comment") {
-                stream.skipTo('*') || stream.skipToEnd();
-                if (stream.match('*/')) {
-                    state.pop();
-                } else stream.eat('*');
-                return token.COMMENT;
-            } else if (stream.match('/*')) {
-                state.tmp.commentStart = stream.column();
-                state.push("comment");
-                return this.token(stream, state);
-            }
-            // ignore spaces
-            if (stream.eatSpace()) return null;
-            // ; starts parsing from scratch
-            /*
-            if (stream.eat(';')) {
-                if (state.current() == "prefix") {
-                    state.addPrefix(state.tmp['prefix'], state.tmp['ns']); 
-                }
-                log(stream, state, "RESET");
-                state.reset(); 
-                return token.OP;
-            }
-            */
-            var result = state.parser(stream, state);
-            log(stream, state, result);
-            return result;
-        },
-        electricChars: "/@=[];",
-        indent: function(state, textAfter) {
-            switch (state.current()) {
-            case 'comment':
-                return state.tmp.commentStart +(textAfter.search(/^\s*\*\//)==0?1:3);
-                break;
-            case 'default':
-                // no indent for @prefix etc...
-                if (textAfter.search(/^\s*@/) == 0) {
-                    return 0;
-                }
-                return config.indentUnit;
-                break;
-            }
-            return 0;
-        }
-    }
-});
-
-// Autocompletion
-if (CodeMirror.simpleHint && jQuery) {
-    function completePrefix(editor, cur, token) {
-        var line = editor.getLine(cur.line);
-        var match = line.match(/(^|>)\s*@prefix\s+(\w+)\s*(:\s*<?)?$/);
-        if (match && match[2] && match[2] !== "") {
-            var prefix = match[2], result;
-            try {
-//                jQuery.ajax(token.state.lmfBaseURL + "ldpath/util/prefix", {
-                jQuery.ajax("http://prefix.cc/" + prefix + ".file.json", {
-                    async: false,
-                    data: {prefix: prefix},
-                    success: function(data) {
-                        result = data[prefix];
-                    },
-                    dataType: "json"
-                });
-            } catch (e) {}
-            if (result !== undefined) {
-                var pfx = line.substr(0,cur.ch);
-                var st = pfx.search(/\s*(:\s*<?)?$/);
-                return {
-                    list: [ ": <"+result+">" ],
-                    from: {line: cur.line, ch: st},
-                    to: cur
-                };
-            }
-        }
-        return false;
-    }
-    function completeURI(editor, cur, token) {
-        return false; // No completion here in skwrl
-        var bC = token.string.substr(0, cur.ch - token.start),
-        aC = token.string.substr(cur.ch - token.start),
-        replUntil = token.state.current()=='url'?token.end+1:cur.ch + Math.max(aC.search(/[\s]/), 0);
-        
-        var suggestions;
-        try {
-            var qs = {};
-            if (token.state.stack.indexOf("transformer") >= 0) qs['mode'] = "transformer";
-            for (var n in token.state.namespaces) {
-                qs['ns_'+n] = token.state.getNamespace(n);
-            }
-            qs['uri'] = bC;
-            
-            jQuery.ajax(token.state.lmfBaseURL + "ldpath/util/complete", {
-               async: false,
-               data: qs,
-               success: function(data) {
-                   suggestions = data;  
-               },
-               dataType: "json"
-            });
-        } catch (e) {}
-        if (suggestions !== undefined) {
-            for (var i = 0; i < suggestions.length; i++) {
-                if (suggestions[i].match(/^\w+:\w+$/)) {
-                    // curie!
-                    suggestions[i] = suggestions[i] + " ";
-                } else {
-                    suggestions[i] = "<" + suggestions[i] + "> ";
-                }
-            }
-            return {
-              list: suggestions,
-              from: {line: cur.line, ch: token.start - 1},
-              to: {line: cur.line, ch: replUntil}
-            };
-        }
-        return false;
-    }
-    function completeCUIE(editor, cur, token) {
-        return false; // no completion here in skwrl
-        var from = token.start, 
-            to = token.end, 
-            req = token.string.substr(0, cur.ch - token.start);
-        var prevToken = editor.getTokenAt({line: cur.line, ch: token.start});
-        if (token.className == 'atom' && prevToken.className == 'qualifier') {
-            from = prevToken.start;
-            req = prevToken.string + req;
-        }
-        
-        var suggestions;
-        try {
-            var qs = {};
-            if (token.state.stack.indexOf("transformer") >= 0) qs['mode'] = "transformer";
-            for (var n in token.state.namespaces) {
-                qs['ns_'+n] = token.state.getNamespace(n);
-            }
-            qs['prefix'] = req;
-
-            jQuery.ajax(token.state.lmfBaseURL + "ldpath/util/complete", {
-               async: false,
-               data: qs,
-               success: function(data) {
-                   suggestions = data;  
-               },
-               dataType: "json"
-            });
-        } catch (e) {}
-        if (suggestions !== undefined) {
-            for (var i = 0; i < suggestions.length; i++) {
-                if (suggestions[i].match(/^\w+:\w+(\(\))?$/)) {
-                    // curie!
-                    suggestions[i] = suggestions[i] + " ";
-                } else {
-                    // prefix only
-                    suggestions[i] = suggestions[i] + ":";
-                }
-            }
-            return {
-              list: suggestions,
-              from: {line: cur.line, ch: from},
-              to: {line: cur.line, ch: to}
-            };
-        }
-        
-        return false;
-    }
-    function insertPrefixDef(editor, cur, token) {
-        var prefix = token.string.replace(/:?$/, ""), result;
-        try {
-//            jQuery.ajax(token.state.lmfBaseURL + "ldpath/util/prefix", {
-            jQuery.ajax("http://prefix.cc/" + prefix + ".file.json", {
-                async: false,
-                data: {prefix: prefix},
-                success: function(data) {
-                    result = data[prefix];
-                },
-                dataType: "json"
-            });
-        } catch (e) {}
-        if (result !== undefined) {
-            // check if this url is already prefixed
-            var px;
-            for (var i in token.state.namespaces) {
-                if (token.state.namespaces[i] == result) {
-                    px = i;
-                    break;
-                }
-            } 
-            if (px) {
-                return {
-                    list: [ px + ":" ],
-                    from: { line: cur.line, ch: token.start },
-                    to: { line: cur.line, ch: token.end }
-                };
-            } else {
-            return {
-                list: [ "@prefix " + prefix + ": <" + result + ">\n" ],
-                from: {line: 0, ch: 0},
-                to: {line: 0, ch: 0}
-            };
-            } 
-        }
-    }
-    CodeMirror.commands.skwrlAutocomplete = function(cm) {
-        CodeMirror.simpleHint(cm, function(editor) {
-            var cur = editor.getCursor();
-            var line = editor.getLine(cur.line);
-            var token = editor.getTokenAt(cur);
-        
-            if (token.state.stack.indexOf('prefix') >= 0) {
-                return completePrefix(editor, cur, token);
-//            } else if (token.state.current() == 'url' || (token.state.current() == 'error' && token.state.stack[1] == 'url')) {
-//                return completeURI(editor, cur, token);
-//            } else if (token.className == "qualifier" || (token.className == "atom" && token.state.stack.indexOf("path") >= 0)) {
-//                return completeCUIE(editor, cur, token);
-            } else if (token.className == "string-2") {
-                return insertPrefixDef(editor, cur, token);
-            } else {
-                if (console && console.log) {
-                    console.log("State: " + token.state.stack);
-                }
-            }
-        });
-    }
-}
-
-}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/9c3b63b1/extras/webjars/codemirror/src/main/resources/sparql.js
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/sparql.js b/extras/webjars/codemirror/src/main/resources/sparql.js
deleted file mode 100644
index 8ffa73b..0000000
--- a/extras/webjars/codemirror/src/main/resources/sparql.js
+++ /dev/null
@@ -1,210 +0,0 @@
-// CodeMirror version 2.24
-//
-// All functions that need access to the editor's state live inside
-// the CodeMirror function. Below that, at the bottom of the file,
-// some utilities are defined.
-//
-// License: MIT-License <http://codemirror.net/LICENSE>
-
-CodeMirror.defineMode("sparql", function(config) {
-  var indentUnit = config.indentUnit;
-  var curPunc;
-
-  function wordRegexp(words) {
-    return new RegExp("^(?:" + words.join("|") + ")$", "i");
-  }
-  var ops = wordRegexp(["str", "lang", "langmatches", "datatype", "bound", "sameterm", "isiri", "isuri",
-                        "isblank", "isliteral", "union", "a"]);
-  var keywords = wordRegexp(["base", "prefix", "select", "distinct", "reduced", "construct", "describe",
-                             "ask", "from", "named", "where", "group", "order", "limit", "offset", "filter", 
-                             "optional", "graph", "by", "asc", "desc", "insert", "data", "delete"]);
-  var operatorChars = /[*+\-<>=&|]/;
-
-  function tokenBase(stream, state) {
-    var ch = stream.next();
-    curPunc = null;
-    if (ch == "$" || ch == "?") {
-      stream.match(/^[\w\d]*/);
-      return "variable-2";
-    }
-    else if (ch == "<" && !stream.match(/^[\s\u00a0=]/, false)) {
-      stream.match(/^[^\s\u00a0>]*>?/);
-      return "atom";
-    }
-    else if (ch == "\"" || ch == "'") {
-      state.tokenize = tokenLiteral(ch);
-      return state.tokenize(stream, state);
-    }
-    else if (/[{}\(\),\.;\[\]]/.test(ch)) {
-      curPunc = ch;
-      return null;
-    }
-    else if (ch == "#") {
-      stream.skipToEnd();
-      return "comment";
-    }
-    else if (operatorChars.test(ch)) {
-      stream.eatWhile(operatorChars);
-      return null;
-    }
-    else if (ch == ":") {
-      stream.eatWhile(/[\w\d\._\-]/);
-      return "atom";
-    }
-    else {
-      stream.eatWhile(/[_\w\d]/);
-      if (stream.eat(":")) {
-        stream.eatWhile(/[\w\d_\-]/);
-        return "atom";
-      }
-      var word = stream.current(), type;
-      if (ops.test(word))
-        return null;
-      else if (keywords.test(word))
-        return "keyword";
-      else
-        return "variable";
-    }
-  }
-
-  function tokenLiteral(quote) {
-    return function(stream, state) {
-      var escaped = false, ch;
-      while ((ch = stream.next()) != null) {
-        if (ch == quote && !escaped) {
-          state.tokenize = tokenBase;
-          break;
-        }
-        escaped = !escaped && ch == "\\";
-      }
-      return "string";
-    };
-  }
-
-  function pushContext(state, type, col) {
-    state.context = {prev: state.context, indent: state.indent, col: col, type: type};
-  }
-  function popContext(state) {
-    state.indent = state.context.indent;
-    state.context = state.context.prev;
-  }
-
-  return {
-    startState: function(base) {
-      return {tokenize: tokenBase,
-              context: null,
-              indent: 0,
-              col: 0};
-    },
-
-    token: function(stream, state) {
-      if (stream.sol()) {
-        if (state.context && state.context.align == null) state.context.align = false;
-        state.indent = stream.indentation();
-      }
-      if (stream.eatSpace()) return null;
-      var style = state.tokenize(stream, state);
-
-      if (style != "comment" && state.context && state.context.align == null && state.context.type != "pattern") {
-        state.context.align = true;
-      }
-
-      if (curPunc == "(") pushContext(state, ")", stream.column());
-      else if (curPunc == "[") pushContext(state, "]", stream.column());
-      else if (curPunc == "{") pushContext(state, "}", stream.column());
-      else if (/[\]\}\)]/.test(curPunc)) {
-        while (state.context && state.context.type == "pattern") popContext(state);
-        if (state.context && curPunc == state.context.type) popContext(state);
-      }
-      else if (curPunc == "." && state.context && state.context.type == "pattern") popContext(state);
-      else if (/atom|string|variable/.test(style) && state.context) {
-        if (/[\}\]]/.test(state.context.type))
-          pushContext(state, "pattern", stream.column());
-        else if (state.context.type == "pattern" && !state.context.align) {
-          state.context.align = true;
-          state.context.col = stream.column();
-        }
-      }
-      
-      return style;
-    },
-
-    indent: function(state, textAfter) {
-      var firstChar = textAfter && textAfter.charAt(0);
-      var context = state.context;
-      if (/[\]\}]/.test(firstChar))
-        while (context && context.type == "pattern") context = context.prev;
-
-      var closing = context && firstChar == context.type;
-      if (!context)
-        return 0;
-      else if (context.type == "pattern")
-        return context.col;
-      else if (context.align)
-        return context.col + (closing ? 0 : 1);
-      else
-        return context.indent + (closing ? 0 : indentUnit);
-    }
-  };
-});
-
-if (CodeMirror.simpleHint && jQuery) {
-    function completePrefix(editor, cur, token, prevToken) {
-        var line = editor.getLine(cur.line);
-        var match = line.match(/(^|;)\s*PREFIX\s+(\w+)\s*(:\s*<?)?(;|$)/);
-        if (match && match[2] && match[2] !== "") {
-            var prefix = match[2], result;
-            try {
-                jQuery.ajax("http://prefix.cc/" + prefix + ".file.json", {
-                    async: false,
-                    success: function(data) {
-                        result = data[prefix];
-                    },
-                    dataType: "json"
-                });
-            } catch (e) {}
-            if (result !== undefined) {
-                var pfx = line.substr(0,cur.ch);
-                var st = pfx.search(/\s*(:\s*<?)?$/);
-                return {
-                    list: [ ": <"+result+">" ],
-                    from: {line: cur.line, ch: st},
-                    to: cur
-                };
-            }
-        }
-        return false;
-    }
-    CodeMirror.commands.sparqlAutocomplete = function(cm) {
-        CodeMirror.simpleHint(cm, function(editor) {
-            var cur = editor.getCursor();
-            var line = editor.getLine(cur.line);
-
-            // search for the last prefix
-            for(i = cur.ch; i >= 0; i--) {
-                var token = editor.getTokenAt({line: cur.line, ch: i});
-                if(token.className == "keyword" && token.string == "PREFIX") {
-                    break;
-                }
-            }
-            console.dir(token);
-
-            // search for the next atom
-            for(i = token.end + 1; i <= cur.ch; i++) {
-                var atomToken = editor.getTokenAt({line: cur.line, ch: i});
-                if(atomToken.className == "atom") {
-                    break;
-                }
-            }
-            console.dir(atomToken);
-
-
-            if (atomToken.className == "atom") {
-                return completePrefix(editor, cur, atomToken, token);
-            }
-        });
-    }
-}
-
-
-CodeMirror.defineMIME("application/x-sparql-query", "sparql");

http://git-wip-us.apache.org/repos/asf/marmotta/blob/9c3b63b1/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index b2ac2a7..a8ad7d8 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -912,8 +912,13 @@
                 <version>1.8.21</version>
             </dependency>
             <dependency>
-                <groupId>org.apache.marmotta.webjars</groupId>
+                <groupId>org.webjars</groupId>
                 <artifactId>codemirror</artifactId>
+                <version>3.16</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.marmotta.webjars</groupId>
+                <artifactId>codemirror-modes</artifactId>
                 <version>${project.version}</version>
             </dependency>
             <dependency>


[2/9] removed codemirror sources and added dependency to the codemirror webjar TODO: Update L&N

Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/marmotta/blob/9c3b63b1/extras/webjars/codemirror/src/main/resources/ldpath.html
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/ldpath.html b/extras/webjars/codemirror/src/main/resources/ldpath.html
deleted file mode 100644
index 4a0ea12..0000000
--- a/extras/webjars/codemirror/src/main/resources/ldpath.html
+++ /dev/null
@@ -1,246 +0,0 @@
-<!--
-
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements. See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership. The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-
--->
-<!doctype html>
-<html>
-<head>
-<title>CodeMirror: LDPath Demo</title>
-<link rel="stylesheet" href="codemirror.css">
-<link rel="stylesheet" href="simple-hint.css">
-
-<script type="text/javascript" src="../../../webjars/jquery/1.8.2/jquery.min.js"></script>
-
-<script src="codemirror.js"></script>
-<script src="simple-hint.js"></script>
-<script src="ldpath.js"></script>
-
-<link rel="stylesheet" href="ldpath.css">
-
-<style type="text/css">
-.CodeMirror {
-    border: 1px solid #eee;
-}
-
-td {
-    padding-right: 20px;
-}
-body {
-  font-family: Droid Sans, Arial, sans-serif;
-  line-height: 1.5;
-  max-width: 64.3em;
-  margin: 3em auto;
-  padding: 0 1em;
-}
-
-h1 {
-  letter-spacing: -3px;
-  font-size: 3.23em;
-  font-weight: bold;
-  margin: 0;
-}
-
-h2 {
-  font-size: 1.23em;
-  font-weight: bold;
-  margin: .5em 0;
-  letter-spacing: -1px;
-}
-
-h3 {
-  font-size: 1em;
-  font-weight: bold;
-  margin: .4em 0;
-}
-
-pre {
-  background-color: #eee;
-  -moz-border-radius: 6px;
-  -webkit-border-radius: 6px;
-  border-radius: 6px;
-  padding: 1em;
-}
-
-pre.code {
-  margin: 0 1em;
-}
-
-.grey {
-  font-size: 2.2em;
-  padding: .5em 1em;
-  line-height: 1.2em;
-  margin-top: .5em;
-  position: relative;
-}
-
-img.logo {
-  position: absolute;
-  right: -25px;
-  bottom: 4px;
-}
-
-a:link, a:visited, .quasilink {
-  color: #df0019;
-  cursor: pointer;
-  text-decoration: none;
-}
-
-a:hover, .quasilink:hover {
-  color: #800004;
-}
-
-h1 a:link, h1 a:visited, h1 a:hover {
-  color: black;
-}
-
-ul {
-  margin: 0;
-  padding-left: 1.2em;
-}
-
-a.download {
-  color: white;
-  background-color: #df0019;
-  width: 100%;
-  display: block;
-  text-align: center;
-  font-size: 1.23em;
-  font-weight: bold;
-  text-decoration: none;
-  -moz-border-radius: 6px;
-  -webkit-border-radius: 6px;
-  border-radius: 6px;
-  padding: .5em 0;
-  margin-bottom: 1em;
-}
-
-a.download:hover {
-  background-color: #bb0010;
-}
-
-.rel {
-  margin-bottom: 0;
-}
-
-.rel-note {
-  color: #777;
-  font-size: .9em;
-  margin-top: .1em;
-}
-
-.logo-braces {
-  color: #df0019;
-  position: relative;
-  top: -4px;
-}
-
-.blk {
-  float: left;
-}
-
-.left {
-  width: 37em;
-  padding-right: 6.53em;
-  padding-bottom: 1em;
-}
-
-.left1 {
-  width: 15.24em;
-  padding-right: 6.45em;
-}
-
-.left2 {
-  width: 15.24em;
-}
-
-.right {
-  width: 20.68em;
-}
-
-.leftbig {
-  width: 42.44em;
-  padding-right: 6.53em;
-}
-
-.rightsmall {
-  width: 15.24em;
-}
-
-.clear:after {
-  visibility: hidden;
-  display: block;
-  font-size: 0;
-  content: " ";
-  clear: both;
-  height: 0;
-}
-.clear { display: inline-block; }
-/* start commented backslash hack \*/
-* html .clear { height: 1%; }
-.clear { display: block; }
-/* close commented backslash hack */
-</style>
-</head>
-<body>
-  <h1>CodeMirror: LDPath demo</h1>
-  <div>
-    Read about the <a href="http://marmotta.incubator.apache.org/ldpath/language.html" title="LDPath">LDPath Syntax</a>
-    in <a href="http://marmotta.incubator.apache.org/">Apache Marmotta</a>.
-  </div>
-  <div>
-    <button onclick="javascript:createEditor()">Editor</button>
-    <button onclick="javascript:removeEditor()">Plain</button>
-  </div>
-  <form>
-    <textarea id="code" name="code">
-@prefix iptc : <http://iptc.org/std/nar/2006-10-01/> ;
-@prefix foaf ;
-@prefix rss: ;
-@prefix sioc: ;
-@filter rdf:type is rss:item | rdf:type is isig:WebPage | rdf:type is sioc:Post ;
-  date = dc:date :: xsd:date(multiValued="false") ;
-  desc = dc:description[@de] :: lmf:text_en ;
-  feed = (^rss:items / rss:title | (page:partOf | sioc:has_container / dc:title)) :: xsd:string ;
-  lang = fn:first(^rss:items / dc:language, "de") :: xsd:string ;
-  summary = fn:removeTags((rss:description | dc:description)) :: lmf:text_en ;
-  title = (rss:title | (html:title | dc:title)) :: lmf:text_en ;
-  user = dc:creator :: xsd:string(multiValue="false") ;
-</textarea>
-  </form>
-  <script>
-            var editor = null;
-            function createEditor() {
-                if (editor === null) {
-                    editor = CodeMirror.fromTextArea(document.getElementById("code"), {
-                        lineNumbers : true,
-                        matchBrackets : true,
-						extraKeys: {"Ctrl-Space": "ldpathAutocomplete"},
-                        mode : "ldpath"
-                    });
-                }
-            }
-            function removeEditor() {
-                if (editor) {
-                    editor.toTextArea();
-                    editor = null;
-                }
-            }
-            createEditor();
-        </script>
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/marmotta/blob/9c3b63b1/extras/webjars/codemirror/src/main/resources/ldpath.js
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/ldpath.js b/extras/webjars/codemirror/src/main/resources/ldpath.js
deleted file mode 100644
index a5eb1a4..0000000
--- a/extras/webjars/codemirror/src/main/resources/ldpath.js
+++ /dev/null
@@ -1,471 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-if (CodeMirror && CodeMirror.defineMode) {
-CodeMirror.defineMode("ldpath", function(config, parserConfig) {
-    var token = {
-        COMMENT: "comment",
-        OP: "operator",
-        KWD: "keyword",
-        PREFIX: "qualifier",
-        IDENT: "atom",
-        DEF: "builtin",
-        TEST: "meta",
-        URL: "link",
-        STR: "string",
-        INT: "number",
-        BRACKET: "bracket",
-        WARNING: "string-2",
-        ERROR: "error"
-    },
-        predefinedNamespaces = parserConfig.namespaces || {},
-        baseURL = parserConfig.baseURL || null;
-    
-    function log(stream, status, result) {
-        return;
-        if (console && console.log) {
-            console.log(stream.current() + " := " + result + " (-> " + status.current() + ")");
-        }
-    }
-    
-    function getInitialState() {
-        return {
-            tmp: {},
-            namespaces: {},
-            predefinedNamespaces: predefinedNamespaces,
-            lmfBaseURL: baseURL,
-            stack: ['default'],
-            /* STACKING */
-            push: function(next) {
-                this.stack.unshift(next);
-            },
-            pop: function() {
-                if (this.stack.length <= 1) {
-                    return this.current();
-                } else {
-                    return this.stack.shift();
-                }
-            },
-            current: function() {
-                return this.stack[0];
-            },
-            reset: function() {
-                this.stack = ['default'];
-                this.tmp = {};
-            },
-            height: function() {
-                return this.stack.length;
-            },
-            /* PARSING */
-            parser: function(stream, state) {
-                var parser = parsers[this.current()] || parsers['default'];
-                return parser(stream, state);
-            },
-            /* NAMESPACES */
-            addPrefix: function(prefix, namespace) {
-                if (prefix && namespace)
-                    this.namespaces[prefix] = namespace;
-            },
-            getNamespace: function(prefix) {
-                return this.namespaces[prefix] || this.predefinedNamespaces[prefix];
-            }
-        };
-    }
-
-    function tokenError(stream, state) {
-        if (state.current() !== 'error') state.push('error');
-        stream.skipToEnd();
-        return token.ERROR;
-    }
-    
-    function tokenDefault(stream, state) {
-        // /* ... */
-        if (stream.match('/*')) {
-            state.push('comment');
-            return token.COMMENT;
-        }
-    
-        // @...
-        var kw = stream.match(/^@(\w+)/, true);
-        if (kw) {
-            state.push(kw[1]);
-            return token.KWD;
-        }
-
-        // <URL>
-        if (stream.eat('<')) {
-            state.push('url');
-            return token.BRACKET;
-        }
-        if (stream.eat('[')) {
-            state.push('test');
-            return token.BRACKET;
-        }
-        if (stream.eat('(')) {
-            if (state.current() == "transformer") {
-                state.push('config');
-            }
-            return token.BRACKET;
-        }
-        if (stream.eat(')')) {
-            if (state.current() == "config") {
-                state.pop();
-            }
-            return token.BRACKET;
-        }
-        if (stream.eat(/[\]>\{\}]/)) {
-            return token.BRACKET;
-        }
-
-        // prefix:label
-        if (stream.match(/^\w+:\w*/, false)) {
-            stream.skipTo(":")
-            if (state.current() == 'prefix') {
-                state.tmp["prefix"] = stream.current();
-                return token.PREFIX;
-            } else {
-                px = stream.current();
-                stream.eat(':');
-                if (state.getNamespace(px))
-                    return token.PREFIX;
-                else return token.WARNING;
-            }
-        }
-
-        if (stream.match("=", true)) {
-            if (state.current() == "default") {
-                state.push("path");
-            }
-            return token.DEF;
-        }
-        if (stream.match("::", true)) {
-            state.push("transformer");
-            return token.DEF;
-        }
-        // OPERATORS
-        if (stream.eat(/[:,&\|\/^\+\*.]/)) {
-            return token.OP;
-        }
-
-        if (stream.eat('"')) {
-            if (stream.skipTo('"') && stream.eat('"'))
-                return token.STR;
-            return tokenError(stream, state);
-        }
-        
-        // NUMBERS
-        if (stream.match(/^\d+/, true)) {
-            return token.INT;
-        }
-
-        // IDENT
-        if (state.current() == "prefix") {
-            if (stream.match(/^\w+/, true)) {
-                state.tmp["prefix"] = stream.current();
-                return token.PREFIX;
-            }
-        } else {
-            if (stream.match(/^[\w.-]+/, true)) {
-                return token.IDENT;
-            }
-        }
-
-        return tokenError(stream, state);
-    }
-
-    function tokenURL(stream, state) {
-        if (stream.eat('>')) {
-            state.pop();
-            return token.BRACKET;
-        }
-        if (stream.skipTo('>')) {
-            //state.pop();
-            var url = stream.current();
-            if (url.search(/^https?:\/\//) < 0 || url.search(/\s/) >= 0) {
-                return token.ERROR;
-            }
-            if (state.stack.indexOf("prefix") >= 0) {
-                state.tmp["ns"] = url;
-            }
-            return token.URL;
-        }
-        return tokenError(stream, state);
-    }
-
-    function tokenTest(stream, state) {
-        if (stream.eat(']')) {
-            state.pop();
-            return token.BRACKET;
-        }
-        if (stream.match(/@\w+/, true) || stream.match("^^", true)) {
-            return token.TEST;
-        }
-        if (stream.match("is-a", true)) {
-            return token.TEST;
-        }
-        if (stream.match("is ", false)) {
-            stream.match("is", true);
-            return token.TEST;
-        }
-        if (stream.eat(/[&\|]/)) {
-            return token.TEST;
-        }
-        return tokenDefault(stream, state);
-    }
-
-    var parsers = {
-        'default': tokenDefault,
-        filter: tokenTest,
-        url: tokenURL,
-        test: tokenTest,
-        error: tokenError
-    }
-
-
-    return {
-        startState: getInitialState,
-        compareStates: function(state1, state2) {
-            return state1.stack == state2.stack && state1.namespaces == state2.namespaces;
-        },
-        token: function(stream, state) {
-            // parse comments
-            if (state.current() == "comment") {
-                stream.skipTo('*') || stream.skipToEnd();
-                if (stream.match('*/')) {
-                    state.pop();
-                } else stream.eat('*');
-                return token.COMMENT;
-            } else if (stream.match('/*')) {
-                state.tmp.commentStart = stream.column();
-                state.push("comment");
-                return this.token(stream, state);
-            }
-            // ignore spaces
-            if (stream.eatSpace()) return null;
-            // ; starts parsing from scratch
-            if (stream.eat(';')) {
-                if (state.current() == "prefix") {
-                    state.addPrefix(state.tmp['prefix'], state.tmp['ns']); 
-                }
-                log(stream, state, "RESET");
-                state.reset(); 
-                return token.OP;
-            }
-            var result = state.parser(stream, state);
-            log(stream, state, result);
-            return result;
-        },
-        electricChars: "/@=[];",
-        indent: function(state, textAfter) {
-            switch (state.current()) {
-            case 'comment':
-                return state.tmp.commentStart +(textAfter.search(/^\s*\*\//)==0?1:3);
-                break;
-            case 'test':
-            case 'filter':
-                return 2 * config.indentUnit;
-                break;
-            case 'default':
-                // no indent for @prefix etc...
-                if (textAfter.search(/^\s*@/) == 0) {
-                    return 0;
-                }
-                return config.indentUnit;
-                break;
-            }
-            return 0;
-        }
-    }
-});
-
-// Autocompletion
-if (CodeMirror.simpleHint && jQuery) {
-    function completePrefix(editor, cur, token) {
-        var line = editor.getLine(cur.line);
-        var match = line.match(/(^|;)\s*@prefix\s+(\w+)\s*(:\s*<?)?(;|$)/);
-        if (match && match[2] && match[2] !== "") {
-            var prefix = match[2], result;
-            try {
-                jQuery.ajax(token.state.lmfBaseURL + "ldpath/util/prefix", {
-                    async: false,
-                    data: {prefix: prefix},
-                    success: function(data) {
-                        result = data[prefix];
-                    },
-                    dataType: "json"
-                });
-            } catch (e) {}
-            if (result !== undefined) {
-                var pfx = line.substr(0,cur.ch);
-                var st = pfx.search(/\s*(:\s*<?)?$/);
-                return {
-                    list: [ ": <"+result+">;" ],
-                    from: {line: cur.line, ch: st},
-                    to: cur
-                };
-            }
-        }
-        return false;
-    }
-    function completeURI(editor, cur, token) {
-        var bC = token.string.substr(0, cur.ch - token.start),
-        aC = token.string.substr(cur.ch - token.start),
-        replUntil = token.state.current()=='url'?token.end+1:cur.ch + Math.max(aC.search(/[\s]/), 0);
-        
-        var suggestions;
-        try {
-            var qs = {};
-            if (token.state.stack.indexOf("transformer") >= 0) qs['mode'] = "transformer";
-            for (var n in token.state.namespaces) {
-                qs['ns_'+n] = token.state.getNamespace(n);
-            }
-            qs['uri'] = bC;
-            
-            jQuery.ajax(token.state.lmfBaseURL + "ldpath/util/complete", {
-               async: false,
-               data: qs,
-               success: function(data) {
-                   suggestions = data;  
-               },
-               dataType: "json"
-            });
-        } catch (e) {}
-        if (suggestions !== undefined) {
-            for (var i = 0; i < suggestions.length; i++) {
-                if (suggestions[i].match(/^\w+:\w+$/)) {
-                    // curie!
-                    suggestions[i] = suggestions[i] + " ";
-                } else {
-                    suggestions[i] = "<" + suggestions[i] + "> ";
-                }
-            }
-            return {
-              list: suggestions,
-              from: {line: cur.line, ch: token.start - 1},
-              to: {line: cur.line, ch: replUntil}
-            };
-        }
-        return false;
-    }
-    function completeCUIE(editor, cur, token) {
-        var from = token.start, 
-            to = token.end, 
-            req = token.string.substr(0, cur.ch - token.start);
-        var prevToken = editor.getTokenAt({line: cur.line, ch: token.start});
-        if (token.className == 'atom' && prevToken.className == 'qualifier') {
-            from = prevToken.start;
-            req = prevToken.string + req;
-        }
-        
-        var suggestions;
-        try {
-            var qs = {};
-            if (token.state.stack.indexOf("transformer") >= 0) qs['mode'] = "transformer";
-            for (var n in token.state.namespaces) {
-                qs['ns_'+n] = token.state.getNamespace(n);
-            }
-            qs['prefix'] = req;
-
-            jQuery.ajax(token.state.lmfBaseURL + "ldpath/util/complete", {
-               async: false,
-               data: qs,
-               success: function(data) {
-                   suggestions = data;  
-               },
-               dataType: "json"
-            });
-        } catch (e) {}
-        if (suggestions !== undefined) {
-            for (var i = 0; i < suggestions.length; i++) {
-                if (suggestions[i].match(/^\w+:\w+(\(\))?$/)) {
-                    // curie!
-                    suggestions[i] = suggestions[i] + " ";
-                } else {
-                    // prefix only
-                    suggestions[i] = suggestions[i] + ":";
-                }
-            }
-            return {
-              list: suggestions,
-              from: {line: cur.line, ch: from},
-              to: {line: cur.line, ch: to}
-            };
-        }
-        
-        return false;
-    }
-    function insertPrefixDef(editor, cur, token) {
-        var prefix = token.string.replace(/:?$/, ""), result;
-        try {
-            jQuery.ajax(token.state.lmfBaseURL + "ldpath/util/prefix", {
-//            jQuery.ajax("http://prefix.cc/" + prefix + ".file.json", {
-                async: false,
-                data: {prefix: prefix},
-                success: function(data) {
-                    result = data[prefix];
-                },
-                dataType: "json"
-            });
-        } catch (e) {}
-        if (result !== undefined) {
-            // check if this url is already prefixed
-            var px;
-            for (var i in token.state.namespaces) {
-                if (token.state.namespaces[i] == result) {
-                    px = i;
-                    break;
-                }
-            } 
-            if (px) {
-                return {
-                    list: [ px + ":" ],
-                    from: { line: cur.line, ch: token.start },
-                    to: { line: cur.line, ch: token.end }
-                };
-            } else {
-            return {
-                list: [ "@prefix " + prefix + ": <" + result + "> ;\n" ],
-                from: {line: 0, ch: 0},
-                to: {line: 0, ch: 0}
-            };
-            } 
-        }
-    }
-    CodeMirror.commands.ldpathAutocomplete = function(cm) {
-        CodeMirror.simpleHint(cm, function(editor) {
-            var cur = editor.getCursor();
-            var line = editor.getLine(cur.line);
-            var token = editor.getTokenAt(cur);
-        
-            if (token.state.stack.indexOf('prefix') >= 0) {
-                return completePrefix(editor, cur, token);
-            } else if (token.state.current() == 'url' || (token.state.current() == 'error' && token.state.stack[1] == 'url')) {
-                return completeURI(editor, cur, token);
-            } else if (token.className == "qualifier" || (token.className == "atom" && token.state.stack.indexOf("path") >= 0)) {
-                return completeCUIE(editor, cur, token);
-            } else if (token.className == "string-2") {
-                return insertPrefixDef(editor, cur, token);
-            } else {
-                if (console && console.log) {
-                    console.log("State: " + token.state.stack);
-                }
-            }
-        });
-    }
-}
-
-}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/9c3b63b1/extras/webjars/codemirror/src/main/resources/matchbrackets.js
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/matchbrackets.js b/extras/webjars/codemirror/src/main/resources/matchbrackets.js
deleted file mode 100644
index 131fe83..0000000
--- a/extras/webjars/codemirror/src/main/resources/matchbrackets.js
+++ /dev/null
@@ -1,86 +0,0 @@
-(function() {
-  var ie_lt8 = /MSIE \d/.test(navigator.userAgent) &&
-    (document.documentMode == null || document.documentMode < 8);
-
-  var Pos = CodeMirror.Pos;
-
-  var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"};
-  function findMatchingBracket(cm, where, strict) {
-    var state = cm.state.matchBrackets;
-    var maxScanLen = (state && state.maxScanLineLength) || 10000;
-
-    var cur = where || cm.getCursor(), line = cm.getLineHandle(cur.line), pos = cur.ch - 1;
-    var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];
-    if (!match) return null;
-    var forward = match.charAt(1) == ">", d = forward ? 1 : -1;
-    if (strict && forward != (pos == cur.ch)) return null;
-    var style = cm.getTokenTypeAt(Pos(cur.line, pos + 1));
-
-    var stack = [line.text.charAt(pos)], re = /[(){}[\]]/;
-    function scan(line, lineNo, start) {
-      if (!line.text) return;
-      var pos = forward ? 0 : line.text.length - 1, end = forward ? line.text.length : -1;
-      if (line.text.length > maxScanLen) return null;
-      if (start != null) pos = start + d;
-      for (; pos != end; pos += d) {
-        var ch = line.text.charAt(pos);
-        if (re.test(ch) && cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style) {
-          var match = matching[ch];
-          if (match.charAt(1) == ">" == forward) stack.push(ch);
-          else if (stack.pop() != match.charAt(0)) return {pos: pos, match: false};
-          else if (!stack.length) return {pos: pos, match: true};
-        }
-      }
-    }
-    for (var i = cur.line, found, e = forward ? Math.min(i + 100, cm.lineCount()) : Math.max(-1, i - 100); i != e; i+=d) {
-      if (i == cur.line) found = scan(line, i, pos);
-      else found = scan(cm.getLineHandle(i), i);
-      if (found) break;
-    }
-    return {from: Pos(cur.line, pos), to: found && Pos(i, found.pos),
-            match: found && found.match, forward: forward};
-  }
-
-  function matchBrackets(cm, autoclear) {
-    // Disable brace matching in long lines, since it'll cause hugely slow updates
-    var maxHighlightLen = cm.state.matchBrackets.maxHighlightLineLength || 1000;
-    var found = findMatchingBracket(cm);
-    if (!found || cm.getLine(found.from.line).length > maxHighlightLen ||
-       found.to && cm.getLine(found.to.line).length > maxHighlightLen)
-      return;
-
-    var style = found.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket";
-    var one = cm.markText(found.from, Pos(found.from.line, found.from.ch + 1), {className: style});
-    var two = found.to && cm.markText(found.to, Pos(found.to.line, found.to.ch + 1), {className: style});
-    // Kludge to work around the IE bug from issue #1193, where text
-    // input stops going to the textare whever this fires.
-    if (ie_lt8 && cm.state.focused) cm.display.input.focus();
-    var clear = function() {
-      cm.operation(function() { one.clear(); two && two.clear(); });
-    };
-    if (autoclear) setTimeout(clear, 800);
-    else return clear;
-  }
-
-  var currentlyHighlighted = null;
-  function doMatchBrackets(cm) {
-    cm.operation(function() {
-      if (currentlyHighlighted) {currentlyHighlighted(); currentlyHighlighted = null;}
-      if (!cm.somethingSelected()) currentlyHighlighted = matchBrackets(cm, false);
-    });
-  }
-
-  CodeMirror.defineOption("matchBrackets", false, function(cm, val, old) {
-    if (old && old != CodeMirror.Init)
-      cm.off("cursorActivity", doMatchBrackets);
-    if (val) {
-      cm.state.matchBrackets = typeof val == "object" ? val : {};
-      cm.on("cursorActivity", doMatchBrackets);
-    }
-  });
-
-  CodeMirror.defineExtension("matchBrackets", function() {matchBrackets(this, true);});
-  CodeMirror.defineExtension("findMatchingBracket", function(pos, strict){
-    return findMatchingBracket(this, pos, strict);
-  });
-})();

http://git-wip-us.apache.org/repos/asf/marmotta/blob/9c3b63b1/extras/webjars/codemirror/src/main/resources/mode/ldpath/ldpath.css
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/mode/ldpath/ldpath.css b/extras/webjars/codemirror/src/main/resources/mode/ldpath/ldpath.css
new file mode 100644
index 0000000..7cede3f
--- /dev/null
+++ b/extras/webjars/codemirror/src/main/resources/mode/ldpath/ldpath.css
@@ -0,0 +1,181 @@
+/*
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements. See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership. The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+ */
+
+.CodeMirror {
+    border: 1px solid #eee;
+}
+
+td {
+    padding-right: 20px;
+}
+body {
+  font-family: Droid Sans, Arial, sans-serif;
+  line-height: 1.5;
+  max-width: 64.3em;
+  margin: 3em auto;
+  padding: 0 1em;
+}
+
+h1 {
+  letter-spacing: -3px;
+  font-size: 3.23em;
+  font-weight: bold;
+  margin: 0;
+}
+
+h2 {
+  font-size: 1.23em;
+  font-weight: bold;
+  margin: .5em 0;
+  letter-spacing: -1px;
+}
+
+h3 {
+  font-size: 1em;
+  font-weight: bold;
+  margin: .4em 0;
+}
+
+pre {
+  background-color: #eee;
+  -moz-border-radius: 6px;
+  -webkit-border-radius: 6px;
+  border-radius: 6px;
+  padding: 1em;
+}
+
+pre.code {
+  margin: 0 1em;
+}
+
+.grey {
+  font-size: 2.2em;
+  padding: .5em 1em;
+  line-height: 1.2em;
+  margin-top: .5em;
+  position: relative;
+}
+
+img.logo {
+  position: absolute;
+  right: -25px;
+  bottom: 4px;
+}
+
+a:link, a:visited, .quasilink {
+  color: #df0019;
+  cursor: pointer;
+  text-decoration: none;
+}
+
+a:hover, .quasilink:hover {
+  color: #800004;
+}
+
+h1 a:link, h1 a:visited, h1 a:hover {
+  color: black;
+}
+
+ul {
+  margin: 0;
+  padding-left: 1.2em;
+}
+
+a.download {
+  color: white;
+  background-color: #df0019;
+  width: 100%;
+  display: block;
+  text-align: center;
+  font-size: 1.23em;
+  font-weight: bold;
+  text-decoration: none;
+  -moz-border-radius: 6px;
+  -webkit-border-radius: 6px;
+  border-radius: 6px;
+  padding: .5em 0;
+  margin-bottom: 1em;
+}
+
+a.download:hover {
+  background-color: #bb0010;
+}
+
+.rel {
+  margin-bottom: 0;
+}
+
+.rel-note {
+  color: #777;
+  font-size: .9em;
+  margin-top: .1em;
+}
+
+.logo-braces {
+  color: #df0019;
+  position: relative;
+  top: -4px;
+}
+
+.blk {
+  float: left;
+}
+
+.left {
+  width: 37em;
+  padding-right: 6.53em;
+  padding-bottom: 1em;
+}
+
+.left1 {
+  width: 15.24em;
+  padding-right: 6.45em;
+}
+
+.left2 {
+  width: 15.24em;
+}
+
+.right {
+  width: 20.68em;
+}
+
+.leftbig {
+  width: 42.44em;
+  padding-right: 6.53em;
+}
+
+.rightsmall {
+  width: 15.24em;
+}
+
+.clear:after {
+  visibility: hidden;
+  display: block;
+  font-size: 0;
+  content: " ";
+  clear: both;
+  height: 0;
+}
+.clear { display: inline-block; }
+/* start commented backslash hack \*/
+* html .clear { height: 1%; }
+.clear { display: block; }
+/* close commented backslash hack */

http://git-wip-us.apache.org/repos/asf/marmotta/blob/9c3b63b1/extras/webjars/codemirror/src/main/resources/mode/ldpath/ldpath.html
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/mode/ldpath/ldpath.html b/extras/webjars/codemirror/src/main/resources/mode/ldpath/ldpath.html
new file mode 100644
index 0000000..38f11ba
--- /dev/null
+++ b/extras/webjars/codemirror/src/main/resources/mode/ldpath/ldpath.html
@@ -0,0 +1,87 @@
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements. See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership. The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!doctype html>
+<html>
+<head>
+<title>CodeMirror: LDPath Demo</title>
+
+<script type="text/javascript" src="../../../../../webjars/jquery/1.8.2/jquery.min.js"></script>
+
+<script type="text/javascript" src="../../../../../webjars/codemirror/3.16/lib/codemirror.js"></script>
+<link rel="stylesheet" href="../../../../../webjars/codemirror/3.16/lib/codemirror.css">
+
+<script src="../../../../../webjars/codemirror/3.16/addon/hint/show-hint.js"></script>
+<link rel="stylesheet" href="../../../../../webjars/codemirror/3.16/addon/hint/show-hint.css">
+
+<script src="ldpath.js"></script>
+<link rel="stylesheet" href="ldpath.css">
+
+</head>
+<body>
+  <h1>CodeMirror: LDPath demo</h1>
+  <div>
+    Read about the <a href="http://marmotta.incubator.apache.org/ldpath/language.html" title="LDPath">LDPath Syntax</a>
+    in <a href="http://marmotta.incubator.apache.org/">Apache Marmotta</a>.
+  </div>
+  <div>
+    <button onclick="javascript:createEditor()">Editor</button>
+    <button onclick="javascript:removeEditor()">Plain</button>
+  </div>
+  <form>
+    <textarea id="code" name="code">
+@prefix iptc : &lt;http://iptc.org/std/nar/2006-10-01/&gt; ;
+@prefix foaf ;
+@prefix rss: ;
+@prefix sioc: ;
+@filter rdf:type is rss:item | rdf:type is isig:WebPage | rdf:type is sioc:Post ;
+  date = dc:date :: xsd:date(multiValued="false") ;
+  desc = dc:description[@de] :: lmf:text_en ;
+  feed = (^rss:items / rss:title | (page:partOf | sioc:has_container / dc:title)) :: xsd:string ;
+  lang = fn:first(^rss:items / dc:language, "de") :: xsd:string ;
+  summary = fn:removeTags((rss:description | dc:description)) :: lmf:text_en ;
+  title = (rss:title | (html:title | dc:title)) :: lmf:text_en ;
+  user = dc:creator :: xsd:string(multiValue="false") ;
+</textarea>
+  </form>
+  <script>
+            var editor = null;
+            function createEditor() {
+                if (editor === null) {
+                    CodeMirror.commands.autocomplete = function(cm) {
+                        CodeMirror.showHint(cm, CodeMirror.hint.ldpath);
+                    };
+                    editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+                        lineNumbers : true,
+                        matchBrackets : true,
+						extraKeys: {"Ctrl-Space": "autocomplete"},
+                        mode : "ldpath"
+                    });
+                }
+            }
+            function removeEditor() {
+                if (editor) {
+                    editor.toTextArea();
+                    editor = null;
+                }
+            }
+            createEditor();
+        </script>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/marmotta/blob/9c3b63b1/extras/webjars/codemirror/src/main/resources/mode/ldpath/ldpath.js
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/mode/ldpath/ldpath.js b/extras/webjars/codemirror/src/main/resources/mode/ldpath/ldpath.js
new file mode 100644
index 0000000..f981f87
--- /dev/null
+++ b/extras/webjars/codemirror/src/main/resources/mode/ldpath/ldpath.js
@@ -0,0 +1,471 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+if (CodeMirror && CodeMirror.defineMode) {
+CodeMirror.defineMode("ldpath", function(config, parserConfig) {
+    var token = {
+        COMMENT: "comment",
+        OP: "operator",
+        KWD: "keyword",
+        PREFIX: "qualifier",
+        IDENT: "atom",
+        DEF: "builtin",
+        TEST: "meta",
+        URL: "link",
+        STR: "string",
+        INT: "number",
+        BRACKET: "bracket",
+        WARNING: "string-2",
+        ERROR: "error"
+    },
+        predefinedNamespaces = parserConfig.namespaces || {},
+        baseURL = parserConfig.baseURL || null;
+    
+    function log(stream, status, result) {
+        return;
+        if (console && console.log) {
+            console.log(stream.current() + " := " + result + " (-> " + status.current() + ")");
+        }
+    }
+    
+    function getInitialState() {
+        return {
+            tmp: {},
+            namespaces: {},
+            predefinedNamespaces: predefinedNamespaces,
+            lmfBaseURL: baseURL,
+            stack: ['default'],
+            /* STACKING */
+            push: function(next) {
+                this.stack.unshift(next);
+            },
+            pop: function() {
+                if (this.stack.length <= 1) {
+                    return this.current();
+                } else {
+                    return this.stack.shift();
+                }
+            },
+            current: function() {
+                return this.stack[0];
+            },
+            reset: function() {
+                this.stack = ['default'];
+                this.tmp = {};
+            },
+            height: function() {
+                return this.stack.length;
+            },
+            /* PARSING */
+            parser: function(stream, state) {
+                var parser = parsers[this.current()] || parsers['default'];
+                return parser(stream, state);
+            },
+            /* NAMESPACES */
+            addPrefix: function(prefix, namespace) {
+                if (prefix && namespace)
+                    this.namespaces[prefix] = namespace;
+            },
+            getNamespace: function(prefix) {
+                return this.namespaces[prefix] || this.predefinedNamespaces[prefix];
+            }
+        };
+    }
+
+    function tokenError(stream, state) {
+        if (state.current() !== 'error') state.push('error');
+        stream.skipToEnd();
+        return token.ERROR;
+    }
+    
+    function tokenDefault(stream, state) {
+        // /* ... */
+        if (stream.match('/*')) {
+            state.push('comment');
+            return token.COMMENT;
+        }
+    
+        // @...
+        var kw = stream.match(/^@(\w+)/, true);
+        if (kw) {
+            state.push(kw[1]);
+            return token.KWD;
+        }
+
+        // <URL>
+        if (stream.eat('<')) {
+            state.push('url');
+            return token.BRACKET;
+        }
+        if (stream.eat('[')) {
+            state.push('test');
+            return token.BRACKET;
+        }
+        if (stream.eat('(')) {
+            if (state.current() == "transformer") {
+                state.push('config');
+            }
+            return token.BRACKET;
+        }
+        if (stream.eat(')')) {
+            if (state.current() == "config") {
+                state.pop();
+            }
+            return token.BRACKET;
+        }
+        if (stream.eat(/[\]>\{\}]/)) {
+            return token.BRACKET;
+        }
+
+        // prefix:label
+        if (stream.match(/^\w+:\w*/, false)) {
+            stream.skipTo(":")
+            if (state.current() == 'prefix') {
+                state.tmp["prefix"] = stream.current();
+                return token.PREFIX;
+            } else {
+                px = stream.current();
+                stream.eat(':');
+                if (state.getNamespace(px))
+                    return token.PREFIX;
+                else return token.WARNING;
+            }
+        }
+
+        if (stream.match("=", true)) {
+            if (state.current() == "default") {
+                state.push("path");
+            }
+            return token.DEF;
+        }
+        if (stream.match("::", true)) {
+            state.push("transformer");
+            return token.DEF;
+        }
+        // OPERATORS
+        if (stream.eat(/[:,&\|\/^\+\*.]/)) {
+            return token.OP;
+        }
+
+        if (stream.eat('"')) {
+            if (stream.skipTo('"') && stream.eat('"'))
+                return token.STR;
+            return tokenError(stream, state);
+        }
+        
+        // NUMBERS
+        if (stream.match(/^\d+/, true)) {
+            return token.INT;
+        }
+
+        // IDENT
+        if (state.current() == "prefix") {
+            if (stream.match(/^\w+/, true)) {
+                state.tmp["prefix"] = stream.current();
+                return token.PREFIX;
+            }
+        } else {
+            if (stream.match(/^[\w.-]+/, true)) {
+                return token.IDENT;
+            }
+        }
+
+        return tokenError(stream, state);
+    }
+
+    function tokenURL(stream, state) {
+        if (stream.eat('>')) {
+            state.pop();
+            return token.BRACKET;
+        }
+        if (stream.skipTo('>')) {
+            //state.pop();
+            var url = stream.current();
+            if (url.search(/^https?:\/\//) < 0 || url.search(/\s/) >= 0) {
+                return token.ERROR;
+            }
+            if (state.stack.indexOf("prefix") >= 0) {
+                state.tmp["ns"] = url;
+            }
+            return token.URL;
+        }
+        return tokenError(stream, state);
+    }
+
+    function tokenTest(stream, state) {
+        if (stream.eat(']')) {
+            state.pop();
+            return token.BRACKET;
+        }
+        if (stream.match(/@\w+/, true) || stream.match("^^", true)) {
+            return token.TEST;
+        }
+        if (stream.match("is-a", true)) {
+            return token.TEST;
+        }
+        if (stream.match("is ", false)) {
+            stream.match("is", true);
+            return token.TEST;
+        }
+        if (stream.eat(/[&\|]/)) {
+            return token.TEST;
+        }
+        return tokenDefault(stream, state);
+    }
+
+    var parsers = {
+        'default': tokenDefault,
+        filter: tokenTest,
+        url: tokenURL,
+        test: tokenTest,
+        error: tokenError
+    }
+
+
+    return {
+        startState: getInitialState,
+        compareStates: function(state1, state2) {
+            return state1.stack == state2.stack && state1.namespaces == state2.namespaces;
+        },
+        token: function(stream, state) {
+            // parse comments
+            if (state.current() == "comment") {
+                stream.skipTo('*') || stream.skipToEnd();
+                if (stream.match('*/')) {
+                    state.pop();
+                } else stream.eat('*');
+                return token.COMMENT;
+            } else if (stream.match('/*')) {
+                state.tmp.commentStart = stream.column();
+                state.push("comment");
+                return this.token(stream, state);
+            }
+            // ignore spaces
+            if (stream.eatSpace()) return null;
+            // ; starts parsing from scratch
+            if (stream.eat(';')) {
+                if (state.current() == "prefix") {
+                    state.addPrefix(state.tmp['prefix'], state.tmp['ns']); 
+                }
+                log(stream, state, "RESET");
+                state.reset(); 
+                return token.OP;
+            }
+            var result = state.parser(stream, state);
+            log(stream, state, result);
+            return result;
+        },
+        electricChars: "/@=[];",
+        indent: function(state, textAfter) {
+            switch (state.current()) {
+            case 'comment':
+                return state.tmp.commentStart +(textAfter.search(/^\s*\*\//)==0?1:3);
+                break;
+            case 'test':
+            case 'filter':
+                return 2 * config.indentUnit;
+                break;
+            case 'default':
+                // no indent for @prefix etc...
+                if (textAfter.search(/^\s*@/) == 0) {
+                    return 0;
+                }
+                return config.indentUnit;
+                break;
+            }
+            return 0;
+        }
+    }
+});
+
+// Autocompletion
+if (CodeMirror.showHint && jQuery) {
+    function completePrefix(editor, cur, token) {
+        var line = editor.getLine(cur.line);
+        var match = line.match(/(^|;)\s*@prefix\s+(\w+)\s*(:\s*<?)?(;|$)/);
+        if (match && match[2] && match[2] !== "") {
+            var prefix = match[2], result;
+            try {
+                jQuery.ajax(token.state.lmfBaseURL + "ldpath/util/prefix", {
+//                jQuery.ajax("http://prefix.cc/" + prefix + ".file.json", {
+                    async: false,
+                    data: {prefix: prefix},
+                    success: function(data) {
+                        result = data[prefix];
+                    },
+                    dataType: "json"
+                });
+            } catch (e) {}
+            if (result !== undefined) {
+                var pfx = line.substr(0,cur.ch);
+                var st = pfx.search(/\s*(:\s*<?)?$/);
+                return {
+                    list: [ ": <"+result+">;" ],
+                    from: {line: cur.line, ch: st},
+                    to: cur
+                };
+            }
+        }
+        return false;
+    }
+    function completeURI(editor, cur, token) {
+        var bC = token.string.substr(0, cur.ch - token.start),
+        aC = token.string.substr(cur.ch - token.start),
+        replUntil = token.state.current()=='url'?token.end+1:cur.ch + Math.max(aC.search(/[\s]/), 0);
+        
+        var suggestions;
+        try {
+            var qs = {};
+            if (token.state.stack.indexOf("transformer") >= 0) qs['mode'] = "transformer";
+            for (var n in token.state.namespaces) {
+                qs['ns_'+n] = token.state.getNamespace(n);
+            }
+            qs['uri'] = bC;
+            
+            jQuery.ajax(token.state.lmfBaseURL + "ldpath/util/complete", {
+               async: false,
+               data: qs,
+               success: function(data) {
+                   suggestions = data;  
+               },
+               dataType: "json"
+            });
+        } catch (e) {}
+        if (suggestions !== undefined) {
+            for (var i = 0; i < suggestions.length; i++) {
+                if (suggestions[i].match(/^\w+:\w+$/)) {
+                    // curie!
+                    suggestions[i] = suggestions[i] + " ";
+                } else {
+                    suggestions[i] = "<" + suggestions[i] + "> ";
+                }
+            }
+            return {
+              list: suggestions,
+              from: {line: cur.line, ch: token.start - 1},
+              to: {line: cur.line, ch: replUntil}
+            };
+        }
+        return false;
+    }
+    function completeCUIE(editor, cur, token) {
+        var from = token.start, 
+            to = token.end, 
+            req = token.string.substr(0, cur.ch - token.start);
+        var prevToken = editor.getTokenAt({line: cur.line, ch: token.start});
+        if (token.className == 'atom' && prevToken.className == 'qualifier') {
+            from = prevToken.start;
+            req = prevToken.string + req;
+        }
+        
+        var suggestions;
+        try {
+            var qs = {};
+            if (token.state.stack.indexOf("transformer") >= 0) qs['mode'] = "transformer";
+            for (var n in token.state.namespaces) {
+                qs['ns_'+n] = token.state.getNamespace(n);
+            }
+            qs['prefix'] = req;
+
+            jQuery.ajax(token.state.lmfBaseURL + "ldpath/util/complete", {
+               async: false,
+               data: qs,
+               success: function(data) {
+                   suggestions = data;  
+               },
+               dataType: "json"
+            });
+        } catch (e) {}
+        if (suggestions !== undefined) {
+            for (var i = 0; i < suggestions.length; i++) {
+                if (suggestions[i].match(/^\w+:\w+(\(\))?$/)) {
+                    // curie!
+                    suggestions[i] = suggestions[i] + " ";
+                } else {
+                    // prefix only
+                    suggestions[i] = suggestions[i] + ":";
+                }
+            }
+            return {
+              list: suggestions,
+              from: {line: cur.line, ch: from},
+              to: {line: cur.line, ch: to}
+            };
+        }
+        
+        return false;
+    }
+    function insertPrefixDef(editor, cur, token) {
+        var prefix = token.string.replace(/:?$/, ""), result;
+        try {
+            jQuery.ajax(token.state.lmfBaseURL + "ldpath/util/prefix", {
+//            jQuery.ajax("http://prefix.cc/" + prefix + ".file.json", {
+                async: false,
+                data: {prefix: prefix},
+                success: function(data) {
+                    result = data[prefix];
+                },
+                dataType: "json"
+            });
+        } catch (e) {}
+        if (result !== undefined) {
+            // check if this url is already prefixed
+            var px;
+            for (var i in token.state.namespaces) {
+                if (token.state.namespaces[i] == result) {
+                    px = i;
+                    break;
+                }
+            } 
+            if (px) {
+                return {
+                    list: [ px + ":" ],
+                    from: { line: cur.line, ch: token.start },
+                    to: { line: cur.line, ch: token.end }
+                };
+            } else {
+            return {
+                list: [ "@prefix " + prefix + ": <" + result + "> ;\n" ],
+                from: {line: 0, ch: 0},
+                to: {line: 0, ch: 0}
+            };
+            } 
+        }
+    }
+    function ldpathAutocomplete(editor, options) {
+        var cur = editor.getCursor(),
+            line = editor.getLine(cur.line),
+            token = editor.getTokenAt(cur);
+    
+        if (token.state.stack.indexOf('prefix') >= 0) {
+            return completePrefix(editor, cur, token);
+        } else if (token.state.current() == 'url' || (token.state.current() == 'error' && token.state.stack[1] == 'url')) {
+            return completeURI(editor, cur, token);
+        } else if (token.className == "qualifier" || (token.className == "atom" && token.state.stack.indexOf("path") >= 0)) {
+            return completeCUIE(editor, cur, token);
+        } else if (token.className == "string-2") {
+            return insertPrefixDef(editor, cur, token);
+        } else {
+            if (console && console.log) {
+                console.log("State: " + token.state.stack);
+            }
+        }
+    }
+    CodeMirror.registerHelper("hint", "ldpath", ldpathAutocomplete);
+}
+
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/9c3b63b1/extras/webjars/codemirror/src/main/resources/mode/skwrl/skwrl.css
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/mode/skwrl/skwrl.css b/extras/webjars/codemirror/src/main/resources/mode/skwrl/skwrl.css
new file mode 100644
index 0000000..838b773
--- /dev/null
+++ b/extras/webjars/codemirror/src/main/resources/mode/skwrl/skwrl.css
@@ -0,0 +1,172 @@
+@CHARSET "UTF-8";
+
+.CodeMirror {
+    border: 1px solid #eee;
+}
+
+td {
+    padding-right: 20px;
+}
+
+body {
+    font-family: Droid Sans, Arial, sans-serif;
+    line-height: 1.5;
+    max-width: 64.3em;
+    margin: 3em auto;
+    padding: 0 1em;
+}
+
+h1 {
+    letter-spacing: -3px;
+    font-size: 3.23em;
+    font-weight: bold;
+    margin: 0;
+}
+
+h2 {
+    font-size: 1.23em;
+    font-weight: bold;
+    margin: .5em 0;
+    letter-spacing: -1px;
+}
+
+h3 {
+    font-size: 1em;
+    font-weight: bold;
+    margin: .4em 0;
+}
+
+pre {
+    background-color: #eee;
+    -moz-border-radius: 6px;
+    -webkit-border-radius: 6px;
+    border-radius: 6px;
+    padding: 1em;
+}
+
+pre.code {
+    margin: 0 1em;
+}
+
+.grey {
+    font-size: 2.2em;
+    padding: .5em 1em;
+    line-height: 1.2em;
+    margin-top: .5em;
+    position: relative;
+}
+
+img.logo {
+    position: absolute;
+    right: -25px;
+    bottom: 4px;
+}
+
+a:link,a:visited,.quasilink {
+    color: #df0019;
+    cursor: pointer;
+    text-decoration: none;
+}
+
+a:hover,.quasilink:hover {
+    color: #800004;
+}
+
+h1 a:link,h1 a:visited,h1 a:hover {
+    color: black;
+}
+
+ul {
+    margin: 0;
+    padding-left: 1.2em;
+}
+
+a.download {
+    color: white;
+    background-color: #df0019;
+    width: 100%;
+    display: block;
+    text-align: center;
+    font-size: 1.23em;
+    font-weight: bold;
+    text-decoration: none;
+    -moz-border-radius: 6px;
+    -webkit-border-radius: 6px;
+    border-radius: 6px;
+    padding: .5em 0;
+    margin-bottom: 1em;
+}
+
+a.download:hover {
+    background-color: #bb0010;
+}
+
+.rel {
+    margin-bottom: 0;
+}
+
+.rel-note {
+    color: #777;
+    font-size: .9em;
+    margin-top: .1em;
+}
+
+.logo-braces {
+    color: #df0019;
+    position: relative;
+    top: -4px;
+}
+
+.blk {
+    float: left;
+}
+
+.left {
+    width: 37em;
+    padding-right: 6.53em;
+    padding-bottom: 1em;
+}
+
+.left1 {
+    width: 15.24em;
+    padding-right: 6.45em;
+}
+
+.left2 {
+    width: 15.24em;
+}
+
+.right {
+    width: 20.68em;
+}
+
+.leftbig {
+    width: 42.44em;
+    padding-right: 6.53em;
+}
+
+.rightsmall {
+    width: 15.24em;
+}
+
+.clear:after {
+    visibility: hidden;
+    display: block;
+    font-size: 0;
+    content: " ";
+    clear: both;
+    height: 0;
+}
+
+.clear {
+    display: inline-block;
+}
+/* start commented backslash hack \*/
+* html .clear {
+    height: 1%;
+}
+
+.clear {
+    display: block;
+}
+/* close commented backslash hack */
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/marmotta/blob/9c3b63b1/extras/webjars/codemirror/src/main/resources/mode/skwrl/skwrl.html
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/mode/skwrl/skwrl.html b/extras/webjars/codemirror/src/main/resources/mode/skwrl/skwrl.html
new file mode 100644
index 0000000..8666d8c
--- /dev/null
+++ b/extras/webjars/codemirror/src/main/resources/mode/skwrl/skwrl.html
@@ -0,0 +1,96 @@
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements. See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership. The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!doctype html>
+<html>
+<head>
+<title>CodeMirror: SKWRL Demo</title>
+
+
+<script type="text/javascript" src="../../../../../webjars/jquery/1.8.2/jquery.min.js"></script>
+
+<script type="text/javascript" src="../../../../../webjars/codemirror/3.16/lib/codemirror.js"></script>
+<link rel="stylesheet" href="../../../../../webjars/codemirror/3.16/lib/codemirror.css">
+
+<script src="../../../../../webjars/codemirror/3.16/addon/hint/show-hint.js"></script>
+<link rel="stylesheet" href="../../../../../webjars/codemirror/3.16/addon/hint/show-hint.css">
+
+<script type="text/javascript" src="skwrl.js"></script>
+<link rel="stylesheet" href="skwrl.css">
+
+</head>
+<body>
+  <h1>CodeMirror: SKWRL demo</h1>
+  <div>
+    Read about the <a href="http://marmotta.incubator.apache.org/kiwi/reasoner.html" title="Simple KiWi Reasoning Language">SKWRL Langugae</a>
+    in <a href="http://marmotta.incubator.apache.org/">Apache Marmotta</a>.
+  </div>
+  <div>
+    <button onclick="javascript:createEditor()">Editor</button>
+    <button onclick="javascript:removeEditor()">Plain</button>
+  </div>
+  <form>
+<textarea id="code" name="code">
+/* rules taken from http://www.w3.org/TR/2004/REC-rdf-mt-20040210/#RDFRules */
+@prefix rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
+@prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
+@prefix xsd: &lt;http://www.w3.org/2001/XMLSchema#&gt;
+@prefix foaf: &lt;http://xmlns.com/foaf/0.1/&gt;
+
+rdf1: ($u $a $y) -&gt; ($a rdf:type rdf:Property)
+rdfs2: ($a rdfs:domain $x), ($u $a $y) -&gt; ($u rdf:type $x)
+rdfs3: ($a rdfs:range $x),  ($u $a $v) -&gt; ($v rdf:type $x)
+rdfs4a: ($u $a $x) -&gt; ($u rdf:type rdfs:Resource)
+rdfs5: ($u rdfs:subPropertyOf $v), ($v rdfs:subPropertyOf $x) -&gt; ($u rdfs:subPropertyOf $x)
+rdfs6: ($u rdf:type rdf:Property) -&gt; ($u rdfs:subPropertyOf $u)
+rdfs7: ($a rdfs:subPropertyOf $b), ($u $a $y) -&gt; ($u $b $y)
+rdfs8: ($u rdf:type rdfs:Class) -&gt; ($u rdfs:subClassOf rdfs:Resource)
+rdfs9: ($u rdfs:subClassOf $x), ($v rdf:type $u) -&gt; ($v rdf:type $x)
+rdfs10: ($u rdf:type rdfs:Class) -&gt; ($u rdfs:subClassOf $u)
+rdfs11: ($u rdfs:subClassOf $v), ($v rdfs:subClassOf $x) -&gt; ($u rdfs:subClassOf $x)
+rdfs12: ($u rdf:type rdfs:ContainerMembershipProperty) -&gt; ($u rdfs:subPropertyOf rdfs:member)
+rdfs13: ($u rdf:type rdfs:Datatype) -&gt; ($u rdfs:subClassOf rdfs:Literal)
+
+</textarea>
+  </form>
+  <script>
+            var editor = null;
+            function createEditor() {
+                if (editor === null) {
+                    CodeMirror.commands.autocomplete = function(cm) {
+                        CodeMirror.showHint(cm, CodeMirror.hint.skwrl);
+                    };
+                    editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+                        lineNumbers : true,
+                        matchBrackets : true,
+                        extraKeys: {"Ctrl-Space": "autocomplete"},
+                        mode : "skwrl"
+                    });
+                }
+            }
+            function removeEditor() {
+                if (editor) {
+                    editor.toTextArea();
+                    editor = null;
+                }
+            }
+            createEditor();
+        </script>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/marmotta/blob/9c3b63b1/extras/webjars/codemirror/src/main/resources/mode/skwrl/skwrl.js
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/mode/skwrl/skwrl.js b/extras/webjars/codemirror/src/main/resources/mode/skwrl/skwrl.js
new file mode 100644
index 0000000..5f85565
--- /dev/null
+++ b/extras/webjars/codemirror/src/main/resources/mode/skwrl/skwrl.js
@@ -0,0 +1,486 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+if (CodeMirror && CodeMirror.defineMode) {
+CodeMirror.defineMode("skwrl", function(config, parserConfig) {
+    var token = {
+        COMMENT: "comment",
+        KWD: "keyword",
+        IDENT: "atom",
+        OP: "operator",
+        BRACKET: "bracket",
+        URL: "link",
+        VAR: "variable-3",
+        PREFIX: "qualifier",
+        DEF: "variable",
+        WARNING: "string-2",
+        ERROR: "error"
+    },
+        predefinedNamespaces = parserConfig.namespaces || {},
+        baseURL = parserConfig.baseURL || null;
+    
+    function log(stream, status, result) {
+        return;
+        if (console && console.log) {
+            console.log(stream.current() + " := " + result + " (-> " + status.current() + ")");
+        }
+    }
+    
+    function getInitialState() {
+        return {
+            tmp: {},
+            namespaces: {},
+            predefinedNamespaces: predefinedNamespaces,
+            lmfBaseURL: baseURL,
+            stack: ['default'],
+            /* STACKING */
+            push: function(next) {
+                this.stack.unshift(next);
+            },
+            pop: function() {
+                if (this.stack.length <= 1) {
+                    return this.current();
+                } else {
+                    return this.stack.shift();
+                }
+            },
+            current: function() {
+                return this.stack[0];
+            },
+            reset: function() {
+                this.stack = ['default'];
+                this.tmp = {};
+            },
+            height: function() {
+                return this.stack.length;
+            },
+            /* PARSING */
+            parser: function(stream, state) {
+                var parser = parsers[this.current()] || parsers['default'];
+                return parser(stream, state);
+            },
+            /* NAMESPACES */
+            addPrefix: function(prefix, namespace) {
+                if (prefix && namespace)
+                    this.namespaces[prefix] = namespace;
+            },
+            getNamespace: function(prefix) {
+                return this.namespaces[prefix] || this.predefinedNamespaces[prefix];
+            }
+        };
+    }
+
+    function tokenError(stream, state) {
+        if (state.current() !== 'error') state.push('error');
+        stream.skipToEnd();
+        return token.ERROR;
+    }
+    
+    function tokenDefault(stream, state) {
+        // @...
+        var kw = stream.match(/^@(\w+)/, true);
+        if (kw) {
+            if (kw[1] == "prefix") {
+                state.push(kw[1]);
+                return token.KWD;
+            } else return token.ERROR;
+        }
+
+        // <URL>
+        if (stream.eat('<')) {
+            state.push('url');
+            return token.BRACKET;
+        }
+               
+        if (stream.eat('(')) {
+            state.tmp['rule'] = 0;
+            state.push('rule');
+            return token.BRACKET;
+        }
+        if (stream.eat(')')) {
+            if (state.current() != 'rule') return token.ERROR;
+            state.pop();
+            return token.BRACKET;
+        }
+        if (stream.eat(/[)(]/)) {
+            return token.BRACKET;
+        }
+
+        // prefix:label
+        if (stream.match(/^\w+:\w*/, false)) {
+            stream.skipTo(":")
+            if (state.current() == 'prefix') {
+                state.tmp["prefix"] = stream.current();
+                return token.PREFIX;
+            } else if (state.current() == 'default') {
+                return token.DEF;
+            } else {
+                px = stream.current();
+                stream.eat(':');
+                if (state.getNamespace(px))
+                    return token.PREFIX;
+                else return token.WARNING;
+            }
+        }
+
+        if (stream.match("->", true)) {
+            return token.DEF;
+        }
+        // OPERATORS
+        if (stream.eat(/[:,]/)) {
+            return token.OP;
+        }
+
+       
+        // IDENT
+        if (state.current() == "prefix") {
+
+        } else {
+            if (stream.match(/^[\w.-]+/, true)) {
+                return token.IDENT;
+            }
+        }
+
+        return tokenError(stream, state);
+    }
+    
+    function tokenRule(stream, state) {
+        if (stream.eat(')')) {
+            state.pop();
+            if (state.tmp['rule'] != 3) return token.ERROR;
+            return token.BRACKET;
+        } else if (state.tmp['rule'] >= 3) {
+            state.tmp['rule'] = 4;
+            stream.skipTo(')') || stream.next();
+            return token.ERROR;
+        } else
+        // <URL>
+        if (stream.eat('<')) {
+            state.push('url');
+            return token.BRACKET;
+        } else if (stream.eat('>')) {
+            state.tmp['rule']++;
+            return token.BRACKET;
+        } else        
+        // $s
+        if (stream.match(/^\$\w+/)) {
+            state.tmp['rule']++;
+            return token.VAR;
+        } else
+        // ns:local
+        if (stream.match(/^\w+:\w*/, false)) {
+            stream.skipTo(':');
+            var px = stream.current();
+            stream.eat(':');
+            if (!stream.match(/^\w+/, false)) {
+                return token.ERROR;
+            } else if (state.getNamespace(px))
+                return token.PREFIX;
+            else return token.WARNING;
+        } else if (stream.match(/^\w+/)) {
+            state.tmp['rule']++;
+            return token.IDENT;
+        } else if (stream.eat(')')) {
+            state.pop();
+            if (state.tmp['rule'] != 3) return token.ERROR;
+            return token.BRACKET;
+        } else {
+            stream.next();
+            return token.ERROR;
+        }
+
+        return tokenError(stream, state);
+    }
+    
+    function tokenPrefix(stream, state) {
+        if (stream.match(/^\w+/, true)) {
+            state.tmp["prefix"] = stream.current();
+            return token.PREFIX;
+        } else if (stream.eat(':')) {
+            return token.OP;
+        } else
+        // <URL>
+        if (stream.eat('<')) {
+            state.push('url');
+            return token.BRACKET;
+        } else if (stream.eat('>')) {
+            if (state.tmp['prefix'] && state.tmp['ns']) {
+                state.addPrefix(state.tmp['prefix'], state.tmp['ns']);
+                state.reset();
+                // End of prefix state:
+                state.pop();
+                return token.BRACKET;
+            } else return token.ERROR;
+        }
+        
+        return tokenError(stream, state);
+    }
+
+    function tokenURL(stream, state) {
+        if (stream.skipTo('>')) {
+            state.pop();
+            var url = stream.current();
+            if (url.search(/\s/) >= 0) {
+                return token.ERROR;
+            }
+            if (state.stack.indexOf("prefix") >= 0) {
+                state.tmp["ns"] = url;
+            }
+            return token.URL;
+        }
+        return tokenError(stream, state);
+    }
+
+    var parsers = {
+        'default': tokenDefault,
+        rule: tokenRule,
+        prefix: tokenPrefix,
+        url: tokenURL,
+        error: tokenError
+    };
+    
+
+
+    return {
+        startState: getInitialState,
+        compareStates: function(state1, state2) {
+            return state1.stack == state2.stack && state1.namespaces == state2.namespaces;
+        },
+        token: function(stream, state) {
+            // parse comments
+            if (state.current() == "comment") {
+                stream.skipTo('*') || stream.skipToEnd();
+                if (stream.match('*/')) {
+                    state.pop();
+                } else stream.eat('*');
+                return token.COMMENT;
+            } else if (stream.match('/*')) {
+                state.tmp.commentStart = stream.column();
+                state.push("comment");
+                return this.token(stream, state);
+            }
+            // ignore spaces
+            if (stream.eatSpace()) return null;
+            // ; starts parsing from scratch
+            /*
+            if (stream.eat(';')) {
+                if (state.current() == "prefix") {
+                    state.addPrefix(state.tmp['prefix'], state.tmp['ns']); 
+                }
+                log(stream, state, "RESET");
+                state.reset(); 
+                return token.OP;
+            }
+            */
+            var result = state.parser(stream, state);
+            log(stream, state, result);
+            return result;
+        },
+        electricChars: "/@=[];",
+        indent: function(state, textAfter) {
+            switch (state.current()) {
+            case 'comment':
+                return state.tmp.commentStart +(textAfter.search(/^\s*\*\//)==0?1:3);
+                break;
+            case 'default':
+                // no indent for @prefix etc...
+                if (textAfter.search(/^\s*@/) == 0) {
+                    return 0;
+                }
+                return config.indentUnit;
+                break;
+            }
+            return 0;
+        }
+    }
+});
+
+// Autocompletion
+if (CodeMirror.showHint && jQuery) {
+    function completePrefix(editor, cur, token) {
+        var line = editor.getLine(cur.line);
+        var match = line.match(/(^|>)\s*@prefix\s+(\w+)\s*(:\s*<?)?$/);
+        if (match && match[2] && match[2] !== "") {
+            var prefix = match[2], result;
+            try {
+//                jQuery.ajax(token.state.lmfBaseURL + "ldpath/util/prefix", {
+                jQuery.ajax("http://prefix.cc/" + prefix + ".file.json", {
+                    async: false,
+                    data: {prefix: prefix},
+                    success: function(data) {
+                        result = data[prefix];
+                    },
+                    dataType: "json"
+                });
+            } catch (e) {}
+            if (result !== undefined) {
+                var pfx = line.substr(0,cur.ch);
+                var st = pfx.search(/\s*(:\s*<?)?$/);
+                return {
+                    list: [ ": <"+result+">" ],
+                    from: {line: cur.line, ch: st},
+                    to: cur
+                };
+            }
+        }
+        return false;
+    }
+    function completeURI(editor, cur, token) {
+        return false; // No completion here in skwrl
+        var bC = token.string.substr(0, cur.ch - token.start),
+        aC = token.string.substr(cur.ch - token.start),
+        replUntil = token.state.current()=='url'?token.end+1:cur.ch + Math.max(aC.search(/[\s]/), 0);
+        
+        var suggestions;
+        try {
+            var qs = {};
+            if (token.state.stack.indexOf("transformer") >= 0) qs['mode'] = "transformer";
+            for (var n in token.state.namespaces) {
+                qs['ns_'+n] = token.state.getNamespace(n);
+            }
+            qs['uri'] = bC;
+            
+            jQuery.ajax(token.state.lmfBaseURL + "ldpath/util/complete", {
+               async: false,
+               data: qs,
+               success: function(data) {
+                   suggestions = data;  
+               },
+               dataType: "json"
+            });
+        } catch (e) {}
+        if (suggestions !== undefined) {
+            for (var i = 0; i < suggestions.length; i++) {
+                if (suggestions[i].match(/^\w+:\w+$/)) {
+                    // curie!
+                    suggestions[i] = suggestions[i] + " ";
+                } else {
+                    suggestions[i] = "<" + suggestions[i] + "> ";
+                }
+            }
+            return {
+              list: suggestions,
+              from: {line: cur.line, ch: token.start - 1},
+              to: {line: cur.line, ch: replUntil}
+            };
+        }
+        return false;
+    }
+    function completeCUIE(editor, cur, token) {
+        return false; // no completion here in skwrl
+        var from = token.start, 
+            to = token.end, 
+            req = token.string.substr(0, cur.ch - token.start);
+        var prevToken = editor.getTokenAt({line: cur.line, ch: token.start});
+        if (token.className == 'atom' && prevToken.className == 'qualifier') {
+            from = prevToken.start;
+            req = prevToken.string + req;
+        }
+        
+        var suggestions;
+        try {
+            var qs = {};
+            if (token.state.stack.indexOf("transformer") >= 0) qs['mode'] = "transformer";
+            for (var n in token.state.namespaces) {
+                qs['ns_'+n] = token.state.getNamespace(n);
+            }
+            qs['prefix'] = req;
+
+            jQuery.ajax(token.state.lmfBaseURL + "ldpath/util/complete", {
+               async: false,
+               data: qs,
+               success: function(data) {
+                   suggestions = data;  
+               },
+               dataType: "json"
+            });
+        } catch (e) {}
+        if (suggestions !== undefined) {
+            for (var i = 0; i < suggestions.length; i++) {
+                if (suggestions[i].match(/^\w+:\w+(\(\))?$/)) {
+                    // curie!
+                    suggestions[i] = suggestions[i] + " ";
+                } else {
+                    // prefix only
+                    suggestions[i] = suggestions[i] + ":";
+                }
+            }
+            return {
+              list: suggestions,
+              from: {line: cur.line, ch: from},
+              to: {line: cur.line, ch: to}
+            };
+        }
+        
+        return false;
+    }
+    function insertPrefixDef(editor, cur, token) {
+        var prefix = token.string.replace(/:?$/, ""), result;
+        try {
+//            jQuery.ajax(token.state.lmfBaseURL + "ldpath/util/prefix", {
+            jQuery.ajax("http://prefix.cc/" + prefix + ".file.json", {
+                async: false,
+                data: {prefix: prefix},
+                success: function(data) {
+                    result = data[prefix];
+                },
+                dataType: "json"
+            });
+        } catch (e) {}
+        if (result !== undefined) {
+            // check if this url is already prefixed
+            var px;
+            for (var i in token.state.namespaces) {
+                if (token.state.namespaces[i] == result) {
+                    px = i;
+                    break;
+                }
+            } 
+            if (px) {
+                return {
+                    list: [ px + ":" ],
+                    from: { line: cur.line, ch: token.start },
+                    to: { line: cur.line, ch: token.end }
+                };
+            } else {
+            return {
+                list: [ "@prefix " + prefix + ": <" + result + ">\n" ],
+                from: {line: 0, ch: 0},
+                to: {line: 0, ch: 0}
+            };
+            } 
+        }
+    }
+    function skwrlAutocomplete(editor, options) {
+        var cur = editor.getCursor(),
+            line = editor.getLine(cur.line),
+            token = editor.getTokenAt(cur);
+        
+        if (token.state.stack.indexOf('prefix') >= 0) {
+            return completePrefix(editor, cur, token);
+        } else if (token.className == "string-2") {
+            return insertPrefixDef(editor, cur, token);
+        } else {
+            if (console && console.log) {
+                console.log("State: " + token.state.stack);
+            }
+        }
+    }
+    CodeMirror.registerHelper("hint", "skwrl", skwrlAutocomplete);
+}
+
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/9c3b63b1/extras/webjars/codemirror/src/main/resources/simple-hint.css
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/simple-hint.css b/extras/webjars/codemirror/src/main/resources/simple-hint.css
deleted file mode 100644
index 2deea4e..0000000
--- a/extras/webjars/codemirror/src/main/resources/simple-hint.css
+++ /dev/null
@@ -1,20 +0,0 @@
-/* CodeMirror version 2.24
- *
- * License: MIT-License <http://codemirror.net/LICENSE>
-*/
-#center .CodeMirror-completions, .CodeMirror-completions {
-  position: absolute;
-  z-index: 10;
-  overflow: hidden;
-  -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
-  -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
-  box-shadow: 2px 3px 5px rgba(0,0,0,.2);
-}
-#center .CodeMirror-completions select, .CodeMirror-completions select {
-  background: #fafafa;
-  outline: none;
-  border: none;
-  padding: 0;
-  margin: 0;
-  font-family: monospace;
-}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/9c3b63b1/extras/webjars/codemirror/src/main/resources/simple-hint.js
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/simple-hint.js b/extras/webjars/codemirror/src/main/resources/simple-hint.js
deleted file mode 100644
index ad0f5eb..0000000
--- a/extras/webjars/codemirror/src/main/resources/simple-hint.js
+++ /dev/null
@@ -1,80 +0,0 @@
-// CodeMirror version 2.24
-//
-// All functions that need access to the editor's state live inside
-// the CodeMirror function. Below that, at the bottom of the file,
-// some utilities are defined.
-//
-// License: MIT-License <http://codemirror.net/LICENSE>
-
-(function() {
-  CodeMirror.simpleHint = function(editor, getHints) {
-    // We want a single cursor position.
-    if (editor.somethingSelected()) return;
-    var result = getHints(editor);
-    if (!result || !result.list.length) return;
-    var completions = result.list;
-    function insert(str) {
-      editor.replaceRange(str, result.from, result.to);
-    }
-    // When there is only one completion, use it directly.
-    if (completions.length == 1) {insert(completions[0]); return true;}
-
-    // Build the select widget
-    var complete = document.createElement("div");
-    complete.className = "CodeMirror-completions";
-    var sel = complete.appendChild(document.createElement("select"));
-    // Opera doesn't move the selection when pressing up/down in a
-    // multi-select, but it does properly support the size property on
-    // single-selects, so no multi-select is necessary.
-    if (!window.opera) sel.multiple = true;
-    for (var i = 0; i < completions.length; ++i) {
-      var opt = sel.appendChild(document.createElement("option"));
-      opt.appendChild(document.createTextNode(completions[i]));
-    }
-    sel.firstChild.selected = true;
-    sel.size = Math.min(10, completions.length);
-    var pos = editor.cursorCoords();
-    complete.style.left = pos.x + "px";
-    complete.style.top = pos.yBot + "px";
-    document.body.appendChild(complete);
-    // If we're at the edge of the screen, then we want the menu to appear on the left of the cursor.
-    var winW = window.innerWidth || Math.max(document.body.offsetWidth, document.documentElement.offsetWidth);
-    if(winW - pos.x < sel.clientWidth)
-      complete.style.left = (pos.x - sel.clientWidth) + "px";
-    // Hack to hide the scrollbar.
-    if (completions.length <= 10)
-      complete.style.width = (sel.clientWidth - 1) + "px";
-
-    var done = false;
-    function close() {
-      if (done) return;
-      done = true;
-      complete.parentNode.removeChild(complete);
-    }
-    function pick() {
-      insert(completions[sel.selectedIndex]);
-      close();
-      setTimeout(function(){editor.focus();}, 50);
-    }
-    CodeMirror.connect(sel, "blur", close);
-    CodeMirror.connect(sel, "keydown", function(event) {
-      var code = event.keyCode;
-      // Enter
-      if (code == 13) {CodeMirror.e_stop(event); pick();}
-      // Escape
-      else if (code == 27) {CodeMirror.e_stop(event); close(); editor.focus();}
-      else if (code != 38 && code != 40) {
-        close(); editor.focus();
-        // Pass the event to the CodeMirror instance so that it can handle things like backspace properly.
-        editor.triggerOnKeyDown(event);
-        setTimeout(function(){CodeMirror.simpleHint(editor, getHints);}, 50);
-      }
-    });
-    CodeMirror.connect(sel, "dblclick", pick);
-
-    sel.focus();
-    // Opera sometimes ignores focusing a freshly created node
-    if (window.opera) setTimeout(function(){if (!done) sel.focus();}, 100);
-    return true;
-  };
-})();

http://git-wip-us.apache.org/repos/asf/marmotta/blob/9c3b63b1/extras/webjars/codemirror/src/main/resources/skwrl.html
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/skwrl.html b/extras/webjars/codemirror/src/main/resources/skwrl.html
deleted file mode 100644
index 6ed695b..0000000
--- a/extras/webjars/codemirror/src/main/resources/skwrl.html
+++ /dev/null
@@ -1,254 +0,0 @@
-<!--
-
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements. See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership. The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-
--->
-<!doctype html>
-<html>
-<head>
-<title>CodeMirror: SKWRL Demo</title>
-<link rel="stylesheet" href="codemirror.css">
-<link rel="stylesheet" href="simple-hint.css">
-
-<script type="text/javascript" src="../../../webjars/jquery/1.8.2/jquery.min.js"></script>
-
-<script src="codemirror.js"></script>
-<script src="simple-hint.js"></script>
-<script src="skwrl.js"></script>
-
-<link rel="stylesheet" href="skwrl.css">
-
-<style type="text/css">
-.CodeMirror {
-    border: 1px solid #eee;
-}
-
-td {
-    padding-right: 20px;
-}
-body {
-  font-family: Droid Sans, Arial, sans-serif;
-  line-height: 1.5;
-  max-width: 64.3em;
-  margin: 3em auto;
-  padding: 0 1em;
-}
-
-h1 {
-  letter-spacing: -3px;
-  font-size: 3.23em;
-  font-weight: bold;
-  margin: 0;
-}
-
-h2 {
-  font-size: 1.23em;
-  font-weight: bold;
-  margin: .5em 0;
-  letter-spacing: -1px;
-}
-
-h3 {
-  font-size: 1em;
-  font-weight: bold;
-  margin: .4em 0;
-}
-
-pre {
-  background-color: #eee;
-  -moz-border-radius: 6px;
-  -webkit-border-radius: 6px;
-  border-radius: 6px;
-  padding: 1em;
-}
-
-pre.code {
-  margin: 0 1em;
-}
-
-.grey {
-  font-size: 2.2em;
-  padding: .5em 1em;
-  line-height: 1.2em;
-  margin-top: .5em;
-  position: relative;
-}
-
-img.logo {
-  position: absolute;
-  right: -25px;
-  bottom: 4px;
-}
-
-a:link, a:visited, .quasilink {
-  color: #df0019;
-  cursor: pointer;
-  text-decoration: none;
-}
-
-a:hover, .quasilink:hover {
-  color: #800004;
-}
-
-h1 a:link, h1 a:visited, h1 a:hover {
-  color: black;
-}
-
-ul {
-  margin: 0;
-  padding-left: 1.2em;
-}
-
-a.download {
-  color: white;
-  background-color: #df0019;
-  width: 100%;
-  display: block;
-  text-align: center;
-  font-size: 1.23em;
-  font-weight: bold;
-  text-decoration: none;
-  -moz-border-radius: 6px;
-  -webkit-border-radius: 6px;
-  border-radius: 6px;
-  padding: .5em 0;
-  margin-bottom: 1em;
-}
-
-a.download:hover {
-  background-color: #bb0010;
-}
-
-.rel {
-  margin-bottom: 0;
-}
-
-.rel-note {
-  color: #777;
-  font-size: .9em;
-  margin-top: .1em;
-}
-
-.logo-braces {
-  color: #df0019;
-  position: relative;
-  top: -4px;
-}
-
-.blk {
-  float: left;
-}
-
-.left {
-  width: 37em;
-  padding-right: 6.53em;
-  padding-bottom: 1em;
-}
-
-.left1 {
-  width: 15.24em;
-  padding-right: 6.45em;
-}
-
-.left2 {
-  width: 15.24em;
-}
-
-.right {
-  width: 20.68em;
-}
-
-.leftbig {
-  width: 42.44em;
-  padding-right: 6.53em;
-}
-
-.rightsmall {
-  width: 15.24em;
-}
-
-.clear:after {
-  visibility: hidden;
-  display: block;
-  font-size: 0;
-  content: " ";
-  clear: both;
-  height: 0;
-}
-.clear { display: inline-block; }
-/* start commented backslash hack \*/
-* html .clear { height: 1%; }
-.clear { display: block; }
-/* close commented backslash hack */
-</style>
-</head>
-<body>
-  <h1>CodeMirror: SKWRL demo</h1>
-  <div>
-    Read about the <a href="http://marmotta.incubator.apache.org/kiwi/reasoner.html" title="Simple KiWi Reasoning Language">SKWRL Langugae</a>
-    in <a href="http://marmotta.incubator.apache.org/">Apache Marmotta</a>.
-  </div>
-  <div>
-    <button onclick="javascript:createEditor()">Editor</button>
-    <button onclick="javascript:removeEditor()">Plain</button>
-  </div>
-  <form>
-<textarea id="code" name="code">
-/* rules taken from http://www.w3.org/TR/2004/REC-rdf-mt-20040210/#RDFRules */
-@prefix rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
-@prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
-@prefix xsd: &lt;http://www.w3.org/2001/XMLSchema#&gt;
-@prefix foaf: &lt;http://xmlns.com/foaf/0.1/&gt;
-
-rdf1: ($u $a $y) -&gt; ($a rdf:type rdf:Property)
-rdfs2: ($a rdfs:domain $x), ($u $a $y) -&gt; ($u rdf:type $x)
-rdfs3: ($a rdfs:range $x),  ($u $a $v) -&gt; ($v rdf:type $x)
-rdfs4a: ($u $a $x) -&gt; ($u rdf:type rdfs:Resource)
-rdfs5: ($u rdfs:subPropertyOf $v), ($v rdfs:subPropertyOf $x) -&gt; ($u rdfs:subPropertyOf $x)
-rdfs6: ($u rdf:type rdf:Property) -&gt; ($u rdfs:subPropertyOf $u)
-rdfs7: ($a rdfs:subPropertyOf $b), ($u $a $y) -&gt; ($u $b $y)
-rdfs8: ($u rdf:type rdfs:Class) -&gt; ($u rdfs:subClassOf rdfs:Resource)
-rdfs9: ($u rdfs:subClassOf $x), ($v rdf:type $u) -&gt; ($v rdf:type $x)
-rdfs10: ($u rdf:type rdfs:Class) -&gt; ($u rdfs:subClassOf $u)
-rdfs11: ($u rdfs:subClassOf $v), ($v rdfs:subClassOf $x) -&gt; ($u rdfs:subClassOf $x)
-rdfs12: ($u rdf:type rdfs:ContainerMembershipProperty) -&gt; ($u rdfs:subPropertyOf rdfs:member)
-rdfs13: ($u rdf:type rdfs:Datatype) -&gt; ($u rdfs:subClassOf rdfs:Literal)
-
-</textarea>
-  </form>
-  <script>
-            var editor = null;
-            function createEditor() {
-                if (editor === null) {
-                    editor = CodeMirror.fromTextArea(document.getElementById("code"), {
-                        lineNumbers : true,
-                        matchBrackets : true,
-                        extraKeys: {"Ctrl-Space": "skwrlAutocomplete"},
-                        mode : "skwrl"
-                    });
-                }
-            }
-            function removeEditor() {
-                if (editor) {
-                    editor.toTextArea();
-                    editor = null;
-                }
-            }
-            createEditor();
-        </script>
-</body>
-</html>


[7/9] git commit: MARMOTTA-321: Updated links to 3rd-party js-sources included in Apache Marmotta

Posted by ja...@apache.org.
MARMOTTA-321: Updated links to 3rd-party js-sources included in Apache Marmotta


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/9e5195f2
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/9e5195f2
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/9e5195f2

Branch: refs/heads/develop
Commit: 9e5195f2006512bd220f50b52bc3b1fcc01b15d7
Parents: 8fa40d8
Author: Jakob Frank <ja...@apache.org>
Authored: Wed Oct 23 16:22:39 2013 +0200
Committer: Jakob Frank <ja...@apache.org>
Committed: Wed Oct 23 16:22:39 2013 +0200

----------------------------------------------------------------------
 LICENSE.txt | 96 +++++---------------------------------------------------
 1 file changed, 7 insertions(+), 89 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/9e5195f2/LICENSE.txt
----------------------------------------------------------------------
diff --git a/LICENSE.txt b/LICENSE.txt
index f9de3d8..d777a04 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -214,8 +214,7 @@ following licenses.
 For the D3.js component,
 
     located at:
-        platform/marmotta-core/src/main/resources/web/admin/js/lib/
-        platform/marmotta-sparql/src/main/resources/web/admin/sgvizler/0.5/lib/
+        extras/webjars/sgvizler/src/main/resources/lib/
 
     Copyright (c) 2013 Michael Bostock, http://d3js.org
 
@@ -247,7 +246,7 @@ For the D3.js component,
 For the Dracula Graph Library component,
 
     located at:
-        platform/marmotta-core/src/main/resources/web/admin/js/lib/
+        extras/webjars/sgvizler/src/main/resources/lib/
 
     Copyright (c) 2013 Johann Philipp Strathausen, http://www.graphdracula.net
 
@@ -273,7 +272,7 @@ For the Dracula Graph Library component,
 For the strftime component,
 
     located at:
-        platform/marmotta-core/src/main/resources/web/public/js/lib
+        extras/webjars/strftime/src/main/resources/
 
     Copyright (c) 2008 Philip S Tellis, http://hacks.bluesmoon.info/strftime
     Extended by Marmotta with German locales and %F formatter.
@@ -300,64 +299,10 @@ For the strftime component,
     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
-For the jQuery component,
-
-    located at:
-        platform/marmotta-core/src/main/resources/web/public/js/lib
-
-    Copyright (c) 2013 jQuery Foundation, http://jquery.com
-
-    Permission is hereby granted, free of charge, to any person obtaining a copy of
-    this software and associated documentation files (the "Software"), to deal in
-    the Software without restriction, including without limitation the rights to
-    use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-    of the Software, and to permit persons to whom the Software is furnished to do
-    so, subject to the following conditions:
-
-    The above copyright notice and this permission notice shall be included in all
-    copies or substantial portions of the Software.
-
-    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-    SOFTWARE.
-
-
-For the CodeMirror component,
-
-    located at:
-        platform/marmotta-ldpath/src/main/resources/web/cm
-        platform/marmotta-sparql/src/main/resources/web/cm
-        platform/marmotta-sparql/src/main/resources/web/admin/editor/sparql/lib
-
-    Copyright (c) 2013 Marijn Haverbeke, http://codemirror.net
-
-    Permission is hereby granted, free of charge, to any person obtaining a copy of
-    this software and associated documentation files (the "Software"), to deal in
-    the Software without restriction, including without limitation the rights to
-    use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-    of the Software, and to permit persons to whom the Software is furnished to do
-    so, subject to the following conditions:
-
-    The above copyright notice and this permission notice shall be included in all
-    copies or substantial portions of the Software.
-
-    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-    SOFTWARE.
-
-
 For the D2R Snorql component,
 
     located at:
-        platform/marmotta-sparql/src/main/resources/web/admin/snorql
+        extras/webjars/snorql/src/main/resources/
 
     Copyright (c) 2007 Richard Cyganiak, http://www4.wiwiss.fu-berlin.de/bizer/d2r-server/
     with some minor modifications for Apache Marmotta.
@@ -368,7 +313,7 @@ For the D2R Snorql component,
 For the script.aculo.us component,
 
     located at:
-        platform/marmotta-sparql/src/main/resources/web/admin/snorql/scriptaculous
+        extras/webjars/snorql/src/main/resources/scriptaculous/
 
     Copyright (c) 2010 Thomas Fuchs, http://script.aculo.us
 
@@ -394,7 +339,7 @@ For the script.aculo.us component,
 For the Prototype component,
 
     located at:
-        platform/marmotta-sparql/src/main/resources/web/admin/snorql
+        extras/webjars/snorql/src/main/resources/
 
     Copyright (c) 2010 Sam Stephenson, http://prototypejs.org
 
@@ -417,37 +362,10 @@ For the Prototype component,
     SOFTWARE.    
 
 
-For the SPARQL Flint Editor component, 
-
-    located at:
-        platform/marmotta-sparql/src/main/resources/web/admin/editor/
-
-    Copyright (c) 2011 TSO Ltd, http://github.com/TSO-Openup/FlintSparqlEditor
-
-    Permission is hereby granted, free of charge, to any person obtaining a copy of
-    this software and associated documentation files (the "Software"), to deal in
-    the Software without restriction, including without limitation the rights to
-    use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-    of the Software, and to permit persons to whom the Software is furnished to do
-    so, subject to the following conditions:
-
-    The above copyright notice and this permission notice shall be included in all
-    copies or substantial portions of the Software.
-
-    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-    SOFTWARE.   
-
-
 For the Sgvizler component,
 
     located at:
-        platform/marmotta-core/src/main/resources/web/admin/js/lib
-        platform/marmotta-sparql/src/main/resources/web/admin/sgvizler
+        extras/webjars/sgvizler/src/main/resources/
 
     Copyright (c) 2011 Martin G. Skjæveland, http://sgvizler.googlecode.com
 


[8/9] git commit: Merge branch 'MARMOTTA-321' into develop

Posted by ja...@apache.org.
Merge branch 'MARMOTTA-321' into develop


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/9c967993
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/9c967993
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/9c967993

Branch: refs/heads/develop
Commit: 9c96799322d9b82da6fb532ef839eff94e0a6e55
Parents: 5a6e37a 9e5195f
Author: Jakob Frank <ja...@apache.org>
Authored: Fri Nov 29 15:59:58 2013 +0100
Committer: Jakob Frank <ja...@apache.org>
Committed: Fri Nov 29 15:59:58 2013 +0100

----------------------------------------------------------------------
 LICENSE.txt                                     |   96 +-
 extras/webjars/codemirror/pom.xml               |   24 +-
 .../src/main/resources/codemirror.css           |  259 -
 .../codemirror/src/main/resources/codemirror.js | 5831 ------------------
 .../codemirror/src/main/resources/ldpath.html   |  246 -
 .../codemirror/src/main/resources/ldpath.js     |  471 --
 .../src/main/resources/matchbrackets.js         |   86 -
 .../src/main/resources/mode/ldpath/ldpath.css   |  181 +
 .../src/main/resources/mode/ldpath/ldpath.html  |   87 +
 .../src/main/resources/mode/ldpath/ldpath.js    |  471 ++
 .../src/main/resources/mode/skwrl/skwrl.css     |  172 +
 .../src/main/resources/mode/skwrl/skwrl.html    |   96 +
 .../src/main/resources/mode/skwrl/skwrl.js      |  486 ++
 .../src/main/resources/simple-hint.css          |   20 -
 .../src/main/resources/simple-hint.js           |   80 -
 .../codemirror/src/main/resources/skwrl.html    |  254 -
 .../codemirror/src/main/resources/skwrl.js      |  491 --
 .../codemirror/src/main/resources/sparql.js     |  210 -
 parent/pom.xml                                  |   12 +-
 platform/marmotta-ldpath/pom.xml                |    2 +-
 .../src/main/resources/web/admin/ldpath.html    |   13 +-
 .../src/main/resources/web/admin/ldpath.js      |    5 +-
 platform/marmotta-reasoner-kiwi/pom.xml         |    7 +-
 .../src/main/resources/web/admin/configure.html |   10 +-
 platform/marmotta-sparql/pom.xml                |    2 +-
 .../src/main/resources/web/admin/sgvizler.html  |   10 +-
 .../src/main/resources/web/admin/snorql.html    |    6 +-
 .../src/main/resources/web/admin/update.html    |    6 +-
 28 files changed, 1570 insertions(+), 8064 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/9c967993/extras/webjars/codemirror/pom.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/marmotta/blob/9c967993/extras/webjars/codemirror/src/main/resources/mode/skwrl/skwrl.html
----------------------------------------------------------------------
diff --cc extras/webjars/codemirror/src/main/resources/mode/skwrl/skwrl.html
index 0000000,8666d8c..442ba27
mode 000000,100644..100644
--- a/extras/webjars/codemirror/src/main/resources/mode/skwrl/skwrl.html
+++ b/extras/webjars/codemirror/src/main/resources/mode/skwrl/skwrl.html
@@@ -1,0 -1,96 +1,96 @@@
+ <!--
+ 
+     Licensed to the Apache Software Foundation (ASF) under one
+     or more contributor license agreements. See the NOTICE file
+     distributed with this work for additional information
+     regarding copyright ownership. The ASF licenses this file
+     to you under the Apache License, Version 2.0 (the
+     "License"); you may not use this file except in compliance
+     with the License.  You may obtain a copy of the License at
+ 
+         http://www.apache.org/licenses/LICENSE-2.0
+ 
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+ 
+ -->
+ <!doctype html>
+ <html>
+ <head>
+ <title>CodeMirror: SKWRL Demo</title>
+ 
+ 
+ <script type="text/javascript" src="../../../../../webjars/jquery/1.8.2/jquery.min.js"></script>
+ 
+ <script type="text/javascript" src="../../../../../webjars/codemirror/3.16/lib/codemirror.js"></script>
+ <link rel="stylesheet" href="../../../../../webjars/codemirror/3.16/lib/codemirror.css">
+ 
+ <script src="../../../../../webjars/codemirror/3.16/addon/hint/show-hint.js"></script>
+ <link rel="stylesheet" href="../../../../../webjars/codemirror/3.16/addon/hint/show-hint.css">
+ 
+ <script type="text/javascript" src="skwrl.js"></script>
+ <link rel="stylesheet" href="skwrl.css">
+ 
+ </head>
+ <body>
+   <h1>CodeMirror: SKWRL demo</h1>
+   <div>
 -    Read about the <a href="http://marmotta.incubator.apache.org/kiwi/reasoner.html" title="Simple KiWi Reasoning Language">SKWRL Langugae</a>
 -    in <a href="http://marmotta.incubator.apache.org/">Apache Marmotta</a>.
++    Read about the <a href="http://marmotta.apache.org/kiwi/reasoner.html" title="Simple KiWi Reasoning Language">SKWRL Langugae</a>
++    in <a href="http://marmotta.apache.org/">Apache Marmotta</a>.
+   </div>
+   <div>
+     <button onclick="javascript:createEditor()">Editor</button>
+     <button onclick="javascript:removeEditor()">Plain</button>
+   </div>
+   <form>
+ <textarea id="code" name="code">
+ /* rules taken from http://www.w3.org/TR/2004/REC-rdf-mt-20040210/#RDFRules */
+ @prefix rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
+ @prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
+ @prefix xsd: &lt;http://www.w3.org/2001/XMLSchema#&gt;
+ @prefix foaf: &lt;http://xmlns.com/foaf/0.1/&gt;
+ 
+ rdf1: ($u $a $y) -&gt; ($a rdf:type rdf:Property)
+ rdfs2: ($a rdfs:domain $x), ($u $a $y) -&gt; ($u rdf:type $x)
+ rdfs3: ($a rdfs:range $x),  ($u $a $v) -&gt; ($v rdf:type $x)
+ rdfs4a: ($u $a $x) -&gt; ($u rdf:type rdfs:Resource)
+ rdfs5: ($u rdfs:subPropertyOf $v), ($v rdfs:subPropertyOf $x) -&gt; ($u rdfs:subPropertyOf $x)
+ rdfs6: ($u rdf:type rdf:Property) -&gt; ($u rdfs:subPropertyOf $u)
+ rdfs7: ($a rdfs:subPropertyOf $b), ($u $a $y) -&gt; ($u $b $y)
+ rdfs8: ($u rdf:type rdfs:Class) -&gt; ($u rdfs:subClassOf rdfs:Resource)
+ rdfs9: ($u rdfs:subClassOf $x), ($v rdf:type $u) -&gt; ($v rdf:type $x)
+ rdfs10: ($u rdf:type rdfs:Class) -&gt; ($u rdfs:subClassOf $u)
+ rdfs11: ($u rdfs:subClassOf $v), ($v rdfs:subClassOf $x) -&gt; ($u rdfs:subClassOf $x)
+ rdfs12: ($u rdf:type rdfs:ContainerMembershipProperty) -&gt; ($u rdfs:subPropertyOf rdfs:member)
+ rdfs13: ($u rdf:type rdfs:Datatype) -&gt; ($u rdfs:subClassOf rdfs:Literal)
+ 
+ </textarea>
+   </form>
+   <script>
+             var editor = null;
+             function createEditor() {
+                 if (editor === null) {
+                     CodeMirror.commands.autocomplete = function(cm) {
+                         CodeMirror.showHint(cm, CodeMirror.hint.skwrl);
+                     };
+                     editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+                         lineNumbers : true,
+                         matchBrackets : true,
+                         extraKeys: {"Ctrl-Space": "autocomplete"},
+                         mode : "skwrl"
+                     });
+                 }
+             }
+             function removeEditor() {
+                 if (editor) {
+                     editor.toTextArea();
+                     editor = null;
+                 }
+             }
+             createEditor();
+         </script>
+ </body>
+ </html>

http://git-wip-us.apache.org/repos/asf/marmotta/blob/9c967993/parent/pom.xml
----------------------------------------------------------------------
diff --cc parent/pom.xml
index 033015f,a8ad7d8..ab4298a
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@@ -918,11 -913,12 +918,17 @@@
              </dependency>
              <dependency>
                  <groupId>org.webjars</groupId>
+                 <artifactId>codemirror</artifactId>
+                 <version>3.16</version>
+             </dependency>
+             <dependency>
++                <groupId>org.webjars</groupId>
 +                <artifactId>angularjs</artifactId>
 +                <version>1.2.2</version>
-             </dependency>            <dependency>
++            </dependency>
++            <dependency>
                  <groupId>org.apache.marmotta.webjars</groupId>
-                 <artifactId>codemirror</artifactId>
+                 <artifactId>codemirror-modes</artifactId>
                  <version>${project.version}</version>
              </dependency>
              <dependency>
@@@ -1225,14 -1207,12 +1231,14 @@@
              </dependency>
              <dependency>
                  <groupId>org.apache.marmotta</groupId>
 -                <artifactId>kiwi-versioning</artifactId>
 +                <artifactId>kiwi-reasoner</artifactId>
                  <version>${project.version}</version>
              </dependency>
 +
-             <!-- LMF Sesame Tools -->
++            <!-- Marmotta Sesame Tools -->
              <dependency>
                  <groupId>org.apache.marmotta</groupId>
 -                <artifactId>kiwi-reasoner</artifactId>
 +                <artifactId>sesame-transactions</artifactId>
                  <version>${project.version}</version>
              </dependency>
              <dependency>

http://git-wip-us.apache.org/repos/asf/marmotta/blob/9c967993/platform/marmotta-ldpath/pom.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/marmotta/blob/9c967993/platform/marmotta-reasoner-kiwi/pom.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/marmotta/blob/9c967993/platform/marmotta-sparql/pom.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/marmotta/blob/9c967993/platform/marmotta-sparql/src/main/resources/web/admin/snorql.html
----------------------------------------------------------------------
diff --cc platform/marmotta-sparql/src/main/resources/web/admin/snorql.html
index 1cd0349,78b6e03..78b6e03
mode 100644,100755..100644
--- a/platform/marmotta-sparql/src/main/resources/web/admin/snorql.html
+++ b/platform/marmotta-sparql/src/main/resources/web/admin/snorql.html


[9/9] git commit: Merge remote-tracking branch 'origin/develop' into develop

Posted by ja...@apache.org.
Merge remote-tracking branch 'origin/develop' into develop


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/1954841e
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/1954841e
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/1954841e

Branch: refs/heads/develop
Commit: 1954841e8aad8f7b8f31c778f7cc4d54fe5a56e0
Parents: 9c96799 5fca08c
Author: Jakob Frank <ja...@apache.org>
Authored: Fri Nov 29 16:14:08 2013 +0100
Committer: Jakob Frank <ja...@apache.org>
Committed: Fri Nov 29 16:14:08 2013 +0100

----------------------------------------------------------------------
 .../src/main/resources/web/admin/about.html     |   1 -
 .../main/resources/web/admin/configuration.html |  31 +--
 .../src/main/webapp/WEB-INF/web.xml             |  76 ++++++-
 .../src/main/webapp/WEB-INF/web.xml             |  83 ++++++-
 parent/pom.xml                                  |   7 +-
 platform/marmotta-core/pom.xml                  |   4 +
 .../core/jndi/MarmottaJndiListener.java         |   2 -
 .../core/servlet/MarmottaH2ConsoleFilter.java   |   7 +-
 .../core/servlet/MarmottaOptionsFilter.java     |   9 +-
 .../core/servlet/MarmottaPostStartupFilter.java |  13 +-
 .../core/servlet/MarmottaPreStartupFilter.java  |   9 +-
 .../servlet/MarmottaPreStartupListener.java     |   8 +-
 .../core/servlet/MarmottaResourceFilter.java    |   4 -
 .../webservices/logging/LoggingWebService.java  | 219 +++++++++++++------
 .../src/main/resources/web/admin/js/logging.js  | 114 +++++++++-
 .../src/main/resources/web/admin/logging.html   | 137 +++++++-----
 .../src/main/resources/web/admin/about.html     |   2 -
 .../src/main/resources/web/admin/configure.html |   1 -
 .../src/main/resources/web/admin/sgvizler.html  |   1 -
 .../src/main/resources/web/admin/update.html    |   2 +-
 .../src/main/resources/web/admin/about.html     |   1 -
 .../main/resources/web/admin/configuration.html |  24 +-
 .../src/main/resources/web/admin/about.html     |  37 ++++
 .../main/resources/web/admin/configuration.html |  51 +++++
 24 files changed, 625 insertions(+), 218 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/1954841e/parent/pom.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/marmotta/blob/1954841e/platform/marmotta-reasoner-kiwi/src/main/resources/web/admin/configure.html
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/marmotta/blob/1954841e/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler.html
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/marmotta/blob/1954841e/platform/marmotta-sparql/src/main/resources/web/admin/update.html
----------------------------------------------------------------------
diff --cc platform/marmotta-sparql/src/main/resources/web/admin/update.html
index 6207cfc,1bea78d..ed443db
--- a/platform/marmotta-sparql/src/main/resources/web/admin/update.html
+++ b/platform/marmotta-sparql/src/main/resources/web/admin/update.html
@@@ -75,10 -75,8 +75,10 @@@
    </form>
  
  <script type="text/javascript" src="../../webjars/jquery/1.8.2/jquery.min.js"></script>
- <script type="text/javascript" src="../../webjars/jquery-ui/1.8.21/jquery-ui.min.js"></script>
+ <script type="text/javascript" src="../../webjars/jquery-ui/1.10.3/ui/minified/jquery-ui.min.js"></script>
 -<script type="text/javascript" src="../../webjars/codemirror/3.16/codemirror.js"></script>
 +<script type="text/javascript" src="../../webjars/codemirror/3.16/lib/codemirror.js"></script>
 +<script type="text/javascript" src="../../webjars/codemirror/3.16/addon/hint/show-hint.js"></script>
 +<script type="text/javascript" src="../../webjars/codemirror/3.16/mode/sparql/sparql.js"></script>
  
  <script type="text/javascript"> 
  


[3/9] removed codemirror sources and added dependency to the codemirror webjar TODO: Update L&N

Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/marmotta/blob/9c3b63b1/extras/webjars/codemirror/src/main/resources/codemirror.js
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/codemirror.js b/extras/webjars/codemirror/src/main/resources/codemirror.js
deleted file mode 100644
index e53195d..0000000
--- a/extras/webjars/codemirror/src/main/resources/codemirror.js
+++ /dev/null
@@ -1,5831 +0,0 @@
-// CodeMirror version 3.16
-//
-// CodeMirror is the only global var we claim
-//
-// License: MIT-License <http://codemirror.net/LICENSE>
-window.CodeMirror = (function() {
-  "use strict";
-
-  // BROWSER SNIFFING
-
-  // Crude, but necessary to handle a number of hard-to-feature-detect
-  // bugs and behavior differences.
-  var gecko = /gecko\/\d/i.test(navigator.userAgent);
-  var ie = /MSIE \d/.test(navigator.userAgent);
-  var ie_lt8 = ie && (document.documentMode == null || document.documentMode < 8);
-  var ie_lt9 = ie && (document.documentMode == null || document.documentMode < 9);
-  var webkit = /WebKit\//.test(navigator.userAgent);
-  var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(navigator.userAgent);
-  var chrome = /Chrome\//.test(navigator.userAgent);
-  var opera = /Opera\//.test(navigator.userAgent);
-  var safari = /Apple Computer/.test(navigator.vendor);
-  var khtml = /KHTML\//.test(navigator.userAgent);
-  var mac_geLion = /Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent);
-  var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent);
-  var phantom = /PhantomJS/.test(navigator.userAgent);
-
-  var ios = /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent);
-  // This is woefully incomplete. Suggestions for alternative methods welcome.
-  var mobile = ios || /Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent);
-  var mac = ios || /Mac/.test(navigator.platform);
-  var windows = /win/i.test(navigator.platform);
-
-  var opera_version = opera && navigator.userAgent.match(/Version\/(\d*\.\d*)/);
-  if (opera_version) opera_version = Number(opera_version[1]);
-  if (opera_version && opera_version >= 15) { opera = false; webkit = true; }
-  // Some browsers use the wrong event properties to signal cmd/ctrl on OS X
-  var flipCtrlCmd = mac && (qtwebkit || opera && (opera_version == null || opera_version < 12.11));
-  var captureMiddleClick = gecko || (ie && !ie_lt9);
-
-  // Optimize some code when these features are not used
-  var sawReadOnlySpans = false, sawCollapsedSpans = false;
-
-  // CONSTRUCTOR
-
-  function CodeMirror(place, options) {
-    if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);
-
-    this.options = options = options || {};
-    // Determine effective options based on given values and defaults.
-    for (var opt in defaults) if (!options.hasOwnProperty(opt) && defaults.hasOwnProperty(opt))
-      options[opt] = defaults[opt];
-    setGuttersForLineNumbers(options);
-
-    var docStart = typeof options.value == "string" ? 0 : options.value.first;
-    var display = this.display = makeDisplay(place, docStart);
-    display.wrapper.CodeMirror = this;
-    updateGutters(this);
-    if (options.autofocus && !mobile) focusInput(this);
-
-    this.state = {keyMaps: [],
-                  overlays: [],
-                  modeGen: 0,
-                  overwrite: false, focused: false,
-                  suppressEdits: false, pasteIncoming: false,
-                  draggingText: false,
-                  highlight: new Delayed()};
-
-    themeChanged(this);
-    if (options.lineWrapping)
-      this.display.wrapper.className += " CodeMirror-wrap";
-
-    var doc = options.value;
-    if (typeof doc == "string") doc = new Doc(options.value, options.mode);
-    operation(this, attachDoc)(this, doc);
-
-    // Override magic textarea content restore that IE sometimes does
-    // on our hidden textarea on reload
-    if (ie) setTimeout(bind(resetInput, this, true), 20);
-
-    registerEventHandlers(this);
-    // IE throws unspecified error in certain cases, when
-    // trying to access activeElement before onload
-    var hasFocus; try { hasFocus = (document.activeElement == display.input); } catch(e) { }
-    if (hasFocus || (options.autofocus && !mobile)) setTimeout(bind(onFocus, this), 20);
-    else onBlur(this);
-
-    operation(this, function() {
-      for (var opt in optionHandlers)
-        if (optionHandlers.propertyIsEnumerable(opt))
-          optionHandlers[opt](this, options[opt], Init);
-      for (var i = 0; i < initHooks.length; ++i) initHooks[i](this);
-    })();
-  }
-
-  // DISPLAY CONSTRUCTOR
-
-  function makeDisplay(place, docStart) {
-    var d = {};
-
-    var input = d.input = elt("textarea", null, null, "position: absolute; padding: 0; width: 1px; height: 1em; outline: none; font-size: 4px;");
-    if (webkit) input.style.width = "1000px";
-    else input.setAttribute("wrap", "off");
-    // if border: 0; -- iOS fails to open keyboard (issue #1287)
-    if (ios) input.style.border = "1px solid black";
-    input.setAttribute("autocorrect", "off"); input.setAttribute("autocapitalize", "off"); input.setAttribute("spellcheck", "false");
-
-    // Wraps and hides input textarea
-    d.inputDiv = elt("div", [input], null, "overflow: hidden; position: relative; width: 3px; height: 0px;");
-    // The actual fake scrollbars.
-    d.scrollbarH = elt("div", [elt("div", null, null, "height: 1px")], "CodeMirror-hscrollbar");
-    d.scrollbarV = elt("div", [elt("div", null, null, "width: 1px")], "CodeMirror-vscrollbar");
-    d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler");
-    d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler");
-    // DIVs containing the selection and the actual code
-    d.lineDiv = elt("div", null, "CodeMirror-code");
-    d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1");
-    // Blinky cursor, and element used to ensure cursor fits at the end of a line
-    d.cursor = elt("div", "\u00a0", "CodeMirror-cursor");
-    // Secondary cursor, shown when on a 'jump' in bi-directional text
-    d.otherCursor = elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor");
-    // Used to measure text size
-    d.measure = elt("div", null, "CodeMirror-measure");
-    // Wraps everything that needs to exist inside the vertically-padded coordinate system
-    d.lineSpace = elt("div", [d.measure, d.selectionDiv, d.lineDiv, d.cursor, d.otherCursor],
-                         null, "position: relative; outline: none");
-    // Moved around its parent to cover visible view
-    d.mover = elt("div", [elt("div", [d.lineSpace], "CodeMirror-lines")], null, "position: relative");
-    // Set to the height of the text, causes scrolling
-    d.sizer = elt("div", [d.mover], "CodeMirror-sizer");
-    // D is needed because behavior of elts with overflow: auto and padding is inconsistent across browsers
-    d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerCutOff + "px; width: 1px;");
-    // Will contain the gutters, if any
-    d.gutters = elt("div", null, "CodeMirror-gutters");
-    d.lineGutter = null;
-    // Provides scrolling
-    d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll");
-    d.scroller.setAttribute("tabIndex", "-1");
-    // The element in which the editor lives.
-    d.wrapper = elt("div", [d.inputDiv, d.scrollbarH, d.scrollbarV,
-                            d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror");
-    // Work around IE7 z-index bug
-    if (ie_lt8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }
-    if (place.appendChild) place.appendChild(d.wrapper); else place(d.wrapper);
-
-    // Needed to hide big blue blinking cursor on Mobile Safari
-    if (ios) input.style.width = "0px";
-    if (!webkit) d.scroller.draggable = true;
-    // Needed to handle Tab key in KHTML
-    if (khtml) { d.inputDiv.style.height = "1px"; d.inputDiv.style.position = "absolute"; }
-    // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
-    else if (ie_lt8) d.scrollbarH.style.minWidth = d.scrollbarV.style.minWidth = "18px";
-
-    // Current visible range (may be bigger than the view window).
-    d.viewOffset = d.lastSizeC = 0;
-    d.showingFrom = d.showingTo = docStart;
-
-    // Used to only resize the line number gutter when necessary (when
-    // the amount of lines crosses a boundary that makes its width change)
-    d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;
-    // See readInput and resetInput
-    d.prevInput = "";
-    // Set to true when a non-horizontal-scrolling widget is added. As
-    // an optimization, widget aligning is skipped when d is false.
-    d.alignWidgets = false;
-    // Flag that indicates whether we currently expect input to appear
-    // (after some event like 'keypress' or 'input') and are polling
-    // intensively.
-    d.pollingFast = false;
-    // Self-resetting timeout for the poller
-    d.poll = new Delayed();
-
-    d.cachedCharWidth = d.cachedTextHeight = null;
-    d.measureLineCache = [];
-    d.measureLineCachePos = 0;
-
-    // Tracks when resetInput has punted to just putting a short
-    // string instead of the (large) selection.
-    d.inaccurateSelection = false;
-
-    // Tracks the maximum line length so that the horizontal scrollbar
-    // can be kept static when scrolling.
-    d.maxLine = null;
-    d.maxLineLength = 0;
-    d.maxLineChanged = false;
-
-    // Used for measuring wheel scrolling granularity
-    d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;
-
-    return d;
-  }
-
-  // STATE UPDATES
-
-  // Used to get the editor into a consistent state again when options change.
-
-  function loadMode(cm) {
-    cm.doc.mode = CodeMirror.getMode(cm.options, cm.doc.modeOption);
-    cm.doc.iter(function(line) {
-      if (line.stateAfter) line.stateAfter = null;
-      if (line.styles) line.styles = null;
-    });
-    cm.doc.frontier = cm.doc.first;
-    startWorker(cm, 100);
-    cm.state.modeGen++;
-    if (cm.curOp) regChange(cm);
-  }
-
-  function wrappingChanged(cm) {
-    if (cm.options.lineWrapping) {
-      cm.display.wrapper.className += " CodeMirror-wrap";
-      cm.display.sizer.style.minWidth = "";
-    } else {
-      cm.display.wrapper.className = cm.display.wrapper.className.replace(" CodeMirror-wrap", "");
-      computeMaxLength(cm);
-    }
-    estimateLineHeights(cm);
-    regChange(cm);
-    clearCaches(cm);
-    setTimeout(function(){updateScrollbars(cm);}, 100);
-  }
-
-  function estimateHeight(cm) {
-    var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;
-    var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);
-    return function(line) {
-      if (lineIsHidden(cm.doc, line))
-        return 0;
-      else if (wrapping)
-        return (Math.ceil(line.text.length / perLine) || 1) * th;
-      else
-        return th;
-    };
-  }
-
-  function estimateLineHeights(cm) {
-    var doc = cm.doc, est = estimateHeight(cm);
-    doc.iter(function(line) {
-      var estHeight = est(line);
-      if (estHeight != line.height) updateLineHeight(line, estHeight);
-    });
-  }
-
-  function keyMapChanged(cm) {
-    var map = keyMap[cm.options.keyMap], style = map.style;
-    cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-keymap-\S+/g, "") +
-      (style ? " cm-keymap-" + style : "");
-    cm.state.disableInput = map.disableInput;
-  }
-
-  function themeChanged(cm) {
-    cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") +
-      cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-");
-    clearCaches(cm);
-  }
-
-  function guttersChanged(cm) {
-    updateGutters(cm);
-    regChange(cm);
-    setTimeout(function(){alignHorizontally(cm);}, 20);
-  }
-
-  function updateGutters(cm) {
-    var gutters = cm.display.gutters, specs = cm.options.gutters;
-    removeChildren(gutters);
-    for (var i = 0; i < specs.length; ++i) {
-      var gutterClass = specs[i];
-      var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass));
-      if (gutterClass == "CodeMirror-linenumbers") {
-        cm.display.lineGutter = gElt;
-        gElt.style.width = (cm.display.lineNumWidth || 1) + "px";
-      }
-    }
-    gutters.style.display = i ? "" : "none";
-  }
-
-  function lineLength(doc, line) {
-    if (line.height == 0) return 0;
-    var len = line.text.length, merged, cur = line;
-    while (merged = collapsedSpanAtStart(cur)) {
-      var found = merged.find();
-      cur = getLine(doc, found.from.line);
-      len += found.from.ch - found.to.ch;
-    }
-    cur = line;
-    while (merged = collapsedSpanAtEnd(cur)) {
-      var found = merged.find();
-      len -= cur.text.length - found.from.ch;
-      cur = getLine(doc, found.to.line);
-      len += cur.text.length - found.to.ch;
-    }
-    return len;
-  }
-
-  function computeMaxLength(cm) {
-    var d = cm.display, doc = cm.doc;
-    d.maxLine = getLine(doc, doc.first);
-    d.maxLineLength = lineLength(doc, d.maxLine);
-    d.maxLineChanged = true;
-    doc.iter(function(line) {
-      var len = lineLength(doc, line);
-      if (len > d.maxLineLength) {
-        d.maxLineLength = len;
-        d.maxLine = line;
-      }
-    });
-  }
-
-  // Make sure the gutters options contains the element
-  // "CodeMirror-linenumbers" when the lineNumbers option is true.
-  function setGuttersForLineNumbers(options) {
-    var found = false;
-    for (var i = 0; i < options.gutters.length; ++i) {
-      if (options.gutters[i] == "CodeMirror-linenumbers") {
-        if (options.lineNumbers) found = true;
-        else options.gutters.splice(i--, 1);
-      }
-    }
-    if (!found && options.lineNumbers)
-      options.gutters.push("CodeMirror-linenumbers");
-  }
-
-  // SCROLLBARS
-
-  // Re-synchronize the fake scrollbars with the actual size of the
-  // content. Optionally force a scrollTop.
-  function updateScrollbars(cm) {
-    var d = cm.display, docHeight = cm.doc.height;
-    var totalHeight = docHeight + paddingVert(d);
-    d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + "px";
-    d.gutters.style.height = Math.max(totalHeight, d.scroller.clientHeight - scrollerCutOff) + "px";
-    var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);
-    var needsH = d.scroller.scrollWidth > (d.scroller.clientWidth + 1);
-    var needsV = scrollHeight > (d.scroller.clientHeight + 1);
-    if (needsV) {
-      d.scrollbarV.style.display = "block";
-      d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + "px" : "0";
-      d.scrollbarV.firstChild.style.height =
-        (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + "px";
-    } else {
-      d.scrollbarV.style.display = "";
-      d.scrollbarV.firstChild.style.height = "0";
-    }
-    if (needsH) {
-      d.scrollbarH.style.display = "block";
-      d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + "px" : "0";
-      d.scrollbarH.firstChild.style.width =
-        (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + "px";
-    } else {
-      d.scrollbarH.style.display = "";
-      d.scrollbarH.firstChild.style.width = "0";
-    }
-    if (needsH && needsV) {
-      d.scrollbarFiller.style.display = "block";
-      d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + "px";
-    } else d.scrollbarFiller.style.display = "";
-    if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {
-      d.gutterFiller.style.display = "block";
-      d.gutterFiller.style.height = scrollbarWidth(d.measure) + "px";
-      d.gutterFiller.style.width = d.gutters.offsetWidth + "px";
-    } else d.gutterFiller.style.display = "";
-
-    if (mac_geLion && scrollbarWidth(d.measure) === 0)
-      d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? "18px" : "12px";
-  }
-
-  function visibleLines(display, doc, viewPort) {
-    var top = display.scroller.scrollTop, height = display.wrapper.clientHeight;
-    if (typeof viewPort == "number") top = viewPort;
-    else if (viewPort) {top = viewPort.top; height = viewPort.bottom - viewPort.top;}
-    top = Math.floor(top - paddingTop(display));
-    var bottom = Math.ceil(top + height);
-    return {from: lineAtHeight(doc, top), to: lineAtHeight(doc, bottom)};
-  }
-
-  // LINE NUMBERS
-
-  function alignHorizontally(cm) {
-    var display = cm.display;
-    if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;
-    var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;
-    var gutterW = display.gutters.offsetWidth, l = comp + "px";
-    for (var n = display.lineDiv.firstChild; n; n = n.nextSibling) if (n.alignable) {
-      for (var i = 0, a = n.alignable; i < a.length; ++i) a[i].style.left = l;
-    }
-    if (cm.options.fixedGutter)
-      display.gutters.style.left = (comp + gutterW) + "px";
-  }
-
-  function maybeUpdateLineNumberWidth(cm) {
-    if (!cm.options.lineNumbers) return false;
-    var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;
-    if (last.length != display.lineNumChars) {
-      var test = display.measure.appendChild(elt("div", [elt("div", last)],
-                                                 "CodeMirror-linenumber CodeMirror-gutter-elt"));
-      var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;
-      display.lineGutter.style.width = "";
-      display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding);
-      display.lineNumWidth = display.lineNumInnerWidth + padding;
-      display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;
-      display.lineGutter.style.width = display.lineNumWidth + "px";
-      return true;
-    }
-    return false;
-  }
-
-  function lineNumberFor(options, i) {
-    return String(options.lineNumberFormatter(i + options.firstLineNumber));
-  }
-  function compensateForHScroll(display) {
-    return getRect(display.scroller).left - getRect(display.sizer).left;
-  }
-
-  // DISPLAY DRAWING
-
-  function updateDisplay(cm, changes, viewPort, forced) {
-    var oldFrom = cm.display.showingFrom, oldTo = cm.display.showingTo, updated;
-    var visible = visibleLines(cm.display, cm.doc, viewPort);
-    for (;;) {
-      if (!updateDisplayInner(cm, changes, visible, forced)) break;
-      forced = false;
-      updated = true;
-      updateSelection(cm);
-      updateScrollbars(cm);
-
-      // Clip forced viewport to actual scrollable area
-      if (viewPort)
-        viewPort = Math.min(cm.display.scroller.scrollHeight - cm.display.scroller.clientHeight,
-                            typeof viewPort == "number" ? viewPort : viewPort.top);
-      visible = visibleLines(cm.display, cm.doc, viewPort);
-      if (visible.from >= cm.display.showingFrom && visible.to <= cm.display.showingTo)
-        break;
-      changes = [];
-    }
-
-    if (updated) {
-      signalLater(cm, "update", cm);
-      if (cm.display.showingFrom != oldFrom || cm.display.showingTo != oldTo)
-        signalLater(cm, "viewportChange", cm, cm.display.showingFrom, cm.display.showingTo);
-    }
-    return updated;
-  }
-
-  // Uses a set of changes plus the current scroll position to
-  // determine which DOM updates have to be made, and makes the
-  // updates.
-  function updateDisplayInner(cm, changes, visible, forced) {
-    var display = cm.display, doc = cm.doc;
-    if (!display.wrapper.clientWidth) {
-      display.showingFrom = display.showingTo = doc.first;
-      display.viewOffset = 0;
-      return;
-    }
-
-    // Bail out if the visible area is already rendered and nothing changed.
-    if (!forced && changes.length == 0 &&
-        visible.from > display.showingFrom && visible.to < display.showingTo)
-      return;
-
-    if (maybeUpdateLineNumberWidth(cm))
-      changes = [{from: doc.first, to: doc.first + doc.size}];
-    var gutterW = display.sizer.style.marginLeft = display.gutters.offsetWidth + "px";
-    display.scrollbarH.style.left = cm.options.fixedGutter ? gutterW : "0";
-
-    // Used to determine which lines need their line numbers updated
-    var positionsChangedFrom = Infinity;
-    if (cm.options.lineNumbers)
-      for (var i = 0; i < changes.length; ++i)
-        if (changes[i].diff && changes[i].from < positionsChangedFrom) { positionsChangedFrom = changes[i].from; }
-
-    var end = doc.first + doc.size;
-    var from = Math.max(visible.from - cm.options.viewportMargin, doc.first);
-    var to = Math.min(end, visible.to + cm.options.viewportMargin);
-    if (display.showingFrom < from && from - display.showingFrom < 20) from = Math.max(doc.first, display.showingFrom);
-    if (display.showingTo > to && display.showingTo - to < 20) to = Math.min(end, display.showingTo);
-    if (sawCollapsedSpans) {
-      from = lineNo(visualLine(doc, getLine(doc, from)));
-      while (to < end && lineIsHidden(doc, getLine(doc, to))) ++to;
-    }
-
-    // Create a range of theoretically intact lines, and punch holes
-    // in that using the change info.
-    var intact = [{from: Math.max(display.showingFrom, doc.first),
-                   to: Math.min(display.showingTo, end)}];
-    if (intact[0].from >= intact[0].to) intact = [];
-    else intact = computeIntact(intact, changes);
-    // When merged lines are present, we might have to reduce the
-    // intact ranges because changes in continued fragments of the
-    // intact lines do require the lines to be redrawn.
-    if (sawCollapsedSpans)
-      for (var i = 0; i < intact.length; ++i) {
-        var range = intact[i], merged;
-        while (merged = collapsedSpanAtEnd(getLine(doc, range.to - 1))) {
-          var newTo = merged.find().from.line;
-          if (newTo > range.from) range.to = newTo;
-          else { intact.splice(i--, 1); break; }
-        }
-      }
-
-    // Clip off the parts that won't be visible
-    var intactLines = 0;
-    for (var i = 0; i < intact.length; ++i) {
-      var range = intact[i];
-      if (range.from < from) range.from = from;
-      if (range.to > to) range.to = to;
-      if (range.from >= range.to) intact.splice(i--, 1);
-      else intactLines += range.to - range.from;
-    }
-    if (!forced && intactLines == to - from && from == display.showingFrom && to == display.showingTo) {
-      updateViewOffset(cm);
-      return;
-    }
-    intact.sort(function(a, b) {return a.from - b.from;});
-
-    // Avoid crashing on IE's "unspecified error" when in iframes
-    try {
-      var focused = document.activeElement;
-    } catch(e) {}
-    if (intactLines < (to - from) * .7) display.lineDiv.style.display = "none";
-    patchDisplay(cm, from, to, intact, positionsChangedFrom);
-    display.lineDiv.style.display = "";
-    if (focused && document.activeElement != focused && focused.offsetHeight) focused.focus();
-
-    var different = from != display.showingFrom || to != display.showingTo ||
-      display.lastSizeC != display.wrapper.clientHeight;
-    // This is just a bogus formula that detects when the editor is
-    // resized or the font size changes.
-    if (different) {
-      display.lastSizeC = display.wrapper.clientHeight;
-      startWorker(cm, 400);
-    }
-    display.showingFrom = from; display.showingTo = to;
-
-    updateHeightsInViewport(cm);
-    updateViewOffset(cm);
-
-    return true;
-  }
-
-  function updateHeightsInViewport(cm) {
-    var display = cm.display;
-    var prevBottom = display.lineDiv.offsetTop;
-    for (var node = display.lineDiv.firstChild, height; node; node = node.nextSibling) if (node.lineObj) {
-      if (ie_lt8) {
-        var bot = node.offsetTop + node.offsetHeight;
-        height = bot - prevBottom;
-        prevBottom = bot;
-      } else {
-        var box = getRect(node);
-        height = box.bottom - box.top;
-      }
-      var diff = node.lineObj.height - height;
-      if (height < 2) height = textHeight(display);
-      if (diff > .001 || diff < -.001) {
-        updateLineHeight(node.lineObj, height);
-        var widgets = node.lineObj.widgets;
-        if (widgets) for (var i = 0; i < widgets.length; ++i)
-          widgets[i].height = widgets[i].node.offsetHeight;
-      }
-    }
-  }
-
-  function updateViewOffset(cm) {
-    var off = cm.display.viewOffset = heightAtLine(cm, getLine(cm.doc, cm.display.showingFrom));
-    // Position the mover div to align with the current virtual scroll position
-    cm.display.mover.style.top = off + "px";
-  }
-
-  function computeIntact(intact, changes) {
-    for (var i = 0, l = changes.length || 0; i < l; ++i) {
-      var change = changes[i], intact2 = [], diff = change.diff || 0;
-      for (var j = 0, l2 = intact.length; j < l2; ++j) {
-        var range = intact[j];
-        if (change.to <= range.from && change.diff) {
-          intact2.push({from: range.from + diff, to: range.to + diff});
-        } else if (change.to <= range.from || change.from >= range.to) {
-          intact2.push(range);
-        } else {
-          if (change.from > range.from)
-            intact2.push({from: range.from, to: change.from});
-          if (change.to < range.to)
-            intact2.push({from: change.to + diff, to: range.to + diff});
-        }
-      }
-      intact = intact2;
-    }
-    return intact;
-  }
-
-  function getDimensions(cm) {
-    var d = cm.display, left = {}, width = {};
-    for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {
-      left[cm.options.gutters[i]] = n.offsetLeft;
-      width[cm.options.gutters[i]] = n.offsetWidth;
-    }
-    return {fixedPos: compensateForHScroll(d),
-            gutterTotalWidth: d.gutters.offsetWidth,
-            gutterLeft: left,
-            gutterWidth: width,
-            wrapperWidth: d.wrapper.clientWidth};
-  }
-
-  function patchDisplay(cm, from, to, intact, updateNumbersFrom) {
-    var dims = getDimensions(cm);
-    var display = cm.display, lineNumbers = cm.options.lineNumbers;
-    if (!intact.length && (!webkit || !cm.display.currentWheelTarget))
-      removeChildren(display.lineDiv);
-    var container = display.lineDiv, cur = container.firstChild;
-
-    function rm(node) {
-      var next = node.nextSibling;
-      if (webkit && mac && cm.display.currentWheelTarget == node) {
-        node.style.display = "none";
-        node.lineObj = null;
-      } else {
-        node.parentNode.removeChild(node);
-      }
-      return next;
-    }
-
-    var nextIntact = intact.shift(), lineN = from;
-    cm.doc.iter(from, to, function(line) {
-      if (nextIntact && nextIntact.to == lineN) nextIntact = intact.shift();
-      if (lineIsHidden(cm.doc, line)) {
-        if (line.height != 0) updateLineHeight(line, 0);
-        if (line.widgets && cur && cur.previousSibling) for (var i = 0; i < line.widgets.length; ++i) {
-          var w = line.widgets[i];
-          if (w.showIfHidden) {
-            var prev = cur.previousSibling;
-            if (/pre/i.test(prev.nodeName)) {
-              var wrap = elt("div", null, null, "position: relative");
-              prev.parentNode.replaceChild(wrap, prev);
-              wrap.appendChild(prev);
-              prev = wrap;
-            }
-            var wnode = prev.appendChild(elt("div", [w.node], "CodeMirror-linewidget"));
-            if (!w.handleMouseEvents) wnode.ignoreEvents = true;
-            positionLineWidget(w, wnode, prev, dims);
-          }
-        }
-      } else if (nextIntact && nextIntact.from <= lineN && nextIntact.to > lineN) {
-        // This line is intact. Skip to the actual node. Update its
-        // line number if needed.
-        while (cur.lineObj != line) cur = rm(cur);
-        if (lineNumbers && updateNumbersFrom <= lineN && cur.lineNumber)
-          setTextContent(cur.lineNumber, lineNumberFor(cm.options, lineN));
-        cur = cur.nextSibling;
-      } else {
-        // For lines with widgets, make an attempt to find and reuse
-        // the existing element, so that widgets aren't needlessly
-        // removed and re-inserted into the dom
-        if (line.widgets) for (var j = 0, search = cur, reuse; search && j < 20; ++j, search = search.nextSibling)
-          if (search.lineObj == line && /div/i.test(search.nodeName)) { reuse = search; break; }
-        // This line needs to be generated.
-        var lineNode = buildLineElement(cm, line, lineN, dims, reuse);
-        if (lineNode != reuse) {
-          container.insertBefore(lineNode, cur);
-        } else {
-          while (cur != reuse) cur = rm(cur);
-          cur = cur.nextSibling;
-        }
-
-        lineNode.lineObj = line;
-      }
-      ++lineN;
-    });
-    while (cur) cur = rm(cur);
-  }
-
-  function buildLineElement(cm, line, lineNo, dims, reuse) {
-    var lineElement = lineContent(cm, line);
-    var markers = line.gutterMarkers, display = cm.display, wrap;
-
-    if (!cm.options.lineNumbers && !markers && !line.bgClass && !line.wrapClass && !line.widgets)
-      return lineElement;
-
-    // Lines with gutter elements, widgets or a background class need
-    // to be wrapped again, and have the extra elements added to the
-    // wrapper div
-
-    if (reuse) {
-      reuse.alignable = null;
-      var isOk = true, widgetsSeen = 0, insertBefore = null;
-      for (var n = reuse.firstChild, next; n; n = next) {
-        next = n.nextSibling;
-        if (!/\bCodeMirror-linewidget\b/.test(n.className)) {
-          reuse.removeChild(n);
-        } else {
-          for (var i = 0; i < line.widgets.length; ++i) {
-            var widget = line.widgets[i];
-            if (widget.node == n.firstChild) {
-              if (!widget.above && !insertBefore) insertBefore = n;
-              positionLineWidget(widget, n, reuse, dims);
-              ++widgetsSeen;
-              break;
-            }
-          }
-          if (i == line.widgets.length) { isOk = false; break; }
-        }
-      }
-      reuse.insertBefore(lineElement, insertBefore);
-      if (isOk && widgetsSeen == line.widgets.length) {
-        wrap = reuse;
-        reuse.className = line.wrapClass || "";
-      }
-    }
-    if (!wrap) {
-      wrap = elt("div", null, line.wrapClass, "position: relative");
-      wrap.appendChild(lineElement);
-    }
-    // Kludge to make sure the styled element lies behind the selection (by z-index)
-    if (line.bgClass)
-      wrap.insertBefore(elt("div", null, line.bgClass + " CodeMirror-linebackground"), wrap.firstChild);
-    if (cm.options.lineNumbers || markers) {
-      var gutterWrap = wrap.insertBefore(elt("div", null, null, "position: absolute; left: " +
-                                             (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px"),
-                                         wrap.firstChild);
-      if (cm.options.fixedGutter) (wrap.alignable || (wrap.alignable = [])).push(gutterWrap);
-      if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"]))
-        wrap.lineNumber = gutterWrap.appendChild(
-          elt("div", lineNumberFor(cm.options, lineNo),
-              "CodeMirror-linenumber CodeMirror-gutter-elt",
-              "left: " + dims.gutterLeft["CodeMirror-linenumbers"] + "px; width: "
-              + display.lineNumInnerWidth + "px"));
-      if (markers)
-        for (var k = 0; k < cm.options.gutters.length; ++k) {
-          var id = cm.options.gutters[k], found = markers.hasOwnProperty(id) && markers[id];
-          if (found)
-            gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt", "left: " +
-                                       dims.gutterLeft[id] + "px; width: " + dims.gutterWidth[id] + "px"));
-        }
-    }
-    if (ie_lt8) wrap.style.zIndex = 2;
-    if (line.widgets && wrap != reuse) for (var i = 0, ws = line.widgets; i < ws.length; ++i) {
-      var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget");
-      if (!widget.handleMouseEvents) node.ignoreEvents = true;
-      positionLineWidget(widget, node, wrap, dims);
-      if (widget.above)
-        wrap.insertBefore(node, cm.options.lineNumbers && line.height != 0 ? gutterWrap : lineElement);
-      else
-        wrap.appendChild(node);
-      signalLater(widget, "redraw");
-    }
-    return wrap;
-  }
-
-  function positionLineWidget(widget, node, wrap, dims) {
-    if (widget.noHScroll) {
-      (wrap.alignable || (wrap.alignable = [])).push(node);
-      var width = dims.wrapperWidth;
-      node.style.left = dims.fixedPos + "px";
-      if (!widget.coverGutter) {
-        width -= dims.gutterTotalWidth;
-        node.style.paddingLeft = dims.gutterTotalWidth + "px";
-      }
-      node.style.width = width + "px";
-    }
-    if (widget.coverGutter) {
-      node.style.zIndex = 5;
-      node.style.position = "relative";
-      if (!widget.noHScroll) node.style.marginLeft = -dims.gutterTotalWidth + "px";
-    }
-  }
-
-  // SELECTION / CURSOR
-
-  function updateSelection(cm) {
-    var display = cm.display;
-    var collapsed = posEq(cm.doc.sel.from, cm.doc.sel.to);
-    if (collapsed || cm.options.showCursorWhenSelecting)
-      updateSelectionCursor(cm);
-    else
-      display.cursor.style.display = display.otherCursor.style.display = "none";
-    if (!collapsed)
-      updateSelectionRange(cm);
-    else
-      display.selectionDiv.style.display = "none";
-
-    // Move the hidden textarea near the cursor to prevent scrolling artifacts
-    if (cm.options.moveInputWithCursor) {
-      var headPos = cursorCoords(cm, cm.doc.sel.head, "div");
-      var wrapOff = getRect(display.wrapper), lineOff = getRect(display.lineDiv);
-      display.inputDiv.style.top = Math.max(0, Math.min(display.wrapper.clientHeight - 10,
-                                                        headPos.top + lineOff.top - wrapOff.top)) + "px";
-      display.inputDiv.style.left = Math.max(0, Math.min(display.wrapper.clientWidth - 10,
-                                                         headPos.left + lineOff.left - wrapOff.left)) + "px";
-    }
-  }
-
-  // No selection, plain cursor
-  function updateSelectionCursor(cm) {
-    var display = cm.display, pos = cursorCoords(cm, cm.doc.sel.head, "div");
-    display.cursor.style.left = pos.left + "px";
-    display.cursor.style.top = pos.top + "px";
-    display.cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px";
-    display.cursor.style.display = "";
-
-    if (pos.other) {
-      display.otherCursor.style.display = "";
-      display.otherCursor.style.left = pos.other.left + "px";
-      display.otherCursor.style.top = pos.other.top + "px";
-      display.otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px";
-    } else { display.otherCursor.style.display = "none"; }
-  }
-
-  // Highlight selection
-  function updateSelectionRange(cm) {
-    var display = cm.display, doc = cm.doc, sel = cm.doc.sel;
-    var fragment = document.createDocumentFragment();
-    var clientWidth = display.lineSpace.offsetWidth, pl = paddingLeft(cm.display);
-
-    function add(left, top, width, bottom) {
-      if (top < 0) top = 0;
-      fragment.appendChild(elt("div", null, "CodeMirror-selected", "position: absolute; left: " + left +
-                               "px; top: " + top + "px; width: " + (width == null ? clientWidth - left : width) +
-                               "px; height: " + (bottom - top) + "px"));
-    }
-
-    function drawForLine(line, fromArg, toArg) {
-      var lineObj = getLine(doc, line);
-      var lineLen = lineObj.text.length;
-      var start, end;
-      function coords(ch, bias) {
-        return charCoords(cm, Pos(line, ch), "div", lineObj, bias);
-      }
-
-      iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {
-        var leftPos = coords(from, "left"), rightPos, left, right;
-        if (from == to) {
-          rightPos = leftPos;
-          left = right = leftPos.left;
-        } else {
-          rightPos = coords(to - 1, "right");
-          if (dir == "rtl") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }
-          left = leftPos.left;
-          right = rightPos.right;
-        }
-        if (fromArg == null && from == 0) left = pl;
-        if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part
-          add(left, leftPos.top, null, leftPos.bottom);
-          left = pl;
-          if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);
-        }
-        if (toArg == null && to == lineLen) right = clientWidth;
-        if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)
-          start = leftPos;
-        if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)
-          end = rightPos;
-        if (left < pl + 1) left = pl;
-        add(left, rightPos.top, right - left, rightPos.bottom);
-      });
-      return {start: start, end: end};
-    }
-
-    if (sel.from.line == sel.to.line) {
-      drawForLine(sel.from.line, sel.from.ch, sel.to.ch);
-    } else {
-      var fromLine = getLine(doc, sel.from.line), toLine = getLine(doc, sel.to.line);
-      var singleVLine = visualLine(doc, fromLine) == visualLine(doc, toLine);
-      var leftEnd = drawForLine(sel.from.line, sel.from.ch, singleVLine ? fromLine.text.length : null).end;
-      var rightStart = drawForLine(sel.to.line, singleVLine ? 0 : null, sel.to.ch).start;
-      if (singleVLine) {
-        if (leftEnd.top < rightStart.top - 2) {
-          add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);
-          add(pl, rightStart.top, rightStart.left, rightStart.bottom);
-        } else {
-          add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);
-        }
-      }
-      if (leftEnd.bottom < rightStart.top)
-        add(pl, leftEnd.bottom, null, rightStart.top);
-    }
-
-    removeChildrenAndAdd(display.selectionDiv, fragment);
-    display.selectionDiv.style.display = "";
-  }
-
-  // Cursor-blinking
-  function restartBlink(cm) {
-    if (!cm.state.focused) return;
-    var display = cm.display;
-    clearInterval(display.blinker);
-    var on = true;
-    display.cursor.style.visibility = display.otherCursor.style.visibility = "";
-    if (cm.options.cursorBlinkRate > 0)
-      display.blinker = setInterval(function() {
-        display.cursor.style.visibility = display.otherCursor.style.visibility = (on = !on) ? "" : "hidden";
-      }, cm.options.cursorBlinkRate);
-  }
-
-  // HIGHLIGHT WORKER
-
-  function startWorker(cm, time) {
-    if (cm.doc.mode.startState && cm.doc.frontier < cm.display.showingTo)
-      cm.state.highlight.set(time, bind(highlightWorker, cm));
-  }
-
-  function highlightWorker(cm) {
-    var doc = cm.doc;
-    if (doc.frontier < doc.first) doc.frontier = doc.first;
-    if (doc.frontier >= cm.display.showingTo) return;
-    var end = +new Date + cm.options.workTime;
-    var state = copyState(doc.mode, getStateBefore(cm, doc.frontier));
-    var changed = [], prevChange;
-    doc.iter(doc.frontier, Math.min(doc.first + doc.size, cm.display.showingTo + 500), function(line) {
-      if (doc.frontier >= cm.display.showingFrom) { // Visible
-        var oldStyles = line.styles;
-        line.styles = highlightLine(cm, line, state);
-        var ischange = !oldStyles || oldStyles.length != line.styles.length;
-        for (var i = 0; !ischange && i < oldStyles.length; ++i) ischange = oldStyles[i] != line.styles[i];
-        if (ischange) {
-          if (prevChange && prevChange.end == doc.frontier) prevChange.end++;
-          else changed.push(prevChange = {start: doc.frontier, end: doc.frontier + 1});
-        }
-        line.stateAfter = copyState(doc.mode, state);
-      } else {
-        processLine(cm, line, state);
-        line.stateAfter = doc.frontier % 5 == 0 ? copyState(doc.mode, state) : null;
-      }
-      ++doc.frontier;
-      if (+new Date > end) {
-        startWorker(cm, cm.options.workDelay);
-        return true;
-      }
-    });
-    if (changed.length)
-      operation(cm, function() {
-        for (var i = 0; i < changed.length; ++i)
-          regChange(this, changed[i].start, changed[i].end);
-      })();
-  }
-
-  // Finds the line to start with when starting a parse. Tries to
-  // find a line with a stateAfter, so that it can start with a
-  // valid state. If that fails, it returns the line with the
-  // smallest indentation, which tends to need the least context to
-  // parse correctly.
-  function findStartLine(cm, n, precise) {
-    var minindent, minline, doc = cm.doc, maxScan = cm.doc.mode.innerMode ? 1000 : 100;
-    for (var search = n, lim = n - maxScan; search > lim; --search) {
-      if (search <= doc.first) return doc.first;
-      var line = getLine(doc, search - 1);
-      if (line.stateAfter && (!precise || search <= doc.frontier)) return search;
-      var indented = countColumn(line.text, null, cm.options.tabSize);
-      if (minline == null || minindent > indented) {
-        minline = search - 1;
-        minindent = indented;
-      }
-    }
-    return minline;
-  }
-
-  function getStateBefore(cm, n, precise) {
-    var doc = cm.doc, display = cm.display;
-    if (!doc.mode.startState) return true;
-    var pos = findStartLine(cm, n, precise), state = pos > doc.first && getLine(doc, pos-1).stateAfter;
-    if (!state) state = startState(doc.mode);
-    else state = copyState(doc.mode, state);
-    doc.iter(pos, n, function(line) {
-      processLine(cm, line, state);
-      var save = pos == n - 1 || pos % 5 == 0 || pos >= display.showingFrom && pos < display.showingTo;
-      line.stateAfter = save ? copyState(doc.mode, state) : null;
-      ++pos;
-    });
-    return state;
-  }
-
-  // POSITION MEASUREMENT
-
-  function paddingTop(display) {return display.lineSpace.offsetTop;}
-  function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight;}
-  function paddingLeft(display) {
-    var e = removeChildrenAndAdd(display.measure, elt("pre", null, null, "text-align: left")).appendChild(elt("span", "x"));
-    return e.offsetLeft;
-  }
-
-  function measureChar(cm, line, ch, data, bias) {
-    var dir = -1;
-    data = data || measureLine(cm, line);
-
-    for (var pos = ch;; pos += dir) {
-      var r = data[pos];
-      if (r) break;
-      if (dir < 0 && pos == 0) dir = 1;
-    }
-    bias = pos > ch ? "left" : pos < ch ? "right" : bias;
-    if (bias == "left" && r.leftSide) r = r.leftSide;
-    else if (bias == "right" && r.rightSide) r = r.rightSide;
-    return {left: pos < ch ? r.right : r.left,
-            right: pos > ch ? r.left : r.right,
-            top: r.top,
-            bottom: r.bottom};
-  }
-
-  function findCachedMeasurement(cm, line) {
-    var cache = cm.display.measureLineCache;
-    for (var i = 0; i < cache.length; ++i) {
-      var memo = cache[i];
-      if (memo.text == line.text && memo.markedSpans == line.markedSpans &&
-          cm.display.scroller.clientWidth == memo.width &&
-          memo.classes == line.textClass + "|" + line.bgClass + "|" + line.wrapClass)
-        return memo;
-    }
-  }
-
-  function clearCachedMeasurement(cm, line) {
-    var exists = findCachedMeasurement(cm, line);
-    if (exists) exists.text = exists.measure = exists.markedSpans = null;
-  }
-
-  function measureLine(cm, line) {
-    // First look in the cache
-    var cached = findCachedMeasurement(cm, line);
-    if (cached) return cached.measure;
-
-    // Failing that, recompute and store result in cache
-    var measure = measureLineInner(cm, line);
-    var cache = cm.display.measureLineCache;
-    var memo = {text: line.text, width: cm.display.scroller.clientWidth,
-                markedSpans: line.markedSpans, measure: measure,
-                classes: line.textClass + "|" + line.bgClass + "|" + line.wrapClass};
-    if (cache.length == 16) cache[++cm.display.measureLineCachePos % 16] = memo;
-    else cache.push(memo);
-    return measure;
-  }
-
-  function measureLineInner(cm, line) {
-    var display = cm.display, measure = emptyArray(line.text.length);
-    var pre = lineContent(cm, line, measure, true);
-
-    // IE does not cache element positions of inline elements between
-    // calls to getBoundingClientRect. This makes the loop below,
-    // which gathers the positions of all the characters on the line,
-    // do an amount of layout work quadratic to the number of
-    // characters. When line wrapping is off, we try to improve things
-    // by first subdividing the line into a bunch of inline blocks, so
-    // that IE can reuse most of the layout information from caches
-    // for those blocks. This does interfere with line wrapping, so it
-    // doesn't work when wrapping is on, but in that case the
-    // situation is slightly better, since IE does cache line-wrapping
-    // information and only recomputes per-line.
-    if (ie && !ie_lt8 && !cm.options.lineWrapping && pre.childNodes.length > 100) {
-      var fragment = document.createDocumentFragment();
-      var chunk = 10, n = pre.childNodes.length;
-      for (var i = 0, chunks = Math.ceil(n / chunk); i < chunks; ++i) {
-        var wrap = elt("div", null, null, "display: inline-block");
-        for (var j = 0; j < chunk && n; ++j) {
-          wrap.appendChild(pre.firstChild);
-          --n;
-        }
-        fragment.appendChild(wrap);
-      }
-      pre.appendChild(fragment);
-    }
-
-    removeChildrenAndAdd(display.measure, pre);
-
-    var outer = getRect(display.lineDiv);
-    var vranges = [], data = emptyArray(line.text.length), maxBot = pre.offsetHeight;
-    // Work around an IE7/8 bug where it will sometimes have randomly
-    // replaced our pre with a clone at this point.
-    if (ie_lt9 && display.measure.first != pre)
-      removeChildrenAndAdd(display.measure, pre);
-
-    function measureRect(rect) {
-      var top = rect.top - outer.top, bot = rect.bottom - outer.top;
-      if (bot > maxBot) bot = maxBot;
-      if (top < 0) top = 0;
-      for (var i = vranges.length - 2; i >= 0; i -= 2) {
-        var rtop = vranges[i], rbot = vranges[i+1];
-        if (rtop > bot || rbot < top) continue;
-        if (rtop <= top && rbot >= bot ||
-            top <= rtop && bot >= rbot ||
-            Math.min(bot, rbot) - Math.max(top, rtop) >= (bot - top) >> 1) {
-          vranges[i] = Math.min(top, rtop);
-          vranges[i+1] = Math.max(bot, rbot);
-          break;
-        }
-      }
-      if (i < 0) { i = vranges.length; vranges.push(top, bot); }
-      return {left: rect.left - outer.left,
-              right: rect.right - outer.left,
-              top: i, bottom: null};
-    }
-    function finishRect(rect) {
-      rect.bottom = vranges[rect.top+1];
-      rect.top = vranges[rect.top];
-    }
-
-    for (var i = 0, cur; i < measure.length; ++i) if (cur = measure[i]) {
-      var node = cur, rect = null;
-      // A widget might wrap, needs special care
-      if (/\bCodeMirror-widget\b/.test(cur.className) && cur.getClientRects) {
-        if (cur.firstChild.nodeType == 1) node = cur.firstChild;
-        var rects = node.getClientRects();
-        if (rects.length > 1) {
-          rect = data[i] = measureRect(rects[0]);
-          rect.rightSide = measureRect(rects[rects.length - 1]);
-        }
-      }
-      if (!rect) rect = data[i] = measureRect(getRect(node));
-      if (cur.measureRight) rect.right = getRect(cur.measureRight).left;
-      if (cur.leftSide) rect.leftSide = measureRect(getRect(cur.leftSide));
-    }
-    removeChildren(cm.display.measure);
-    for (var i = 0, cur; i < data.length; ++i) if (cur = data[i]) {
-      finishRect(cur);
-      if (cur.leftSide) finishRect(cur.leftSide);
-      if (cur.rightSide) finishRect(cur.rightSide);
-    }
-    return data;
-  }
-
-  function measureLineWidth(cm, line) {
-    var hasBadSpan = false;
-    if (line.markedSpans) for (var i = 0; i < line.markedSpans; ++i) {
-      var sp = line.markedSpans[i];
-      if (sp.collapsed && (sp.to == null || sp.to == line.text.length)) hasBadSpan = true;
-    }
-    var cached = !hasBadSpan && findCachedMeasurement(cm, line);
-    if (cached) return measureChar(cm, line, line.text.length, cached.measure, "right").right;
-
-    var pre = lineContent(cm, line, null, true);
-    var end = pre.appendChild(zeroWidthElement(cm.display.measure));
-    removeChildrenAndAdd(cm.display.measure, pre);
-    return getRect(end).right - getRect(cm.display.lineDiv).left;
-  }
-
-  function clearCaches(cm) {
-    cm.display.measureLineCache.length = cm.display.measureLineCachePos = 0;
-    cm.display.cachedCharWidth = cm.display.cachedTextHeight = null;
-    if (!cm.options.lineWrapping) cm.display.maxLineChanged = true;
-    cm.display.lineNumChars = null;
-  }
-
-  function pageScrollX() { return window.pageXOffset || (document.documentElement || document.body).scrollLeft; }
-  function pageScrollY() { return window.pageYOffset || (document.documentElement || document.body).scrollTop; }
-
-  // Context is one of "line", "div" (display.lineDiv), "local"/null (editor), or "page"
-  function intoCoordSystem(cm, lineObj, rect, context) {
-    if (lineObj.widgets) for (var i = 0; i < lineObj.widgets.length; ++i) if (lineObj.widgets[i].above) {
-      var size = widgetHeight(lineObj.widgets[i]);
-      rect.top += size; rect.bottom += size;
-    }
-    if (context == "line") return rect;
-    if (!context) context = "local";
-    var yOff = heightAtLine(cm, lineObj);
-    if (context == "local") yOff += paddingTop(cm.display);
-    else yOff -= cm.display.viewOffset;
-    if (context == "page" || context == "window") {
-      var lOff = getRect(cm.display.lineSpace);
-      yOff += lOff.top + (context == "window" ? 0 : pageScrollY());
-      var xOff = lOff.left + (context == "window" ? 0 : pageScrollX());
-      rect.left += xOff; rect.right += xOff;
-    }
-    rect.top += yOff; rect.bottom += yOff;
-    return rect;
-  }
-
-  // Context may be "window", "page", "div", or "local"/null
-  // Result is in "div" coords
-  function fromCoordSystem(cm, coords, context) {
-    if (context == "div") return coords;
-    var left = coords.left, top = coords.top;
-    // First move into "page" coordinate system
-    if (context == "page") {
-      left -= pageScrollX();
-      top -= pageScrollY();
-    } else if (context == "local" || !context) {
-      var localBox = getRect(cm.display.sizer);
-      left += localBox.left;
-      top += localBox.top;
-    }
-
-    var lineSpaceBox = getRect(cm.display.lineSpace);
-    return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top};
-  }
-
-  function charCoords(cm, pos, context, lineObj, bias) {
-    if (!lineObj) lineObj = getLine(cm.doc, pos.line);
-    return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, null, bias), context);
-  }
-
-  function cursorCoords(cm, pos, context, lineObj, measurement) {
-    lineObj = lineObj || getLine(cm.doc, pos.line);
-    if (!measurement) measurement = measureLine(cm, lineObj);
-    function get(ch, right) {
-      var m = measureChar(cm, lineObj, ch, measurement, right ? "right" : "left");
-      if (right) m.left = m.right; else m.right = m.left;
-      return intoCoordSystem(cm, lineObj, m, context);
-    }
-    function getBidi(ch, partPos) {
-      var part = order[partPos], right = part.level % 2;
-      if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) {
-        part = order[--partPos];
-        ch = bidiRight(part) - (part.level % 2 ? 0 : 1);
-        right = true;
-      } else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) {
-        part = order[++partPos];
-        ch = bidiLeft(part) - part.level % 2;
-        right = false;
-      }
-      if (right && ch == part.to && ch > part.from) return get(ch - 1);
-      return get(ch, right);
-    }
-    var order = getOrder(lineObj), ch = pos.ch;
-    if (!order) return get(ch);
-    var partPos = getBidiPartAt(order, ch);
-    var val = getBidi(ch, partPos);
-    if (bidiOther != null) val.other = getBidi(ch, bidiOther);
-    return val;
-  }
-
-  function PosWithInfo(line, ch, outside, xRel) {
-    var pos = new Pos(line, ch);
-    pos.xRel = xRel;
-    if (outside) pos.outside = true;
-    return pos;
-  }
-
-  // Coords must be lineSpace-local
-  function coordsChar(cm, x, y) {
-    var doc = cm.doc;
-    y += cm.display.viewOffset;
-    if (y < 0) return PosWithInfo(doc.first, 0, true, -1);
-    var lineNo = lineAtHeight(doc, y), last = doc.first + doc.size - 1;
-    if (lineNo > last)
-      return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);
-    if (x < 0) x = 0;
-
-    for (;;) {
-      var lineObj = getLine(doc, lineNo);
-      var found = coordsCharInner(cm, lineObj, lineNo, x, y);
-      var merged = collapsedSpanAtEnd(lineObj);
-      var mergedPos = merged && merged.find();
-      if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))
-        lineNo = mergedPos.to.line;
-      else
-        return found;
-    }
-  }
-
-  function coordsCharInner(cm, lineObj, lineNo, x, y) {
-    var innerOff = y - heightAtLine(cm, lineObj);
-    var wrongLine = false, adjust = 2 * cm.display.wrapper.clientWidth;
-    var measurement = measureLine(cm, lineObj);
-
-    function getX(ch) {
-      var sp = cursorCoords(cm, Pos(lineNo, ch), "line",
-                            lineObj, measurement);
-      wrongLine = true;
-      if (innerOff > sp.bottom) return sp.left - adjust;
-      else if (innerOff < sp.top) return sp.left + adjust;
-      else wrongLine = false;
-      return sp.left;
-    }
-
-    var bidi = getOrder(lineObj), dist = lineObj.text.length;
-    var from = lineLeft(lineObj), to = lineRight(lineObj);
-    var fromX = getX(from), fromOutside = wrongLine, toX = getX(to), toOutside = wrongLine;
-
-    if (x > toX) return PosWithInfo(lineNo, to, toOutside, 1);
-    // Do a binary search between these bounds.
-    for (;;) {
-      if (bidi ? to == from || to == moveVisually(lineObj, from, 1) : to - from <= 1) {
-        var ch = x < fromX || x - fromX <= toX - x ? from : to;
-        var xDiff = x - (ch == from ? fromX : toX);
-        while (isExtendingChar.test(lineObj.text.charAt(ch))) ++ch;
-        var pos = PosWithInfo(lineNo, ch, ch == from ? fromOutside : toOutside,
-                              xDiff < 0 ? -1 : xDiff ? 1 : 0);
-        return pos;
-      }
-      var step = Math.ceil(dist / 2), middle = from + step;
-      if (bidi) {
-        middle = from;
-        for (var i = 0; i < step; ++i) middle = moveVisually(lineObj, middle, 1);
-      }
-      var middleX = getX(middle);
-      if (middleX > x) {to = middle; toX = middleX; if (toOutside = wrongLine) toX += 1000; dist = step;}
-      else {from = middle; fromX = middleX; fromOutside = wrongLine; dist -= step;}
-    }
-  }
-
-  var measureText;
-  function textHeight(display) {
-    if (display.cachedTextHeight != null) return display.cachedTextHeight;
-    if (measureText == null) {
-      measureText = elt("pre");
-      // Measure a bunch of lines, for browsers that compute
-      // fractional heights.
-      for (var i = 0; i < 49; ++i) {
-        measureText.appendChild(document.createTextNode("x"));
-        measureText.appendChild(elt("br"));
-      }
-      measureText.appendChild(document.createTextNode("x"));
-    }
-    removeChildrenAndAdd(display.measure, measureText);
-    var height = measureText.offsetHeight / 50;
-    if (height > 3) display.cachedTextHeight = height;
-    removeChildren(display.measure);
-    return height || 1;
-  }
-
-  function charWidth(display) {
-    if (display.cachedCharWidth != null) return display.cachedCharWidth;
-    var anchor = elt("span", "x");
-    var pre = elt("pre", [anchor]);
-    removeChildrenAndAdd(display.measure, pre);
-    var width = anchor.offsetWidth;
-    if (width > 2) display.cachedCharWidth = width;
-    return width || 10;
-  }
-
-  // OPERATIONS
-
-  // Operations are used to wrap changes in such a way that each
-  // change won't have to update the cursor and display (which would
-  // be awkward, slow, and error-prone), but instead updates are
-  // batched and then all combined and executed at once.
-
-  var nextOpId = 0;
-  function startOperation(cm) {
-    cm.curOp = {
-      // An array of ranges of lines that have to be updated. See
-      // updateDisplay.
-      changes: [],
-      forceUpdate: false,
-      updateInput: null,
-      userSelChange: null,
-      textChanged: null,
-      selectionChanged: false,
-      cursorActivity: false,
-      updateMaxLine: false,
-      updateScrollPos: false,
-      id: ++nextOpId
-    };
-    if (!delayedCallbackDepth++) delayedCallbacks = [];
-  }
-
-  function endOperation(cm) {
-    var op = cm.curOp, doc = cm.doc, display = cm.display;
-    cm.curOp = null;
-
-    if (op.updateMaxLine) computeMaxLength(cm);
-    if (display.maxLineChanged && !cm.options.lineWrapping && display.maxLine) {
-      var width = measureLineWidth(cm, display.maxLine);
-      display.sizer.style.minWidth = Math.max(0, width + 3 + scrollerCutOff) + "px";
-      display.maxLineChanged = false;
-      var maxScrollLeft = Math.max(0, display.sizer.offsetLeft + display.sizer.offsetWidth - display.scroller.clientWidth);
-      if (maxScrollLeft < doc.scrollLeft && !op.updateScrollPos)
-        setScrollLeft(cm, Math.min(display.scroller.scrollLeft, maxScrollLeft), true);
-    }
-    var newScrollPos, updated;
-    if (op.updateScrollPos) {
-      newScrollPos = op.updateScrollPos;
-    } else if (op.selectionChanged && display.scroller.clientHeight) { // don't rescroll if not visible
-      var coords = cursorCoords(cm, doc.sel.head);
-      newScrollPos = calculateScrollPos(cm, coords.left, coords.top, coords.left, coords.bottom);
-    }
-    if (op.changes.length || op.forceUpdate || newScrollPos && newScrollPos.scrollTop != null) {
-      updated = updateDisplay(cm, op.changes, newScrollPos && newScrollPos.scrollTop, op.forceUpdate);
-      if (cm.display.scroller.offsetHeight) cm.doc.scrollTop = cm.display.scroller.scrollTop;
-    }
-    if (!updated && op.selectionChanged) updateSelection(cm);
-    if (op.updateScrollPos) {
-      display.scroller.scrollTop = display.scrollbarV.scrollTop = doc.scrollTop = newScrollPos.scrollTop;
-      display.scroller.scrollLeft = display.scrollbarH.scrollLeft = doc.scrollLeft = newScrollPos.scrollLeft;
-      alignHorizontally(cm);
-      if (op.scrollToPos)
-        scrollPosIntoView(cm, clipPos(cm.doc, op.scrollToPos), op.scrollToPosMargin);
-    } else if (newScrollPos) {
-      scrollCursorIntoView(cm);
-    }
-    if (op.selectionChanged) restartBlink(cm);
-
-    if (cm.state.focused && op.updateInput)
-      resetInput(cm, op.userSelChange);
-
-    var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers;
-    if (hidden) for (var i = 0; i < hidden.length; ++i)
-      if (!hidden[i].lines.length) signal(hidden[i], "hide");
-    if (unhidden) for (var i = 0; i < unhidden.length; ++i)
-      if (unhidden[i].lines.length) signal(unhidden[i], "unhide");
-
-    var delayed;
-    if (!--delayedCallbackDepth) {
-      delayed = delayedCallbacks;
-      delayedCallbacks = null;
-    }
-    if (op.textChanged)
-      signal(cm, "change", cm, op.textChanged);
-    if (op.cursorActivity) signal(cm, "cursorActivity", cm);
-    if (delayed) for (var i = 0; i < delayed.length; ++i) delayed[i]();
-  }
-
-  // Wraps a function in an operation. Returns the wrapped function.
-  function operation(cm1, f) {
-    return function() {
-      var cm = cm1 || this, withOp = !cm.curOp;
-      if (withOp) startOperation(cm);
-      try { var result = f.apply(cm, arguments); }
-      finally { if (withOp) endOperation(cm); }
-      return result;
-    };
-  }
-  function docOperation(f) {
-    return function() {
-      var withOp = this.cm && !this.cm.curOp, result;
-      if (withOp) startOperation(this.cm);
-      try { result = f.apply(this, arguments); }
-      finally { if (withOp) endOperation(this.cm); }
-      return result;
-    };
-  }
-  function runInOp(cm, f) {
-    var withOp = !cm.curOp, result;
-    if (withOp) startOperation(cm);
-    try { result = f(); }
-    finally { if (withOp) endOperation(cm); }
-    return result;
-  }
-
-  function regChange(cm, from, to, lendiff) {
-    if (from == null) from = cm.doc.first;
-    if (to == null) to = cm.doc.first + cm.doc.size;
-    cm.curOp.changes.push({from: from, to: to, diff: lendiff});
-  }
-
-  // INPUT HANDLING
-
-  function slowPoll(cm) {
-    if (cm.display.pollingFast) return;
-    cm.display.poll.set(cm.options.pollInterval, function() {
-      readInput(cm);
-      if (cm.state.focused) slowPoll(cm);
-    });
-  }
-
-  function fastPoll(cm) {
-    var missed = false;
-    cm.display.pollingFast = true;
-    function p() {
-      var changed = readInput(cm);
-      if (!changed && !missed) {missed = true; cm.display.poll.set(60, p);}
-      else {cm.display.pollingFast = false; slowPoll(cm);}
-    }
-    cm.display.poll.set(20, p);
-  }
-
-  // prevInput is a hack to work with IME. If we reset the textarea
-  // on every change, that breaks IME. So we look for changes
-  // compared to the previous content instead. (Modern browsers have
-  // events that indicate IME taking place, but these are not widely
-  // supported or compatible enough yet to rely on.)
-  function readInput(cm) {
-    var input = cm.display.input, prevInput = cm.display.prevInput, doc = cm.doc, sel = doc.sel;
-    if (!cm.state.focused || hasSelection(input) || isReadOnly(cm) || cm.state.disableInput) return false;
-    if (cm.state.pasteIncoming && cm.state.fakedLastChar) {
-      input.value = input.value.substring(0, input.value.length - 1);
-      cm.state.fakedLastChar = false;
-    }
-    var text = input.value;
-    if (text == prevInput && posEq(sel.from, sel.to)) return false;
-    if (ie && !ie_lt9 && cm.display.inputHasSelection === text) {
-      resetInput(cm, true);
-      return false;
-    }
-
-    var withOp = !cm.curOp;
-    if (withOp) startOperation(cm);
-    sel.shift = false;
-    var same = 0, l = Math.min(prevInput.length, text.length);
-    while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) ++same;
-    var from = sel.from, to = sel.to;
-    if (same < prevInput.length)
-      from = Pos(from.line, from.ch - (prevInput.length - same));
-    else if (cm.state.overwrite && posEq(from, to) && !cm.state.pasteIncoming)
-      to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + (text.length - same)));
-
-    var updateInput = cm.curOp.updateInput;
-    var changeEvent = {from: from, to: to, text: splitLines(text.slice(same)),
-                       origin: cm.state.pasteIncoming ? "paste" : "+input"};
-    makeChange(cm.doc, changeEvent, "end");
-    cm.curOp.updateInput = updateInput;
-    signalLater(cm, "inputRead", cm, changeEvent);
-
-    if (text.length > 1000 || text.indexOf("\n") > -1) input.value = cm.display.prevInput = "";
-    else cm.display.prevInput = text;
-    if (withOp) endOperation(cm);
-    cm.state.pasteIncoming = false;
-    return true;
-  }
-
-  function resetInput(cm, user) {
-    var minimal, selected, doc = cm.doc;
-    if (!posEq(doc.sel.from, doc.sel.to)) {
-      cm.display.prevInput = "";
-      minimal = hasCopyEvent &&
-        (doc.sel.to.line - doc.sel.from.line > 100 || (selected = cm.getSelection()).length > 1000);
-      var content = minimal ? "-" : selected || cm.getSelection();
-      cm.display.input.value = content;
-      if (cm.state.focused) selectInput(cm.display.input);
-      if (ie && !ie_lt9) cm.display.inputHasSelection = content;
-    } else if (user) {
-      cm.display.prevInput = cm.display.input.value = "";
-      if (ie && !ie_lt9) cm.display.inputHasSelection = null;
-    }
-    cm.display.inaccurateSelection = minimal;
-  }
-
-  function focusInput(cm) {
-    if (cm.options.readOnly != "nocursor" && (!mobile || document.activeElement != cm.display.input))
-      cm.display.input.focus();
-  }
-
-  function isReadOnly(cm) {
-    return cm.options.readOnly || cm.doc.cantEdit;
-  }
-
-  // EVENT HANDLERS
-
-  function registerEventHandlers(cm) {
-    var d = cm.display;
-    on(d.scroller, "mousedown", operation(cm, onMouseDown));
-    if (ie)
-      on(d.scroller, "dblclick", operation(cm, function(e) {
-        if (signalDOMEvent(cm, e)) return;
-        var pos = posFromMouse(cm, e);
-        if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) return;
-        e_preventDefault(e);
-        var word = findWordAt(getLine(cm.doc, pos.line).text, pos);
-        extendSelection(cm.doc, word.from, word.to);
-      }));
-    else
-      on(d.scroller, "dblclick", function(e) { signalDOMEvent(cm, e) || e_preventDefault(e); });
-    on(d.lineSpace, "selectstart", function(e) {
-      if (!eventInWidget(d, e)) e_preventDefault(e);
-    });
-    // Gecko browsers fire contextmenu *after* opening the menu, at
-    // which point we can't mess with it anymore. Context menu is
-    // handled in onMouseDown for Gecko.
-    if (!captureMiddleClick) on(d.scroller, "contextmenu", function(e) {onContextMenu(cm, e);});
-
-    on(d.scroller, "scroll", function() {
-      if (d.scroller.clientHeight) {
-        setScrollTop(cm, d.scroller.scrollTop);
-        setScrollLeft(cm, d.scroller.scrollLeft, true);
-        signal(cm, "scroll", cm);
-      }
-    });
-    on(d.scrollbarV, "scroll", function() {
-      if (d.scroller.clientHeight) setScrollTop(cm, d.scrollbarV.scrollTop);
-    });
-    on(d.scrollbarH, "scroll", function() {
-      if (d.scroller.clientHeight) setScrollLeft(cm, d.scrollbarH.scrollLeft);
-    });
-
-    on(d.scroller, "mousewheel", function(e){onScrollWheel(cm, e);});
-    on(d.scroller, "DOMMouseScroll", function(e){onScrollWheel(cm, e);});
-
-    function reFocus() { if (cm.state.focused) setTimeout(bind(focusInput, cm), 0); }
-    on(d.scrollbarH, "mousedown", reFocus);
-    on(d.scrollbarV, "mousedown", reFocus);
-    // Prevent wrapper from ever scrolling
-    on(d.wrapper, "scroll", function() { d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });
-
-    var resizeTimer;
-    function onResize() {
-      if (resizeTimer == null) resizeTimer = setTimeout(function() {
-        resizeTimer = null;
-        // Might be a text scaling operation, clear size caches.
-        d.cachedCharWidth = d.cachedTextHeight = knownScrollbarWidth = null;
-        clearCaches(cm);
-        runInOp(cm, bind(regChange, cm));
-      }, 100);
-    }
-    on(window, "resize", onResize);
-    // Above handler holds on to the editor and its data structures.
-    // Here we poll to unregister it when the editor is no longer in
-    // the document, so that it can be garbage-collected.
-    function unregister() {
-      for (var p = d.wrapper.parentNode; p && p != document.body; p = p.parentNode) {}
-      if (p) setTimeout(unregister, 5000);
-      else off(window, "resize", onResize);
-    }
-    setTimeout(unregister, 5000);
-
-    on(d.input, "keyup", operation(cm, function(e) {
-      if (signalDOMEvent(cm, e) || cm.options.onKeyEvent && cm.options.onKeyEvent(cm, addStop(e))) return;
-      if (e.keyCode == 16) cm.doc.sel.shift = false;
-    }));
-    on(d.input, "input", bind(fastPoll, cm));
-    on(d.input, "keydown", operation(cm, onKeyDown));
-    on(d.input, "keypress", operation(cm, onKeyPress));
-    on(d.input, "focus", bind(onFocus, cm));
-    on(d.input, "blur", bind(onBlur, cm));
-
-    function drag_(e) {
-      if (signalDOMEvent(cm, e) || cm.options.onDragEvent && cm.options.onDragEvent(cm, addStop(e))) return;
-      e_stop(e);
-    }
-    if (cm.options.dragDrop) {
-      on(d.scroller, "dragstart", function(e){onDragStart(cm, e);});
-      on(d.scroller, "dragenter", drag_);
-      on(d.scroller, "dragover", drag_);
-      on(d.scroller, "drop", operation(cm, onDrop));
-    }
-    on(d.scroller, "paste", function(e) {
-      if (eventInWidget(d, e)) return;
-      focusInput(cm);
-      fastPoll(cm);
-    });
-    on(d.input, "paste", function() {
-      // Workaround for webkit bug https://bugs.webkit.org/show_bug.cgi?id=90206
-      // Add a char to the end of textarea before paste occur so that
-      // selection doesn't span to the end of textarea.
-      if (webkit && !cm.state.fakedLastChar && !(new Date - cm.state.lastMiddleDown < 200)) {
-        var start = d.input.selectionStart, end = d.input.selectionEnd;
-        d.input.value += "$";
-        d.input.selectionStart = start;
-        d.input.selectionEnd = end;
-        cm.state.fakedLastChar = true;
-      }
-      cm.state.pasteIncoming = true;
-      fastPoll(cm);
-    });
-
-    function prepareCopy() {
-      if (d.inaccurateSelection) {
-        d.prevInput = "";
-        d.inaccurateSelection = false;
-        d.input.value = cm.getSelection();
-        selectInput(d.input);
-      }
-    }
-    on(d.input, "cut", prepareCopy);
-    on(d.input, "copy", prepareCopy);
-
-    // Needed to handle Tab key in KHTML
-    if (khtml) on(d.sizer, "mouseup", function() {
-        if (document.activeElement == d.input) d.input.blur();
-        focusInput(cm);
-    });
-  }
-
-  function eventInWidget(display, e) {
-    for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {
-      if (!n || n.ignoreEvents || n.parentNode == display.sizer && n != display.mover) return true;
-    }
-  }
-
-  function posFromMouse(cm, e, liberal) {
-    var display = cm.display;
-    if (!liberal) {
-      var target = e_target(e);
-      if (target == display.scrollbarH || target == display.scrollbarH.firstChild ||
-          target == display.scrollbarV || target == display.scrollbarV.firstChild ||
-          target == display.scrollbarFiller || target == display.gutterFiller) return null;
-    }
-    var x, y, space = getRect(display.lineSpace);
-    // Fails unpredictably on IE[67] when mouse is dragged around quickly.
-    try { x = e.clientX; y = e.clientY; } catch (e) { return null; }
-    return coordsChar(cm, x - space.left, y - space.top);
-  }
-
-  var lastClick, lastDoubleClick;
-  function onMouseDown(e) {
-    if (signalDOMEvent(this, e)) return;
-    var cm = this, display = cm.display, doc = cm.doc, sel = doc.sel;
-    sel.shift = e.shiftKey;
-
-    if (eventInWidget(display, e)) {
-      if (!webkit) {
-        display.scroller.draggable = false;
-        setTimeout(function(){display.scroller.draggable = true;}, 100);
-      }
-      return;
-    }
-    if (clickInGutter(cm, e)) return;
-    var start = posFromMouse(cm, e);
-
-    switch (e_button(e)) {
-    case 3:
-      if (captureMiddleClick) onContextMenu.call(cm, cm, e);
-      return;
-    case 2:
-      if (webkit) cm.state.lastMiddleDown = +new Date;
-      if (start) extendSelection(cm.doc, start);
-      setTimeout(bind(focusInput, cm), 20);
-      e_preventDefault(e);
-      return;
-    }
-    // For button 1, if it was clicked inside the editor
-    // (posFromMouse returning non-null), we have to adjust the
-    // selection.
-    if (!start) {if (e_target(e) == display.scroller) e_preventDefault(e); return;}
-
-    if (!cm.state.focused) onFocus(cm);
-
-    var now = +new Date, type = "single";
-    if (lastDoubleClick && lastDoubleClick.time > now - 400 && posEq(lastDoubleClick.pos, start)) {
-      type = "triple";
-      e_preventDefault(e);
-      setTimeout(bind(focusInput, cm), 20);
-      selectLine(cm, start.line);
-    } else if (lastClick && lastClick.time > now - 400 && posEq(lastClick.pos, start)) {
-      type = "double";
-      lastDoubleClick = {time: now, pos: start};
-      e_preventDefault(e);
-      var word = findWordAt(getLine(doc, start.line).text, start);
-      extendSelection(cm.doc, word.from, word.to);
-    } else { lastClick = {time: now, pos: start}; }
-
-    var last = start;
-    if (cm.options.dragDrop && dragAndDrop && !isReadOnly(cm) && !posEq(sel.from, sel.to) &&
-        !posLess(start, sel.from) && !posLess(sel.to, start) && type == "single") {
-      var dragEnd = operation(cm, function(e2) {
-        if (webkit) display.scroller.draggable = false;
-        cm.state.draggingText = false;
-        off(document, "mouseup", dragEnd);
-        off(display.scroller, "drop", dragEnd);
-        if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {
-          e_preventDefault(e2);
-          extendSelection(cm.doc, start);
-          focusInput(cm);
-        }
-      });
-      // Let the drag handler handle this.
-      if (webkit) display.scroller.draggable = true;
-      cm.state.draggingText = dragEnd;
-      // IE's approach to draggable
-      if (display.scroller.dragDrop) display.scroller.dragDrop();
-      on(document, "mouseup", dragEnd);
-      on(display.scroller, "drop", dragEnd);
-      return;
-    }
-    e_preventDefault(e);
-    if (type == "single") extendSelection(cm.doc, clipPos(doc, start));
-
-    var startstart = sel.from, startend = sel.to, lastPos = start;
-
-    function doSelect(cur) {
-      if (posEq(lastPos, cur)) return;
-      lastPos = cur;
-
-      if (type == "single") {
-        extendSelection(cm.doc, clipPos(doc, start), cur);
-        return;
-      }
-
-      startstart = clipPos(doc, startstart);
-      startend = clipPos(doc, startend);
-      if (type == "double") {
-        var word = findWordAt(getLine(doc, cur.line).text, cur);
-        if (posLess(cur, startstart)) extendSelection(cm.doc, word.from, startend);
-        else extendSelection(cm.doc, startstart, word.to);
-      } else if (type == "triple") {
-        if (posLess(cur, startstart)) extendSelection(cm.doc, startend, clipPos(doc, Pos(cur.line, 0)));
-        else extendSelection(cm.doc, startstart, clipPos(doc, Pos(cur.line + 1, 0)));
-      }
-    }
-
-    var editorSize = getRect(display.wrapper);
-    // Used to ensure timeout re-tries don't fire when another extend
-    // happened in the meantime (clearTimeout isn't reliable -- at
-    // least on Chrome, the timeouts still happen even when cleared,
-    // if the clear happens after their scheduled firing time).
-    var counter = 0;
-
-    function extend(e) {
-      var curCount = ++counter;
-      var cur = posFromMouse(cm, e, true);
-      if (!cur) return;
-      if (!posEq(cur, last)) {
-        if (!cm.state.focused) onFocus(cm);
-        last = cur;
-        doSelect(cur);
-        var visible = visibleLines(display, doc);
-        if (cur.line >= visible.to || cur.line < visible.from)
-          setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);
-      } else {
-        var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;
-        if (outside) setTimeout(operation(cm, function() {
-          if (counter != curCount) return;
-          display.scroller.scrollTop += outside;
-          extend(e);
-        }), 50);
-      }
-    }
-
-    function done(e) {
-      counter = Infinity;
-      e_preventDefault(e);
-      focusInput(cm);
-      off(document, "mousemove", move);
-      off(document, "mouseup", up);
-    }
-
-    var move = operation(cm, function(e) {
-      if (!ie && !e_button(e)) done(e);
-      else extend(e);
-    });
-    var up = operation(cm, done);
-    on(document, "mousemove", move);
-    on(document, "mouseup", up);
-  }
-
-  function clickInGutter(cm, e) {
-    var display = cm.display;
-    try { var mX = e.clientX, mY = e.clientY; }
-    catch(e) { return false; }
-
-    if (mX >= Math.floor(getRect(display.gutters).right)) return false;
-    e_preventDefault(e);
-    if (!hasHandler(cm, "gutterClick")) return true;
-
-    var lineBox = getRect(display.lineDiv);
-    if (mY > lineBox.bottom) return true;
-    mY -= lineBox.top - display.viewOffset;
-
-    for (var i = 0; i < cm.options.gutters.length; ++i) {
-      var g = display.gutters.childNodes[i];
-      if (g && getRect(g).right >= mX) {
-        var line = lineAtHeight(cm.doc, mY);
-        var gutter = cm.options.gutters[i];
-        signalLater(cm, "gutterClick", cm, line, gutter, e);
-        break;
-      }
-    }
-    return true;
-  }
-
-  // Kludge to work around strange IE behavior where it'll sometimes
-  // re-fire a series of drag-related events right after the drop (#1551)
-  var lastDrop = 0;
-
-  function onDrop(e) {
-    var cm = this;
-    if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e) || (cm.options.onDragEvent && cm.options.onDragEvent(cm, addStop(e))))
-      return;
-    e_preventDefault(e);
-    if (ie) lastDrop = +new Date;
-    var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;
-    if (!pos || isReadOnly(cm)) return;
-    if (files && files.length && window.FileReader && window.File) {
-      var n = files.length, text = Array(n), read = 0;
-      var loadFile = function(file, i) {
-        var reader = new FileReader;
-        reader.onload = function() {
-          text[i] = reader.result;
-          if (++read == n) {
-            pos = clipPos(cm.doc, pos);
-            makeChange(cm.doc, {from: pos, to: pos, text: splitLines(text.join("\n")), origin: "paste"}, "around");
-          }
-        };
-        reader.readAsText(file);
-      };
-      for (var i = 0; i < n; ++i) loadFile(files[i], i);
-    } else {
-      // Don't do a replace if the drop happened inside of the selected text.
-      if (cm.state.draggingText && !(posLess(pos, cm.doc.sel.from) || posLess(cm.doc.sel.to, pos))) {
-        cm.state.draggingText(e);
-        // Ensure the editor is re-focused
-        setTimeout(bind(focusInput, cm), 20);
-        return;
-      }
-      try {
-        var text = e.dataTransfer.getData("Text");
-        if (text) {
-          var curFrom = cm.doc.sel.from, curTo = cm.doc.sel.to;
-          setSelection(cm.doc, pos, pos);
-          if (cm.state.draggingText) replaceRange(cm.doc, "", curFrom, curTo, "paste");
-          cm.replaceSelection(text, null, "paste");
-          focusInput(cm);
-          onFocus(cm);
-        }
-      }
-      catch(e){}
-    }
-  }
-
-  function onDragStart(cm, e) {
-    if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return; }
-    if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) return;
-
-    var txt = cm.getSelection();
-    e.dataTransfer.setData("Text", txt);
-
-    // Use dummy image instead of default browsers image.
-    // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.
-    if (e.dataTransfer.setDragImage && !safari) {
-      var img = elt("img", null, null, "position: fixed; left: 0; top: 0;");
-      if (opera) {
-        img.width = img.height = 1;
-        cm.display.wrapper.appendChild(img);
-        // Force a relayout, or Opera won't use our image for some obscure reason
-        img._top = img.offsetTop;
-      }
-      e.dataTransfer.setDragImage(img, 0, 0);
-      if (opera) img.parentNode.removeChild(img);
-    }
-  }
-
-  function setScrollTop(cm, val) {
-    if (Math.abs(cm.doc.scrollTop - val) < 2) return;
-    cm.doc.scrollTop = val;
-    if (!gecko) updateDisplay(cm, [], val);
-    if (cm.display.scroller.scrollTop != val) cm.display.scroller.scrollTop = val;
-    if (cm.display.scrollbarV.scrollTop != val) cm.display.scrollbarV.scrollTop = val;
-    if (gecko) updateDisplay(cm, []);
-    startWorker(cm, 100);
-  }
-  function setScrollLeft(cm, val, isScroller) {
-    if (isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) return;
-    val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth);
-    cm.doc.scrollLeft = val;
-    alignHorizontally(cm);
-    if (cm.display.scroller.scrollLeft != val) cm.display.scroller.scrollLeft = val;
-    if (cm.display.scrollbarH.scrollLeft != val) cm.display.scrollbarH.scrollLeft = val;
-  }
-
-  // Since the delta values reported on mouse wheel events are
-  // unstandardized between browsers and even browser versions, and
-  // generally horribly unpredictable, this code starts by measuring
-  // the scroll effect that the first few mouse wheel events have,
-  // and, from that, detects the way it can convert deltas to pixel
-  // offsets afterwards.
-  //
-  // The reason we want to know the amount a wheel event will scroll
-  // is that it gives us a chance to update the display before the
-  // actual scrolling happens, reducing flickering.
-
-  var wheelSamples = 0, wheelPixelsPerUnit = null;
-  // Fill in a browser-detected starting value on browsers where we
-  // know one. These don't have to be accurate -- the result of them
-  // being wrong would just be a slight flicker on the first wheel
-  // scroll (if it is large enough).
-  if (ie) wheelPixelsPerUnit = -.53;
-  else if (gecko) wheelPixelsPerUnit = 15;
-  else if (chrome) wheelPixelsPerUnit = -.7;
-  else if (safari) wheelPixelsPerUnit = -1/3;
-
-  function onScrollWheel(cm, e) {
-    var dx = e.wheelDeltaX, dy = e.wheelDeltaY;
-    if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) dx = e.detail;
-    if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) dy = e.detail;
-    else if (dy == null) dy = e.wheelDelta;
-
-    var display = cm.display, scroll = display.scroller;
-    // Quit if there's nothing to scroll here
-    if (!(dx && scroll.scrollWidth > scroll.clientWidth ||
-          dy && scroll.scrollHeight > scroll.clientHeight)) return;
-
-    // Webkit browsers on OS X abort momentum scrolls when the target
-    // of the scroll event is removed from the scrollable element.
-    // This hack (see related code in patchDisplay) makes sure the
-    // element is kept around.
-    if (dy && mac && webkit) {
-      for (var cur = e.target; cur != scroll; cur = cur.parentNode) {
-        if (cur.lineObj) {
-          cm.display.currentWheelTarget = cur;
-          break;
-        }
-      }
-    }
-
-    // On some browsers, horizontal scrolling will cause redraws to
-    // happen before the gutter has been realigned, causing it to
-    // wriggle around in a most unseemly way. When we have an
-    // estimated pixels/delta value, we just handle horizontal
-    // scrolling entirely here. It'll be slightly off from native, but
-    // better than glitching out.
-    if (dx && !gecko && !opera && wheelPixelsPerUnit != null) {
-      if (dy)
-        setScrollTop(cm, Math.max(0, Math.min(scroll.scrollTop + dy * wheelPixelsPerUnit, scroll.scrollHeight - scroll.clientHeight)));
-      setScrollLeft(cm, Math.max(0, Math.min(scroll.scrollLeft + dx * wheelPixelsPerUnit, scroll.scrollWidth - scroll.clientWidth)));
-      e_preventDefault(e);
-      display.wheelStartX = null; // Abort measurement, if in progress
-      return;
-    }
-
-    if (dy && wheelPixelsPerUnit != null) {
-      var pixels = dy * wheelPixelsPerUnit;
-      var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;
-      if (pixels < 0) top = Math.max(0, top + pixels - 50);
-      else bot = Math.min(cm.doc.height, bot + pixels + 50);
-      updateDisplay(cm, [], {top: top, bottom: bot});
-    }
-
-    if (wheelSamples < 20) {
-      if (display.wheelStartX == null) {
-        display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;
-        display.wheelDX = dx; display.wheelDY = dy;
-        setTimeout(function() {
-          if (display.wheelStartX == null) return;
-          var movedX = scroll.scrollLeft - display.wheelStartX;
-          var movedY = scroll.scrollTop - display.wheelStartY;
-          var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||
-            (movedX && display.wheelDX && movedX / display.wheelDX);
-          display.wheelStartX = display.wheelStartY = null;
-          if (!sample) return;
-          wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);
-          ++wheelSamples;
-        }, 200);
-      } else {
-        display.wheelDX += dx; display.wheelDY += dy;
-      }
-    }
-  }
-
-  function doHandleBinding(cm, bound, dropShift) {
-    if (typeof bound == "string") {
-      bound = commands[bound];
-      if (!bound) return false;
-    }
-    // Ensure previous input has been read, so that the handler sees a
-    // consistent view of the document
-    if (cm.display.pollingFast && readInput(cm)) cm.display.pollingFast = false;
-    var doc = cm.doc, prevShift = doc.sel.shift, done = false;
-    try {
-      if (isReadOnly(cm)) cm.state.suppressEdits = true;
-      if (dropShift) doc.sel.shift = false;
-      done = bound(cm) != Pass;
-    } finally {
-      doc.sel.shift = prevShift;
-      cm.state.suppressEdits = false;
-    }
-    return done;
-  }
-
-  function allKeyMaps(cm) {
-    var maps = cm.state.keyMaps.slice(0);
-    if (cm.options.extraKeys) maps.push(cm.options.extraKeys);
-    maps.push(cm.options.keyMap);
-    return maps;
-  }
-
-  var maybeTransition;
-  function handleKeyBinding(cm, e) {
-    // Handle auto keymap transitions
-    var startMap = getKeyMap(cm.options.keyMap), next = startMap.auto;
-    clearTimeout(maybeTransition);
-    if (next && !isModifierKey(e)) maybeTransition = setTimeout(function() {
-      if (getKeyMap(cm.options.keyMap) == startMap) {
-        cm.options.keyMap = (next.call ? next.call(null, cm) : next);
-        keyMapChanged(cm);
-      }
-    }, 50);
-
-    var name = keyName(e, true), handled = false;
-    if (!name) return false;
-    var keymaps = allKeyMaps(cm);
-
-    if (e.shiftKey) {
-      // First try to resolve full name (including 'Shift-'). Failing
-      // that, see if there is a cursor-motion command (starting with
-      // 'go') bound to the keyname without 'Shift-'.
-      handled = lookupKey("Shift-" + name, keymaps, function(b) {return doHandleBinding(cm, b, true);})
-             || lookupKey(name, keymaps, function(b) {
-                  if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion)
-                    return doHandleBinding(cm, b);
-                });
-    } else {
-      handled = lookupKey(name, keymaps, function(b) { return doHandleBinding(cm, b); });
-    }
-
-    if (handled) {
-      e_preventDefault(e);
-      restartBlink(cm);
-      if (ie_lt9) { e.oldKeyCode = e.keyCode; e.keyCode = 0; }
-      signalLater(cm, "keyHandled", cm, name, e);
-    }
-    return handled;
-  }
-
-  function handleCharBinding(cm, e, ch) {
-    var handled = lookupKey("'" + ch + "'", allKeyMaps(cm),
-                            function(b) { return doHandleBinding(cm, b, true); });
-    if (handled) {
-      e_preventDefault(e);
-      restartBlink(cm);
-      signalLater(cm, "keyHandled", cm, "'" + ch + "'", e);
-    }
-    return handled;
-  }
-
-  var lastStoppedKey = null;
-  function onKeyDown(e) {
-    var cm = this;
-    if (!cm.state.focused) onFocus(cm);
-    if (signalDOMEvent(cm, e) || cm.options.onKeyEvent && cm.options.onKeyEvent(cm, addStop(e))) return;
-    if (ie && e.keyCode == 27) e.returnValue = false;
-    var code = e.keyCode;
-    // IE does strange things with escape.
-    cm.doc.sel.shift = code == 16 || e.shiftKey;
-    // First give onKeyEvent option a chance to handle this.
-    var handled = handleKeyBinding(cm, e);
-    if (opera) {
-      lastStoppedKey = handled ? code : null;
-      // Opera has no cut event... we try to at least catch the key combo
-      if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))
-        cm.replaceSelection("");
-    }
-  }
-
-  function onKeyPress(e) {
-    var cm = this;
-    if (signalDOMEvent(cm, e) || cm.options.onKeyEvent && cm.options.onKeyEvent(cm, addStop(e))) return;
-    var keyCode = e.keyCode, charCode = e.charCode;
-    if (opera && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return;}
-    if (((opera && (!e.which || e.which < 10)) || khtml) && handleKeyBinding(cm, e)) return;
-    var ch = String.fromCharCode(charCode == null ? keyCode : charCode);
-    if (this.options.electricChars && this.doc.mode.electricChars &&
-        this.options.smartIndent && !isReadOnly(this) &&
-        this.doc.mode.electricChars.indexOf(ch) > -1)
-      setTimeout(operation(cm, function() {indentLine(cm, cm.doc.sel.to.line, "smart");}), 75);
-    if (handleCharBinding(cm, e, ch)) return;
-    if (ie && !ie_lt9) cm.display.inputHasSelection = null;
-    fastPoll(cm);
-  }
-
-  function onFocus(cm) {
-    if (cm.options.readOnly == "nocursor") return;
-    if (!cm.state.focused) {
-      signal(cm, "focus", cm);
-      cm.state.focused = true;
-      if (cm.display.wrapper.className.search(/\bCodeMirror-focused\b/) == -1)
-        cm.display.wrapper.className += " CodeMirror-focused";
-      if (!cm.curOp) {
-        resetInput(cm, true);
-        if (webkit) setTimeout(bind(resetInp

<TRUNCATED>

[6/9] git commit: Merge branch 'develop' into MARMOTTA-321

Posted by ja...@apache.org.
Merge branch 'develop' into MARMOTTA-321


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/8fa40d82
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/8fa40d82
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/8fa40d82

Branch: refs/heads/develop
Commit: 8fa40d828af14dc69d77d5f157b7c9abfef632ff
Parents: e568642 3c31958
Author: Jakob Frank <ja...@apache.org>
Authored: Wed Oct 23 16:07:27 2013 +0200
Committer: Jakob Frank <ja...@apache.org>
Committed: Wed Oct 23 16:07:27 2013 +0200

----------------------------------------------------------------------
 build/check-rebel.root.sh                       | 11 +++++++
 commons/marmotta-commons/pom.xml                |  1 -
 launchers/marmotta-webapp/pom.xml               |  2 +-
 .../backends/marmotta-backend-bigdata/pom.xml   |  3 +-
 .../bigdata/BigDataSesame27Repository.java      | 13 ++++++--
 .../backend/bigdata/BigDataSesame27Sail.java    | 24 ++++++++++----
 platform/backends/marmotta-backend-kiwi/pom.xml |  4 +--
 .../backends/marmotta-backend-memory/pom.xml    |  4 +--
 .../backends/marmotta-backend-native/pom.xml    |  4 +--
 .../ldcache/marmotta-ldcache-common/pom.xml     |  4 +--
 .../LinkedDataCachingWebService.java            | 32 ++++++++++++------
 platform/ldcache/marmotta-ldcache-file/pom.xml  |  2 +-
 platform/ldcache/marmotta-ldcache-kiwi/pom.xml  |  2 +-
 .../src/main/resources/META-INF/beans.xml       | 28 ----------------
 .../src/main/resources/kiwi-module.properties   | 34 --------------------
 15 files changed, 74 insertions(+), 94 deletions(-)
----------------------------------------------------------------------



[4/9] git commit: removed codemirror sources and added dependency to the codemirror webjar TODO: Update L&N

Posted by ja...@apache.org.
removed codemirror sources and added dependency to the codemirror webjar
TODO: Update L&N


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/9c3b63b1
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/9c3b63b1
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/9c3b63b1

Branch: refs/heads/develop
Commit: 9c3b63b1686d999d6287fadd957f33022346d409
Parents: 47855a4
Author: Jakob Frank <ja...@apache.org>
Authored: Wed Oct 23 14:40:54 2013 +0200
Committer: Jakob Frank <ja...@apache.org>
Committed: Wed Oct 23 14:40:54 2013 +0200

----------------------------------------------------------------------
 extras/webjars/codemirror/pom.xml               |   24 +-
 .../src/main/resources/codemirror.css           |  259 -
 .../codemirror/src/main/resources/codemirror.js | 5831 ------------------
 .../codemirror/src/main/resources/ldpath.html   |  246 -
 .../codemirror/src/main/resources/ldpath.js     |  471 --
 .../src/main/resources/matchbrackets.js         |   86 -
 .../src/main/resources/mode/ldpath/ldpath.css   |  181 +
 .../src/main/resources/mode/ldpath/ldpath.html  |   87 +
 .../src/main/resources/mode/ldpath/ldpath.js    |  471 ++
 .../src/main/resources/mode/skwrl/skwrl.css     |  172 +
 .../src/main/resources/mode/skwrl/skwrl.html    |   96 +
 .../src/main/resources/mode/skwrl/skwrl.js      |  486 ++
 .../src/main/resources/simple-hint.css          |   20 -
 .../src/main/resources/simple-hint.js           |   80 -
 .../codemirror/src/main/resources/skwrl.html    |  254 -
 .../codemirror/src/main/resources/skwrl.js      |  491 --
 .../codemirror/src/main/resources/sparql.js     |  210 -
 parent/pom.xml                                  |    7 +-
 18 files changed, 1518 insertions(+), 7954 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/9c3b63b1/extras/webjars/codemirror/pom.xml
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/pom.xml b/extras/webjars/codemirror/pom.xml
index 004f5bd..7b2b3f8 100644
--- a/extras/webjars/codemirror/pom.xml
+++ b/extras/webjars/codemirror/pom.xml
@@ -32,7 +32,7 @@
     </properties>
 
     <groupId>org.apache.marmotta.webjars</groupId>
-    <artifactId>codemirror</artifactId>
+    <artifactId>codemirror-modes</artifactId>
     <packaging>jar</packaging>
 
     <build>
@@ -42,6 +42,7 @@
                 <artifactId>yuicompressor-maven-plugin</artifactId>
                 <version>1.0.0</version>
                 <executions>
+                <!-- jakob@apache.org: deactivated during webjar-cleanup
                     <execution>
                         <id>assemble-javascript</id>
                         <goals>
@@ -68,16 +69,19 @@
                             <output>${webjar.path}/codemirror.css</output>
                         </configuration>
                     </execution>
+                 -->
                 </executions>
             </plugin>
             <plugin>
-                <!-- these are "extras", so they come from 3rd parties, no RAT check! -->
                 <groupId>org.apache.rat</groupId>
                 <artifactId>apache-rat-plugin</artifactId>
+            </plugin>
+            <plugin> <!-- generate JRebel Configuration -->
+                <groupId>org.zeroturnaround</groupId>
+                <artifactId>jrebel-maven-plugin</artifactId>
                 <configuration>
-                    <excludes>
-                        <exclude>src/**</exclude>
-                    </excludes>
+                    <relativePath>../../../</relativePath>
+                    <rootPath>$${rebel.root}</rootPath>
                 </configuration>
             </plugin>
         </plugins>
@@ -85,8 +89,10 @@
             <resource>
                 <directory>src/main/resources</directory>
                 <excludes>
+                <!-- do not exclude as the yuicompressor is turned off.
                     <exclude>**/*.js</exclude>
                     <exclude>**/*.css</exclude>
+                 -->
                 </excludes>
                 <filtering>false</filtering>
                 <targetPath>${webjar.path}</targetPath>
@@ -94,4 +100,12 @@
         </resources>
     </build>
 
+    <dependencies>
+        <dependency>
+            <groupId>org.webjars</groupId>
+            <artifactId>codemirror</artifactId>
+            <version>${webjar.version}</version>
+            <scope>runtime</scope>
+        </dependency>
+    </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/marmotta/blob/9c3b63b1/extras/webjars/codemirror/src/main/resources/codemirror.css
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/codemirror.css b/extras/webjars/codemirror/src/main/resources/codemirror.css
deleted file mode 100644
index c95db64..0000000
--- a/extras/webjars/codemirror/src/main/resources/codemirror.css
+++ /dev/null
@@ -1,259 +0,0 @@
-/* BASICS */
-
-.CodeMirror {
-  /* Set height, width, borders, and global font properties here */
-  font-family: monospace;
-  height: 300px;
-}
-.CodeMirror-scroll {
-  /* Set scrolling behaviour here */
-  overflow: auto;
-}
-
-/* PADDING */
-
-.CodeMirror-lines {
-  padding: 4px 0; /* Vertical padding around content */
-}
-.CodeMirror pre {
-  padding: 0 4px; /* Horizontal padding of content */
-}
-
-.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
-  background-color: white; /* The little square between H and V scrollbars */
-}
-
-/* GUTTER */
-
-.CodeMirror-gutters {
-  border-right: 1px solid #ddd;
-  background-color: #f7f7f7;
-  white-space: nowrap;
-}
-.CodeMirror-linenumbers {}
-.CodeMirror-linenumber {
-  padding: 0 3px 0 5px;
-  min-width: 20px;
-  text-align: right;
-  color: #999;
-}
-
-/* CURSOR */
-
-.CodeMirror div.CodeMirror-cursor {
-  border-left: 1px solid black;
-  z-index: 3;
-}
-/* Shown when moving in bi-directional text */
-.CodeMirror div.CodeMirror-secondarycursor {
-  border-left: 1px solid silver;
-}
-.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor {
-  width: auto;
-  border: 0;
-  background: #7e7;
-  z-index: 1;
-}
-/* Can style cursor different in overwrite (non-insert) mode */
-.CodeMirror div.CodeMirror-cursor.CodeMirror-overwrite {}
-
-.cm-tab { display: inline-block; }
-
-/* DEFAULT THEME */
-
-.cm-s-default .cm-keyword {color: #708;}
-.cm-s-default .cm-atom {color: #219;}
-.cm-s-default .cm-number {color: #164;}
-.cm-s-default .cm-def {color: #00f;}
-.cm-s-default .cm-variable {color: black;}
-.cm-s-default .cm-variable-2 {color: #05a;}
-.cm-s-default .cm-variable-3 {color: #085;}
-.cm-s-default .cm-property {color: black;}
-.cm-s-default .cm-operator {color: black;}
-.cm-s-default .cm-comment {color: #a50;}
-.cm-s-default .cm-string {color: #a11;}
-.cm-s-default .cm-string-2 {color: #f50;}
-.cm-s-default .cm-meta {color: #555;}
-.cm-s-default .cm-error {color: #f00;}
-.cm-s-default .cm-qualifier {color: #555;}
-.cm-s-default .cm-builtin {color: #30a;}
-.cm-s-default .cm-bracket {color: #997;}
-.cm-s-default .cm-tag {color: #170;}
-.cm-s-default .cm-attribute {color: #00c;}
-.cm-s-default .cm-header {color: blue;}
-.cm-s-default .cm-quote {color: #090;}
-.cm-s-default .cm-hr {color: #999;}
-.cm-s-default .cm-link {color: #00c;}
-
-.cm-negative {color: #d44;}
-.cm-positive {color: #292;}
-.cm-header, .cm-strong {font-weight: bold;}
-.cm-em {font-style: italic;}
-.cm-link {text-decoration: underline;}
-
-.cm-invalidchar {color: #f00;}
-
-div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
-div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
-.CodeMirror-activeline-background {background: #e8f2ff;}
-
-/* STOP */
-
-/* The rest of this file contains styles related to the mechanics of
-   the editor. You probably shouldn't touch them. */
-
-.CodeMirror {
-  line-height: 1;
-  position: relative;
-  overflow: hidden;
-  background: white;
-  color: black;
-}
-
-.CodeMirror-scroll {
-  /* 30px is the magic margin used to hide the element's real scrollbars */
-  /* See overflow: hidden in .CodeMirror */
-  margin-bottom: -30px; margin-right: -30px;
-  padding-bottom: 30px; padding-right: 30px;
-  height: 100%;
-  outline: none; /* Prevent dragging from highlighting the element */
-  position: relative;
-}
-.CodeMirror-sizer {
-  position: relative;
-}
-
-/* The fake, visible scrollbars. Used to force redraw during scrolling
-   before actuall scrolling happens, thus preventing shaking and
-   flickering artifacts. */
-.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
-  position: absolute;
-  z-index: 6;
-  display: none;
-}
-.CodeMirror-vscrollbar {
-  right: 0; top: 0;
-  overflow-x: hidden;
-  overflow-y: scroll;
-}
-.CodeMirror-hscrollbar {
-  bottom: 0; left: 0;
-  overflow-y: hidden;
-  overflow-x: scroll;
-}
-.CodeMirror-scrollbar-filler {
-  right: 0; bottom: 0;
-}
-.CodeMirror-gutter-filler {
-  left: 0; bottom: 0;
-}
-
-.CodeMirror-gutters {
-  position: absolute; left: 0; top: 0;
-  padding-bottom: 30px;
-  z-index: 3;
-}
-.CodeMirror-gutter {
-  white-space: normal;
-  height: 100%;
-  padding-bottom: 30px;
-  margin-bottom: -32px;
-  display: inline-block;
-  /* Hack to make IE7 behave */
-  *zoom:1;
-  *display:inline;
-}
-.CodeMirror-gutter-elt {
-  position: absolute;
-  cursor: default;
-  z-index: 4;
-}
-
-.CodeMirror-lines {
-  cursor: text;
-}
-.CodeMirror pre {
-  /* Reset some styles that the rest of the page might have set */
-  -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
-  border-width: 0;
-  background: transparent;
-  font-family: inherit;
-  font-size: inherit;
-  margin: 0;
-  white-space: pre;
-  word-wrap: normal;
-  line-height: inherit;
-  color: inherit;
-  z-index: 2;
-  position: relative;
-  overflow: visible;
-}
-.CodeMirror-wrap pre {
-  word-wrap: break-word;
-  white-space: pre-wrap;
-  word-break: normal;
-}
-.CodeMirror-code pre {
-  border-right: 30px solid transparent;
-  width: -webkit-fit-content;
-  width: -moz-fit-content;
-  width: fit-content;
-}
-.CodeMirror-wrap .CodeMirror-code pre {
-  border-right: none;
-  width: auto;
-}
-.CodeMirror-linebackground {
-  position: absolute;
-  left: 0; right: 0; top: 0; bottom: 0;
-  z-index: 0;
-}
-
-.CodeMirror-linewidget {
-  position: relative;
-  z-index: 2;
-  overflow: auto;
-}
-
-.CodeMirror-widget {
-}
-
-.CodeMirror-wrap .CodeMirror-scroll {
-  overflow-x: hidden;
-}
-
-.CodeMirror-measure {
-  position: absolute;
-  width: 100%; height: 0px;
-  overflow: hidden;
-  visibility: hidden;
-}
-.CodeMirror-measure pre { position: static; }
-
-.CodeMirror div.CodeMirror-cursor {
-  position: absolute;
-  visibility: hidden;
-  border-right: none;
-  width: 0;
-}
-.CodeMirror-focused div.CodeMirror-cursor {
-  visibility: visible;
-}
-
-.CodeMirror-selected { background: #d9d9d9; }
-.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
-
-.cm-searching {
-  background: #ffa;
-  background: rgba(255, 255, 0, .4);
-}
-
-/* IE7 hack to prevent it from returning funny offsetTops on the spans */
-.CodeMirror span { *vertical-align: text-bottom; }
-
-@media print {
-  /* Hide the cursor when printing */
-  .CodeMirror div.CodeMirror-cursor {
-    visibility: hidden;
-  }
-}


[5/9] git commit: Updated marmotta-ldpath and marmotta-sparql to the new codemirror-modes webjar layout. Prepared marmotta-reasoner-kiwi to use the skwrl-mode for codemirror (MARMOTTA-346)

Posted by ja...@apache.org.
Updated marmotta-ldpath and marmotta-sparql to the new codemirror-modes webjar layout.
Prepared marmotta-reasoner-kiwi to use the skwrl-mode for codemirror (MARMOTTA-346)


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/e5686422
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/e5686422
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/e5686422

Branch: refs/heads/develop
Commit: e56864228e54d75bc7a94e62b188f43e4bd6e5c6
Parents: 9c3b63b
Author: Jakob Frank <ja...@apache.org>
Authored: Wed Oct 23 14:44:04 2013 +0200
Committer: Jakob Frank <ja...@apache.org>
Committed: Wed Oct 23 14:48:08 2013 +0200

----------------------------------------------------------------------
 platform/marmotta-ldpath/pom.xml                       |  2 +-
 .../src/main/resources/web/admin/ldpath.html           | 13 ++++++++++---
 .../src/main/resources/web/admin/ldpath.js             |  5 ++++-
 platform/marmotta-reasoner-kiwi/pom.xml                |  7 ++++---
 .../src/main/resources/web/admin/configure.html        | 10 +++++++++-
 platform/marmotta-sparql/pom.xml                       |  2 +-
 .../src/main/resources/web/admin/sgvizler.html         | 10 +++++-----
 .../src/main/resources/web/admin/snorql.html           |  6 ++++--
 .../src/main/resources/web/admin/update.html           |  6 ++++--
 9 files changed, 42 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/e5686422/platform/marmotta-ldpath/pom.xml
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldpath/pom.xml b/platform/marmotta-ldpath/pom.xml
index abb6788..b8b5b4b 100644
--- a/platform/marmotta-ldpath/pom.xml
+++ b/platform/marmotta-ldpath/pom.xml
@@ -155,7 +155,7 @@
         </dependency>
         <dependency>
             <groupId>org.apache.marmotta.webjars</groupId>
-            <artifactId>codemirror</artifactId>
+            <artifactId>codemirror-modes</artifactId>
         </dependency>
 
 

http://git-wip-us.apache.org/repos/asf/marmotta/blob/e5686422/platform/marmotta-ldpath/src/main/resources/web/admin/ldpath.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldpath/src/main/resources/web/admin/ldpath.html b/platform/marmotta-ldpath/src/main/resources/web/admin/ldpath.html
index 6c551ab..955e468 100644
--- a/platform/marmotta-ldpath/src/main/resources/web/admin/ldpath.html
+++ b/platform/marmotta-ldpath/src/main/resources/web/admin/ldpath.html
@@ -26,10 +26,17 @@
 <title>LDPath Test Suite</title>
 <script type="text/javascript" src="../../webjars/jquery/1.8.2/jquery.min.js"></script>
 <script type="text/javascript" src="../../webjars/marmotta.js"></script>
-<script type="text/javascript" src="../../webjars/codemirror/3.16/codemirror.js"></script>
+
+<script type="text/javascript" src="../../webjars/codemirror/3.16/lib/codemirror.js"></script>
+<link rel="stylesheet" href="../../webjars/codemirror/3.16/lib/codemirror.css">
+
+<script src="../../webjars/codemirror/3.16/addon/hint/show-hint.js"></script>
+<link rel="stylesheet" href="../../webjars/codemirror/3.16/addon/hint/show-hint.css">
+
+<script src="../../webjars/codemirror-modes/3.16/mode/ldpath/ldpath.js"></script>
+<link rel="stylesheet" href="../../webjars/codemirror-modes/3.16/mode/ldpath/ldpath.css">
 
 <link rel="stylesheet" href="style.css" />
-<link rel="stylesheet" href="../../webjars/codemirror/3.16/codemirror.css" />
 <script type="text/javascript" src="ldpath.js"></script>
 <!--###END_HEAD###-->
 </head>
@@ -46,12 +53,12 @@
       <div><input id="addContextUri" type=text /><button id="addContext">Add Context</button></div>
     </div>
     <div id="editor">
-      <h2>LDPath</h2>
       <div>
         <div class="chooseEditor"><a href="#" title="use smart editor" class="editor_cm">rich</a> | <a href="#" title="use plain text editor" class="editor_plain">plain</a></div>
 <!--
         <label for="templates">Select Template:</label><select id="templates"></select>&nbsp;<span id="chooserStatus" class="icon loading">Loading...</span>
 -->
+        <h2>LDPath</h2>
       </div>
       <div>
         <div class="editor_wrap"><textarea id="ldpath"></textarea></div>

http://git-wip-us.apache.org/repos/asf/marmotta/blob/e5686422/platform/marmotta-ldpath/src/main/resources/web/admin/ldpath.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldpath/src/main/resources/web/admin/ldpath.js b/platform/marmotta-ldpath/src/main/resources/web/admin/ldpath.js
index 3005581..275c31a 100644
--- a/platform/marmotta-ldpath/src/main/resources/web/admin/ldpath.js
+++ b/platform/marmotta-ldpath/src/main/resources/web/admin/ldpath.js
@@ -154,10 +154,13 @@ $(function() {
         $.getJSON(_SERVER_URL + "ldpath/util/namespaces", function(data) {
             defaultNamespaces = data;
         }).complete(function() {
+            CodeMirror.commands.autocomplete = function(cm) {
+                CodeMirror.showHint(cm, CodeMirror.hint.ldpath);
+            };
           editor = CodeMirror.fromTextArea(document.getElementById("ldpath"), {
               lineNumbers : true,
               matchBrackets : true,
-              extraKeys: {"Ctrl-Space": "ldpathAutocomplete"},
+              extraKeys: {"Ctrl-Space": "autocomplete"},
               mode : {
                 name: "ldpath",
                 baseURL: _SERVER_URL,

http://git-wip-us.apache.org/repos/asf/marmotta/blob/e5686422/platform/marmotta-reasoner-kiwi/pom.xml
----------------------------------------------------------------------
diff --git a/platform/marmotta-reasoner-kiwi/pom.xml b/platform/marmotta-reasoner-kiwi/pom.xml
index e4e994f..912bffb 100644
--- a/platform/marmotta-reasoner-kiwi/pom.xml
+++ b/platform/marmotta-reasoner-kiwi/pom.xml
@@ -162,7 +162,10 @@
         <dependency>
             <groupId>org.apache.marmotta</groupId>
             <artifactId>kiwi-reasoner</artifactId>
-            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.marmotta.webjars</groupId>
+            <artifactId>codemirror-modes</artifactId>
         </dependency>
 
         <!-- LMF Testing Package -->
@@ -176,13 +179,11 @@
         <dependency>
             <groupId>org.eclipse.jetty</groupId>
             <artifactId>jetty-server</artifactId>
-            <version>${jetty.version}</version>
             <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.eclipse.jetty</groupId>
             <artifactId>jetty-servlet</artifactId>
-            <version>${jetty.version}</version>
             <scope>test</scope>
         </dependency>
         <dependency>

http://git-wip-us.apache.org/repos/asf/marmotta/blob/e5686422/platform/marmotta-reasoner-kiwi/src/main/resources/web/admin/configure.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-reasoner-kiwi/src/main/resources/web/admin/configure.html b/platform/marmotta-reasoner-kiwi/src/main/resources/web/admin/configure.html
index b3d6142..4729698 100644
--- a/platform/marmotta-reasoner-kiwi/src/main/resources/web/admin/configure.html
+++ b/platform/marmotta-reasoner-kiwi/src/main/resources/web/admin/configure.html
@@ -24,6 +24,14 @@
 <!--###BEGIN_HEAD###-->
     <title>Reasoning Module</title>
     <script type="text/javascript" src="../../webjars/jquery/1.8.2/jquery.min.js"></script>
+    <script type="text/javascript" src="../../webjars/codemirror/3.16/lib/codemirror.js"></script>
+    <link rel="stylesheet" href="../../webjars/codemirror/3.16/lib/codemirror.css">
+
+    <script src="../../webjars/codemirror/3.16/addon/hint/show-hint.js"></script>
+    <link rel="stylesheet" href="../../webjars/codemirror/3.16/addon/hint/show-hint.css">
+
+    <script src="../../webjars/codemirror-modes/3.16/mode/skwrl/skwrl.js"></script>
+
     <script type="text/javascript" src="widget/conf_reasoner.js"></script>
     <script type="text/javascript">
         jQuery(document).ready(function(){
@@ -52,4 +60,4 @@
         </div>
 <!--###END_CONTENT###-->
 </body>
-</html>
\ No newline at end of file
+</html>

http://git-wip-us.apache.org/repos/asf/marmotta/blob/e5686422/platform/marmotta-sparql/pom.xml
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/pom.xml b/platform/marmotta-sparql/pom.xml
index aa0c931..096c581 100644
--- a/platform/marmotta-sparql/pom.xml
+++ b/platform/marmotta-sparql/pom.xml
@@ -183,7 +183,7 @@
             <artifactId>jquery-ui</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.apache.marmotta.webjars</groupId>
+            <groupId>org.webjars</groupId>
             <artifactId>codemirror</artifactId>
         </dependency>
         <dependency>

http://git-wip-us.apache.org/repos/asf/marmotta/blob/e5686422/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler.html b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler.html
index 7d8c8af..96ddb70 100644
--- a/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler.html
+++ b/platform/marmotta-sparql/src/main/resources/web/admin/sgvizler.html
@@ -8,9 +8,9 @@
     <script type="text/javascript" src="../../webjars/jquery/1.8.2/jquery.min.js"></script>
     <script type="text/javascript" src="https://www.google.com/jsapi"></script>
     <script type="text/javascript" src="../../webjars/sgvizler/0.5.1/sgvizler.js" id="sgvzlr_script" ></script>
-    <script type="text/javascript" src="../../webjars/codemirror/3.16/codemirror.js"></script>
-    <script type="text/javascript" src="../../webjars/codemirror/3.16/simple-hint.js"></script>
-    <script type="text/javascript" src="../../webjars/codemirror/3.16/sparql.js"></script>
+    <script type="text/javascript" src="../../webjars/codemirror/3.16/lib/codemirror.js"></script>
+    <script type="text/javascript" src="../../webjars/codemirror/3.16/addon/hint/show-hint.js"></script>
+    <script type="text/javascript" src="../../webjars/codemirror/3.16/mode/sparql/sparql.js"></script>
     <script type="text/javascript">
         // CONFIGURATION Sgvizler 0.5: Set variables to fit your setup.
         // NB! Do not let the last item in a list end with a comma.
@@ -94,8 +94,8 @@
         $(document).ready(sgvizler.go());
 
     </script>
-    <link rel="stylesheet" href="../../../cm/codemirror.css" />
-    <link rel="stylesheet" href="../../../cm/simple-hint.css" />
+    <link rel="stylesheet" href="../../webjars/codemirror/3.16/lib/codemirror.css" />
+    <link rel="stylesheet" href="../../webjars/codemirror/3.16/adon/hint/show-hint.css" />
     <style type="text/css">
         .CodeMirror {
             background-color: #fff;

http://git-wip-us.apache.org/repos/asf/marmotta/blob/e5686422/platform/marmotta-sparql/src/main/resources/web/admin/snorql.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/snorql.html b/platform/marmotta-sparql/src/main/resources/web/admin/snorql.html
index 1cd0349..78b6e03 100755
--- a/platform/marmotta-sparql/src/main/resources/web/admin/snorql.html
+++ b/platform/marmotta-sparql/src/main/resources/web/admin/snorql.html
@@ -24,7 +24,7 @@
     <!--###BEGIN_HEAD###-->
     <title>Snorql: A SPARQL Explorer</title>
     <link rel="stylesheet" type="text/css" href="../../webjars/snorql/1.0/snorql.css" />
-    <link rel="stylesheet" type="text/css" href="../../webjars/codemirror/3.16/codemirror.css" />
+    <link rel="stylesheet" type="text/css" href="../../webjars/codemirror/3.16/lib/codemirror.css" />
     <style type="text/css">
         .CodeMirror {
             background-color: #fff;
@@ -112,7 +112,9 @@
 
     <script type="text/javascript" src="../../webjars/snorql/1.0/snorql.js"></script>
     <script type="text/javascript" src="../../webjars/jquery/1.8.2/jquery.min.js"></script>
-    <script type="text/javascript" src="../../webjars/codemirror/3.16/codemirror.js"></script>
+    <script type="text/javascript" src="../../webjars/codemirror/3.16/lib/codemirror.js"></script>
+    <script type="text/javascript" src="../../webjars/codemirror/3.16/addon/hint/show-hint.js"></script>
+    <script type="text/javascript" src="../../webjars/codemirror/3.16/mode/sparql/sparql.js"></script>
     <script type="text/javascript">
         jQuery.noConflict();
     </script>

http://git-wip-us.apache.org/repos/asf/marmotta/blob/e5686422/platform/marmotta-sparql/src/main/resources/web/admin/update.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/resources/web/admin/update.html b/platform/marmotta-sparql/src/main/resources/web/admin/update.html
index 691ad66..6207cfc 100644
--- a/platform/marmotta-sparql/src/main/resources/web/admin/update.html
+++ b/platform/marmotta-sparql/src/main/resources/web/admin/update.html
@@ -22,7 +22,7 @@
     <!--###BEGIN_HEAD###-->
     <title>SPARQL Update</title>
     <link href="../style/sparql.css" rel="stylesheet" type="text/css" />
-    <link href="../../webjars/codemirror/3.16/codemirror.css" rel="stylesheet" type="text/css" />
+    <link href="../../webjars/codemirror/3.16/lib/codemirror.css" rel="stylesheet" type="text/css" />
     <style type="text/css">
         #refesh_box {
             display: inline-block;
@@ -76,7 +76,9 @@
 
 <script type="text/javascript" src="../../webjars/jquery/1.8.2/jquery.min.js"></script>
 <script type="text/javascript" src="../../webjars/jquery-ui/1.8.21/jquery-ui.min.js"></script>
-<script type="text/javascript" src="../../webjars/codemirror/3.16/codemirror.js"></script>
+<script type="text/javascript" src="../../webjars/codemirror/3.16/lib/codemirror.js"></script>
+<script type="text/javascript" src="../../webjars/codemirror/3.16/addon/hint/show-hint.js"></script>
+<script type="text/javascript" src="../../webjars/codemirror/3.16/mode/sparql/sparql.js"></script>
 
 <script type="text/javascript">