summaryrefslogtreecommitdiffstats
path: root/public/plugins/codemirror-5.17.0/mode/turtle/turtle.js
diff options
context:
space:
mode:
authorMichael Lustfield <MTecknology@users.noreply.github.com>2017-08-23 09:58:05 -0500
committerKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2017-08-23 16:58:05 +0200
commita915a09e4f8edc7734c9374ad9f9a51b39241ee3 (patch)
treed2498d2cfb579cd5c1d73d750163905cfbc5fab5 /public/plugins/codemirror-5.17.0/mode/turtle/turtle.js
parent64b706884635bcac31710d878bbb5e1b2d96ac0c (diff)
downloadgitea-a915a09e4f8edc7734c9374ad9f9a51b39241ee3.tar.gz
gitea-a915a09e4f8edc7734c9374ad9f9a51b39241ee3.zip
Moved vendored js/css into `public/vendor` and documented sources (#1484) (#2241)
* Cleaning up public/ and documenting js/css libs. This commit mostly addresses #1484 by moving vendor'ed plugins into a vendor/ directory and documenting their upstream source and license in vendor/librejs.html. This also proves gitea is using only open source js/css libraries which helps toward reaching #1524. * Removing unused css file. The version of this file in use is located at: vendor/plugins/highlight/github.css * Cleaned up librejs.html and added javascript header A SafeJS function was added to templates/helper.go to allow keeping comments inside of javascript. A javascript comment was added in the header of templates/base/head.tmpl to mark all non-inline source as free. The librejs.html file was updated to meet the current librejs spec. I have now verified that the librejs plugin detects most of the scripts included in gitea and suspect the non-free detections are the result of a bug in the plugin. I believe this commit is enough to meet the C0.0 requirement of #1534. * Updating SafeJS function per lint suggestion * Added VERSIONS file, per request
Diffstat (limited to 'public/plugins/codemirror-5.17.0/mode/turtle/turtle.js')
-rw-r--r--public/plugins/codemirror-5.17.0/mode/turtle/turtle.js162
1 files changed, 0 insertions, 162 deletions
diff --git a/public/plugins/codemirror-5.17.0/mode/turtle/turtle.js b/public/plugins/codemirror-5.17.0/mode/turtle/turtle.js
deleted file mode 100644
index 0988f0a442..0000000000
--- a/public/plugins/codemirror-5.17.0/mode/turtle/turtle.js
+++ /dev/null
@@ -1,162 +0,0 @@
-// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
-
-(function(mod) {
- if (typeof exports == "object" && typeof module == "object") // CommonJS
- mod(require("../../lib/codemirror"));
- else if (typeof define == "function" && define.amd) // AMD
- define(["../../lib/codemirror"], mod);
- else // Plain browser env
- mod(CodeMirror);
-})(function(CodeMirror) {
-"use strict";
-
-CodeMirror.defineMode("turtle", function(config) {
- var indentUnit = config.indentUnit;
- var curPunc;
-
- function wordRegexp(words) {
- return new RegExp("^(?:" + words.join("|") + ")$", "i");
- }
- var ops = wordRegexp([]);
- var keywords = wordRegexp(["@prefix", "@base", "a"]);
- var operatorChars = /[*+\-<>=&|]/;
-
- function tokenBase(stream, state) {
- var ch = stream.next();
- curPunc = null;
- 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 == ":") {
- return "operator";
- } else {
- stream.eatWhile(/[_\w\d]/);
- if(stream.peek() == ":") {
- return "variable-3";
- } else {
- var word = stream.current();
-
- if(keywords.test(word)) {
- return "meta";
- }
-
- if(ch >= "A" && ch <= "Z") {
- return "comment";
- } else {
- return "keyword";
- }
- }
- var word = stream.current();
- if (ops.test(word))
- return null;
- else if (keywords.test(word))
- return "meta";
- 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() {
- 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);
- },
-
- lineComment: "#"
- };
-});
-
-CodeMirror.defineMIME("text/turtle", "turtle");
-
-});