diff options
author | Wu Cheng-Han | 2016-11-28 01:36:48 +0800 |
---|---|---|
committer | Wu Cheng-Han | 2016-11-28 01:36:48 +0800 |
commit | 9f79ed929e4156dc8b5b45161895d70d51cfa5a2 (patch) | |
tree | 760e0491a52558036b93b0c986e96aa95b4c0127 /public/vendor/codemirror/mode/http | |
parent | 3a305b8258782797b328f2ce46e8bb74e9603594 (diff) |
Update to move custom CodeMirror codebase to our own repo and update webpack build config
Diffstat (limited to 'public/vendor/codemirror/mode/http')
-rw-r--r-- | public/vendor/codemirror/mode/http/http.js | 113 | ||||
-rw-r--r-- | public/vendor/codemirror/mode/http/index.html | 45 |
2 files changed, 0 insertions, 158 deletions
diff --git a/public/vendor/codemirror/mode/http/http.js b/public/vendor/codemirror/mode/http/http.js deleted file mode 100644 index 9a3c5f9f..00000000 --- a/public/vendor/codemirror/mode/http/http.js +++ /dev/null @@ -1,113 +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("http", function() { - function failFirstLine(stream, state) { - stream.skipToEnd(); - state.cur = header; - return "error"; - } - - function start(stream, state) { - if (stream.match(/^HTTP\/\d\.\d/)) { - state.cur = responseStatusCode; - return "keyword"; - } else if (stream.match(/^[A-Z]+/) && /[ \t]/.test(stream.peek())) { - state.cur = requestPath; - return "keyword"; - } else { - return failFirstLine(stream, state); - } - } - - function responseStatusCode(stream, state) { - var code = stream.match(/^\d+/); - if (!code) return failFirstLine(stream, state); - - state.cur = responseStatusText; - var status = Number(code[0]); - if (status >= 100 && status < 200) { - return "positive informational"; - } else if (status >= 200 && status < 300) { - return "positive success"; - } else if (status >= 300 && status < 400) { - return "positive redirect"; - } else if (status >= 400 && status < 500) { - return "negative client-error"; - } else if (status >= 500 && status < 600) { - return "negative server-error"; - } else { - return "error"; - } - } - - function responseStatusText(stream, state) { - stream.skipToEnd(); - state.cur = header; - return null; - } - - function requestPath(stream, state) { - stream.eatWhile(/\S/); - state.cur = requestProtocol; - return "string-2"; - } - - function requestProtocol(stream, state) { - if (stream.match(/^HTTP\/\d\.\d$/)) { - state.cur = header; - return "keyword"; - } else { - return failFirstLine(stream, state); - } - } - - function header(stream) { - if (stream.sol() && !stream.eat(/[ \t]/)) { - if (stream.match(/^.*?:/)) { - return "atom"; - } else { - stream.skipToEnd(); - return "error"; - } - } else { - stream.skipToEnd(); - return "string"; - } - } - - function body(stream) { - stream.skipToEnd(); - return null; - } - - return { - token: function(stream, state) { - var cur = state.cur; - if (cur != header && cur != body && stream.eatSpace()) return null; - return cur(stream, state); - }, - - blankLine: function(state) { - state.cur = body; - }, - - startState: function() { - return {cur: start}; - } - }; -}); - -CodeMirror.defineMIME("message/http", "http"); - -}); diff --git a/public/vendor/codemirror/mode/http/index.html b/public/vendor/codemirror/mode/http/index.html deleted file mode 100644 index 0b8d5315..00000000 --- a/public/vendor/codemirror/mode/http/index.html +++ /dev/null @@ -1,45 +0,0 @@ -<!doctype html> - -<title>CodeMirror: HTTP mode</title> -<meta charset="utf-8"/> -<link rel=stylesheet href="../../doc/docs.css"> - -<link rel="stylesheet" href="../../lib/codemirror.css"> -<script src="../../lib/codemirror.js"></script> -<script src="http.js"></script> -<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style> -<div id=nav> - <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a> - - <ul> - <li><a href="../../index.html">Home</a> - <li><a href="../../doc/manual.html">Manual</a> - <li><a href="https://github.com/codemirror/codemirror">Code</a> - </ul> - <ul> - <li><a href="../index.html">Language modes</a> - <li><a class=active href="#">HTTP</a> - </ul> -</div> - -<article> -<h2>HTTP mode</h2> - - -<div><textarea id="code" name="code"> -POST /somewhere HTTP/1.1 -Host: example.com -If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT -Content-Type: application/x-www-form-urlencoded; - charset=utf-8 -User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.11 (KHTML, like Gecko) Ubuntu/12.04 Chromium/20.0.1132.47 Chrome/20.0.1132.47 Safari/536.11 - -This is the request body! -</textarea></div> - - <script> - var editor = CodeMirror.fromTextArea(document.getElementById("code"), {}); - </script> - - <p><strong>MIME types defined:</strong> <code>message/http</code>.</p> - </article> |