├── .env.example ├── .gitignore ├── LICENSE ├── README.md ├── docker-compose.jwilder-nginx.yml ├── docker-compose.yml ├── docker ├── nginx │ ├── Dockerfile │ ├── application.conf │ ├── entrypoint.sh │ └── requirements.txt └── uwsgi │ └── Dockerfile ├── gulpfile.js ├── package-lock.json ├── package.json ├── pastitude.ini ├── pastitude.py ├── resources ├── js │ ├── app │ │ ├── app.js │ │ ├── input.js │ │ └── output.js │ └── editor │ │ └── editor.js └── sass │ ├── app.scss │ ├── codemirror-default.scss │ ├── codemirror.scss │ ├── dark.scss │ ├── elements.scss │ ├── highlight.scss │ ├── remodal-default-theme.scss │ └── remodal.scss ├── static ├── bundle.min.css ├── bundle.min.js ├── codemirror │ ├── apl │ │ ├── apl.js │ │ └── apl.min.js │ ├── asciiarmor │ │ ├── asciiarmor.js │ │ └── asciiarmor.min.js │ ├── asn.1 │ │ ├── asn.1.js │ │ └── asn.1.min.js │ ├── asterisk │ │ ├── asterisk.js │ │ └── asterisk.min.js │ ├── brainfuck │ │ ├── brainfuck.js │ │ └── brainfuck.min.js │ ├── clike │ │ ├── clike.js │ │ └── clike.min.js │ ├── clojure │ │ ├── clojure.js │ │ └── clojure.min.js │ ├── cmake │ │ ├── cmake.js │ │ └── cmake.min.js │ ├── cobol │ │ ├── cobol.js │ │ └── cobol.min.js │ ├── coffeescript │ │ ├── coffeescript.js │ │ └── coffeescript.min.js │ ├── commonlisp │ │ ├── commonlisp.js │ │ └── commonlisp.min.js │ ├── crystal │ │ ├── crystal.js │ │ └── crystal.min.js │ ├── css │ │ ├── css.js │ │ └── css.min.js │ ├── cypher │ │ ├── cypher.js │ │ └── cypher.min.js │ ├── d │ │ ├── d.js │ │ └── d.min.js │ ├── dart │ │ ├── dart.js │ │ └── dart.min.js │ ├── diff │ │ ├── diff.js │ │ └── diff.min.js │ ├── django │ │ ├── django.js │ │ └── django.min.js │ ├── dockerfile │ │ ├── dockerfile.js │ │ └── dockerfile.min.js │ ├── dtd │ │ ├── dtd.js │ │ └── dtd.min.js │ ├── dylan │ │ ├── dylan.js │ │ └── dylan.min.js │ ├── ebnf │ │ ├── ebnf.js │ │ └── ebnf.min.js │ ├── ecl │ │ ├── ecl.js │ │ └── ecl.min.js │ ├── eiffel │ │ ├── eiffel.js │ │ └── eiffel.min.js │ ├── elm │ │ ├── elm.js │ │ └── elm.min.js │ ├── erlang │ │ ├── erlang.js │ │ └── erlang.min.js │ ├── factor │ │ ├── factor.js │ │ └── factor.min.js │ ├── fcl │ │ ├── fcl.js │ │ └── fcl.min.js │ ├── forth │ │ ├── forth.js │ │ └── forth.min.js │ ├── fortran │ │ ├── fortran.js │ │ └── fortran.min.js │ ├── gas │ │ ├── gas.js │ │ └── gas.min.js │ ├── gfm │ │ ├── gfm.js │ │ └── gfm.min.js │ ├── gherkin │ │ ├── gherkin.js │ │ └── gherkin.min.js │ ├── go │ │ ├── go.js │ │ └── go.min.js │ ├── groovy │ │ ├── groovy.js │ │ └── groovy.min.js │ ├── haml │ │ ├── haml.js │ │ └── haml.min.js │ ├── handlebars │ │ ├── handlebars.js │ │ └── handlebars.min.js │ ├── haskell-literate │ │ ├── haskell-literate.js │ │ └── haskell-literate.min.js │ ├── haskell │ │ ├── haskell.js │ │ └── haskell.min.js │ ├── haxe │ │ ├── haxe.js │ │ └── haxe.min.js │ ├── htmlembedded │ │ ├── htmlembedded.js │ │ └── htmlembedded.min.js │ ├── htmlmixed │ │ ├── htmlmixed.js │ │ └── htmlmixed.min.js │ ├── http │ │ ├── http.js │ │ └── http.min.js │ ├── idl │ │ ├── idl.js │ │ └── idl.min.js │ ├── javascript │ │ ├── javascript.js │ │ └── javascript.min.js │ ├── jinja2 │ │ ├── jinja2.js │ │ └── jinja2.min.js │ ├── jsx │ │ ├── jsx.js │ │ └── jsx.min.js │ ├── julia │ │ ├── julia.js │ │ └── julia.min.js │ ├── livescript │ │ ├── livescript.js │ │ └── livescript.min.js │ ├── lua │ │ ├── lua.js │ │ └── lua.min.js │ ├── markdown │ │ ├── markdown.js │ │ └── markdown.min.js │ ├── mathematica │ │ ├── mathematica.js │ │ └── mathematica.min.js │ ├── mbox │ │ ├── mbox.js │ │ └── mbox.min.js │ ├── mirc │ │ ├── mirc.js │ │ └── mirc.min.js │ ├── mllike │ │ ├── mllike.js │ │ └── mllike.min.js │ ├── modelica │ │ ├── modelica.js │ │ └── modelica.min.js │ ├── mscgen │ │ ├── mscgen.js │ │ └── mscgen.min.js │ ├── mumps │ │ ├── mumps.js │ │ └── mumps.min.js │ ├── nginx │ │ ├── nginx.js │ │ └── nginx.min.js │ ├── nsis │ │ ├── nsis.js │ │ └── nsis.min.js │ ├── ntriples │ │ ├── ntriples.js │ │ └── ntriples.min.js │ ├── octave │ │ ├── octave.js │ │ └── octave.min.js │ ├── oz │ │ ├── oz.js │ │ └── oz.min.js │ ├── pascal │ │ ├── pascal.js │ │ └── pascal.min.js │ ├── pegjs │ │ ├── pegjs.js │ │ └── pegjs.min.js │ ├── perl │ │ ├── perl.js │ │ └── perl.min.js │ ├── php │ │ ├── php.js │ │ └── php.min.js │ ├── pig │ │ ├── pig.js │ │ └── pig.min.js │ ├── powershell │ │ ├── powershell.js │ │ └── powershell.min.js │ ├── properties │ │ ├── properties.js │ │ └── properties.min.js │ ├── protobuf │ │ ├── protobuf.js │ │ └── protobuf.min.js │ ├── pug │ │ ├── pug.js │ │ └── pug.min.js │ ├── puppet │ │ ├── puppet.js │ │ └── puppet.min.js │ ├── python │ │ ├── python.js │ │ └── python.min.js │ ├── q │ │ ├── q.js │ │ └── q.min.js │ ├── r │ │ ├── r.js │ │ └── r.min.js │ ├── rpm │ │ ├── rpm.js │ │ └── rpm.min.js │ ├── rst │ │ ├── rst.js │ │ └── rst.min.js │ ├── ruby │ │ ├── ruby.js │ │ └── ruby.min.js │ ├── rust │ │ ├── rust.js │ │ └── rust.min.js │ ├── sas │ │ ├── sas.js │ │ └── sas.min.js │ ├── sass │ │ ├── sass.js │ │ └── sass.min.js │ ├── scheme │ │ ├── scheme.js │ │ └── scheme.min.js │ ├── shell │ │ ├── shell.js │ │ └── shell.min.js │ ├── sieve │ │ ├── sieve.js │ │ └── sieve.min.js │ ├── simple.js │ ├── simple.min.js │ ├── slim │ │ ├── slim.js │ │ └── slim.min.js │ ├── smalltalk │ │ ├── smalltalk.js │ │ └── smalltalk.min.js │ ├── smarty │ │ ├── smarty.js │ │ └── smarty.min.js │ ├── solr │ │ ├── solr.js │ │ └── solr.min.js │ ├── soy │ │ ├── soy.js │ │ └── soy.min.js │ ├── sparql │ │ ├── sparql.js │ │ └── sparql.min.js │ ├── spreadsheet │ │ ├── spreadsheet.js │ │ └── spreadsheet.min.js │ ├── sql │ │ ├── sql.js │ │ └── sql.min.js │ ├── stex │ │ ├── stex.js │ │ └── stex.min.js │ ├── stylus │ │ ├── stylus.js │ │ └── stylus.min.js │ ├── swift │ │ ├── swift.js │ │ └── swift.min.js │ ├── tcl │ │ ├── tcl.js │ │ └── tcl.min.js │ ├── textile │ │ ├── textile.js │ │ └── textile.min.js │ ├── tiddlywiki │ │ ├── tiddlywiki.js │ │ └── tiddlywiki.min.js │ ├── tiki │ │ ├── tiki.js │ │ └── tiki.min.js │ ├── toml │ │ ├── toml.js │ │ └── toml.min.js │ ├── tornado │ │ ├── tornado.js │ │ └── tornado.min.js │ ├── troff │ │ ├── troff.js │ │ └── troff.min.js │ ├── ttcn-cfg │ │ ├── ttcn-cfg.js │ │ └── ttcn-cfg.min.js │ ├── ttcn │ │ ├── ttcn.js │ │ └── ttcn.min.js │ ├── turtle │ │ ├── turtle.js │ │ └── turtle.min.js │ ├── twig │ │ ├── twig.js │ │ └── twig.min.js │ ├── vb │ │ ├── vb.js │ │ └── vb.min.js │ ├── vbscript │ │ ├── vbscript.js │ │ └── vbscript.min.js │ ├── velocity │ │ ├── velocity.js │ │ └── velocity.min.js │ ├── verilog │ │ ├── verilog.js │ │ └── verilog.min.js │ ├── vhdl │ │ ├── vhdl.js │ │ └── vhdl.min.js │ ├── vim.js │ ├── vim.min.js │ ├── vue │ │ ├── vue.js │ │ └── vue.min.js │ ├── webidl │ │ ├── webidl.js │ │ └── webidl.min.js │ ├── xml │ │ ├── xml.js │ │ └── xml.min.js │ ├── xquery │ │ ├── xquery.js │ │ └── xquery.min.js │ ├── yacas │ │ ├── yacas.js │ │ └── yacas.min.js │ ├── yaml-frontmatter │ │ ├── yaml-frontmatter.js │ │ └── yaml-frontmatter.min.js │ ├── yaml │ │ ├── yaml.js │ │ └── yaml.min.js │ └── z80 │ │ ├── z80.js │ │ └── z80.min.js ├── encryption-icon.png ├── fonts │ └── dejavu-sans │ │ ├── DejaVuSansMono.ttf │ │ └── LICENSE └── icons │ └── lock.svg ├── storage └── redis │ └── .gitignore ├── templates └── pastitude.html ├── utils.py ├── webpack.config.js └── wsgi.py /.env.example: -------------------------------------------------------------------------------- 1 | VIRTUAL_HOST= 2 | 3 | LETSENCRYPT_EMAIL= 4 | LETSENCRYPT_HOST= -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Editor/IDE files 2 | .idea/ 3 | 4 | # Environment files 5 | .env 6 | 7 | # Application files 8 | node_modules/ 9 | __pycache__/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Pastitude 2 | Pastitude is an open-source project for sharing source code. It comes with features that aim to make sharing code more comfortable and easier. 3 | 4 | ## Main features: 5 | * End-to-end encryption (with an auto-generated key in URL or password) 6 | * Multiple files under a single link 7 | * Destroy paste when opened or after given time 8 | * Real-time syntax highlight 9 | * Vim mode support 10 | * Nice design (currently only dark theme) 11 | 12 | ## Installation 13 | I highly recommend to run Pastitude via docker-compose. You have to do only following steps: 14 | 1. Copy `.env.example` to `.env` 15 | 2. If you are in another branch than a master, then run `npm install && gulp build --production` 16 | 3. Run `docker-compose up -d` 17 | 18 | _Environment file doesn't have specific purpose for an application. It's just prepared for [jwilder's nginx proxy](https://github.com/jwilder/nginx-proxy)._ 19 | 20 | ## Contribution 21 | If you want to contribute to Pastitude feel free to do so by forking project and creating pull request, but please keep the code standard consistent. _You don't have to run `gulp build --production` before posting pull request, I'll do it for you._ 22 | 23 | If you only want to share your idea, create issue :) -------------------------------------------------------------------------------- /docker-compose.jwilder-nginx.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | networks: 4 | application: 5 | # Prepared for proxy 6 | web: 7 | external: true 8 | 9 | volumes: 10 | application: 11 | 12 | services: 13 | nginx: 14 | restart: unless-stopped 15 | build: 16 | context: . 17 | dockerfile: docker/nginx/Dockerfile 18 | env_file: 19 | - .env 20 | networks: 21 | # Prepared for proxy 22 | - web 23 | - application 24 | volumes: 25 | - application:/app 26 | # Comment ports section if you would like to use proxy 27 | # ports: 28 | # - 80:80 29 | 30 | uwsgi: 31 | restart: unless-stopped 32 | build: 33 | context: . 34 | dockerfile: docker/uwsgi/Dockerfile 35 | networks: 36 | - application 37 | volumes: 38 | - application:/app 39 | environment: 40 | - REDIS_HOST=redis 41 | 42 | redis: 43 | restart: unless-stopped 44 | image: redis:alpine 45 | volumes: 46 | - ./storage/redis:/data 47 | networks: 48 | - application 49 | command: redis-server --appendonly yes 50 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | networks: 4 | application: 5 | # Prepared for proxy 6 | # public: 7 | # external: true 8 | 9 | volumes: 10 | application: 11 | 12 | services: 13 | nginx: 14 | restart: unless-stopped 15 | build: 16 | context: . 17 | dockerfile: docker/nginx/Dockerfile 18 | env_file: 19 | - .env 20 | networks: 21 | # Prepared for proxy 22 | # - public 23 | - application 24 | volumes: 25 | - application:/app 26 | # Comment ports section if you would like to use proxy 27 | ports: 28 | - 80:80 29 | 30 | uwsgi: 31 | restart: unless-stopped 32 | build: 33 | context: . 34 | dockerfile: docker/uwsgi/Dockerfile 35 | networks: 36 | - application 37 | volumes: 38 | - application:/app 39 | environment: 40 | - REDIS_HOST=redis 41 | 42 | redis: 43 | restart: unless-stopped 44 | image: redis:alpine 45 | volumes: 46 | - ./storage/redis:/data 47 | networks: 48 | - application 49 | command: redis-server --appendonly yes 50 | -------------------------------------------------------------------------------- /docker/nginx/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.7 2 | 3 | ADD . /app 4 | 5 | WORKDIR /app 6 | 7 | RUN \ 8 | apk add --update nginx 9 | 10 | # Clear default configurations 11 | RUN \ 12 | rm /etc/nginx/conf.d/default.conf && \ 13 | mkdir -p /run/nginx && \ 14 | ln -s /dev/stderr /var/log/nginx/error.log && \ 15 | ln -s /dev/stdout /var/log/nginx/access.log 16 | 17 | COPY docker/nginx/application.conf /etc/nginx/conf.d/application.conf 18 | 19 | COPY docker/nginx/entrypoint.sh /entrypoint.sh 20 | 21 | RUN chmod +x /entrypoint.sh 22 | 23 | EXPOSE 80 24 | 25 | ENTRYPOINT ["/entrypoint.sh"] -------------------------------------------------------------------------------- /docker/nginx/application.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | 4 | location / { 5 | include uwsgi_params; 6 | uwsgi_pass uwsgi:8081; 7 | } 8 | } -------------------------------------------------------------------------------- /docker/nginx/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/ash 2 | 3 | nginx -g "daemon off;" -------------------------------------------------------------------------------- /docker/nginx/requirements.txt: -------------------------------------------------------------------------------- 1 | flask 2 | redis 3 | -------------------------------------------------------------------------------- /docker/uwsgi/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.7 2 | 3 | ADD . /app 4 | 5 | WORKDIR /app 6 | 7 | RUN \ 8 | apk add --update python3 uwsgi uwsgi-python3 && \ 9 | pip3 install --upgrade pip && \ 10 | pip3 install -r /app/docker/nginx/requirements.txt 11 | 12 | EXPOSE 3031 13 | 14 | CMD ["uwsgi", "--ini", "/app/pastitude.ini", "--plugin", "python3"] -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'), 2 | concat = require('gulp-concat'), 3 | uglify = require('gulp-uglify'), 4 | rename = require('gulp-rename'), 5 | babel = require('gulp-babel'), 6 | browserify = require('gulp-browserify'), 7 | util = require('gulp-util'), 8 | sass = require('gulp-sass'); 9 | 10 | gulp.task('build-editor', function () { 11 | return gulp.src('resources/js/editor/**/*.js') 12 | .pipe(concat('editor-bundle.js')) 13 | .pipe(browserify()) 14 | .pipe(util.env.production ? babel({ 15 | presets: ['es2015'] 16 | }) : util.noop()) 17 | .pipe(util.env.production ? uglify() : util.noop()) 18 | .pipe(rename({suffix: '.min'})) 19 | .pipe(gulp.dest('static/')); 20 | }); 21 | 22 | gulp.task('build-all-editor-modes', function () { 23 | return gulp.src(['node_modules/codemirror/addon/mode/simple.js', 'node_modules/codemirror/mode/*/*.js']) 24 | .pipe(util.env.production ? uglify() : util.noop()) 25 | .pipe(rename({suffix: '.min'})) 26 | .pipe(gulp.dest('static/codemirror')); 27 | }); 28 | 29 | gulp.task('build-editor-vim-keymap-mode', function () { 30 | return gulp.src(['node_modules/codemirror/keymap/vim.js']) 31 | .pipe(util.env.production ? uglify() : util.noop()) 32 | .pipe(rename({suffix: '.min'})) 33 | .pipe(gulp.dest('static/codemirror')); 34 | }); 35 | 36 | gulp.task('build-sass', function () { 37 | return gulp.src(['resources/sass/**/*.scss', 'node_modules/codemirror/addon/dialog/dialog.css']) 38 | .pipe(concat('bundle.min.css')) 39 | .pipe(sass()) 40 | .pipe(gulp.dest('static/')) 41 | }); 42 | 43 | gulp.task('build', ['build-sass', 'build-all-editor-modes', 'build-editor-vim-keymap-mode']) 44 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pastitude", 3 | "version": "0.1.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "Patrik Janoušek ", 10 | "license": "MIT", 11 | "devDependencies": { 12 | "@babel/core": "^7.4.5", 13 | "babel-core": "^6.26.3", 14 | "babel-preset-es2015": "^6.24.1", 15 | "gulp": "^3.9.1", 16 | "gulp-babel": "^8.0.0", 17 | "gulp-browserify": "^0.5.1", 18 | "gulp-concat": "^2.6.1", 19 | "gulp-rename": "^1.4.0", 20 | "gulp-sass": "^4.0.2", 21 | "gulp-uglify": "^3.0.2", 22 | "gulp-util": "^3.0.8", 23 | "webpack": "^4.33.0", 24 | "webpack-cli": "^3.3.4" 25 | }, 26 | "dependencies": { 27 | "codemirror": "^5.47.0", 28 | "crypto-js": "^3.1.9-1", 29 | "jquery": "^3.4.1", 30 | "natives": "^1.1.6", 31 | "remodal": "^1.1.1" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /pastitude.ini: -------------------------------------------------------------------------------- 1 | [uwsgi] 2 | module = wsgi 3 | 4 | master = true 5 | processes = 5 6 | 7 | socket = 0.0.0.0:8081 8 | chmod-socket = 660 9 | vacuum = true -------------------------------------------------------------------------------- /pastitude.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | import redis 4 | 5 | from flask import Flask, render_template, request, jsonify 6 | from utils import genereate_random_string 7 | 8 | app = Flask(__name__) 9 | r = redis.StrictRedis(os.environ.get('REDIS_HOST', 'localhost')) 10 | 11 | 12 | @app.route('/', methods=['GET']) 13 | def store_form(): 14 | return render_template('pastitude.html') 15 | 16 | 17 | @app.route('/', methods=['POST']) 18 | def store(): 19 | while True: 20 | paste_id = genereate_random_string(8) 21 | 22 | if r.get(paste_id + ':data') is None: 23 | break 24 | 25 | data = request.get_json() 26 | 27 | expiration = int(data['expiration']) 28 | 29 | if expiration not in [15, 60, 1440, 10080, 302400, 110376000] and expiration > 0: 30 | return 'Nice try!' 31 | 32 | r.set(paste_id + ':data', json.dumps(data), ex=(expiration * 60 if expiration > 0 else None)) 33 | r.set(paste_id + ':expiration', expiration, ex=(expiration * 60 if expiration > 0 else None)) 34 | 35 | return jsonify({ 36 | 'uuid': paste_id 37 | }) 38 | 39 | 40 | @app.route('/', methods=['GET']) 41 | def get_paste(uuid): 42 | try: 43 | data = r.get(uuid + ':data').decode('utf-8') 44 | expiration = int(r.get(uuid + ':expiration').decode('utf-8')) 45 | 46 | if expiration == -1: 47 | r.decr(uuid + ':expiration', 1) 48 | elif expiration == -2: 49 | r.delete(uuid + ':data') 50 | except AttributeError: 51 | return 'Oops!' 52 | 53 | return render_template('pastitude.html', data=data) 54 | 55 | 56 | if __name__ == '__main__': 57 | app.run() 58 | -------------------------------------------------------------------------------- /resources/js/app/app.js: -------------------------------------------------------------------------------- 1 | import './input' 2 | import './output' 3 | 4 | import $ from 'jquery' 5 | 6 | // Load settings 7 | $(function () { 8 | if (localStorage.getItem('settings.editor.keymap') !== null) { 9 | $('#switch-vim-mode').click(); 10 | } 11 | }); 12 | -------------------------------------------------------------------------------- /resources/js/app/output.js: -------------------------------------------------------------------------------- 1 | import $ from 'jquery' 2 | import editorWrapper from '../editor/editor' 3 | import CryptoJS from 'crypto-js' 4 | 5 | 6 | require('remodal'); 7 | 8 | 9 | if ($('#data').length != 0) { 10 | let data = JSON.parse($('#data').val()) 11 | 12 | if (Number.parseInt(data['expiration']) == -1) { 13 | $('#destroyed-warning').css('visibility', 'visible'); 14 | } 15 | 16 | let initializeEditor = function (decryptionKey) { 17 | data = JSON.parse(CryptoJS.AES.decrypt(data.encrypted_data, decryptionKey) 18 | .toString(CryptoJS.enc.Utf8)); 19 | 20 | let editor = editorWrapper.createEditor($('#editor')[0], { 21 | theme: 'material-peacock', 22 | lineNumbers: true, 23 | indentUnit: 4, 24 | readOnly: true, 25 | cursorBlinkRate: -1, // Hide cursor 26 | lineWrapping: true, 27 | }); 28 | 29 | global.window.data = data; 30 | global.window.editor = editor; 31 | 32 | if (data.files.length > 1) { 33 | $('#editor').css('height', 'calc(100% - 41px)'); 34 | 35 | for (let i = 0; i < data.files.length; i++) { 36 | $('#file-tabs') 37 | .append('
  • ') 38 | 39 | $('.file-tab:last input[type=button]').on('click', function (event) { 40 | let $this = $(this); 41 | let file = data.files[$this.attr('data-index')]; 42 | 43 | 44 | $('.file-tab input[type=button].active').removeClass('active'); 45 | $this.addClass('active'); 46 | 47 | editor.setLanguage(file.mime, function () { 48 | editor.setValue(file.content); 49 | }); 50 | }) 51 | } 52 | 53 | $('.file-tab:first input[type=button]').click() 54 | } else { 55 | $('#editor').css('height', '100%'); 56 | $('#editor').css('margin-top', '0'); 57 | $('html').css('margin-top', '0'); 58 | $('body').css('margin-top', '0'); 59 | 60 | 61 | editor.setLanguage(data.files[0].mime, function () { 62 | editor.setValue(data.files[0].content); 63 | }); 64 | } 65 | } 66 | 67 | 68 | if (window.location.hash.length != 0) { 69 | let decryptionKey = window.location.hash.substr(1, window.location.hash.length - 1); 70 | initializeEditor(decryptionKey); 71 | } else { 72 | $(function () { 73 | let modal = $('[data-remodal-id=decrypt]').remodal(); 74 | modal.open(); 75 | 76 | $('[data-remodal-id=decrypt]').on('confirmation', function () { 77 | initializeEditor($('#decryption-key').val()); 78 | }); 79 | 80 | $('#decryption-key').on('keydown', function (e) { 81 | if (e.which == 13) { 82 | $("button[data-remodal-action='confirm']").click(); 83 | } 84 | }); 85 | }); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /resources/js/editor/editor.js: -------------------------------------------------------------------------------- 1 | var $ = require('jquery'), 2 | CodeMirror = require('codemirror'); 3 | 4 | require('codemirror/mode/meta'); 5 | require('codemirror/addon/mode/multiplex'); 6 | require('codemirror/addon/mode/simple'); 7 | require('codemirror/addon/mode/overlay'); 8 | require('codemirror/addon/dialog/dialog'); 9 | require('codemirror/addon/search/searchcursor'); 10 | require('codemirror/addon/search/search'); 11 | 12 | global.window.CodeMirror = CodeMirror; 13 | 14 | module.exports.createEditor = function (element, options) { 15 | let editor = CodeMirror(element, options); 16 | 17 | let recursion = 0; 18 | let loadModesWithDependencies = function (modeName, callback) { 19 | $.getScript('/static/codemirror/' + modeName + '/' + modeName + '.min.js', function () { 20 | if (CodeMirror.modes[modeName] && CodeMirror.modes[modeName].dependencies !== undefined) { 21 | for (let i in CodeMirror.modes[modeName].dependencies) { 22 | loadModesWithDependencies(CodeMirror.modes[modeName].dependencies[i], callback); 23 | recursion++; 24 | } 25 | } 26 | 27 | recursion--; 28 | 29 | if (recursion == -1) { 30 | recursion++; 31 | callback && callback(); 32 | } 33 | }); 34 | } 35 | 36 | editor.setLanguage = function (language, callback) { 37 | let mode = null; 38 | let mime = null; 39 | if (Number.isInteger(language)) { 40 | mode = CodeMirror.modeInfo[language].mode; 41 | mime = CodeMirror.modeInfo[language].mime; 42 | } else { 43 | // Is mime type... 44 | for (let m in CodeMirror.modeInfo) { 45 | if (CodeMirror.modeInfo[m].mime == language) { 46 | mode = CodeMirror.modeInfo[m].mode; 47 | mime = CodeMirror.modeInfo[m].mime; 48 | } 49 | } 50 | } 51 | 52 | if (mode != 'null') { 53 | loadModesWithDependencies(mode, function () { 54 | callback && callback(); 55 | editor.setOption('mode', mime); 56 | }); 57 | } else { 58 | callback && callback(); 59 | editor.setOption('mode', mime); 60 | } 61 | } 62 | 63 | return editor; 64 | } 65 | -------------------------------------------------------------------------------- /resources/sass/app.scss: -------------------------------------------------------------------------------- 1 | @import "dark"; 2 | 3 | @font-face { 4 | font-family: "Deja Vu Sans Mono"; 5 | src: url("/static/fonts/dejavu-sans/DejaVuSansMono.ttf"); 6 | } 7 | 8 | html, body { 9 | height: 100%; 10 | color: $default-text-color; 11 | font-family: "Deja Vu Sans Mono"; 12 | font-size: 10pt; 13 | margin: 5px 0 0; 14 | overflow: hidden; 15 | } 16 | 17 | input { 18 | font-family: "Deja Vu Sans Mono"; 19 | } 20 | 21 | body { 22 | background: $background-color; 23 | } 24 | 25 | #bar { 26 | margin: 5px; 27 | } 28 | 29 | #editor { 30 | width: 100%; 31 | height: calc(100% - 73px); 32 | margin-top: 10px; 33 | resize: none; 34 | border: none; 35 | outline: none; 36 | background: transparent; 37 | color: $default-text-color; 38 | cursor: text; 39 | } 40 | 41 | ul.settings-bar { 42 | list-style-type: none; 43 | margin: 0; 44 | padding: 0; 45 | overflow: hidden; 46 | } 47 | 48 | .settings-bar li { 49 | float: left; 50 | padding: 0 5px; 51 | } 52 | -------------------------------------------------------------------------------- /resources/sass/codemirror.scss: -------------------------------------------------------------------------------- 1 | @import "dark"; 2 | 3 | .CodeMirror { 4 | height: 100vh; 5 | color: $default-text-color; 6 | background: $background-color; 7 | } 8 | 9 | .CodeMirror-cursor { 10 | border-left: 1px solid $default-text-color; 11 | } 12 | 13 | .CodeMirror-linenumbers { 14 | background: $background-color; 15 | } 16 | 17 | .CodeMirror-linenumber { 18 | color: $secondary-text-color 19 | } 20 | 21 | .CodeMirror-dialog input { 22 | font-family: "Deja Vu Sans Mono"; 23 | } 24 | -------------------------------------------------------------------------------- /resources/sass/dark.scss: -------------------------------------------------------------------------------- 1 | $default-text-color: white; 2 | $background-color: #171E22; 3 | 4 | $primary-color: #26A6A6; 5 | $primary-placeholder-color: #34444D; 6 | $primary-hover-color: #3E505A; 7 | $primary-focus-color: #4A606C; 8 | $primary-focus-color-transparent: rgba(0, 255, 0, 0.25); 9 | $primary-background-color: #2E3C43; 10 | 11 | $secondary-text-color: #4E6D71; 12 | $secondary-color: #304E52; 13 | 14 | $cm-keyword: #26A6A6; 15 | $cm-operator: #26A6A6; 16 | $cm-builtin: #26A6A6; 17 | $cm-atom: #BCD42A; 18 | $cm-number: #BCD42A; 19 | $cm-def: #BCD42A; 20 | $cm-string: #BCD42A; 21 | $cm-comment: #304E52; 22 | $cm-tag: #26A6A6; 23 | $cm-meta: #26A6A6; 24 | $cm-attribute: #FF5D38; 25 | $cm-property: #FF5D38; 26 | $cm-qualifier: #26A6A6; 27 | $cm-variable: #E9F6FB; 28 | $cm-variable-3: #26A6A6; 29 | $cm-type: #26A6A6; 30 | $cm-tag: #26A6A6; 31 | $cm-error: #DA1E3C; 32 | -------------------------------------------------------------------------------- /resources/sass/elements.scss: -------------------------------------------------------------------------------- 1 | @import "dark"; 2 | 3 | /* Custom checkbox */ 4 | .container-checkbox { 5 | & { 6 | display: inline-block; 7 | position: relative; 8 | padding-left: 20px; 9 | margin-bottom: 12px; 10 | cursor: pointer; 11 | font-size: 10pt; 12 | -webkit-user-select: none; 13 | -moz-user-select: none; 14 | -ms-user-select: none; 15 | user-select: none; 16 | } 17 | 18 | /* Hide the browser's default checkbox */ 19 | & input { 20 | position: absolute; 21 | opacity: 0; 22 | cursor: pointer; 23 | } 24 | 25 | /* When the checkbox is checked, add a blue background */ 26 | & input:checked ~ .checkmark-checkbox { 27 | background-color: $primary-color; 28 | } 29 | 30 | /* Show the checkmark-checkbox when checked */ 31 | & input:checked ~ .checkmark-checkbox:after { 32 | display: block; 33 | } 34 | 35 | /* Style the checkmark-checkbox/indicator */ 36 | & .checkmark-checkbox:after { 37 | left: 5px; 38 | top: 1px; 39 | width: 4px; 40 | height: 8px; 41 | border: solid white; 42 | border-width: 0 2px 2px 0; 43 | -webkit-transform: rotate(45deg); 44 | -ms-transform: rotate(45deg); 45 | transform: rotate(45deg); 46 | } 47 | } 48 | 49 | .checkmark-checkbox { 50 | /* Create a custom checkbox */ 51 | & { 52 | position: absolute; 53 | top: 0; 54 | left: 0; 55 | height: 15px; 56 | width: 15px; 57 | background-color: $primary-placeholder-color; 58 | border-radius: 2px; 59 | } 60 | 61 | /* Create the checkmark-checkbox/indicator (hidden when not checked) */ 62 | &:after { 63 | content: ""; 64 | position: absolute; 65 | display: none; 66 | } 67 | } 68 | 69 | .container-radio { 70 | /* Customize the label (the container) */ 71 | & { 72 | display: inline-block; 73 | position: relative; 74 | padding-left: 20px; 75 | margin-bottom: 16px; 76 | cursor: pointer; 77 | font-size: 10pt; 78 | -webkit-user-select: none; 79 | -moz-user-select: none; 80 | -ms-user-select: none; 81 | user-select: none; 82 | } 83 | /* Hide the browser's default radio button */ 84 | & input { 85 | position: absolute; 86 | opacity: 0; 87 | } 88 | /* When the radio button is checked, add a blue background */ 89 | & input:checked ~ .checkmark-radio { 90 | background-color: $primary-color; 91 | } 92 | 93 | &:hover input:not(:checked) ~ .checkmark-radio { 94 | background-color: $primary-hover-color; 95 | transition: 150ms ease-in; 96 | } 97 | /* Show the indicator (dot/circle) when checked */ 98 | & input:checked ~ .checkmark-radio:after { 99 | display: block; 100 | } 101 | 102 | /* Style the indicator (dot/circle) */ 103 | & .checkmark-radio:after { 104 | top: 5px; 105 | left: 5px; 106 | width: 5px; 107 | height: 5px; 108 | border-radius: 50%; 109 | background: white; 110 | } 111 | } 112 | 113 | /* Create a custom radio button */ 114 | .checkmark-radio { 115 | & { 116 | position: absolute; 117 | top: 0; 118 | left: 0; 119 | height: 15px; 120 | width: 15px; 121 | background-color: $primary-placeholder-color; 122 | border-radius: 50%; 123 | transition: 150ms ease-in; 124 | } 125 | 126 | /* Create the indicator (the dot/circle - hidden when not checked) */ 127 | &:after { 128 | content: ""; 129 | position: absolute; 130 | display: none; 131 | } 132 | } 133 | 134 | input { 135 | &[type=text], &[type=password] { 136 | background-color: transparent; 137 | border: none; 138 | border-bottom: 2px solid $primary-placeholder-color; 139 | outline: 0; 140 | color: white; 141 | transition: 150ms ease-in; 142 | } 143 | 144 | &[type=text]:hover, &[type=password]:hover { 145 | border-color: $primary-hover-color; 146 | } 147 | 148 | &[type=text]:focus, &[type=password]:focus { 149 | border-color: $primary-focus-color; 150 | } 151 | 152 | &[type=button] { 153 | font-family: "Deja Vu Sans Mono"; 154 | background-color: $primary-background-color; 155 | color: white; 156 | border: none; 157 | outline: 0; 158 | padding: 3px 6px; 159 | border-radius: 2px; 160 | transition: 150ms ease-in; 161 | } 162 | 163 | &[type=button]:hover { 164 | background-color: $primary-hover-color; 165 | } 166 | 167 | &[type=button].active { 168 | background-color: $primary-focus-color; 169 | } 170 | } 171 | 172 | select { 173 | & { 174 | background-color: $background-color; 175 | border: none; 176 | border-bottom: 2px solid $primary-placeholder-color; 177 | outline: 0; 178 | color: white; 179 | transition: 150ms ease-in; 180 | } 181 | 182 | &:hover { 183 | border-color: $primary-hover-color; 184 | } 185 | 186 | &:focus { 187 | border-color: $primary-focus-color; 188 | } 189 | } -------------------------------------------------------------------------------- /resources/sass/highlight.scss: -------------------------------------------------------------------------------- 1 | @import "dark"; 2 | 3 | .cm-s-material-peacock { 4 | &.CodeMirror { 5 | background-color: $background-color; 6 | color: rgba(233, 237, 237, 1); 7 | } 8 | 9 | & .CodeMirror-gutters { 10 | border-right: 1px solid $secondary-color; 11 | background: $background-color; 12 | } 13 | 14 | & .CodeMirror-guttermarker, & .CodeMirror-guttermarker-subtle, & .CodeMirror-linenumber { 15 | color: rgb(83, 127, 126); 16 | } 17 | 18 | & .CodeMirror-cursor { 19 | border-left: 1px solid #f8f8f0; 20 | } 21 | 22 | & div.CodeMirror-selected { 23 | background: $background-color; 24 | } 25 | 26 | &.CodeMirror-focused div.CodeMirror-selected { 27 | background: rgba(255, 255, 255, 0.10); 28 | } 29 | 30 | & .CodeMirror-line::selection, & .CodeMirror-line > span::selection, & .CodeMirror-line > span > span::selection { 31 | background: rgba(255, 255, 255, 0.10); 32 | } 33 | 34 | & .CodeMirror-line::-moz-selection, & .CodeMirror-line > span::-moz-selection, & .CodeMirror-line > span > span::-moz-selection { 35 | background: rgba(255, 255, 255, 0.10); 36 | } 37 | 38 | & .CodeMirror-activeline-background { 39 | background: rgba(0, 0, 0, 0); 40 | } 41 | 42 | & .cm-keyword { 43 | color: $cm-keyword; 44 | } 45 | 46 | & .cm-operator { 47 | color: $cm-operator; 48 | } 49 | 50 | & .cm-variable-2 { 51 | color: $cm-variable; 52 | } 53 | 54 | & .cm-variable-3 { 55 | color: $cm-variable; 56 | } 57 | 58 | & .cm-builtin { 59 | color: $cm-builtin; 60 | } 61 | 62 | & .cm-atom { 63 | color: $cm-atom; 64 | } 65 | 66 | & .cm-number { 67 | color: $cm-number; 68 | } 69 | 70 | & .cm-def { 71 | color: $cm-def; 72 | } 73 | 74 | & .cm-string { 75 | color: $cm-string; 76 | } 77 | 78 | & .cm-string-2 { 79 | color: $cm-string; 80 | } 81 | 82 | & .cm-comment { 83 | color: $cm-comment; 84 | } 85 | 86 | & .cm-variable { 87 | color: $cm-variable; 88 | } 89 | 90 | & .cm-tag { 91 | color: $cm-tag; 92 | } 93 | 94 | & .cm-meta { 95 | color: $cm-meta; 96 | } 97 | 98 | & .cm-attribute { 99 | color: $cm-attribute; 100 | } 101 | 102 | & .cm-property { 103 | color: $cm-property; 104 | } 105 | 106 | & .cm-qualifier { 107 | color: $cm-qualifier; 108 | } 109 | 110 | & .cm-variable-3 { 111 | color: $cm-variable-3; 112 | } 113 | 114 | & .cm-type { 115 | color: $cm-type; 116 | } 117 | 118 | & .cm-tag { 119 | color: $cm-tag; 120 | } 121 | 122 | & .cm-error { 123 | color: $cm-error; 124 | } 125 | 126 | & .CodeMirror-matchingbracket { 127 | text-decoration: underline; 128 | color: white !important; 129 | } 130 | } -------------------------------------------------------------------------------- /resources/sass/remodal.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * Remodal - v1.1.1 3 | * Responsive, lightweight, fast, synchronized with CSS animations, fully customizable modal window plugin with declarative configuration and hash tracking. 4 | * http://vodkabears.github.io/remodal/ 5 | * 6 | * Made by Ilya Makarov 7 | * Under MIT License 8 | */ 9 | 10 | /* ========================================================================== 11 | Remodal's necessary styles 12 | ========================================================================== */ 13 | 14 | /* Hide scroll bar */ 15 | 16 | html.remodal-is-locked { 17 | overflow: hidden; 18 | 19 | -ms-touch-action: none; 20 | touch-action: none; 21 | } 22 | 23 | /* Anti FOUC */ 24 | 25 | .remodal, 26 | [data-remodal-id] { 27 | display: none; 28 | } 29 | 30 | /* Necessary styles of the overlay */ 31 | 32 | .remodal-overlay { 33 | position: fixed; 34 | z-index: 9999; 35 | top: -5000px; 36 | right: -5000px; 37 | bottom: -5000px; 38 | left: -5000px; 39 | 40 | display: none; 41 | } 42 | 43 | /* Necessary styles of the wrapper */ 44 | 45 | .remodal-wrapper { 46 | position: fixed; 47 | z-index: 10000; 48 | top: 0; 49 | right: 0; 50 | bottom: 0; 51 | left: 0; 52 | 53 | display: none; 54 | overflow: auto; 55 | 56 | text-align: center; 57 | 58 | -webkit-overflow-scrolling: touch; 59 | } 60 | 61 | .remodal-wrapper:after { 62 | display: inline-block; 63 | 64 | height: 100%; 65 | margin-left: -0.05em; 66 | 67 | content: ""; 68 | } 69 | 70 | /* Fix iPad, iPhone glitches */ 71 | 72 | .remodal-overlay, 73 | .remodal-wrapper { 74 | -webkit-backface-visibility: hidden; 75 | backface-visibility: hidden; 76 | } 77 | 78 | /* Necessary styles of the modal dialog */ 79 | 80 | .remodal { 81 | position: relative; 82 | 83 | outline: none; 84 | 85 | -webkit-text-size-adjust: 100%; 86 | -ms-text-size-adjust: 100%; 87 | text-size-adjust: 100%; 88 | } 89 | 90 | .remodal-is-initialized { 91 | /* Disable Anti-FOUC */ 92 | display: inline-block; 93 | } 94 | -------------------------------------------------------------------------------- /static/codemirror/asciiarmor/asciiarmor.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | function errorIfNotEmpty(stream) { 15 | var nonWS = stream.match(/^\s*\S/); 16 | stream.skipToEnd(); 17 | return nonWS ? "error" : null; 18 | } 19 | 20 | CodeMirror.defineMode("asciiarmor", function() { 21 | return { 22 | token: function(stream, state) { 23 | var m; 24 | if (state.state == "top") { 25 | if (stream.sol() && (m = stream.match(/^-----BEGIN (.*)?-----\s*$/))) { 26 | state.state = "headers"; 27 | state.type = m[1]; 28 | return "tag"; 29 | } 30 | return errorIfNotEmpty(stream); 31 | } else if (state.state == "headers") { 32 | if (stream.sol() && stream.match(/^\w+:/)) { 33 | state.state = "header"; 34 | return "atom"; 35 | } else { 36 | var result = errorIfNotEmpty(stream); 37 | if (result) state.state = "body"; 38 | return result; 39 | } 40 | } else if (state.state == "header") { 41 | stream.skipToEnd(); 42 | state.state = "headers"; 43 | return "string"; 44 | } else if (state.state == "body") { 45 | if (stream.sol() && (m = stream.match(/^-----END (.*)?-----\s*$/))) { 46 | if (m[1] != state.type) return "error"; 47 | state.state = "end"; 48 | return "tag"; 49 | } else { 50 | if (stream.eatWhile(/[A-Za-z0-9+\/=]/)) { 51 | return null; 52 | } else { 53 | stream.next(); 54 | return "error"; 55 | } 56 | } 57 | } else if (state.state == "end") { 58 | return errorIfNotEmpty(stream); 59 | } 60 | }, 61 | blankLine: function(state) { 62 | if (state.state == "headers") state.state = "body"; 63 | }, 64 | startState: function() { 65 | return {state: "top", type: null}; 66 | } 67 | }; 68 | }); 69 | 70 | CodeMirror.defineMIME("application/pgp", "asciiarmor"); 71 | CodeMirror.defineMIME("application/pgp-encrypted", "asciiarmor"); 72 | CodeMirror.defineMIME("application/pgp-keys", "asciiarmor"); 73 | CodeMirror.defineMIME("application/pgp-signature", "asciiarmor"); 74 | }); 75 | -------------------------------------------------------------------------------- /static/codemirror/asciiarmor/asciiarmor.min.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | function errorIfNotEmpty(stream) { 15 | var nonWS = stream.match(/^\s*\S/); 16 | stream.skipToEnd(); 17 | return nonWS ? "error" : null; 18 | } 19 | 20 | CodeMirror.defineMode("asciiarmor", function() { 21 | return { 22 | token: function(stream, state) { 23 | var m; 24 | if (state.state == "top") { 25 | if (stream.sol() && (m = stream.match(/^-----BEGIN (.*)?-----\s*$/))) { 26 | state.state = "headers"; 27 | state.type = m[1]; 28 | return "tag"; 29 | } 30 | return errorIfNotEmpty(stream); 31 | } else if (state.state == "headers") { 32 | if (stream.sol() && stream.match(/^\w+:/)) { 33 | state.state = "header"; 34 | return "atom"; 35 | } else { 36 | var result = errorIfNotEmpty(stream); 37 | if (result) state.state = "body"; 38 | return result; 39 | } 40 | } else if (state.state == "header") { 41 | stream.skipToEnd(); 42 | state.state = "headers"; 43 | return "string"; 44 | } else if (state.state == "body") { 45 | if (stream.sol() && (m = stream.match(/^-----END (.*)?-----\s*$/))) { 46 | if (m[1] != state.type) return "error"; 47 | state.state = "end"; 48 | return "tag"; 49 | } else { 50 | if (stream.eatWhile(/[A-Za-z0-9+\/=]/)) { 51 | return null; 52 | } else { 53 | stream.next(); 54 | return "error"; 55 | } 56 | } 57 | } else if (state.state == "end") { 58 | return errorIfNotEmpty(stream); 59 | } 60 | }, 61 | blankLine: function(state) { 62 | if (state.state == "headers") state.state = "body"; 63 | }, 64 | startState: function() { 65 | return {state: "top", type: null}; 66 | } 67 | }; 68 | }); 69 | 70 | CodeMirror.defineMIME("application/pgp", "asciiarmor"); 71 | CodeMirror.defineMIME("application/pgp-encrypted", "asciiarmor"); 72 | CodeMirror.defineMIME("application/pgp-keys", "asciiarmor"); 73 | CodeMirror.defineMIME("application/pgp-signature", "asciiarmor"); 74 | }); 75 | -------------------------------------------------------------------------------- /static/codemirror/brainfuck/brainfuck.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | // Brainfuck mode created by Michael Kaminsky https://github.com/mkaminsky11 5 | 6 | (function(mod) { 7 | if (typeof exports == "object" && typeof module == "object") 8 | mod(require("../../lib/codemirror")) 9 | else if (typeof define == "function" && define.amd) 10 | define(["../../lib/codemirror"], mod) 11 | else 12 | mod(CodeMirror) 13 | })(function(CodeMirror) { 14 | "use strict" 15 | var reserve = "><+-.,[]".split(""); 16 | /* 17 | comments can be either: 18 | placed behind lines 19 | 20 | +++ this is a comment 21 | 22 | where reserved characters cannot be used 23 | or in a loop 24 | [ 25 | this is ok to use [ ] and stuff 26 | ] 27 | or preceded by # 28 | */ 29 | CodeMirror.defineMode("brainfuck", function() { 30 | return { 31 | startState: function() { 32 | return { 33 | commentLine: false, 34 | left: 0, 35 | right: 0, 36 | commentLoop: false 37 | } 38 | }, 39 | token: function(stream, state) { 40 | if (stream.eatSpace()) return null 41 | if(stream.sol()){ 42 | state.commentLine = false; 43 | } 44 | var ch = stream.next().toString(); 45 | if(reserve.indexOf(ch) !== -1){ 46 | if(state.commentLine === true){ 47 | if(stream.eol()){ 48 | state.commentLine = false; 49 | } 50 | return "comment"; 51 | } 52 | if(ch === "]" || ch === "["){ 53 | if(ch === "["){ 54 | state.left++; 55 | } 56 | else{ 57 | state.right++; 58 | } 59 | return "bracket"; 60 | } 61 | else if(ch === "+" || ch === "-"){ 62 | return "keyword"; 63 | } 64 | else if(ch === "<" || ch === ">"){ 65 | return "atom"; 66 | } 67 | else if(ch === "." || ch === ","){ 68 | return "def"; 69 | } 70 | } 71 | else{ 72 | state.commentLine = true; 73 | if(stream.eol()){ 74 | state.commentLine = false; 75 | } 76 | return "comment"; 77 | } 78 | if(stream.eol()){ 79 | state.commentLine = false; 80 | } 81 | } 82 | }; 83 | }); 84 | CodeMirror.defineMIME("text/x-brainfuck","brainfuck") 85 | }); 86 | -------------------------------------------------------------------------------- /static/codemirror/brainfuck/brainfuck.min.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | // Brainfuck mode created by Michael Kaminsky https://github.com/mkaminsky11 5 | 6 | (function(mod) { 7 | if (typeof exports == "object" && typeof module == "object") 8 | mod(require("../../lib/codemirror")) 9 | else if (typeof define == "function" && define.amd) 10 | define(["../../lib/codemirror"], mod) 11 | else 12 | mod(CodeMirror) 13 | })(function(CodeMirror) { 14 | "use strict" 15 | var reserve = "><+-.,[]".split(""); 16 | /* 17 | comments can be either: 18 | placed behind lines 19 | 20 | +++ this is a comment 21 | 22 | where reserved characters cannot be used 23 | or in a loop 24 | [ 25 | this is ok to use [ ] and stuff 26 | ] 27 | or preceded by # 28 | */ 29 | CodeMirror.defineMode("brainfuck", function() { 30 | return { 31 | startState: function() { 32 | return { 33 | commentLine: false, 34 | left: 0, 35 | right: 0, 36 | commentLoop: false 37 | } 38 | }, 39 | token: function(stream, state) { 40 | if (stream.eatSpace()) return null 41 | if(stream.sol()){ 42 | state.commentLine = false; 43 | } 44 | var ch = stream.next().toString(); 45 | if(reserve.indexOf(ch) !== -1){ 46 | if(state.commentLine === true){ 47 | if(stream.eol()){ 48 | state.commentLine = false; 49 | } 50 | return "comment"; 51 | } 52 | if(ch === "]" || ch === "["){ 53 | if(ch === "["){ 54 | state.left++; 55 | } 56 | else{ 57 | state.right++; 58 | } 59 | return "bracket"; 60 | } 61 | else if(ch === "+" || ch === "-"){ 62 | return "keyword"; 63 | } 64 | else if(ch === "<" || ch === ">"){ 65 | return "atom"; 66 | } 67 | else if(ch === "." || ch === ","){ 68 | return "def"; 69 | } 70 | } 71 | else{ 72 | state.commentLine = true; 73 | if(stream.eol()){ 74 | state.commentLine = false; 75 | } 76 | return "comment"; 77 | } 78 | if(stream.eol()){ 79 | state.commentLine = false; 80 | } 81 | } 82 | }; 83 | }); 84 | CodeMirror.defineMIME("text/x-brainfuck","brainfuck") 85 | }); 86 | -------------------------------------------------------------------------------- /static/codemirror/cmake/cmake.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) 8 | define(["../../lib/codemirror"], mod); 9 | else 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode("cmake", function () { 15 | var variable_regex = /({)?[a-zA-Z0-9_]+(})?/; 16 | 17 | function tokenString(stream, state) { 18 | var current, prev, found_var = false; 19 | while (!stream.eol() && (current = stream.next()) != state.pending) { 20 | if (current === '$' && prev != '\\' && state.pending == '"') { 21 | found_var = true; 22 | break; 23 | } 24 | prev = current; 25 | } 26 | if (found_var) { 27 | stream.backUp(1); 28 | } 29 | if (current == state.pending) { 30 | state.continueString = false; 31 | } else { 32 | state.continueString = true; 33 | } 34 | return "string"; 35 | } 36 | 37 | function tokenize(stream, state) { 38 | var ch = stream.next(); 39 | 40 | // Have we found a variable? 41 | if (ch === '$') { 42 | if (stream.match(variable_regex)) { 43 | return 'variable-2'; 44 | } 45 | return 'variable'; 46 | } 47 | // Should we still be looking for the end of a string? 48 | if (state.continueString) { 49 | // If so, go through the loop again 50 | stream.backUp(1); 51 | return tokenString(stream, state); 52 | } 53 | // Do we just have a function on our hands? 54 | // In 'cmake_minimum_required (VERSION 2.8.8)', 'cmake_minimum_required' is matched 55 | if (stream.match(/(\s+)?\w+\(/) || stream.match(/(\s+)?\w+\ \(/)) { 56 | stream.backUp(1); 57 | return 'def'; 58 | } 59 | if (ch == "#") { 60 | stream.skipToEnd(); 61 | return "comment"; 62 | } 63 | // Have we found a string? 64 | if (ch == "'" || ch == '"') { 65 | // Store the type (single or double) 66 | state.pending = ch; 67 | // Perform the looping function to find the end 68 | return tokenString(stream, state); 69 | } 70 | if (ch == '(' || ch == ')') { 71 | return 'bracket'; 72 | } 73 | if (ch.match(/[0-9]/)) { 74 | return 'number'; 75 | } 76 | stream.eatWhile(/[\w-]/); 77 | return null; 78 | } 79 | return { 80 | startState: function () { 81 | var state = {}; 82 | state.inDefinition = false; 83 | state.inInclude = false; 84 | state.continueString = false; 85 | state.pending = false; 86 | return state; 87 | }, 88 | token: function (stream, state) { 89 | if (stream.eatSpace()) return null; 90 | return tokenize(stream, state); 91 | } 92 | }; 93 | }); 94 | 95 | CodeMirror.defineMIME("text/x-cmake", "cmake"); 96 | 97 | }); 98 | -------------------------------------------------------------------------------- /static/codemirror/cmake/cmake.min.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) 8 | define(["../../lib/codemirror"], mod); 9 | else 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode("cmake", function () { 15 | var variable_regex = /({)?[a-zA-Z0-9_]+(})?/; 16 | 17 | function tokenString(stream, state) { 18 | var current, prev, found_var = false; 19 | while (!stream.eol() && (current = stream.next()) != state.pending) { 20 | if (current === '$' && prev != '\\' && state.pending == '"') { 21 | found_var = true; 22 | break; 23 | } 24 | prev = current; 25 | } 26 | if (found_var) { 27 | stream.backUp(1); 28 | } 29 | if (current == state.pending) { 30 | state.continueString = false; 31 | } else { 32 | state.continueString = true; 33 | } 34 | return "string"; 35 | } 36 | 37 | function tokenize(stream, state) { 38 | var ch = stream.next(); 39 | 40 | // Have we found a variable? 41 | if (ch === '$') { 42 | if (stream.match(variable_regex)) { 43 | return 'variable-2'; 44 | } 45 | return 'variable'; 46 | } 47 | // Should we still be looking for the end of a string? 48 | if (state.continueString) { 49 | // If so, go through the loop again 50 | stream.backUp(1); 51 | return tokenString(stream, state); 52 | } 53 | // Do we just have a function on our hands? 54 | // In 'cmake_minimum_required (VERSION 2.8.8)', 'cmake_minimum_required' is matched 55 | if (stream.match(/(\s+)?\w+\(/) || stream.match(/(\s+)?\w+\ \(/)) { 56 | stream.backUp(1); 57 | return 'def'; 58 | } 59 | if (ch == "#") { 60 | stream.skipToEnd(); 61 | return "comment"; 62 | } 63 | // Have we found a string? 64 | if (ch == "'" || ch == '"') { 65 | // Store the type (single or double) 66 | state.pending = ch; 67 | // Perform the looping function to find the end 68 | return tokenString(stream, state); 69 | } 70 | if (ch == '(' || ch == ')') { 71 | return 'bracket'; 72 | } 73 | if (ch.match(/[0-9]/)) { 74 | return 'number'; 75 | } 76 | stream.eatWhile(/[\w-]/); 77 | return null; 78 | } 79 | return { 80 | startState: function () { 81 | var state = {}; 82 | state.inDefinition = false; 83 | state.inInclude = false; 84 | state.continueString = false; 85 | state.pending = false; 86 | return state; 87 | }, 88 | token: function (stream, state) { 89 | if (stream.eatSpace()) return null; 90 | return tokenize(stream, state); 91 | } 92 | }; 93 | }); 94 | 95 | CodeMirror.defineMIME("text/x-cmake", "cmake"); 96 | 97 | }); 98 | -------------------------------------------------------------------------------- /static/codemirror/commonlisp/commonlisp.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode("commonlisp", function (config) { 15 | var specialForm = /^(block|let*|return-from|catch|load-time-value|setq|eval-when|locally|symbol-macrolet|flet|macrolet|tagbody|function|multiple-value-call|the|go|multiple-value-prog1|throw|if|progn|unwind-protect|labels|progv|let|quote)$/; 16 | var assumeBody = /^with|^def|^do|^prog|case$|^cond$|bind$|when$|unless$/; 17 | var numLiteral = /^(?:[+\-]?(?:\d+|\d*\.\d+)(?:[efd][+\-]?\d+)?|[+\-]?\d+(?:\/[+\-]?\d+)?|#b[+\-]?[01]+|#o[+\-]?[0-7]+|#x[+\-]?[\da-f]+)/; 18 | var symbol = /[^\s'`,@()\[\]";]/; 19 | var type; 20 | 21 | function readSym(stream) { 22 | var ch; 23 | while (ch = stream.next()) { 24 | if (ch == "\\") stream.next(); 25 | else if (!symbol.test(ch)) { stream.backUp(1); break; } 26 | } 27 | return stream.current(); 28 | } 29 | 30 | function base(stream, state) { 31 | if (stream.eatSpace()) {type = "ws"; return null;} 32 | if (stream.match(numLiteral)) return "number"; 33 | var ch = stream.next(); 34 | if (ch == "\\") ch = stream.next(); 35 | 36 | if (ch == '"') return (state.tokenize = inString)(stream, state); 37 | else if (ch == "(") { type = "open"; return "bracket"; } 38 | else if (ch == ")" || ch == "]") { type = "close"; return "bracket"; } 39 | else if (ch == ";") { stream.skipToEnd(); type = "ws"; return "comment"; } 40 | else if (/['`,@]/.test(ch)) return null; 41 | else if (ch == "|") { 42 | if (stream.skipTo("|")) { stream.next(); return "symbol"; } 43 | else { stream.skipToEnd(); return "error"; } 44 | } else if (ch == "#") { 45 | var ch = stream.next(); 46 | if (ch == "(") { type = "open"; return "bracket"; } 47 | else if (/[+\-=\.']/.test(ch)) return null; 48 | else if (/\d/.test(ch) && stream.match(/^\d*#/)) return null; 49 | else if (ch == "|") return (state.tokenize = inComment)(stream, state); 50 | else if (ch == ":") { readSym(stream); return "meta"; } 51 | else if (ch == "\\") { stream.next(); readSym(stream); return "string-2" } 52 | else return "error"; 53 | } else { 54 | var name = readSym(stream); 55 | if (name == ".") return null; 56 | type = "symbol"; 57 | if (name == "nil" || name == "t" || name.charAt(0) == ":") return "atom"; 58 | if (state.lastType == "open" && (specialForm.test(name) || assumeBody.test(name))) return "keyword"; 59 | if (name.charAt(0) == "&") return "variable-2"; 60 | return "variable"; 61 | } 62 | } 63 | 64 | function inString(stream, state) { 65 | var escaped = false, next; 66 | while (next = stream.next()) { 67 | if (next == '"' && !escaped) { state.tokenize = base; break; } 68 | escaped = !escaped && next == "\\"; 69 | } 70 | return "string"; 71 | } 72 | 73 | function inComment(stream, state) { 74 | var next, last; 75 | while (next = stream.next()) { 76 | if (next == "#" && last == "|") { state.tokenize = base; break; } 77 | last = next; 78 | } 79 | type = "ws"; 80 | return "comment"; 81 | } 82 | 83 | return { 84 | startState: function () { 85 | return {ctx: {prev: null, start: 0, indentTo: 0}, lastType: null, tokenize: base}; 86 | }, 87 | 88 | token: function (stream, state) { 89 | if (stream.sol() && typeof state.ctx.indentTo != "number") 90 | state.ctx.indentTo = state.ctx.start + 1; 91 | 92 | type = null; 93 | var style = state.tokenize(stream, state); 94 | if (type != "ws") { 95 | if (state.ctx.indentTo == null) { 96 | if (type == "symbol" && assumeBody.test(stream.current())) 97 | state.ctx.indentTo = state.ctx.start + config.indentUnit; 98 | else 99 | state.ctx.indentTo = "next"; 100 | } else if (state.ctx.indentTo == "next") { 101 | state.ctx.indentTo = stream.column(); 102 | } 103 | state.lastType = type; 104 | } 105 | if (type == "open") state.ctx = {prev: state.ctx, start: stream.column(), indentTo: null}; 106 | else if (type == "close") state.ctx = state.ctx.prev || state.ctx; 107 | return style; 108 | }, 109 | 110 | indent: function (state, _textAfter) { 111 | var i = state.ctx.indentTo; 112 | return typeof i == "number" ? i : state.ctx.start + 1; 113 | }, 114 | 115 | closeBrackets: {pairs: "()[]{}\"\""}, 116 | lineComment: ";;", 117 | blockCommentStart: "#|", 118 | blockCommentEnd: "|#" 119 | }; 120 | }); 121 | 122 | CodeMirror.defineMIME("text/x-common-lisp", "commonlisp"); 123 | 124 | }); 125 | -------------------------------------------------------------------------------- /static/codemirror/commonlisp/commonlisp.min.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode("commonlisp", function (config) { 15 | var specialForm = /^(block|let*|return-from|catch|load-time-value|setq|eval-when|locally|symbol-macrolet|flet|macrolet|tagbody|function|multiple-value-call|the|go|multiple-value-prog1|throw|if|progn|unwind-protect|labels|progv|let|quote)$/; 16 | var assumeBody = /^with|^def|^do|^prog|case$|^cond$|bind$|when$|unless$/; 17 | var numLiteral = /^(?:[+\-]?(?:\d+|\d*\.\d+)(?:[efd][+\-]?\d+)?|[+\-]?\d+(?:\/[+\-]?\d+)?|#b[+\-]?[01]+|#o[+\-]?[0-7]+|#x[+\-]?[\da-f]+)/; 18 | var symbol = /[^\s'`,@()\[\]";]/; 19 | var type; 20 | 21 | function readSym(stream) { 22 | var ch; 23 | while (ch = stream.next()) { 24 | if (ch == "\\") stream.next(); 25 | else if (!symbol.test(ch)) { stream.backUp(1); break; } 26 | } 27 | return stream.current(); 28 | } 29 | 30 | function base(stream, state) { 31 | if (stream.eatSpace()) {type = "ws"; return null;} 32 | if (stream.match(numLiteral)) return "number"; 33 | var ch = stream.next(); 34 | if (ch == "\\") ch = stream.next(); 35 | 36 | if (ch == '"') return (state.tokenize = inString)(stream, state); 37 | else if (ch == "(") { type = "open"; return "bracket"; } 38 | else if (ch == ")" || ch == "]") { type = "close"; return "bracket"; } 39 | else if (ch == ";") { stream.skipToEnd(); type = "ws"; return "comment"; } 40 | else if (/['`,@]/.test(ch)) return null; 41 | else if (ch == "|") { 42 | if (stream.skipTo("|")) { stream.next(); return "symbol"; } 43 | else { stream.skipToEnd(); return "error"; } 44 | } else if (ch == "#") { 45 | var ch = stream.next(); 46 | if (ch == "(") { type = "open"; return "bracket"; } 47 | else if (/[+\-=\.']/.test(ch)) return null; 48 | else if (/\d/.test(ch) && stream.match(/^\d*#/)) return null; 49 | else if (ch == "|") return (state.tokenize = inComment)(stream, state); 50 | else if (ch == ":") { readSym(stream); return "meta"; } 51 | else if (ch == "\\") { stream.next(); readSym(stream); return "string-2" } 52 | else return "error"; 53 | } else { 54 | var name = readSym(stream); 55 | if (name == ".") return null; 56 | type = "symbol"; 57 | if (name == "nil" || name == "t" || name.charAt(0) == ":") return "atom"; 58 | if (state.lastType == "open" && (specialForm.test(name) || assumeBody.test(name))) return "keyword"; 59 | if (name.charAt(0) == "&") return "variable-2"; 60 | return "variable"; 61 | } 62 | } 63 | 64 | function inString(stream, state) { 65 | var escaped = false, next; 66 | while (next = stream.next()) { 67 | if (next == '"' && !escaped) { state.tokenize = base; break; } 68 | escaped = !escaped && next == "\\"; 69 | } 70 | return "string"; 71 | } 72 | 73 | function inComment(stream, state) { 74 | var next, last; 75 | while (next = stream.next()) { 76 | if (next == "#" && last == "|") { state.tokenize = base; break; } 77 | last = next; 78 | } 79 | type = "ws"; 80 | return "comment"; 81 | } 82 | 83 | return { 84 | startState: function () { 85 | return {ctx: {prev: null, start: 0, indentTo: 0}, lastType: null, tokenize: base}; 86 | }, 87 | 88 | token: function (stream, state) { 89 | if (stream.sol() && typeof state.ctx.indentTo != "number") 90 | state.ctx.indentTo = state.ctx.start + 1; 91 | 92 | type = null; 93 | var style = state.tokenize(stream, state); 94 | if (type != "ws") { 95 | if (state.ctx.indentTo == null) { 96 | if (type == "symbol" && assumeBody.test(stream.current())) 97 | state.ctx.indentTo = state.ctx.start + config.indentUnit; 98 | else 99 | state.ctx.indentTo = "next"; 100 | } else if (state.ctx.indentTo == "next") { 101 | state.ctx.indentTo = stream.column(); 102 | } 103 | state.lastType = type; 104 | } 105 | if (type == "open") state.ctx = {prev: state.ctx, start: stream.column(), indentTo: null}; 106 | else if (type == "close") state.ctx = state.ctx.prev || state.ctx; 107 | return style; 108 | }, 109 | 110 | indent: function (state, _textAfter) { 111 | var i = state.ctx.indentTo; 112 | return typeof i == "number" ? i : state.ctx.start + 1; 113 | }, 114 | 115 | closeBrackets: {pairs: "()[]{}\"\""}, 116 | lineComment: ";;", 117 | blockCommentStart: "#|", 118 | blockCommentEnd: "|#" 119 | }; 120 | }); 121 | 122 | CodeMirror.defineMIME("text/x-common-lisp", "commonlisp"); 123 | 124 | }); 125 | -------------------------------------------------------------------------------- /static/codemirror/diff/diff.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode("diff", function() { 15 | 16 | var TOKEN_NAMES = { 17 | '+': 'positive', 18 | '-': 'negative', 19 | '@': 'meta' 20 | }; 21 | 22 | return { 23 | token: function(stream) { 24 | var tw_pos = stream.string.search(/[\t ]+?$/); 25 | 26 | if (!stream.sol() || tw_pos === 0) { 27 | stream.skipToEnd(); 28 | return ("error " + ( 29 | TOKEN_NAMES[stream.string.charAt(0)] || '')).replace(/ $/, ''); 30 | } 31 | 32 | var token_name = TOKEN_NAMES[stream.peek()] || stream.skipToEnd(); 33 | 34 | if (tw_pos === -1) { 35 | stream.skipToEnd(); 36 | } else { 37 | stream.pos = tw_pos; 38 | } 39 | 40 | return token_name; 41 | } 42 | }; 43 | }); 44 | 45 | CodeMirror.defineMIME("text/x-diff", "diff"); 46 | 47 | }); 48 | -------------------------------------------------------------------------------- /static/codemirror/diff/diff.min.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode("diff", function() { 15 | 16 | var TOKEN_NAMES = { 17 | '+': 'positive', 18 | '-': 'negative', 19 | '@': 'meta' 20 | }; 21 | 22 | return { 23 | token: function(stream) { 24 | var tw_pos = stream.string.search(/[\t ]+?$/); 25 | 26 | if (!stream.sol() || tw_pos === 0) { 27 | stream.skipToEnd(); 28 | return ("error " + ( 29 | TOKEN_NAMES[stream.string.charAt(0)] || '')).replace(/ $/, ''); 30 | } 31 | 32 | var token_name = TOKEN_NAMES[stream.peek()] || stream.skipToEnd(); 33 | 34 | if (tw_pos === -1) { 35 | stream.skipToEnd(); 36 | } else { 37 | stream.pos = tw_pos; 38 | } 39 | 40 | return token_name; 41 | } 42 | }; 43 | }); 44 | 45 | CodeMirror.defineMIME("text/x-diff", "diff"); 46 | 47 | }); 48 | -------------------------------------------------------------------------------- /static/codemirror/eiffel/eiffel.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode("eiffel", function() { 15 | function wordObj(words) { 16 | var o = {}; 17 | for (var i = 0, e = words.length; i < e; ++i) o[words[i]] = true; 18 | return o; 19 | } 20 | var keywords = wordObj([ 21 | 'note', 22 | 'across', 23 | 'when', 24 | 'variant', 25 | 'until', 26 | 'unique', 27 | 'undefine', 28 | 'then', 29 | 'strip', 30 | 'select', 31 | 'retry', 32 | 'rescue', 33 | 'require', 34 | 'rename', 35 | 'reference', 36 | 'redefine', 37 | 'prefix', 38 | 'once', 39 | 'old', 40 | 'obsolete', 41 | 'loop', 42 | 'local', 43 | 'like', 44 | 'is', 45 | 'inspect', 46 | 'infix', 47 | 'include', 48 | 'if', 49 | 'frozen', 50 | 'from', 51 | 'external', 52 | 'export', 53 | 'ensure', 54 | 'end', 55 | 'elseif', 56 | 'else', 57 | 'do', 58 | 'creation', 59 | 'create', 60 | 'check', 61 | 'alias', 62 | 'agent', 63 | 'separate', 64 | 'invariant', 65 | 'inherit', 66 | 'indexing', 67 | 'feature', 68 | 'expanded', 69 | 'deferred', 70 | 'class', 71 | 'Void', 72 | 'True', 73 | 'Result', 74 | 'Precursor', 75 | 'False', 76 | 'Current', 77 | 'create', 78 | 'attached', 79 | 'detachable', 80 | 'as', 81 | 'and', 82 | 'implies', 83 | 'not', 84 | 'or' 85 | ]); 86 | var operators = wordObj([":=", "and then","and", "or","<<",">>"]); 87 | 88 | function chain(newtok, stream, state) { 89 | state.tokenize.push(newtok); 90 | return newtok(stream, state); 91 | } 92 | 93 | function tokenBase(stream, state) { 94 | if (stream.eatSpace()) return null; 95 | var ch = stream.next(); 96 | if (ch == '"'||ch == "'") { 97 | return chain(readQuoted(ch, "string"), stream, state); 98 | } else if (ch == "-"&&stream.eat("-")) { 99 | stream.skipToEnd(); 100 | return "comment"; 101 | } else if (ch == ":"&&stream.eat("=")) { 102 | return "operator"; 103 | } else if (/[0-9]/.test(ch)) { 104 | stream.eatWhile(/[xXbBCc0-9\.]/); 105 | stream.eat(/[\?\!]/); 106 | return "ident"; 107 | } else if (/[a-zA-Z_0-9]/.test(ch)) { 108 | stream.eatWhile(/[a-zA-Z_0-9]/); 109 | stream.eat(/[\?\!]/); 110 | return "ident"; 111 | } else if (/[=+\-\/*^%<>~]/.test(ch)) { 112 | stream.eatWhile(/[=+\-\/*^%<>~]/); 113 | return "operator"; 114 | } else { 115 | return null; 116 | } 117 | } 118 | 119 | function readQuoted(quote, style, unescaped) { 120 | return function(stream, state) { 121 | var escaped = false, ch; 122 | while ((ch = stream.next()) != null) { 123 | if (ch == quote && (unescaped || !escaped)) { 124 | state.tokenize.pop(); 125 | break; 126 | } 127 | escaped = !escaped && ch == "%"; 128 | } 129 | return style; 130 | }; 131 | } 132 | 133 | return { 134 | startState: function() { 135 | return {tokenize: [tokenBase]}; 136 | }, 137 | 138 | token: function(stream, state) { 139 | var style = state.tokenize[state.tokenize.length-1](stream, state); 140 | if (style == "ident") { 141 | var word = stream.current(); 142 | style = keywords.propertyIsEnumerable(stream.current()) ? "keyword" 143 | : operators.propertyIsEnumerable(stream.current()) ? "operator" 144 | : /^[A-Z][A-Z_0-9]*$/g.test(word) ? "tag" 145 | : /^0[bB][0-1]+$/g.test(word) ? "number" 146 | : /^0[cC][0-7]+$/g.test(word) ? "number" 147 | : /^0[xX][a-fA-F0-9]+$/g.test(word) ? "number" 148 | : /^([0-9]+\.[0-9]*)|([0-9]*\.[0-9]+)$/g.test(word) ? "number" 149 | : /^[0-9]+$/g.test(word) ? "number" 150 | : "variable"; 151 | } 152 | return style; 153 | }, 154 | lineComment: "--" 155 | }; 156 | }); 157 | 158 | CodeMirror.defineMIME("text/x-eiffel", "eiffel"); 159 | 160 | }); 161 | -------------------------------------------------------------------------------- /static/codemirror/eiffel/eiffel.min.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode("eiffel", function() { 15 | function wordObj(words) { 16 | var o = {}; 17 | for (var i = 0, e = words.length; i < e; ++i) o[words[i]] = true; 18 | return o; 19 | } 20 | var keywords = wordObj([ 21 | 'note', 22 | 'across', 23 | 'when', 24 | 'variant', 25 | 'until', 26 | 'unique', 27 | 'undefine', 28 | 'then', 29 | 'strip', 30 | 'select', 31 | 'retry', 32 | 'rescue', 33 | 'require', 34 | 'rename', 35 | 'reference', 36 | 'redefine', 37 | 'prefix', 38 | 'once', 39 | 'old', 40 | 'obsolete', 41 | 'loop', 42 | 'local', 43 | 'like', 44 | 'is', 45 | 'inspect', 46 | 'infix', 47 | 'include', 48 | 'if', 49 | 'frozen', 50 | 'from', 51 | 'external', 52 | 'export', 53 | 'ensure', 54 | 'end', 55 | 'elseif', 56 | 'else', 57 | 'do', 58 | 'creation', 59 | 'create', 60 | 'check', 61 | 'alias', 62 | 'agent', 63 | 'separate', 64 | 'invariant', 65 | 'inherit', 66 | 'indexing', 67 | 'feature', 68 | 'expanded', 69 | 'deferred', 70 | 'class', 71 | 'Void', 72 | 'True', 73 | 'Result', 74 | 'Precursor', 75 | 'False', 76 | 'Current', 77 | 'create', 78 | 'attached', 79 | 'detachable', 80 | 'as', 81 | 'and', 82 | 'implies', 83 | 'not', 84 | 'or' 85 | ]); 86 | var operators = wordObj([":=", "and then","and", "or","<<",">>"]); 87 | 88 | function chain(newtok, stream, state) { 89 | state.tokenize.push(newtok); 90 | return newtok(stream, state); 91 | } 92 | 93 | function tokenBase(stream, state) { 94 | if (stream.eatSpace()) return null; 95 | var ch = stream.next(); 96 | if (ch == '"'||ch == "'") { 97 | return chain(readQuoted(ch, "string"), stream, state); 98 | } else if (ch == "-"&&stream.eat("-")) { 99 | stream.skipToEnd(); 100 | return "comment"; 101 | } else if (ch == ":"&&stream.eat("=")) { 102 | return "operator"; 103 | } else if (/[0-9]/.test(ch)) { 104 | stream.eatWhile(/[xXbBCc0-9\.]/); 105 | stream.eat(/[\?\!]/); 106 | return "ident"; 107 | } else if (/[a-zA-Z_0-9]/.test(ch)) { 108 | stream.eatWhile(/[a-zA-Z_0-9]/); 109 | stream.eat(/[\?\!]/); 110 | return "ident"; 111 | } else if (/[=+\-\/*^%<>~]/.test(ch)) { 112 | stream.eatWhile(/[=+\-\/*^%<>~]/); 113 | return "operator"; 114 | } else { 115 | return null; 116 | } 117 | } 118 | 119 | function readQuoted(quote, style, unescaped) { 120 | return function(stream, state) { 121 | var escaped = false, ch; 122 | while ((ch = stream.next()) != null) { 123 | if (ch == quote && (unescaped || !escaped)) { 124 | state.tokenize.pop(); 125 | break; 126 | } 127 | escaped = !escaped && ch == "%"; 128 | } 129 | return style; 130 | }; 131 | } 132 | 133 | return { 134 | startState: function() { 135 | return {tokenize: [tokenBase]}; 136 | }, 137 | 138 | token: function(stream, state) { 139 | var style = state.tokenize[state.tokenize.length-1](stream, state); 140 | if (style == "ident") { 141 | var word = stream.current(); 142 | style = keywords.propertyIsEnumerable(stream.current()) ? "keyword" 143 | : operators.propertyIsEnumerable(stream.current()) ? "operator" 144 | : /^[A-Z][A-Z_0-9]*$/g.test(word) ? "tag" 145 | : /^0[bB][0-1]+$/g.test(word) ? "number" 146 | : /^0[cC][0-7]+$/g.test(word) ? "number" 147 | : /^0[xX][a-fA-F0-9]+$/g.test(word) ? "number" 148 | : /^([0-9]+\.[0-9]*)|([0-9]*\.[0-9]+)$/g.test(word) ? "number" 149 | : /^[0-9]+$/g.test(word) ? "number" 150 | : "variable"; 151 | } 152 | return style; 153 | }, 154 | lineComment: "--" 155 | }; 156 | }); 157 | 158 | CodeMirror.defineMIME("text/x-eiffel", "eiffel"); 159 | 160 | }); 161 | -------------------------------------------------------------------------------- /static/codemirror/factor/factor.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | // Factor syntax highlight - simple mode 5 | // 6 | // by Dimage Sapelkin (https://github.com/kerabromsmu) 7 | 8 | (function(mod) { 9 | if (typeof exports == "object" && typeof module == "object") // CommonJS 10 | mod(require("../../lib/codemirror"), require("../../addon/mode/simple")); 11 | else if (typeof define == "function" && define.amd) // AMD 12 | define(["../../lib/codemirror", "../../addon/mode/simple"], mod); 13 | else // Plain browser env 14 | mod(CodeMirror); 15 | })(function(CodeMirror) { 16 | "use strict"; 17 | 18 | CodeMirror.defineSimpleMode("factor", { 19 | // The start state contains the rules that are intially used 20 | start: [ 21 | // comments 22 | {regex: /#?!.*/, token: "comment"}, 23 | // strings """, multiline --> state 24 | {regex: /"""/, token: "string", next: "string3"}, 25 | {regex: /(STRING:)(\s)/, token: ["keyword", null], next: "string2"}, 26 | {regex: /\S*?"/, token: "string", next: "string"}, 27 | // numbers: dec, hex, unicode, bin, fractional, complex 28 | {regex: /(?:0x[\d,a-f]+)|(?:0o[0-7]+)|(?:0b[0,1]+)|(?:\-?\d+.?\d*)(?=\s)/, token: "number"}, 29 | //{regex: /[+-]?/} //fractional 30 | // definition: defining word, defined word, etc 31 | {regex: /((?:GENERIC)|\:?\:)(\s+)(\S+)(\s+)(\()/, token: ["keyword", null, "def", null, "bracket"], next: "stack"}, 32 | // method definition: defining word, type, defined word, etc 33 | {regex: /(M\:)(\s+)(\S+)(\s+)(\S+)/, token: ["keyword", null, "def", null, "tag"]}, 34 | // vocabulary using --> state 35 | {regex: /USING\:/, token: "keyword", next: "vocabulary"}, 36 | // vocabulary definition/use 37 | {regex: /(USE\:|IN\:)(\s+)(\S+)(?=\s|$)/, token: ["keyword", null, "tag"]}, 38 | // definition: a defining word, defined word 39 | {regex: /(\S+\:)(\s+)(\S+)(?=\s|$)/, token: ["keyword", null, "def"]}, 40 | // "keywords", incl. ; t f . [ ] { } defining words 41 | {regex: /(?:;|\\|t|f|if|loop|while|until|do|PRIVATE>| and the like 43 | {regex: /\S+[\)>\.\*\?]+(?=\s|$)/, token: "builtin"}, 44 | {regex: /[\)><]+\S+(?=\s|$)/, token: "builtin"}, 45 | // operators 46 | {regex: /(?:[\+\-\=\/\*<>])(?=\s|$)/, token: "keyword"}, 47 | // any id (?) 48 | {regex: /\S+/, token: "variable"}, 49 | {regex: /\s+|./, token: null} 50 | ], 51 | vocabulary: [ 52 | {regex: /;/, token: "keyword", next: "start"}, 53 | {regex: /\S+/, token: "tag"}, 54 | {regex: /\s+|./, token: null} 55 | ], 56 | string: [ 57 | {regex: /(?:[^\\]|\\.)*?"/, token: "string", next: "start"}, 58 | {regex: /.*/, token: "string"} 59 | ], 60 | string2: [ 61 | {regex: /^;/, token: "keyword", next: "start"}, 62 | {regex: /.*/, token: "string"} 63 | ], 64 | string3: [ 65 | {regex: /(?:[^\\]|\\.)*?"""/, token: "string", next: "start"}, 66 | {regex: /.*/, token: "string"} 67 | ], 68 | stack: [ 69 | {regex: /\)/, token: "bracket", next: "start"}, 70 | {regex: /--/, token: "bracket"}, 71 | {regex: /\S+/, token: "meta"}, 72 | {regex: /\s+|./, token: null} 73 | ], 74 | // The meta property contains global information about the mode. It 75 | // can contain properties like lineComment, which are supported by 76 | // all modes, and also directives like dontIndentStates, which are 77 | // specific to simple modes. 78 | meta: { 79 | dontIndentStates: ["start", "vocabulary", "string", "string3", "stack"], 80 | lineComment: [ "!", "#!" ] 81 | } 82 | }); 83 | 84 | CodeMirror.defineMIME("text/x-factor", "factor"); 85 | }); 86 | -------------------------------------------------------------------------------- /static/codemirror/factor/factor.min.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | // Factor syntax highlight - simple mode 5 | // 6 | // by Dimage Sapelkin (https://github.com/kerabromsmu) 7 | 8 | (function(mod) { 9 | if (typeof exports == "object" && typeof module == "object") // CommonJS 10 | mod(require("../../lib/codemirror"), require("../../addon/mode/simple")); 11 | else if (typeof define == "function" && define.amd) // AMD 12 | define(["../../lib/codemirror", "../../addon/mode/simple"], mod); 13 | else // Plain browser env 14 | mod(CodeMirror); 15 | })(function(CodeMirror) { 16 | "use strict"; 17 | 18 | CodeMirror.defineSimpleMode("factor", { 19 | // The start state contains the rules that are intially used 20 | start: [ 21 | // comments 22 | {regex: /#?!.*/, token: "comment"}, 23 | // strings """, multiline --> state 24 | {regex: /"""/, token: "string", next: "string3"}, 25 | {regex: /(STRING:)(\s)/, token: ["keyword", null], next: "string2"}, 26 | {regex: /\S*?"/, token: "string", next: "string"}, 27 | // numbers: dec, hex, unicode, bin, fractional, complex 28 | {regex: /(?:0x[\d,a-f]+)|(?:0o[0-7]+)|(?:0b[0,1]+)|(?:\-?\d+.?\d*)(?=\s)/, token: "number"}, 29 | //{regex: /[+-]?/} //fractional 30 | // definition: defining word, defined word, etc 31 | {regex: /((?:GENERIC)|\:?\:)(\s+)(\S+)(\s+)(\()/, token: ["keyword", null, "def", null, "bracket"], next: "stack"}, 32 | // method definition: defining word, type, defined word, etc 33 | {regex: /(M\:)(\s+)(\S+)(\s+)(\S+)/, token: ["keyword", null, "def", null, "tag"]}, 34 | // vocabulary using --> state 35 | {regex: /USING\:/, token: "keyword", next: "vocabulary"}, 36 | // vocabulary definition/use 37 | {regex: /(USE\:|IN\:)(\s+)(\S+)(?=\s|$)/, token: ["keyword", null, "tag"]}, 38 | // definition: a defining word, defined word 39 | {regex: /(\S+\:)(\s+)(\S+)(?=\s|$)/, token: ["keyword", null, "def"]}, 40 | // "keywords", incl. ; t f . [ ] { } defining words 41 | {regex: /(?:;|\\|t|f|if|loop|while|until|do|PRIVATE>| and the like 43 | {regex: /\S+[\)>\.\*\?]+(?=\s|$)/, token: "builtin"}, 44 | {regex: /[\)><]+\S+(?=\s|$)/, token: "builtin"}, 45 | // operators 46 | {regex: /(?:[\+\-\=\/\*<>])(?=\s|$)/, token: "keyword"}, 47 | // any id (?) 48 | {regex: /\S+/, token: "variable"}, 49 | {regex: /\s+|./, token: null} 50 | ], 51 | vocabulary: [ 52 | {regex: /;/, token: "keyword", next: "start"}, 53 | {regex: /\S+/, token: "tag"}, 54 | {regex: /\s+|./, token: null} 55 | ], 56 | string: [ 57 | {regex: /(?:[^\\]|\\.)*?"/, token: "string", next: "start"}, 58 | {regex: /.*/, token: "string"} 59 | ], 60 | string2: [ 61 | {regex: /^;/, token: "keyword", next: "start"}, 62 | {regex: /.*/, token: "string"} 63 | ], 64 | string3: [ 65 | {regex: /(?:[^\\]|\\.)*?"""/, token: "string", next: "start"}, 66 | {regex: /.*/, token: "string"} 67 | ], 68 | stack: [ 69 | {regex: /\)/, token: "bracket", next: "start"}, 70 | {regex: /--/, token: "bracket"}, 71 | {regex: /\S+/, token: "meta"}, 72 | {regex: /\s+|./, token: null} 73 | ], 74 | // The meta property contains global information about the mode. It 75 | // can contain properties like lineComment, which are supported by 76 | // all modes, and also directives like dontIndentStates, which are 77 | // specific to simple modes. 78 | meta: { 79 | dontIndentStates: ["start", "vocabulary", "string", "string3", "stack"], 80 | lineComment: [ "!", "#!" ] 81 | } 82 | }); 83 | 84 | CodeMirror.defineMIME("text/x-factor", "factor"); 85 | }); 86 | -------------------------------------------------------------------------------- /static/codemirror/handlebars/handlebars.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror"), require("../../addon/mode/simple"), require("../../addon/mode/multiplex")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror", "../../addon/mode/simple", "../../addon/mode/multiplex"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineSimpleMode("handlebars-tags", { 15 | start: [ 16 | { regex: /\{\{!--/, push: "dash_comment", token: "comment" }, 17 | { regex: /\{\{!/, push: "comment", token: "comment" }, 18 | { regex: /\{\{/, push: "handlebars", token: "tag" } 19 | ], 20 | handlebars: [ 21 | { regex: /\}\}/, pop: true, token: "tag" }, 22 | 23 | // Double and single quotes 24 | { regex: /"(?:[^\\"]|\\.)*"?/, token: "string" }, 25 | { regex: /'(?:[^\\']|\\.)*'?/, token: "string" }, 26 | 27 | // Handlebars keywords 28 | { regex: />|[#\/]([A-Za-z_]\w*)/, token: "keyword" }, 29 | { regex: /(?:else|this)\b/, token: "keyword" }, 30 | 31 | // Numeral 32 | { regex: /\d+/i, token: "number" }, 33 | 34 | // Atoms like = and . 35 | { regex: /=|~|@|true|false/, token: "atom" }, 36 | 37 | // Paths 38 | { regex: /(?:\.\.\/)*(?:[A-Za-z_][\w\.]*)+/, token: "variable-2" } 39 | ], 40 | dash_comment: [ 41 | { regex: /--\}\}/, pop: true, token: "comment" }, 42 | 43 | // Commented code 44 | { regex: /./, token: "comment"} 45 | ], 46 | comment: [ 47 | { regex: /\}\}/, pop: true, token: "comment" }, 48 | { regex: /./, token: "comment" } 49 | ], 50 | meta: { 51 | blockCommentStart: "{{--", 52 | blockCommentEnd: "--}}" 53 | } 54 | }); 55 | 56 | CodeMirror.defineMode("handlebars", function(config, parserConfig) { 57 | var handlebars = CodeMirror.getMode(config, "handlebars-tags"); 58 | if (!parserConfig || !parserConfig.base) return handlebars; 59 | return CodeMirror.multiplexingMode( 60 | CodeMirror.getMode(config, parserConfig.base), 61 | {open: "{{", close: "}}", mode: handlebars, parseDelimiters: true} 62 | ); 63 | }); 64 | 65 | CodeMirror.defineMIME("text/x-handlebars-template", "handlebars"); 66 | }); 67 | -------------------------------------------------------------------------------- /static/codemirror/handlebars/handlebars.min.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror"), require("../../addon/mode/simple"), require("../../addon/mode/multiplex")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror", "../../addon/mode/simple", "../../addon/mode/multiplex"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineSimpleMode("handlebars-tags", { 15 | start: [ 16 | { regex: /\{\{!--/, push: "dash_comment", token: "comment" }, 17 | { regex: /\{\{!/, push: "comment", token: "comment" }, 18 | { regex: /\{\{/, push: "handlebars", token: "tag" } 19 | ], 20 | handlebars: [ 21 | { regex: /\}\}/, pop: true, token: "tag" }, 22 | 23 | // Double and single quotes 24 | { regex: /"(?:[^\\"]|\\.)*"?/, token: "string" }, 25 | { regex: /'(?:[^\\']|\\.)*'?/, token: "string" }, 26 | 27 | // Handlebars keywords 28 | { regex: />|[#\/]([A-Za-z_]\w*)/, token: "keyword" }, 29 | { regex: /(?:else|this)\b/, token: "keyword" }, 30 | 31 | // Numeral 32 | { regex: /\d+/i, token: "number" }, 33 | 34 | // Atoms like = and . 35 | { regex: /=|~|@|true|false/, token: "atom" }, 36 | 37 | // Paths 38 | { regex: /(?:\.\.\/)*(?:[A-Za-z_][\w\.]*)+/, token: "variable-2" } 39 | ], 40 | dash_comment: [ 41 | { regex: /--\}\}/, pop: true, token: "comment" }, 42 | 43 | // Commented code 44 | { regex: /./, token: "comment"} 45 | ], 46 | comment: [ 47 | { regex: /\}\}/, pop: true, token: "comment" }, 48 | { regex: /./, token: "comment" } 49 | ], 50 | meta: { 51 | blockCommentStart: "{{--", 52 | blockCommentEnd: "--}}" 53 | } 54 | }); 55 | 56 | CodeMirror.defineMode("handlebars", function(config, parserConfig) { 57 | var handlebars = CodeMirror.getMode(config, "handlebars-tags"); 58 | if (!parserConfig || !parserConfig.base) return handlebars; 59 | return CodeMirror.multiplexingMode( 60 | CodeMirror.getMode(config, parserConfig.base), 61 | {open: "{{", close: "}}", mode: handlebars, parseDelimiters: true} 62 | ); 63 | }); 64 | 65 | CodeMirror.defineMIME("text/x-handlebars-template", "handlebars"); 66 | }); 67 | -------------------------------------------------------------------------------- /static/codemirror/haskell-literate/haskell-literate.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function (mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror"), require("../haskell/haskell")) 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror", "../haskell/haskell"], mod) 9 | else // Plain browser env 10 | mod(CodeMirror) 11 | })(function (CodeMirror) { 12 | "use strict" 13 | 14 | CodeMirror.defineMode("haskell-literate", function (config, parserConfig) { 15 | var baseMode = CodeMirror.getMode(config, (parserConfig && parserConfig.base) || "haskell") 16 | 17 | return { 18 | startState: function () { 19 | return { 20 | inCode: false, 21 | baseState: CodeMirror.startState(baseMode) 22 | } 23 | }, 24 | token: function (stream, state) { 25 | if (stream.sol()) { 26 | if (state.inCode = stream.eat(">")) 27 | return "meta" 28 | } 29 | if (state.inCode) { 30 | return baseMode.token(stream, state.baseState) 31 | } else { 32 | stream.skipToEnd() 33 | return "comment" 34 | } 35 | }, 36 | innerMode: function (state) { 37 | return state.inCode ? {state: state.baseState, mode: baseMode} : null 38 | } 39 | } 40 | }, "haskell") 41 | 42 | CodeMirror.defineMIME("text/x-literate-haskell", "haskell-literate") 43 | }); 44 | -------------------------------------------------------------------------------- /static/codemirror/haskell-literate/haskell-literate.min.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function (mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror"), require("../haskell/haskell")) 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror", "../haskell/haskell"], mod) 9 | else // Plain browser env 10 | mod(CodeMirror) 11 | })(function (CodeMirror) { 12 | "use strict" 13 | 14 | CodeMirror.defineMode("haskell-literate", function (config, parserConfig) { 15 | var baseMode = CodeMirror.getMode(config, (parserConfig && parserConfig.base) || "haskell") 16 | 17 | return { 18 | startState: function () { 19 | return { 20 | inCode: false, 21 | baseState: CodeMirror.startState(baseMode) 22 | } 23 | }, 24 | token: function (stream, state) { 25 | if (stream.sol()) { 26 | if (state.inCode = stream.eat(">")) 27 | return "meta" 28 | } 29 | if (state.inCode) { 30 | return baseMode.token(stream, state.baseState) 31 | } else { 32 | stream.skipToEnd() 33 | return "comment" 34 | } 35 | }, 36 | innerMode: function (state) { 37 | return state.inCode ? {state: state.baseState, mode: baseMode} : null 38 | } 39 | } 40 | }, "haskell") 41 | 42 | CodeMirror.defineMIME("text/x-literate-haskell", "haskell-literate") 43 | }); 44 | -------------------------------------------------------------------------------- /static/codemirror/htmlembedded/htmlembedded.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"), 7 | require("../../addon/mode/multiplex")); 8 | else if (typeof define == "function" && define.amd) // AMD 9 | define(["../../lib/codemirror", "../htmlmixed/htmlmixed", 10 | "../../addon/mode/multiplex"], mod); 11 | else // Plain browser env 12 | mod(CodeMirror); 13 | })(function(CodeMirror) { 14 | "use strict"; 15 | 16 | CodeMirror.defineMode("htmlembedded", function(config, parserConfig) { 17 | var closeComment = parserConfig.closeComment || "--%>" 18 | return CodeMirror.multiplexingMode(CodeMirror.getMode(config, "htmlmixed"), { 19 | open: parserConfig.openComment || "<%--", 20 | close: closeComment, 21 | delimStyle: "comment", 22 | mode: {token: function(stream) { 23 | stream.skipTo(closeComment) || stream.skipToEnd() 24 | return "comment" 25 | }} 26 | }, { 27 | open: parserConfig.open || parserConfig.scriptStartRegex || "<%", 28 | close: parserConfig.close || parserConfig.scriptEndRegex || "%>", 29 | mode: CodeMirror.getMode(config, parserConfig.scriptingModeSpec) 30 | }); 31 | }, "htmlmixed"); 32 | 33 | CodeMirror.defineMIME("application/x-ejs", {name: "htmlembedded", scriptingModeSpec:"javascript"}); 34 | CodeMirror.defineMIME("application/x-aspx", {name: "htmlembedded", scriptingModeSpec:"text/x-csharp"}); 35 | CodeMirror.defineMIME("application/x-jsp", {name: "htmlembedded", scriptingModeSpec:"text/x-java"}); 36 | CodeMirror.defineMIME("application/x-erb", {name: "htmlembedded", scriptingModeSpec:"ruby"}); 37 | }); 38 | -------------------------------------------------------------------------------- /static/codemirror/htmlembedded/htmlembedded.min.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"), 7 | require("../../addon/mode/multiplex")); 8 | else if (typeof define == "function" && define.amd) // AMD 9 | define(["../../lib/codemirror", "../htmlmixed/htmlmixed", 10 | "../../addon/mode/multiplex"], mod); 11 | else // Plain browser env 12 | mod(CodeMirror); 13 | })(function(CodeMirror) { 14 | "use strict"; 15 | 16 | CodeMirror.defineMode("htmlembedded", function(config, parserConfig) { 17 | var closeComment = parserConfig.closeComment || "--%>" 18 | return CodeMirror.multiplexingMode(CodeMirror.getMode(config, "htmlmixed"), { 19 | open: parserConfig.openComment || "<%--", 20 | close: closeComment, 21 | delimStyle: "comment", 22 | mode: {token: function(stream) { 23 | stream.skipTo(closeComment) || stream.skipToEnd() 24 | return "comment" 25 | }} 26 | }, { 27 | open: parserConfig.open || parserConfig.scriptStartRegex || "<%", 28 | close: parserConfig.close || parserConfig.scriptEndRegex || "%>", 29 | mode: CodeMirror.getMode(config, parserConfig.scriptingModeSpec) 30 | }); 31 | }, "htmlmixed"); 32 | 33 | CodeMirror.defineMIME("application/x-ejs", {name: "htmlembedded", scriptingModeSpec:"javascript"}); 34 | CodeMirror.defineMIME("application/x-aspx", {name: "htmlembedded", scriptingModeSpec:"text/x-csharp"}); 35 | CodeMirror.defineMIME("application/x-jsp", {name: "htmlembedded", scriptingModeSpec:"text/x-java"}); 36 | CodeMirror.defineMIME("application/x-erb", {name: "htmlembedded", scriptingModeSpec:"ruby"}); 37 | }); 38 | -------------------------------------------------------------------------------- /static/codemirror/http/http.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode("http", function() { 15 | function failFirstLine(stream, state) { 16 | stream.skipToEnd(); 17 | state.cur = header; 18 | return "error"; 19 | } 20 | 21 | function start(stream, state) { 22 | if (stream.match(/^HTTP\/\d\.\d/)) { 23 | state.cur = responseStatusCode; 24 | return "keyword"; 25 | } else if (stream.match(/^[A-Z]+/) && /[ \t]/.test(stream.peek())) { 26 | state.cur = requestPath; 27 | return "keyword"; 28 | } else { 29 | return failFirstLine(stream, state); 30 | } 31 | } 32 | 33 | function responseStatusCode(stream, state) { 34 | var code = stream.match(/^\d+/); 35 | if (!code) return failFirstLine(stream, state); 36 | 37 | state.cur = responseStatusText; 38 | var status = Number(code[0]); 39 | if (status >= 100 && status < 200) { 40 | return "positive informational"; 41 | } else if (status >= 200 && status < 300) { 42 | return "positive success"; 43 | } else if (status >= 300 && status < 400) { 44 | return "positive redirect"; 45 | } else if (status >= 400 && status < 500) { 46 | return "negative client-error"; 47 | } else if (status >= 500 && status < 600) { 48 | return "negative server-error"; 49 | } else { 50 | return "error"; 51 | } 52 | } 53 | 54 | function responseStatusText(stream, state) { 55 | stream.skipToEnd(); 56 | state.cur = header; 57 | return null; 58 | } 59 | 60 | function requestPath(stream, state) { 61 | stream.eatWhile(/\S/); 62 | state.cur = requestProtocol; 63 | return "string-2"; 64 | } 65 | 66 | function requestProtocol(stream, state) { 67 | if (stream.match(/^HTTP\/\d\.\d$/)) { 68 | state.cur = header; 69 | return "keyword"; 70 | } else { 71 | return failFirstLine(stream, state); 72 | } 73 | } 74 | 75 | function header(stream) { 76 | if (stream.sol() && !stream.eat(/[ \t]/)) { 77 | if (stream.match(/^.*?:/)) { 78 | return "atom"; 79 | } else { 80 | stream.skipToEnd(); 81 | return "error"; 82 | } 83 | } else { 84 | stream.skipToEnd(); 85 | return "string"; 86 | } 87 | } 88 | 89 | function body(stream) { 90 | stream.skipToEnd(); 91 | return null; 92 | } 93 | 94 | return { 95 | token: function(stream, state) { 96 | var cur = state.cur; 97 | if (cur != header && cur != body && stream.eatSpace()) return null; 98 | return cur(stream, state); 99 | }, 100 | 101 | blankLine: function(state) { 102 | state.cur = body; 103 | }, 104 | 105 | startState: function() { 106 | return {cur: start}; 107 | } 108 | }; 109 | }); 110 | 111 | CodeMirror.defineMIME("message/http", "http"); 112 | 113 | }); 114 | -------------------------------------------------------------------------------- /static/codemirror/http/http.min.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode("http", function() { 15 | function failFirstLine(stream, state) { 16 | stream.skipToEnd(); 17 | state.cur = header; 18 | return "error"; 19 | } 20 | 21 | function start(stream, state) { 22 | if (stream.match(/^HTTP\/\d\.\d/)) { 23 | state.cur = responseStatusCode; 24 | return "keyword"; 25 | } else if (stream.match(/^[A-Z]+/) && /[ \t]/.test(stream.peek())) { 26 | state.cur = requestPath; 27 | return "keyword"; 28 | } else { 29 | return failFirstLine(stream, state); 30 | } 31 | } 32 | 33 | function responseStatusCode(stream, state) { 34 | var code = stream.match(/^\d+/); 35 | if (!code) return failFirstLine(stream, state); 36 | 37 | state.cur = responseStatusText; 38 | var status = Number(code[0]); 39 | if (status >= 100 && status < 200) { 40 | return "positive informational"; 41 | } else if (status >= 200 && status < 300) { 42 | return "positive success"; 43 | } else if (status >= 300 && status < 400) { 44 | return "positive redirect"; 45 | } else if (status >= 400 && status < 500) { 46 | return "negative client-error"; 47 | } else if (status >= 500 && status < 600) { 48 | return "negative server-error"; 49 | } else { 50 | return "error"; 51 | } 52 | } 53 | 54 | function responseStatusText(stream, state) { 55 | stream.skipToEnd(); 56 | state.cur = header; 57 | return null; 58 | } 59 | 60 | function requestPath(stream, state) { 61 | stream.eatWhile(/\S/); 62 | state.cur = requestProtocol; 63 | return "string-2"; 64 | } 65 | 66 | function requestProtocol(stream, state) { 67 | if (stream.match(/^HTTP\/\d\.\d$/)) { 68 | state.cur = header; 69 | return "keyword"; 70 | } else { 71 | return failFirstLine(stream, state); 72 | } 73 | } 74 | 75 | function header(stream) { 76 | if (stream.sol() && !stream.eat(/[ \t]/)) { 77 | if (stream.match(/^.*?:/)) { 78 | return "atom"; 79 | } else { 80 | stream.skipToEnd(); 81 | return "error"; 82 | } 83 | } else { 84 | stream.skipToEnd(); 85 | return "string"; 86 | } 87 | } 88 | 89 | function body(stream) { 90 | stream.skipToEnd(); 91 | return null; 92 | } 93 | 94 | return { 95 | token: function(stream, state) { 96 | var cur = state.cur; 97 | if (cur != header && cur != body && stream.eatSpace()) return null; 98 | return cur(stream, state); 99 | }, 100 | 101 | blankLine: function(state) { 102 | state.cur = body; 103 | }, 104 | 105 | startState: function() { 106 | return {cur: start}; 107 | } 108 | }; 109 | }); 110 | 111 | CodeMirror.defineMIME("message/http", "http"); 112 | 113 | }); 114 | -------------------------------------------------------------------------------- /static/codemirror/jinja2/jinja2.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode("jinja2", function() { 15 | var keywords = ["and", "as", "block", "endblock", "by", "cycle", "debug", "else", "elif", 16 | "extends", "filter", "endfilter", "firstof", "for", 17 | "endfor", "if", "endif", "ifchanged", "endifchanged", 18 | "ifequal", "endifequal", "ifnotequal", 19 | "endifnotequal", "in", "include", "load", "not", "now", "or", 20 | "parsed", "regroup", "reversed", "spaceless", 21 | "endspaceless", "ssi", "templatetag", "openblock", 22 | "closeblock", "openvariable", "closevariable", 23 | "openbrace", "closebrace", "opencomment", 24 | "closecomment", "widthratio", "url", "with", "endwith", 25 | "get_current_language", "trans", "endtrans", "noop", "blocktrans", 26 | "endblocktrans", "get_available_languages", 27 | "get_current_language_bidi", "plural"], 28 | operator = /^[+\-*&%=<>!?|~^]/, 29 | sign = /^[:\[\(\{]/, 30 | atom = ["true", "false"], 31 | number = /^(\d[+\-\*\/])?\d+(\.\d+)?/; 32 | 33 | keywords = new RegExp("((" + keywords.join(")|(") + "))\\b"); 34 | atom = new RegExp("((" + atom.join(")|(") + "))\\b"); 35 | 36 | function tokenBase (stream, state) { 37 | var ch = stream.peek(); 38 | 39 | //Comment 40 | if (state.incomment) { 41 | if(!stream.skipTo("#}")) { 42 | stream.skipToEnd(); 43 | } else { 44 | stream.eatWhile(/\#|}/); 45 | state.incomment = false; 46 | } 47 | return "comment"; 48 | //Tag 49 | } else if (state.intag) { 50 | //After operator 51 | if(state.operator) { 52 | state.operator = false; 53 | if(stream.match(atom)) { 54 | return "atom"; 55 | } 56 | if(stream.match(number)) { 57 | return "number"; 58 | } 59 | } 60 | //After sign 61 | if(state.sign) { 62 | state.sign = false; 63 | if(stream.match(atom)) { 64 | return "atom"; 65 | } 66 | if(stream.match(number)) { 67 | return "number"; 68 | } 69 | } 70 | 71 | if(state.instring) { 72 | if(ch == state.instring) { 73 | state.instring = false; 74 | } 75 | stream.next(); 76 | return "string"; 77 | } else if(ch == "'" || ch == '"') { 78 | state.instring = ch; 79 | stream.next(); 80 | return "string"; 81 | } else if(stream.match(state.intag + "}") || stream.eat("-") && stream.match(state.intag + "}")) { 82 | state.intag = false; 83 | return "tag"; 84 | } else if(stream.match(operator)) { 85 | state.operator = true; 86 | return "operator"; 87 | } else if(stream.match(sign)) { 88 | state.sign = true; 89 | } else { 90 | if(stream.eat(" ") || stream.sol()) { 91 | if(stream.match(keywords)) { 92 | return "keyword"; 93 | } 94 | if(stream.match(atom)) { 95 | return "atom"; 96 | } 97 | if(stream.match(number)) { 98 | return "number"; 99 | } 100 | if(stream.sol()) { 101 | stream.next(); 102 | } 103 | } else { 104 | stream.next(); 105 | } 106 | 107 | } 108 | return "variable"; 109 | } else if (stream.eat("{")) { 110 | if (stream.eat("#")) { 111 | state.incomment = true; 112 | if(!stream.skipTo("#}")) { 113 | stream.skipToEnd(); 114 | } else { 115 | stream.eatWhile(/\#|}/); 116 | state.incomment = false; 117 | } 118 | return "comment"; 119 | //Open tag 120 | } else if (ch = stream.eat(/\{|%/)) { 121 | //Cache close tag 122 | state.intag = ch; 123 | if(ch == "{") { 124 | state.intag = "}"; 125 | } 126 | stream.eat("-"); 127 | return "tag"; 128 | } 129 | } 130 | stream.next(); 131 | }; 132 | 133 | return { 134 | startState: function () { 135 | return {tokenize: tokenBase}; 136 | }, 137 | token: function (stream, state) { 138 | return state.tokenize(stream, state); 139 | } 140 | }; 141 | }); 142 | }); 143 | -------------------------------------------------------------------------------- /static/codemirror/jinja2/jinja2.min.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode("jinja2", function() { 15 | var keywords = ["and", "as", "block", "endblock", "by", "cycle", "debug", "else", "elif", 16 | "extends", "filter", "endfilter", "firstof", "for", 17 | "endfor", "if", "endif", "ifchanged", "endifchanged", 18 | "ifequal", "endifequal", "ifnotequal", 19 | "endifnotequal", "in", "include", "load", "not", "now", "or", 20 | "parsed", "regroup", "reversed", "spaceless", 21 | "endspaceless", "ssi", "templatetag", "openblock", 22 | "closeblock", "openvariable", "closevariable", 23 | "openbrace", "closebrace", "opencomment", 24 | "closecomment", "widthratio", "url", "with", "endwith", 25 | "get_current_language", "trans", "endtrans", "noop", "blocktrans", 26 | "endblocktrans", "get_available_languages", 27 | "get_current_language_bidi", "plural"], 28 | operator = /^[+\-*&%=<>!?|~^]/, 29 | sign = /^[:\[\(\{]/, 30 | atom = ["true", "false"], 31 | number = /^(\d[+\-\*\/])?\d+(\.\d+)?/; 32 | 33 | keywords = new RegExp("((" + keywords.join(")|(") + "))\\b"); 34 | atom = new RegExp("((" + atom.join(")|(") + "))\\b"); 35 | 36 | function tokenBase (stream, state) { 37 | var ch = stream.peek(); 38 | 39 | //Comment 40 | if (state.incomment) { 41 | if(!stream.skipTo("#}")) { 42 | stream.skipToEnd(); 43 | } else { 44 | stream.eatWhile(/\#|}/); 45 | state.incomment = false; 46 | } 47 | return "comment"; 48 | //Tag 49 | } else if (state.intag) { 50 | //After operator 51 | if(state.operator) { 52 | state.operator = false; 53 | if(stream.match(atom)) { 54 | return "atom"; 55 | } 56 | if(stream.match(number)) { 57 | return "number"; 58 | } 59 | } 60 | //After sign 61 | if(state.sign) { 62 | state.sign = false; 63 | if(stream.match(atom)) { 64 | return "atom"; 65 | } 66 | if(stream.match(number)) { 67 | return "number"; 68 | } 69 | } 70 | 71 | if(state.instring) { 72 | if(ch == state.instring) { 73 | state.instring = false; 74 | } 75 | stream.next(); 76 | return "string"; 77 | } else if(ch == "'" || ch == '"') { 78 | state.instring = ch; 79 | stream.next(); 80 | return "string"; 81 | } else if(stream.match(state.intag + "}") || stream.eat("-") && stream.match(state.intag + "}")) { 82 | state.intag = false; 83 | return "tag"; 84 | } else if(stream.match(operator)) { 85 | state.operator = true; 86 | return "operator"; 87 | } else if(stream.match(sign)) { 88 | state.sign = true; 89 | } else { 90 | if(stream.eat(" ") || stream.sol()) { 91 | if(stream.match(keywords)) { 92 | return "keyword"; 93 | } 94 | if(stream.match(atom)) { 95 | return "atom"; 96 | } 97 | if(stream.match(number)) { 98 | return "number"; 99 | } 100 | if(stream.sol()) { 101 | stream.next(); 102 | } 103 | } else { 104 | stream.next(); 105 | } 106 | 107 | } 108 | return "variable"; 109 | } else if (stream.eat("{")) { 110 | if (stream.eat("#")) { 111 | state.incomment = true; 112 | if(!stream.skipTo("#}")) { 113 | stream.skipToEnd(); 114 | } else { 115 | stream.eatWhile(/\#|}/); 116 | state.incomment = false; 117 | } 118 | return "comment"; 119 | //Open tag 120 | } else if (ch = stream.eat(/\{|%/)) { 121 | //Cache close tag 122 | state.intag = ch; 123 | if(ch == "{") { 124 | state.intag = "}"; 125 | } 126 | stream.eat("-"); 127 | return "tag"; 128 | } 129 | } 130 | stream.next(); 131 | }; 132 | 133 | return { 134 | startState: function () { 135 | return {tokenize: tokenBase}; 136 | }, 137 | token: function (stream, state) { 138 | return state.tokenize(stream, state); 139 | }, 140 | blockCommentStart: "{#", 141 | blockCommentEnd: "#}" 142 | }; 143 | }); 144 | 145 | CodeMirror.defineMIME("text/jinja2", "jinja2"); 146 | }); 147 | -------------------------------------------------------------------------------- /static/codemirror/mbox/mbox.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | var rfc2822 = [ 15 | "From", "Sender", "Reply-To", "To", "Cc", "Bcc", "Message-ID", 16 | "In-Reply-To", "References", "Resent-From", "Resent-Sender", "Resent-To", 17 | "Resent-Cc", "Resent-Bcc", "Resent-Message-ID", "Return-Path", "Received" 18 | ]; 19 | var rfc2822NoEmail = [ 20 | "Date", "Subject", "Comments", "Keywords", "Resent-Date" 21 | ]; 22 | 23 | CodeMirror.registerHelper("hintWords", "mbox", rfc2822.concat(rfc2822NoEmail)); 24 | 25 | var whitespace = /^[ \t]/; 26 | var separator = /^From /; // See RFC 4155 27 | var rfc2822Header = new RegExp("^(" + rfc2822.join("|") + "): "); 28 | var rfc2822HeaderNoEmail = new RegExp("^(" + rfc2822NoEmail.join("|") + "): "); 29 | var header = /^[^:]+:/; // Optional fields defined in RFC 2822 30 | var email = /^[^ ]+@[^ ]+/; 31 | var untilEmail = /^.*?(?=[^ ]+?@[^ ]+)/; 32 | var bracketedEmail = /^<.*?>/; 33 | var untilBracketedEmail = /^.*?(?=<.*>)/; 34 | 35 | function styleForHeader(header) { 36 | if (header === "Subject") return "header"; 37 | return "string"; 38 | } 39 | 40 | function readToken(stream, state) { 41 | if (stream.sol()) { 42 | // From last line 43 | state.inSeparator = false; 44 | if (state.inHeader && stream.match(whitespace)) { 45 | // Header folding 46 | return null; 47 | } else { 48 | state.inHeader = false; 49 | state.header = null; 50 | } 51 | 52 | if (stream.match(separator)) { 53 | state.inHeaders = true; 54 | state.inSeparator = true; 55 | return "atom"; 56 | } 57 | 58 | var match; 59 | var emailPermitted = false; 60 | if ((match = stream.match(rfc2822HeaderNoEmail)) || 61 | (emailPermitted = true) && (match = stream.match(rfc2822Header))) { 62 | state.inHeaders = true; 63 | state.inHeader = true; 64 | state.emailPermitted = emailPermitted; 65 | state.header = match[1]; 66 | return "atom"; 67 | } 68 | 69 | // Use vim's heuristics: recognize custom headers only if the line is in a 70 | // block of legitimate headers. 71 | if (state.inHeaders && (match = stream.match(header))) { 72 | state.inHeader = true; 73 | state.emailPermitted = true; 74 | state.header = match[1]; 75 | return "atom"; 76 | } 77 | 78 | state.inHeaders = false; 79 | stream.skipToEnd(); 80 | return null; 81 | } 82 | 83 | if (state.inSeparator) { 84 | if (stream.match(email)) return "link"; 85 | if (stream.match(untilEmail)) return "atom"; 86 | stream.skipToEnd(); 87 | return "atom"; 88 | } 89 | 90 | if (state.inHeader) { 91 | var style = styleForHeader(state.header); 92 | 93 | if (state.emailPermitted) { 94 | if (stream.match(bracketedEmail)) return style + " link"; 95 | if (stream.match(untilBracketedEmail)) return style; 96 | } 97 | stream.skipToEnd(); 98 | return style; 99 | } 100 | 101 | stream.skipToEnd(); 102 | return null; 103 | }; 104 | 105 | CodeMirror.defineMode("mbox", function() { 106 | return { 107 | startState: function() { 108 | return { 109 | // Is in a mbox separator 110 | inSeparator: false, 111 | // Is in a mail header 112 | inHeader: false, 113 | // If bracketed email is permitted. Only applicable when inHeader 114 | emailPermitted: false, 115 | // Name of current header 116 | header: null, 117 | // Is in a region of mail headers 118 | inHeaders: false 119 | }; 120 | }, 121 | token: readToken, 122 | blankLine: function(state) { 123 | state.inHeaders = state.inSeparator = state.inHeader = false; 124 | } 125 | }; 126 | }); 127 | 128 | CodeMirror.defineMIME("application/mbox", "mbox"); 129 | }); 130 | -------------------------------------------------------------------------------- /static/codemirror/mbox/mbox.min.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | var rfc2822 = [ 15 | "From", "Sender", "Reply-To", "To", "Cc", "Bcc", "Message-ID", 16 | "In-Reply-To", "References", "Resent-From", "Resent-Sender", "Resent-To", 17 | "Resent-Cc", "Resent-Bcc", "Resent-Message-ID", "Return-Path", "Received" 18 | ]; 19 | var rfc2822NoEmail = [ 20 | "Date", "Subject", "Comments", "Keywords", "Resent-Date" 21 | ]; 22 | 23 | CodeMirror.registerHelper("hintWords", "mbox", rfc2822.concat(rfc2822NoEmail)); 24 | 25 | var whitespace = /^[ \t]/; 26 | var separator = /^From /; // See RFC 4155 27 | var rfc2822Header = new RegExp("^(" + rfc2822.join("|") + "): "); 28 | var rfc2822HeaderNoEmail = new RegExp("^(" + rfc2822NoEmail.join("|") + "): "); 29 | var header = /^[^:]+:/; // Optional fields defined in RFC 2822 30 | var email = /^[^ ]+@[^ ]+/; 31 | var untilEmail = /^.*?(?=[^ ]+?@[^ ]+)/; 32 | var bracketedEmail = /^<.*?>/; 33 | var untilBracketedEmail = /^.*?(?=<.*>)/; 34 | 35 | function styleForHeader(header) { 36 | if (header === "Subject") return "header"; 37 | return "string"; 38 | } 39 | 40 | function readToken(stream, state) { 41 | if (stream.sol()) { 42 | // From last line 43 | state.inSeparator = false; 44 | if (state.inHeader && stream.match(whitespace)) { 45 | // Header folding 46 | return null; 47 | } else { 48 | state.inHeader = false; 49 | state.header = null; 50 | } 51 | 52 | if (stream.match(separator)) { 53 | state.inHeaders = true; 54 | state.inSeparator = true; 55 | return "atom"; 56 | } 57 | 58 | var match; 59 | var emailPermitted = false; 60 | if ((match = stream.match(rfc2822HeaderNoEmail)) || 61 | (emailPermitted = true) && (match = stream.match(rfc2822Header))) { 62 | state.inHeaders = true; 63 | state.inHeader = true; 64 | state.emailPermitted = emailPermitted; 65 | state.header = match[1]; 66 | return "atom"; 67 | } 68 | 69 | // Use vim's heuristics: recognize custom headers only if the line is in a 70 | // block of legitimate headers. 71 | if (state.inHeaders && (match = stream.match(header))) { 72 | state.inHeader = true; 73 | state.emailPermitted = true; 74 | state.header = match[1]; 75 | return "atom"; 76 | } 77 | 78 | state.inHeaders = false; 79 | stream.skipToEnd(); 80 | return null; 81 | } 82 | 83 | if (state.inSeparator) { 84 | if (stream.match(email)) return "link"; 85 | if (stream.match(untilEmail)) return "atom"; 86 | stream.skipToEnd(); 87 | return "atom"; 88 | } 89 | 90 | if (state.inHeader) { 91 | var style = styleForHeader(state.header); 92 | 93 | if (state.emailPermitted) { 94 | if (stream.match(bracketedEmail)) return style + " link"; 95 | if (stream.match(untilBracketedEmail)) return style; 96 | } 97 | stream.skipToEnd(); 98 | return style; 99 | } 100 | 101 | stream.skipToEnd(); 102 | return null; 103 | }; 104 | 105 | CodeMirror.defineMode("mbox", function() { 106 | return { 107 | startState: function() { 108 | return { 109 | // Is in a mbox separator 110 | inSeparator: false, 111 | // Is in a mail header 112 | inHeader: false, 113 | // If bracketed email is permitted. Only applicable when inHeader 114 | emailPermitted: false, 115 | // Name of current header 116 | header: null, 117 | // Is in a region of mail headers 118 | inHeaders: false 119 | }; 120 | }, 121 | token: readToken, 122 | blankLine: function(state) { 123 | state.inHeaders = state.inSeparator = state.inHeader = false; 124 | } 125 | }; 126 | }); 127 | 128 | CodeMirror.defineMIME("application/mbox", "mbox"); 129 | }); 130 | -------------------------------------------------------------------------------- /static/codemirror/octave/octave.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode("octave", function() { 15 | function wordRegexp(words) { 16 | return new RegExp("^((" + words.join(")|(") + "))\\b"); 17 | } 18 | 19 | var singleOperators = new RegExp("^[\\+\\-\\*/&|\\^~<>!@'\\\\]"); 20 | var singleDelimiters = new RegExp('^[\\(\\[\\{\\},:=;]'); 21 | var doubleOperators = new RegExp("^((==)|(~=)|(<=)|(>=)|(<<)|(>>)|(\\.[\\+\\-\\*/\\^\\\\]))"); 22 | var doubleDelimiters = new RegExp("^((!=)|(\\+=)|(\\-=)|(\\*=)|(/=)|(&=)|(\\|=)|(\\^=))"); 23 | var tripleDelimiters = new RegExp("^((>>=)|(<<=))"); 24 | var expressionEnd = new RegExp("^[\\]\\)]"); 25 | var identifiers = new RegExp("^[_A-Za-z\xa1-\uffff][_A-Za-z0-9\xa1-\uffff]*"); 26 | 27 | var builtins = wordRegexp([ 28 | 'error', 'eval', 'function', 'abs', 'acos', 'atan', 'asin', 'cos', 29 | 'cosh', 'exp', 'log', 'prod', 'sum', 'log10', 'max', 'min', 'sign', 'sin', 'sinh', 30 | 'sqrt', 'tan', 'reshape', 'break', 'zeros', 'default', 'margin', 'round', 'ones', 31 | 'rand', 'syn', 'ceil', 'floor', 'size', 'clear', 'zeros', 'eye', 'mean', 'std', 'cov', 32 | 'det', 'eig', 'inv', 'norm', 'rank', 'trace', 'expm', 'logm', 'sqrtm', 'linspace', 'plot', 33 | 'title', 'xlabel', 'ylabel', 'legend', 'text', 'grid', 'meshgrid', 'mesh', 'num2str', 34 | 'fft', 'ifft', 'arrayfun', 'cellfun', 'input', 'fliplr', 'flipud', 'ismember' 35 | ]); 36 | 37 | var keywords = wordRegexp([ 38 | 'return', 'case', 'switch', 'else', 'elseif', 'end', 'endif', 'endfunction', 39 | 'if', 'otherwise', 'do', 'for', 'while', 'try', 'catch', 'classdef', 'properties', 'events', 40 | 'methods', 'global', 'persistent', 'endfor', 'endwhile', 'printf', 'sprintf', 'disp', 'until', 41 | 'continue', 'pkg' 42 | ]); 43 | 44 | 45 | // tokenizers 46 | function tokenTranspose(stream, state) { 47 | if (!stream.sol() && stream.peek() === '\'') { 48 | stream.next(); 49 | state.tokenize = tokenBase; 50 | return 'operator'; 51 | } 52 | state.tokenize = tokenBase; 53 | return tokenBase(stream, state); 54 | } 55 | 56 | 57 | function tokenComment(stream, state) { 58 | if (stream.match(/^.*%}/)) { 59 | state.tokenize = tokenBase; 60 | return 'comment'; 61 | }; 62 | stream.skipToEnd(); 63 | return 'comment'; 64 | } 65 | 66 | function tokenBase(stream, state) { 67 | // whitespaces 68 | if (stream.eatSpace()) return null; 69 | 70 | // Handle one line Comments 71 | if (stream.match('%{')){ 72 | state.tokenize = tokenComment; 73 | stream.skipToEnd(); 74 | return 'comment'; 75 | } 76 | 77 | if (stream.match(/^[%#]/)){ 78 | stream.skipToEnd(); 79 | return 'comment'; 80 | } 81 | 82 | // Handle Number Literals 83 | if (stream.match(/^[0-9\.+-]/, false)) { 84 | if (stream.match(/^[+-]?0x[0-9a-fA-F]+[ij]?/)) { 85 | stream.tokenize = tokenBase; 86 | return 'number'; }; 87 | if (stream.match(/^[+-]?\d*\.\d+([EeDd][+-]?\d+)?[ij]?/)) { return 'number'; }; 88 | if (stream.match(/^[+-]?\d+([EeDd][+-]?\d+)?[ij]?/)) { return 'number'; }; 89 | } 90 | if (stream.match(wordRegexp(['nan','NaN','inf','Inf']))) { return 'number'; }; 91 | 92 | // Handle Strings 93 | var m = stream.match(/^"(?:[^"]|"")*("|$)/) || stream.match(/^'(?:[^']|'')*('|$)/) 94 | if (m) { return m[1] ? 'string' : "string error"; } 95 | 96 | // Handle words 97 | if (stream.match(keywords)) { return 'keyword'; } ; 98 | if (stream.match(builtins)) { return 'builtin'; } ; 99 | if (stream.match(identifiers)) { return 'variable'; } ; 100 | 101 | if (stream.match(singleOperators) || stream.match(doubleOperators)) { return 'operator'; }; 102 | if (stream.match(singleDelimiters) || stream.match(doubleDelimiters) || stream.match(tripleDelimiters)) { return null; }; 103 | 104 | if (stream.match(expressionEnd)) { 105 | state.tokenize = tokenTranspose; 106 | return null; 107 | }; 108 | 109 | 110 | // Handle non-detected items 111 | stream.next(); 112 | return 'error'; 113 | }; 114 | 115 | 116 | return { 117 | startState: function() { 118 | return { 119 | tokenize: tokenBase 120 | }; 121 | }, 122 | 123 | token: function(stream, state) { 124 | var style = state.tokenize(stream, state); 125 | if (style === 'number' || style === 'variable'){ 126 | state.tokenize = tokenTranspose; 127 | } 128 | return style; 129 | }, 130 | 131 | lineComment: '%', 132 | 133 | fold: 'indent' 134 | }; 135 | }); 136 | 137 | CodeMirror.defineMIME("text/x-octave", "octave"); 138 | 139 | }); 140 | -------------------------------------------------------------------------------- /static/codemirror/pascal/pascal.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode("pascal", function() { 15 | function words(str) { 16 | var obj = {}, words = str.split(" "); 17 | for (var i = 0; i < words.length; ++i) obj[words[i]] = true; 18 | return obj; 19 | } 20 | var keywords = words( 21 | "absolute and array asm begin case const constructor destructor div do " + 22 | "downto else end file for function goto if implementation in inherited " + 23 | "inline interface label mod nil not object of operator or packed procedure " + 24 | "program record reintroduce repeat self set shl shr string then to type " + 25 | "unit until uses var while with xor as class dispinterface except exports " + 26 | "finalization finally initialization inline is library on out packed " + 27 | "property raise resourcestring threadvar try absolute abstract alias " + 28 | "assembler bitpacked break cdecl continue cppdecl cvar default deprecated " + 29 | "dynamic enumerator experimental export external far far16 forward generic " + 30 | "helper implements index interrupt iocheck local message name near " + 31 | "nodefault noreturn nostackframe oldfpccall otherwise overload override " + 32 | "pascal platform private protected public published read register " + 33 | "reintroduce result safecall saveregisters softfloat specialize static " + 34 | "stdcall stored strict unaligned unimplemented varargs virtual write"); 35 | var atoms = {"null": true}; 36 | 37 | var isOperatorChar = /[+\-*&%=<>!?|\/]/; 38 | 39 | function tokenBase(stream, state) { 40 | var ch = stream.next(); 41 | if (ch == "#" && state.startOfLine) { 42 | stream.skipToEnd(); 43 | return "meta"; 44 | } 45 | if (ch == '"' || ch == "'") { 46 | state.tokenize = tokenString(ch); 47 | return state.tokenize(stream, state); 48 | } 49 | if (ch == "(" && stream.eat("*")) { 50 | state.tokenize = tokenComment; 51 | return tokenComment(stream, state); 52 | } 53 | if (/[\[\]{}\(\),;\:\.]/.test(ch)) { 54 | return null; 55 | } 56 | if (/\d/.test(ch)) { 57 | stream.eatWhile(/[\w\.]/); 58 | return "number"; 59 | } 60 | if (ch == "/") { 61 | if (stream.eat("/")) { 62 | stream.skipToEnd(); 63 | return "comment"; 64 | } 65 | } 66 | if (isOperatorChar.test(ch)) { 67 | stream.eatWhile(isOperatorChar); 68 | return "operator"; 69 | } 70 | stream.eatWhile(/[\w\$_]/); 71 | var cur = stream.current(); 72 | if (keywords.propertyIsEnumerable(cur)) return "keyword"; 73 | if (atoms.propertyIsEnumerable(cur)) return "atom"; 74 | return "variable"; 75 | } 76 | 77 | function tokenString(quote) { 78 | return function(stream, state) { 79 | var escaped = false, next, end = false; 80 | while ((next = stream.next()) != null) { 81 | if (next == quote && !escaped) {end = true; break;} 82 | escaped = !escaped && next == "\\"; 83 | } 84 | if (end || !escaped) state.tokenize = null; 85 | return "string"; 86 | }; 87 | } 88 | 89 | function tokenComment(stream, state) { 90 | var maybeEnd = false, ch; 91 | while (ch = stream.next()) { 92 | if (ch == ")" && maybeEnd) { 93 | state.tokenize = null; 94 | break; 95 | } 96 | maybeEnd = (ch == "*"); 97 | } 98 | return "comment"; 99 | } 100 | 101 | // Interface 102 | 103 | return { 104 | startState: function() { 105 | return {tokenize: null}; 106 | }, 107 | 108 | token: function(stream, state) { 109 | if (stream.eatSpace()) return null; 110 | var style = (state.tokenize || tokenBase)(stream, state); 111 | if (style == "comment" || style == "meta") return style; 112 | return style; 113 | }, 114 | 115 | electricChars: "{}" 116 | }; 117 | }); 118 | 119 | CodeMirror.defineMIME("text/x-pascal", "pascal"); 120 | 121 | }); 122 | -------------------------------------------------------------------------------- /static/codemirror/pascal/pascal.min.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode("pascal", function() { 15 | function words(str) { 16 | var obj = {}, words = str.split(" "); 17 | for (var i = 0; i < words.length; ++i) obj[words[i]] = true; 18 | return obj; 19 | } 20 | var keywords = words( 21 | "absolute and array asm begin case const constructor destructor div do " + 22 | "downto else end file for function goto if implementation in inherited " + 23 | "inline interface label mod nil not object of operator or packed procedure " + 24 | "program record reintroduce repeat self set shl shr string then to type " + 25 | "unit until uses var while with xor as class dispinterface except exports " + 26 | "finalization finally initialization inline is library on out packed " + 27 | "property raise resourcestring threadvar try absolute abstract alias " + 28 | "assembler bitpacked break cdecl continue cppdecl cvar default deprecated " + 29 | "dynamic enumerator experimental export external far far16 forward generic " + 30 | "helper implements index interrupt iocheck local message name near " + 31 | "nodefault noreturn nostackframe oldfpccall otherwise overload override " + 32 | "pascal platform private protected public published read register " + 33 | "reintroduce result safecall saveregisters softfloat specialize static " + 34 | "stdcall stored strict unaligned unimplemented varargs virtual write"); 35 | var atoms = {"null": true}; 36 | 37 | var isOperatorChar = /[+\-*&%=<>!?|\/]/; 38 | 39 | function tokenBase(stream, state) { 40 | var ch = stream.next(); 41 | if (ch == "#" && state.startOfLine) { 42 | stream.skipToEnd(); 43 | return "meta"; 44 | } 45 | if (ch == '"' || ch == "'") { 46 | state.tokenize = tokenString(ch); 47 | return state.tokenize(stream, state); 48 | } 49 | if (ch == "(" && stream.eat("*")) { 50 | state.tokenize = tokenComment; 51 | return tokenComment(stream, state); 52 | } 53 | if (/[\[\]{}\(\),;\:\.]/.test(ch)) { 54 | return null; 55 | } 56 | if (/\d/.test(ch)) { 57 | stream.eatWhile(/[\w\.]/); 58 | return "number"; 59 | } 60 | if (ch == "/") { 61 | if (stream.eat("/")) { 62 | stream.skipToEnd(); 63 | return "comment"; 64 | } 65 | } 66 | if (isOperatorChar.test(ch)) { 67 | stream.eatWhile(isOperatorChar); 68 | return "operator"; 69 | } 70 | stream.eatWhile(/[\w\$_]/); 71 | var cur = stream.current(); 72 | if (keywords.propertyIsEnumerable(cur)) return "keyword"; 73 | if (atoms.propertyIsEnumerable(cur)) return "atom"; 74 | return "variable"; 75 | } 76 | 77 | function tokenString(quote) { 78 | return function(stream, state) { 79 | var escaped = false, next, end = false; 80 | while ((next = stream.next()) != null) { 81 | if (next == quote && !escaped) {end = true; break;} 82 | escaped = !escaped && next == "\\"; 83 | } 84 | if (end || !escaped) state.tokenize = null; 85 | return "string"; 86 | }; 87 | } 88 | 89 | function tokenComment(stream, state) { 90 | var maybeEnd = false, ch; 91 | while (ch = stream.next()) { 92 | if (ch == ")" && maybeEnd) { 93 | state.tokenize = null; 94 | break; 95 | } 96 | maybeEnd = (ch == "*"); 97 | } 98 | return "comment"; 99 | } 100 | 101 | // Interface 102 | 103 | return { 104 | startState: function() { 105 | return {tokenize: null}; 106 | }, 107 | 108 | token: function(stream, state) { 109 | if (stream.eatSpace()) return null; 110 | var style = (state.tokenize || tokenBase)(stream, state); 111 | if (style == "comment" || style == "meta") return style; 112 | return style; 113 | }, 114 | 115 | electricChars: "{}" 116 | }; 117 | }); 118 | 119 | CodeMirror.defineMIME("text/x-pascal", "pascal"); 120 | 121 | }); 122 | -------------------------------------------------------------------------------- /static/codemirror/pegjs/pegjs.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror"), require("../javascript/javascript")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror", "../javascript/javascript"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode("pegjs", function (config) { 15 | var jsMode = CodeMirror.getMode(config, "javascript"); 16 | 17 | function identifier(stream) { 18 | return stream.match(/^[a-zA-Z_][a-zA-Z0-9_]*/); 19 | } 20 | 21 | return { 22 | startState: function () { 23 | return { 24 | inString: false, 25 | stringType: null, 26 | inComment: false, 27 | inCharacterClass: false, 28 | braced: 0, 29 | lhs: true, 30 | localState: null 31 | }; 32 | }, 33 | token: function (stream, state) { 34 | if (stream) 35 | 36 | //check for state changes 37 | if (!state.inString && !state.inComment && ((stream.peek() == '"') || (stream.peek() == "'"))) { 38 | state.stringType = stream.peek(); 39 | stream.next(); // Skip quote 40 | state.inString = true; // Update state 41 | } 42 | if (!state.inString && !state.inComment && stream.match(/^\/\*/)) { 43 | state.inComment = true; 44 | } 45 | 46 | //return state 47 | if (state.inString) { 48 | while (state.inString && !stream.eol()) { 49 | if (stream.peek() === state.stringType) { 50 | stream.next(); // Skip quote 51 | state.inString = false; // Clear flag 52 | } else if (stream.peek() === '\\') { 53 | stream.next(); 54 | stream.next(); 55 | } else { 56 | stream.match(/^.[^\\\"\']*/); 57 | } 58 | } 59 | return state.lhs ? "property string" : "string"; // Token style 60 | } else if (state.inComment) { 61 | while (state.inComment && !stream.eol()) { 62 | if (stream.match(/\*\//)) { 63 | state.inComment = false; // Clear flag 64 | } else { 65 | stream.match(/^.[^\*]*/); 66 | } 67 | } 68 | return "comment"; 69 | } else if (state.inCharacterClass) { 70 | while (state.inCharacterClass && !stream.eol()) { 71 | if (!(stream.match(/^[^\]\\]+/) || stream.match(/^\\./))) { 72 | state.inCharacterClass = false; 73 | } 74 | } 75 | } else if (stream.peek() === '[') { 76 | stream.next(); 77 | state.inCharacterClass = true; 78 | return 'bracket'; 79 | } else if (stream.match(/^\/\//)) { 80 | stream.skipToEnd(); 81 | return "comment"; 82 | } else if (state.braced || stream.peek() === '{') { 83 | if (state.localState === null) { 84 | state.localState = CodeMirror.startState(jsMode); 85 | } 86 | var token = jsMode.token(stream, state.localState); 87 | var text = stream.current(); 88 | if (!token) { 89 | for (var i = 0; i < text.length; i++) { 90 | if (text[i] === '{') { 91 | state.braced++; 92 | } else if (text[i] === '}') { 93 | state.braced--; 94 | } 95 | }; 96 | } 97 | return token; 98 | } else if (identifier(stream)) { 99 | if (stream.peek() === ':') { 100 | return 'variable'; 101 | } 102 | return 'variable-2'; 103 | } else if (['[', ']', '(', ')'].indexOf(stream.peek()) != -1) { 104 | stream.next(); 105 | return 'bracket'; 106 | } else if (!stream.eatSpace()) { 107 | stream.next(); 108 | } 109 | return null; 110 | } 111 | }; 112 | }, "javascript"); 113 | 114 | }); 115 | -------------------------------------------------------------------------------- /static/codemirror/pegjs/pegjs.min.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror"), require("../javascript/javascript")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror", "../javascript/javascript"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode("pegjs", function (config) { 15 | var jsMode = CodeMirror.getMode(config, "javascript"); 16 | 17 | function identifier(stream) { 18 | return stream.match(/^[a-zA-Z_][a-zA-Z0-9_]*/); 19 | } 20 | 21 | return { 22 | startState: function () { 23 | return { 24 | inString: false, 25 | stringType: null, 26 | inComment: false, 27 | inCharacterClass: false, 28 | braced: 0, 29 | lhs: true, 30 | localState: null 31 | }; 32 | }, 33 | token: function (stream, state) { 34 | if (stream) 35 | 36 | //check for state changes 37 | if (!state.inString && !state.inComment && ((stream.peek() == '"') || (stream.peek() == "'"))) { 38 | state.stringType = stream.peek(); 39 | stream.next(); // Skip quote 40 | state.inString = true; // Update state 41 | } 42 | if (!state.inString && !state.inComment && stream.match(/^\/\*/)) { 43 | state.inComment = true; 44 | } 45 | 46 | //return state 47 | if (state.inString) { 48 | while (state.inString && !stream.eol()) { 49 | if (stream.peek() === state.stringType) { 50 | stream.next(); // Skip quote 51 | state.inString = false; // Clear flag 52 | } else if (stream.peek() === '\\') { 53 | stream.next(); 54 | stream.next(); 55 | } else { 56 | stream.match(/^.[^\\\"\']*/); 57 | } 58 | } 59 | return state.lhs ? "property string" : "string"; // Token style 60 | } else if (state.inComment) { 61 | while (state.inComment && !stream.eol()) { 62 | if (stream.match(/\*\//)) { 63 | state.inComment = false; // Clear flag 64 | } else { 65 | stream.match(/^.[^\*]*/); 66 | } 67 | } 68 | return "comment"; 69 | } else if (state.inCharacterClass) { 70 | while (state.inCharacterClass && !stream.eol()) { 71 | if (!(stream.match(/^[^\]\\]+/) || stream.match(/^\\./))) { 72 | state.inCharacterClass = false; 73 | } 74 | } 75 | } else if (stream.peek() === '[') { 76 | stream.next(); 77 | state.inCharacterClass = true; 78 | return 'bracket'; 79 | } else if (stream.match(/^\/\//)) { 80 | stream.skipToEnd(); 81 | return "comment"; 82 | } else if (state.braced || stream.peek() === '{') { 83 | if (state.localState === null) { 84 | state.localState = CodeMirror.startState(jsMode); 85 | } 86 | var token = jsMode.token(stream, state.localState); 87 | var text = stream.current(); 88 | if (!token) { 89 | for (var i = 0; i < text.length; i++) { 90 | if (text[i] === '{') { 91 | state.braced++; 92 | } else if (text[i] === '}') { 93 | state.braced--; 94 | } 95 | }; 96 | } 97 | return token; 98 | } else if (identifier(stream)) { 99 | if (stream.peek() === ':') { 100 | return 'variable'; 101 | } 102 | return 'variable-2'; 103 | } else if (['[', ']', '(', ')'].indexOf(stream.peek()) != -1) { 104 | stream.next(); 105 | return 'bracket'; 106 | } else if (!stream.eatSpace()) { 107 | stream.next(); 108 | } 109 | return null; 110 | } 111 | }; 112 | }, "javascript"); 113 | 114 | }); 115 | -------------------------------------------------------------------------------- /static/codemirror/properties/properties.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode("properties", function() { 15 | return { 16 | token: function(stream, state) { 17 | var sol = stream.sol() || state.afterSection; 18 | var eol = stream.eol(); 19 | 20 | state.afterSection = false; 21 | 22 | if (sol) { 23 | if (state.nextMultiline) { 24 | state.inMultiline = true; 25 | state.nextMultiline = false; 26 | } else { 27 | state.position = "def"; 28 | } 29 | } 30 | 31 | if (eol && ! state.nextMultiline) { 32 | state.inMultiline = false; 33 | state.position = "def"; 34 | } 35 | 36 | if (sol) { 37 | while(stream.eatSpace()) {} 38 | } 39 | 40 | var ch = stream.next(); 41 | 42 | if (sol && (ch === "#" || ch === "!" || ch === ";")) { 43 | state.position = "comment"; 44 | stream.skipToEnd(); 45 | return "comment"; 46 | } else if (sol && ch === "[") { 47 | state.afterSection = true; 48 | stream.skipTo("]"); stream.eat("]"); 49 | return "header"; 50 | } else if (ch === "=" || ch === ":") { 51 | state.position = "quote"; 52 | return null; 53 | } else if (ch === "\\" && state.position === "quote") { 54 | if (stream.eol()) { // end of line? 55 | // Multiline value 56 | state.nextMultiline = true; 57 | } 58 | } 59 | 60 | return state.position; 61 | }, 62 | 63 | startState: function() { 64 | return { 65 | position : "def", // Current position, "def", "quote" or "comment" 66 | nextMultiline : false, // Is the next line multiline value 67 | inMultiline : false, // Is the current line a multiline value 68 | afterSection : false // Did we just open a section 69 | }; 70 | } 71 | 72 | }; 73 | }); 74 | 75 | CodeMirror.defineMIME("text/x-properties", "properties"); 76 | CodeMirror.defineMIME("text/x-ini", "properties"); 77 | 78 | }); 79 | -------------------------------------------------------------------------------- /static/codemirror/properties/properties.min.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode("properties", function() { 15 | return { 16 | token: function(stream, state) { 17 | var sol = stream.sol() || state.afterSection; 18 | var eol = stream.eol(); 19 | 20 | state.afterSection = false; 21 | 22 | if (sol) { 23 | if (state.nextMultiline) { 24 | state.inMultiline = true; 25 | state.nextMultiline = false; 26 | } else { 27 | state.position = "def"; 28 | } 29 | } 30 | 31 | if (eol && ! state.nextMultiline) { 32 | state.inMultiline = false; 33 | state.position = "def"; 34 | } 35 | 36 | if (sol) { 37 | while(stream.eatSpace()) {} 38 | } 39 | 40 | var ch = stream.next(); 41 | 42 | if (sol && (ch === "#" || ch === "!" || ch === ";")) { 43 | state.position = "comment"; 44 | stream.skipToEnd(); 45 | return "comment"; 46 | } else if (sol && ch === "[") { 47 | state.afterSection = true; 48 | stream.skipTo("]"); stream.eat("]"); 49 | return "header"; 50 | } else if (ch === "=" || ch === ":") { 51 | state.position = "quote"; 52 | return null; 53 | } else if (ch === "\\" && state.position === "quote") { 54 | if (stream.eol()) { // end of line? 55 | // Multiline value 56 | state.nextMultiline = true; 57 | } 58 | } 59 | 60 | return state.position; 61 | }, 62 | 63 | startState: function() { 64 | return { 65 | position : "def", // Current position, "def", "quote" or "comment" 66 | nextMultiline : false, // Is the next line multiline value 67 | inMultiline : false, // Is the current line a multiline value 68 | afterSection : false // Did we just open a section 69 | }; 70 | } 71 | 72 | }; 73 | }); 74 | 75 | CodeMirror.defineMIME("text/x-properties", "properties"); 76 | CodeMirror.defineMIME("text/x-ini", "properties"); 77 | 78 | }); 79 | -------------------------------------------------------------------------------- /static/codemirror/protobuf/protobuf.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | function wordRegexp(words) { 15 | return new RegExp("^((" + words.join(")|(") + "))\\b", "i"); 16 | }; 17 | 18 | var keywordArray = [ 19 | "package", "message", "import", "syntax", 20 | "required", "optional", "repeated", "reserved", "default", "extensions", "packed", 21 | "bool", "bytes", "double", "enum", "float", "string", 22 | "int32", "int64", "uint32", "uint64", "sint32", "sint64", "fixed32", "fixed64", "sfixed32", "sfixed64", 23 | "option", "service", "rpc", "returns" 24 | ]; 25 | var keywords = wordRegexp(keywordArray); 26 | 27 | CodeMirror.registerHelper("hintWords", "protobuf", keywordArray); 28 | 29 | var identifiers = new RegExp("^[_A-Za-z\xa1-\uffff][_A-Za-z0-9\xa1-\uffff]*"); 30 | 31 | function tokenBase(stream) { 32 | // whitespaces 33 | if (stream.eatSpace()) return null; 34 | 35 | // Handle one line Comments 36 | if (stream.match("//")) { 37 | stream.skipToEnd(); 38 | return "comment"; 39 | } 40 | 41 | // Handle Number Literals 42 | if (stream.match(/^[0-9\.+-]/, false)) { 43 | if (stream.match(/^[+-]?0x[0-9a-fA-F]+/)) 44 | return "number"; 45 | if (stream.match(/^[+-]?\d*\.\d+([EeDd][+-]?\d+)?/)) 46 | return "number"; 47 | if (stream.match(/^[+-]?\d+([EeDd][+-]?\d+)?/)) 48 | return "number"; 49 | } 50 | 51 | // Handle Strings 52 | if (stream.match(/^"([^"]|(""))*"/)) { return "string"; } 53 | if (stream.match(/^'([^']|(''))*'/)) { return "string"; } 54 | 55 | // Handle words 56 | if (stream.match(keywords)) { return "keyword"; } 57 | if (stream.match(identifiers)) { return "variable"; } ; 58 | 59 | // Handle non-detected items 60 | stream.next(); 61 | return null; 62 | }; 63 | 64 | CodeMirror.defineMode("protobuf", function() { 65 | return {token: tokenBase}; 66 | }); 67 | 68 | CodeMirror.defineMIME("text/x-protobuf", "protobuf"); 69 | }); 70 | -------------------------------------------------------------------------------- /static/codemirror/protobuf/protobuf.min.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | function wordRegexp(words) { 15 | return new RegExp("^((" + words.join(")|(") + "))\\b", "i"); 16 | }; 17 | 18 | var keywordArray = [ 19 | "package", "message", "import", "syntax", 20 | "required", "optional", "repeated", "reserved", "default", "extensions", "packed", 21 | "bool", "bytes", "double", "enum", "float", "string", 22 | "int32", "int64", "uint32", "uint64", "sint32", "sint64", "fixed32", "fixed64", "sfixed32", "sfixed64", 23 | "option", "service", "rpc", "returns" 24 | ]; 25 | var keywords = wordRegexp(keywordArray); 26 | 27 | CodeMirror.registerHelper("hintWords", "protobuf", keywordArray); 28 | 29 | var identifiers = new RegExp("^[_A-Za-z\xa1-\uffff][_A-Za-z0-9\xa1-\uffff]*"); 30 | 31 | function tokenBase(stream) { 32 | // whitespaces 33 | if (stream.eatSpace()) return null; 34 | 35 | // Handle one line Comments 36 | if (stream.match("//")) { 37 | stream.skipToEnd(); 38 | return "comment"; 39 | } 40 | 41 | // Handle Number Literals 42 | if (stream.match(/^[0-9\.+-]/, false)) { 43 | if (stream.match(/^[+-]?0x[0-9a-fA-F]+/)) 44 | return "number"; 45 | if (stream.match(/^[+-]?\d*\.\d+([EeDd][+-]?\d+)?/)) 46 | return "number"; 47 | if (stream.match(/^[+-]?\d+([EeDd][+-]?\d+)?/)) 48 | return "number"; 49 | } 50 | 51 | // Handle Strings 52 | if (stream.match(/^"([^"]|(""))*"/)) { return "string"; } 53 | if (stream.match(/^'([^']|(''))*'/)) { return "string"; } 54 | 55 | // Handle words 56 | if (stream.match(keywords)) { return "keyword"; } 57 | if (stream.match(identifiers)) { return "variable"; } ; 58 | 59 | // Handle non-detected items 60 | stream.next(); 61 | return null; 62 | }; 63 | 64 | CodeMirror.defineMode("protobuf", function() { 65 | return {token: tokenBase}; 66 | }); 67 | 68 | CodeMirror.defineMIME("text/x-protobuf", "protobuf"); 69 | }); 70 | -------------------------------------------------------------------------------- /static/codemirror/rpm/rpm.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode("rpm-changes", function() { 15 | var headerSeperator = /^-+$/; 16 | var headerLine = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ?\d{1,2} \d{2}:\d{2}(:\d{2})? [A-Z]{3,4} \d{4} - /; 17 | var simpleEmail = /^[\w+.-]+@[\w.-]+/; 18 | 19 | return { 20 | token: function(stream) { 21 | if (stream.sol()) { 22 | if (stream.match(headerSeperator)) { return 'tag'; } 23 | if (stream.match(headerLine)) { return 'tag'; } 24 | } 25 | if (stream.match(simpleEmail)) { return 'string'; } 26 | stream.next(); 27 | return null; 28 | } 29 | }; 30 | }); 31 | 32 | CodeMirror.defineMIME("text/x-rpm-changes", "rpm-changes"); 33 | 34 | // Quick and dirty spec file highlighting 35 | 36 | CodeMirror.defineMode("rpm-spec", function() { 37 | var arch = /^(i386|i586|i686|x86_64|ppc64le|ppc64|ppc|ia64|s390x|s390|sparc64|sparcv9|sparc|noarch|alphaev6|alpha|hppa|mipsel)/; 38 | 39 | var preamble = /^[a-zA-Z0-9()]+:/; 40 | var section = /^%(debug_package|package|description|prep|build|install|files|clean|changelog|preinstall|preun|postinstall|postun|pretrans|posttrans|pre|post|triggerin|triggerun|verifyscript|check|triggerpostun|triggerprein|trigger)/; 41 | var control_flow_complex = /^%(ifnarch|ifarch|if)/; // rpm control flow macros 42 | var control_flow_simple = /^%(else|endif)/; // rpm control flow macros 43 | var operators = /^(\!|\?|\<\=|\<|\>\=|\>|\=\=|\&\&|\|\|)/; // operators in control flow macros 44 | 45 | return { 46 | startState: function () { 47 | return { 48 | controlFlow: false, 49 | macroParameters: false, 50 | section: false 51 | }; 52 | }, 53 | token: function (stream, state) { 54 | var ch = stream.peek(); 55 | if (ch == "#") { stream.skipToEnd(); return "comment"; } 56 | 57 | if (stream.sol()) { 58 | if (stream.match(preamble)) { return "header"; } 59 | if (stream.match(section)) { return "atom"; } 60 | } 61 | 62 | if (stream.match(/^\$\w+/)) { return "def"; } // Variables like '$RPM_BUILD_ROOT' 63 | if (stream.match(/^\$\{\w+\}/)) { return "def"; } // Variables like '${RPM_BUILD_ROOT}' 64 | 65 | if (stream.match(control_flow_simple)) { return "keyword"; } 66 | if (stream.match(control_flow_complex)) { 67 | state.controlFlow = true; 68 | return "keyword"; 69 | } 70 | if (state.controlFlow) { 71 | if (stream.match(operators)) { return "operator"; } 72 | if (stream.match(/^(\d+)/)) { return "number"; } 73 | if (stream.eol()) { state.controlFlow = false; } 74 | } 75 | 76 | if (stream.match(arch)) { 77 | if (stream.eol()) { state.controlFlow = false; } 78 | return "number"; 79 | } 80 | 81 | // Macros like '%make_install' or '%attr(0775,root,root)' 82 | if (stream.match(/^%[\w]+/)) { 83 | if (stream.match(/^\(/)) { state.macroParameters = true; } 84 | return "keyword"; 85 | } 86 | if (state.macroParameters) { 87 | if (stream.match(/^\d+/)) { return "number";} 88 | if (stream.match(/^\)/)) { 89 | state.macroParameters = false; 90 | return "keyword"; 91 | } 92 | } 93 | 94 | // Macros like '%{defined fedora}' 95 | if (stream.match(/^%\{\??[\w \-\:\!]+\}/)) { 96 | if (stream.eol()) { state.controlFlow = false; } 97 | return "def"; 98 | } 99 | 100 | //TODO: Include bash script sub-parser (CodeMirror supports that) 101 | stream.next(); 102 | return null; 103 | } 104 | }; 105 | }); 106 | 107 | CodeMirror.defineMIME("text/x-rpm-spec", "rpm-spec"); 108 | 109 | }); 110 | -------------------------------------------------------------------------------- /static/codemirror/rpm/rpm.min.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode("rpm-changes", function() { 15 | var headerSeperator = /^-+$/; 16 | var headerLine = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ?\d{1,2} \d{2}:\d{2}(:\d{2})? [A-Z]{3,4} \d{4} - /; 17 | var simpleEmail = /^[\w+.-]+@[\w.-]+/; 18 | 19 | return { 20 | token: function(stream) { 21 | if (stream.sol()) { 22 | if (stream.match(headerSeperator)) { return 'tag'; } 23 | if (stream.match(headerLine)) { return 'tag'; } 24 | } 25 | if (stream.match(simpleEmail)) { return 'string'; } 26 | stream.next(); 27 | return null; 28 | } 29 | }; 30 | }); 31 | 32 | CodeMirror.defineMIME("text/x-rpm-changes", "rpm-changes"); 33 | 34 | // Quick and dirty spec file highlighting 35 | 36 | CodeMirror.defineMode("rpm-spec", function() { 37 | var arch = /^(i386|i586|i686|x86_64|ppc64le|ppc64|ppc|ia64|s390x|s390|sparc64|sparcv9|sparc|noarch|alphaev6|alpha|hppa|mipsel)/; 38 | 39 | var preamble = /^[a-zA-Z0-9()]+:/; 40 | var section = /^%(debug_package|package|description|prep|build|install|files|clean|changelog|preinstall|preun|postinstall|postun|pretrans|posttrans|pre|post|triggerin|triggerun|verifyscript|check|triggerpostun|triggerprein|trigger)/; 41 | var control_flow_complex = /^%(ifnarch|ifarch|if)/; // rpm control flow macros 42 | var control_flow_simple = /^%(else|endif)/; // rpm control flow macros 43 | var operators = /^(\!|\?|\<\=|\<|\>\=|\>|\=\=|\&\&|\|\|)/; // operators in control flow macros 44 | 45 | return { 46 | startState: function () { 47 | return { 48 | controlFlow: false, 49 | macroParameters: false, 50 | section: false 51 | }; 52 | }, 53 | token: function (stream, state) { 54 | var ch = stream.peek(); 55 | if (ch == "#") { stream.skipToEnd(); return "comment"; } 56 | 57 | if (stream.sol()) { 58 | if (stream.match(preamble)) { return "header"; } 59 | if (stream.match(section)) { return "atom"; } 60 | } 61 | 62 | if (stream.match(/^\$\w+/)) { return "def"; } // Variables like '$RPM_BUILD_ROOT' 63 | if (stream.match(/^\$\{\w+\}/)) { return "def"; } // Variables like '${RPM_BUILD_ROOT}' 64 | 65 | if (stream.match(control_flow_simple)) { return "keyword"; } 66 | if (stream.match(control_flow_complex)) { 67 | state.controlFlow = true; 68 | return "keyword"; 69 | } 70 | if (state.controlFlow) { 71 | if (stream.match(operators)) { return "operator"; } 72 | if (stream.match(/^(\d+)/)) { return "number"; } 73 | if (stream.eol()) { state.controlFlow = false; } 74 | } 75 | 76 | if (stream.match(arch)) { 77 | if (stream.eol()) { state.controlFlow = false; } 78 | return "number"; 79 | } 80 | 81 | // Macros like '%make_install' or '%attr(0775,root,root)' 82 | if (stream.match(/^%[\w]+/)) { 83 | if (stream.match(/^\(/)) { state.macroParameters = true; } 84 | return "keyword"; 85 | } 86 | if (state.macroParameters) { 87 | if (stream.match(/^\d+/)) { return "number";} 88 | if (stream.match(/^\)/)) { 89 | state.macroParameters = false; 90 | return "keyword"; 91 | } 92 | } 93 | 94 | // Macros like '%{defined fedora}' 95 | if (stream.match(/^%\{\??[\w \-\:\!]+\}/)) { 96 | if (stream.eol()) { state.controlFlow = false; } 97 | return "def"; 98 | } 99 | 100 | //TODO: Include bash script sub-parser (CodeMirror supports that) 101 | stream.next(); 102 | return null; 103 | } 104 | }; 105 | }); 106 | 107 | CodeMirror.defineMIME("text/x-rpm-spec", "rpm-spec"); 108 | 109 | }); 110 | -------------------------------------------------------------------------------- /static/codemirror/rust/rust.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror"), require("../../addon/mode/simple")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror", "../../addon/mode/simple"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineSimpleMode("rust",{ 15 | start: [ 16 | // string and byte string 17 | {regex: /b?"/, token: "string", next: "string"}, 18 | // raw string and raw byte string 19 | {regex: /b?r"/, token: "string", next: "string_raw"}, 20 | {regex: /b?r#+"/, token: "string", next: "string_raw_hash"}, 21 | // character 22 | {regex: /'(?:[^'\\]|\\(?:[nrt0'"]|x[\da-fA-F]{2}|u\{[\da-fA-F]{6}\}))'/, token: "string-2"}, 23 | // byte 24 | {regex: /b'(?:[^']|\\(?:['\\nrt0]|x[\da-fA-F]{2}))'/, token: "string-2"}, 25 | 26 | {regex: /(?:(?:[0-9][0-9_]*)(?:(?:[Ee][+-]?[0-9_]+)|\.[0-9_]+(?:[Ee][+-]?[0-9_]+)?)(?:f32|f64)?)|(?:0(?:b[01_]+|(?:o[0-7_]+)|(?:x[0-9a-fA-F_]+))|(?:[0-9][0-9_]*))(?:u8|u16|u32|u64|i8|i16|i32|i64|isize|usize)?/, 27 | token: "number"}, 28 | {regex: /(let(?:\s+mut)?|fn|enum|mod|struct|type)(\s+)([a-zA-Z_][a-zA-Z0-9_]*)/, token: ["keyword", null, "def"]}, 29 | {regex: /(?:abstract|alignof|as|box|break|continue|const|crate|do|else|enum|extern|fn|for|final|if|impl|in|loop|macro|match|mod|move|offsetof|override|priv|proc|pub|pure|ref|return|self|sizeof|static|struct|super|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\b/, token: "keyword"}, 30 | {regex: /\b(?:Self|isize|usize|char|bool|u8|u16|u32|u64|f16|f32|f64|i8|i16|i32|i64|str|Option)\b/, token: "atom"}, 31 | {regex: /\b(?:true|false|Some|None|Ok|Err)\b/, token: "builtin"}, 32 | {regex: /\b(fn)(\s+)([a-zA-Z_][a-zA-Z0-9_]*)/, 33 | token: ["keyword", null ,"def"]}, 34 | {regex: /#!?\[.*\]/, token: "meta"}, 35 | {regex: /\/\/.*/, token: "comment"}, 36 | {regex: /\/\*/, token: "comment", next: "comment"}, 37 | {regex: /[-+\/*=<>!]+/, token: "operator"}, 38 | {regex: /[a-zA-Z_]\w*!/,token: "variable-3"}, 39 | {regex: /[a-zA-Z_]\w*/, token: "variable"}, 40 | {regex: /[\{\[\(]/, indent: true}, 41 | {regex: /[\}\]\)]/, dedent: true} 42 | ], 43 | string: [ 44 | {regex: /"/, token: "string", next: "start"}, 45 | {regex: /(?:[^\\"]|\\(?:.|$))*/, token: "string"} 46 | ], 47 | string_raw: [ 48 | {regex: /"/, token: "string", next: "start"}, 49 | {regex: /[^"]*/, token: "string"} 50 | ], 51 | string_raw_hash: [ 52 | {regex: /"#+/, token: "string", next: "start"}, 53 | {regex: /(?:[^"]|"(?!#))*/, token: "string"} 54 | ], 55 | comment: [ 56 | {regex: /.*?\*\//, token: "comment", next: "start"}, 57 | {regex: /.*/, token: "comment"} 58 | ], 59 | meta: { 60 | dontIndentStates: ["comment"], 61 | electricInput: /^\s*\}$/, 62 | blockCommentStart: "/*", 63 | blockCommentEnd: "*/", 64 | lineComment: "//", 65 | fold: "brace" 66 | } 67 | }); 68 | 69 | 70 | CodeMirror.defineMIME("text/x-rustsrc", "rust"); 71 | CodeMirror.defineMIME("text/rust", "rust"); 72 | }); 73 | -------------------------------------------------------------------------------- /static/codemirror/rust/rust.min.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror"), require("../../addon/mode/simple")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror", "../../addon/mode/simple"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineSimpleMode("rust",{ 15 | start: [ 16 | // string and byte string 17 | {regex: /b?"/, token: "string", next: "string"}, 18 | // raw string and raw byte string 19 | {regex: /b?r"/, token: "string", next: "string_raw"}, 20 | {regex: /b?r#+"/, token: "string", next: "string_raw_hash"}, 21 | // character 22 | {regex: /'(?:[^'\\]|\\(?:[nrt0'"]|x[\da-fA-F]{2}|u\{[\da-fA-F]{6}\}))'/, token: "string-2"}, 23 | // byte 24 | {regex: /b'(?:[^']|\\(?:['\\nrt0]|x[\da-fA-F]{2}))'/, token: "string-2"}, 25 | 26 | {regex: /(?:(?:[0-9][0-9_]*)(?:(?:[Ee][+-]?[0-9_]+)|\.[0-9_]+(?:[Ee][+-]?[0-9_]+)?)(?:f32|f64)?)|(?:0(?:b[01_]+|(?:o[0-7_]+)|(?:x[0-9a-fA-F_]+))|(?:[0-9][0-9_]*))(?:u8|u16|u32|u64|i8|i16|i32|i64|isize|usize)?/, 27 | token: "number"}, 28 | {regex: /(let(?:\s+mut)?|fn|enum|mod|struct|type)(\s+)([a-zA-Z_][a-zA-Z0-9_]*)/, token: ["keyword", null, "def"]}, 29 | {regex: /(?:abstract|alignof|as|box|break|continue|const|crate|do|else|enum|extern|fn|for|final|if|impl|in|loop|macro|match|mod|move|offsetof|override|priv|proc|pub|pure|ref|return|self|sizeof|static|struct|super|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\b/, token: "keyword"}, 30 | {regex: /\b(?:Self|isize|usize|char|bool|u8|u16|u32|u64|f16|f32|f64|i8|i16|i32|i64|str|Option)\b/, token: "atom"}, 31 | {regex: /\b(?:true|false|Some|None|Ok|Err)\b/, token: "builtin"}, 32 | {regex: /\b(fn)(\s+)([a-zA-Z_][a-zA-Z0-9_]*)/, 33 | token: ["keyword", null ,"def"]}, 34 | {regex: /#!?\[.*\]/, token: "meta"}, 35 | {regex: /\/\/.*/, token: "comment"}, 36 | {regex: /\/\*/, token: "comment", next: "comment"}, 37 | {regex: /[-+\/*=<>!]+/, token: "operator"}, 38 | {regex: /[a-zA-Z_]\w*!/,token: "variable-3"}, 39 | {regex: /[a-zA-Z_]\w*/, token: "variable"}, 40 | {regex: /[\{\[\(]/, indent: true}, 41 | {regex: /[\}\]\)]/, dedent: true} 42 | ], 43 | string: [ 44 | {regex: /"/, token: "string", next: "start"}, 45 | {regex: /(?:[^\\"]|\\(?:.|$))*/, token: "string"} 46 | ], 47 | string_raw: [ 48 | {regex: /"/, token: "string", next: "start"}, 49 | {regex: /[^"]*/, token: "string"} 50 | ], 51 | string_raw_hash: [ 52 | {regex: /"#+/, token: "string", next: "start"}, 53 | {regex: /(?:[^"]|"(?!#))*/, token: "string"} 54 | ], 55 | comment: [ 56 | {regex: /.*?\*\//, token: "comment", next: "start"}, 57 | {regex: /.*/, token: "comment"} 58 | ], 59 | meta: { 60 | dontIndentStates: ["comment"], 61 | electricInput: /^\s*\}$/, 62 | blockCommentStart: "/*", 63 | blockCommentEnd: "*/", 64 | lineComment: "//", 65 | fold: "brace" 66 | } 67 | }); 68 | 69 | 70 | CodeMirror.defineMIME("text/x-rustsrc", "rust"); 71 | CodeMirror.defineMIME("text/rust", "rust"); 72 | }); 73 | -------------------------------------------------------------------------------- /static/codemirror/solr/solr.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode("solr", function() { 15 | "use strict"; 16 | 17 | var isStringChar = /[^\s\|\!\+\-\*\?\~\^\&\:\(\)\[\]\{\}\"\\]/; 18 | var isOperatorChar = /[\|\!\+\-\*\?\~\^\&]/; 19 | var isOperatorString = /^(OR|AND|NOT|TO)$/i; 20 | 21 | function isNumber(word) { 22 | return parseFloat(word).toString() === word; 23 | } 24 | 25 | function tokenString(quote) { 26 | return function(stream, state) { 27 | var escaped = false, next; 28 | while ((next = stream.next()) != null) { 29 | if (next == quote && !escaped) break; 30 | escaped = !escaped && next == "\\"; 31 | } 32 | 33 | if (!escaped) state.tokenize = tokenBase; 34 | return "string"; 35 | }; 36 | } 37 | 38 | function tokenOperator(operator) { 39 | return function(stream, state) { 40 | var style = "operator"; 41 | if (operator == "+") 42 | style += " positive"; 43 | else if (operator == "-") 44 | style += " negative"; 45 | else if (operator == "|") 46 | stream.eat(/\|/); 47 | else if (operator == "&") 48 | stream.eat(/\&/); 49 | else if (operator == "^") 50 | style += " boost"; 51 | 52 | state.tokenize = tokenBase; 53 | return style; 54 | }; 55 | } 56 | 57 | function tokenWord(ch) { 58 | return function(stream, state) { 59 | var word = ch; 60 | while ((ch = stream.peek()) && ch.match(isStringChar) != null) { 61 | word += stream.next(); 62 | } 63 | 64 | state.tokenize = tokenBase; 65 | if (isOperatorString.test(word)) 66 | return "operator"; 67 | else if (isNumber(word)) 68 | return "number"; 69 | else if (stream.peek() == ":") 70 | return "field"; 71 | else 72 | return "string"; 73 | }; 74 | } 75 | 76 | function tokenBase(stream, state) { 77 | var ch = stream.next(); 78 | if (ch == '"') 79 | state.tokenize = tokenString(ch); 80 | else if (isOperatorChar.test(ch)) 81 | state.tokenize = tokenOperator(ch); 82 | else if (isStringChar.test(ch)) 83 | state.tokenize = tokenWord(ch); 84 | 85 | return (state.tokenize != tokenBase) ? state.tokenize(stream, state) : null; 86 | } 87 | 88 | return { 89 | startState: function() { 90 | return { 91 | tokenize: tokenBase 92 | }; 93 | }, 94 | 95 | token: function(stream, state) { 96 | if (stream.eatSpace()) return null; 97 | return state.tokenize(stream, state); 98 | } 99 | }; 100 | }); 101 | 102 | CodeMirror.defineMIME("text/x-solr", "solr"); 103 | 104 | }); 105 | -------------------------------------------------------------------------------- /static/codemirror/solr/solr.min.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode("solr", function() { 15 | "use strict"; 16 | 17 | var isStringChar = /[^\s\|\!\+\-\*\?\~\^\&\:\(\)\[\]\{\}\"\\]/; 18 | var isOperatorChar = /[\|\!\+\-\*\?\~\^\&]/; 19 | var isOperatorString = /^(OR|AND|NOT|TO)$/i; 20 | 21 | function isNumber(word) { 22 | return parseFloat(word).toString() === word; 23 | } 24 | 25 | function tokenString(quote) { 26 | return function(stream, state) { 27 | var escaped = false, next; 28 | while ((next = stream.next()) != null) { 29 | if (next == quote && !escaped) break; 30 | escaped = !escaped && next == "\\"; 31 | } 32 | 33 | if (!escaped) state.tokenize = tokenBase; 34 | return "string"; 35 | }; 36 | } 37 | 38 | function tokenOperator(operator) { 39 | return function(stream, state) { 40 | var style = "operator"; 41 | if (operator == "+") 42 | style += " positive"; 43 | else if (operator == "-") 44 | style += " negative"; 45 | else if (operator == "|") 46 | stream.eat(/\|/); 47 | else if (operator == "&") 48 | stream.eat(/\&/); 49 | else if (operator == "^") 50 | style += " boost"; 51 | 52 | state.tokenize = tokenBase; 53 | return style; 54 | }; 55 | } 56 | 57 | function tokenWord(ch) { 58 | return function(stream, state) { 59 | var word = ch; 60 | while ((ch = stream.peek()) && ch.match(isStringChar) != null) { 61 | word += stream.next(); 62 | } 63 | 64 | state.tokenize = tokenBase; 65 | if (isOperatorString.test(word)) 66 | return "operator"; 67 | else if (isNumber(word)) 68 | return "number"; 69 | else if (stream.peek() == ":") 70 | return "field"; 71 | else 72 | return "string"; 73 | }; 74 | } 75 | 76 | function tokenBase(stream, state) { 77 | var ch = stream.next(); 78 | if (ch == '"') 79 | state.tokenize = tokenString(ch); 80 | else if (isOperatorChar.test(ch)) 81 | state.tokenize = tokenOperator(ch); 82 | else if (isStringChar.test(ch)) 83 | state.tokenize = tokenWord(ch); 84 | 85 | return (state.tokenize != tokenBase) ? state.tokenize(stream, state) : null; 86 | } 87 | 88 | return { 89 | startState: function() { 90 | return { 91 | tokenize: tokenBase 92 | }; 93 | }, 94 | 95 | token: function(stream, state) { 96 | if (stream.eatSpace()) return null; 97 | return state.tokenize(stream, state); 98 | } 99 | }; 100 | }); 101 | 102 | CodeMirror.defineMIME("text/x-solr", "solr"); 103 | 104 | }); 105 | -------------------------------------------------------------------------------- /static/codemirror/spreadsheet/spreadsheet.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode("spreadsheet", function () { 15 | return { 16 | startState: function () { 17 | return { 18 | stringType: null, 19 | stack: [] 20 | }; 21 | }, 22 | token: function (stream, state) { 23 | if (!stream) return; 24 | 25 | //check for state changes 26 | if (state.stack.length === 0) { 27 | //strings 28 | if ((stream.peek() == '"') || (stream.peek() == "'")) { 29 | state.stringType = stream.peek(); 30 | stream.next(); // Skip quote 31 | state.stack.unshift("string"); 32 | } 33 | } 34 | 35 | //return state 36 | //stack has 37 | switch (state.stack[0]) { 38 | case "string": 39 | while (state.stack[0] === "string" && !stream.eol()) { 40 | if (stream.peek() === state.stringType) { 41 | stream.next(); // Skip quote 42 | state.stack.shift(); // Clear flag 43 | } else if (stream.peek() === "\\") { 44 | stream.next(); 45 | stream.next(); 46 | } else { 47 | stream.match(/^.[^\\\"\']*/); 48 | } 49 | } 50 | return "string"; 51 | 52 | case "characterClass": 53 | while (state.stack[0] === "characterClass" && !stream.eol()) { 54 | if (!(stream.match(/^[^\]\\]+/) || stream.match(/^\\./))) 55 | state.stack.shift(); 56 | } 57 | return "operator"; 58 | } 59 | 60 | var peek = stream.peek(); 61 | 62 | //no stack 63 | switch (peek) { 64 | case "[": 65 | stream.next(); 66 | state.stack.unshift("characterClass"); 67 | return "bracket"; 68 | case ":": 69 | stream.next(); 70 | return "operator"; 71 | case "\\": 72 | if (stream.match(/\\[a-z]+/)) return "string-2"; 73 | else { 74 | stream.next(); 75 | return "atom"; 76 | } 77 | case ".": 78 | case ",": 79 | case ";": 80 | case "*": 81 | case "-": 82 | case "+": 83 | case "^": 84 | case "<": 85 | case "/": 86 | case "=": 87 | stream.next(); 88 | return "atom"; 89 | case "$": 90 | stream.next(); 91 | return "builtin"; 92 | } 93 | 94 | if (stream.match(/\d+/)) { 95 | if (stream.match(/^\w+/)) return "error"; 96 | return "number"; 97 | } else if (stream.match(/^[a-zA-Z_]\w*/)) { 98 | if (stream.match(/(?=[\(.])/, false)) return "keyword"; 99 | return "variable-2"; 100 | } else if (["[", "]", "(", ")", "{", "}"].indexOf(peek) != -1) { 101 | stream.next(); 102 | return "bracket"; 103 | } else if (!stream.eatSpace()) { 104 | stream.next(); 105 | } 106 | return null; 107 | } 108 | }; 109 | }); 110 | 111 | CodeMirror.defineMIME("text/x-spreadsheet", "spreadsheet"); 112 | }); 113 | -------------------------------------------------------------------------------- /static/codemirror/spreadsheet/spreadsheet.min.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode("spreadsheet", function () { 15 | return { 16 | startState: function () { 17 | return { 18 | stringType: null, 19 | stack: [] 20 | }; 21 | }, 22 | token: function (stream, state) { 23 | if (!stream) return; 24 | 25 | //check for state changes 26 | if (state.stack.length === 0) { 27 | //strings 28 | if ((stream.peek() == '"') || (stream.peek() == "'")) { 29 | state.stringType = stream.peek(); 30 | stream.next(); // Skip quote 31 | state.stack.unshift("string"); 32 | } 33 | } 34 | 35 | //return state 36 | //stack has 37 | switch (state.stack[0]) { 38 | case "string": 39 | while (state.stack[0] === "string" && !stream.eol()) { 40 | if (stream.peek() === state.stringType) { 41 | stream.next(); // Skip quote 42 | state.stack.shift(); // Clear flag 43 | } else if (stream.peek() === "\\") { 44 | stream.next(); 45 | stream.next(); 46 | } else { 47 | stream.match(/^.[^\\\"\']*/); 48 | } 49 | } 50 | return "string"; 51 | 52 | case "characterClass": 53 | while (state.stack[0] === "characterClass" && !stream.eol()) { 54 | if (!(stream.match(/^[^\]\\]+/) || stream.match(/^\\./))) 55 | state.stack.shift(); 56 | } 57 | return "operator"; 58 | } 59 | 60 | var peek = stream.peek(); 61 | 62 | //no stack 63 | switch (peek) { 64 | case "[": 65 | stream.next(); 66 | state.stack.unshift("characterClass"); 67 | return "bracket"; 68 | case ":": 69 | stream.next(); 70 | return "operator"; 71 | case "\\": 72 | if (stream.match(/\\[a-z]+/)) return "string-2"; 73 | else { 74 | stream.next(); 75 | return "atom"; 76 | } 77 | case ".": 78 | case ",": 79 | case ";": 80 | case "*": 81 | case "-": 82 | case "+": 83 | case "^": 84 | case "<": 85 | case "/": 86 | case "=": 87 | stream.next(); 88 | return "atom"; 89 | case "$": 90 | stream.next(); 91 | return "builtin"; 92 | } 93 | 94 | if (stream.match(/\d+/)) { 95 | if (stream.match(/^\w+/)) return "error"; 96 | return "number"; 97 | } else if (stream.match(/^[a-zA-Z_]\w*/)) { 98 | if (stream.match(/(?=[\(.])/, false)) return "keyword"; 99 | return "variable-2"; 100 | } else if (["[", "]", "(", ")", "{", "}"].indexOf(peek) != -1) { 101 | stream.next(); 102 | return "bracket"; 103 | } else if (!stream.eatSpace()) { 104 | stream.next(); 105 | } 106 | return null; 107 | } 108 | }; 109 | }); 110 | 111 | CodeMirror.defineMIME("text/x-spreadsheet", "spreadsheet"); 112 | }); 113 | -------------------------------------------------------------------------------- /static/codemirror/toml/toml.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode("toml", function () { 15 | return { 16 | startState: function () { 17 | return { 18 | inString: false, 19 | stringType: "", 20 | lhs: true, 21 | inArray: 0 22 | }; 23 | }, 24 | token: function (stream, state) { 25 | //check for state changes 26 | if (!state.inString && ((stream.peek() == '"') || (stream.peek() == "'"))) { 27 | state.stringType = stream.peek(); 28 | stream.next(); // Skip quote 29 | state.inString = true; // Update state 30 | } 31 | if (stream.sol() && state.inArray === 0) { 32 | state.lhs = true; 33 | } 34 | //return state 35 | if (state.inString) { 36 | while (state.inString && !stream.eol()) { 37 | if (stream.peek() === state.stringType) { 38 | stream.next(); // Skip quote 39 | state.inString = false; // Clear flag 40 | } else if (stream.peek() === '\\') { 41 | stream.next(); 42 | stream.next(); 43 | } else { 44 | stream.match(/^.[^\\\"\']*/); 45 | } 46 | } 47 | return state.lhs ? "property string" : "string"; // Token style 48 | } else if (state.inArray && stream.peek() === ']') { 49 | stream.next(); 50 | state.inArray--; 51 | return 'bracket'; 52 | } else if (state.lhs && stream.peek() === '[' && stream.skipTo(']')) { 53 | stream.next();//skip closing ] 54 | // array of objects has an extra open & close [] 55 | if (stream.peek() === ']') stream.next(); 56 | return "atom"; 57 | } else if (stream.peek() === "#") { 58 | stream.skipToEnd(); 59 | return "comment"; 60 | } else if (stream.eatSpace()) { 61 | return null; 62 | } else if (state.lhs && stream.eatWhile(function (c) { return c != '=' && c != ' '; })) { 63 | return "property"; 64 | } else if (state.lhs && stream.peek() === "=") { 65 | stream.next(); 66 | state.lhs = false; 67 | return null; 68 | } else if (!state.lhs && stream.match(/^\d\d\d\d[\d\-\:\.T]*Z/)) { 69 | return 'atom'; //date 70 | } else if (!state.lhs && (stream.match('true') || stream.match('false'))) { 71 | return 'atom'; 72 | } else if (!state.lhs && stream.peek() === '[') { 73 | state.inArray++; 74 | stream.next(); 75 | return 'bracket'; 76 | } else if (!state.lhs && stream.match(/^\-?\d+(?:\.\d+)?/)) { 77 | return 'number'; 78 | } else if (!stream.eatSpace()) { 79 | stream.next(); 80 | } 81 | return null; 82 | } 83 | }; 84 | }); 85 | 86 | CodeMirror.defineMIME('text/x-toml', 'toml'); 87 | 88 | }); 89 | -------------------------------------------------------------------------------- /static/codemirror/toml/toml.min.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode("toml", function () { 15 | return { 16 | startState: function () { 17 | return { 18 | inString: false, 19 | stringType: "", 20 | lhs: true, 21 | inArray: 0 22 | }; 23 | }, 24 | token: function (stream, state) { 25 | //check for state changes 26 | if (!state.inString && ((stream.peek() == '"') || (stream.peek() == "'"))) { 27 | state.stringType = stream.peek(); 28 | stream.next(); // Skip quote 29 | state.inString = true; // Update state 30 | } 31 | if (stream.sol() && state.inArray === 0) { 32 | state.lhs = true; 33 | } 34 | //return state 35 | if (state.inString) { 36 | while (state.inString && !stream.eol()) { 37 | if (stream.peek() === state.stringType) { 38 | stream.next(); // Skip quote 39 | state.inString = false; // Clear flag 40 | } else if (stream.peek() === '\\') { 41 | stream.next(); 42 | stream.next(); 43 | } else { 44 | stream.match(/^.[^\\\"\']*/); 45 | } 46 | } 47 | return state.lhs ? "property string" : "string"; // Token style 48 | } else if (state.inArray && stream.peek() === ']') { 49 | stream.next(); 50 | state.inArray--; 51 | return 'bracket'; 52 | } else if (state.lhs && stream.peek() === '[' && stream.skipTo(']')) { 53 | stream.next();//skip closing ] 54 | // array of objects has an extra open & close [] 55 | if (stream.peek() === ']') stream.next(); 56 | return "atom"; 57 | } else if (stream.peek() === "#") { 58 | stream.skipToEnd(); 59 | return "comment"; 60 | } else if (stream.eatSpace()) { 61 | return null; 62 | } else if (state.lhs && stream.eatWhile(function (c) { return c != '=' && c != ' '; })) { 63 | return "property"; 64 | } else if (state.lhs && stream.peek() === "=") { 65 | stream.next(); 66 | state.lhs = false; 67 | return null; 68 | } else if (!state.lhs && stream.match(/^\d\d\d\d[\d\-\:\.T]*Z/)) { 69 | return 'atom'; //date 70 | } else if (!state.lhs && (stream.match('true') || stream.match('false'))) { 71 | return 'atom'; 72 | } else if (!state.lhs && stream.peek() === '[') { 73 | state.inArray++; 74 | stream.next(); 75 | return 'bracket'; 76 | } else if (!state.lhs && stream.match(/^\-?\d+(?:\.\d+)?/)) { 77 | return 'number'; 78 | } else if (!stream.eatSpace()) { 79 | stream.next(); 80 | } 81 | return null; 82 | } 83 | }; 84 | }); 85 | 86 | CodeMirror.defineMIME('text/x-toml', 'toml'); 87 | 88 | }); 89 | -------------------------------------------------------------------------------- /static/codemirror/tornado/tornado.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"), 7 | require("../../addon/mode/overlay")); 8 | else if (typeof define == "function" && define.amd) // AMD 9 | define(["../../lib/codemirror", "../htmlmixed/htmlmixed", 10 | "../../addon/mode/overlay"], mod); 11 | else // Plain browser env 12 | mod(CodeMirror); 13 | })(function(CodeMirror) { 14 | "use strict"; 15 | 16 | CodeMirror.defineMode("tornado:inner", function() { 17 | var keywords = ["and","as","assert","autoescape","block","break","class","comment","context", 18 | "continue","datetime","def","del","elif","else","end","escape","except", 19 | "exec","extends","false","finally","for","from","global","if","import","in", 20 | "include","is","json_encode","lambda","length","linkify","load","module", 21 | "none","not","or","pass","print","put","raise","raw","return","self","set", 22 | "squeeze","super","true","try","url_escape","while","with","without","xhtml_escape","yield"]; 23 | keywords = new RegExp("^((" + keywords.join(")|(") + "))\\b"); 24 | 25 | function tokenBase (stream, state) { 26 | stream.eatWhile(/[^\{]/); 27 | var ch = stream.next(); 28 | if (ch == "{") { 29 | if (ch = stream.eat(/\{|%|#/)) { 30 | state.tokenize = inTag(ch); 31 | return "tag"; 32 | } 33 | } 34 | } 35 | function inTag (close) { 36 | if (close == "{") { 37 | close = "}"; 38 | } 39 | return function (stream, state) { 40 | var ch = stream.next(); 41 | if ((ch == close) && stream.eat("}")) { 42 | state.tokenize = tokenBase; 43 | return "tag"; 44 | } 45 | if (stream.match(keywords)) { 46 | return "keyword"; 47 | } 48 | return close == "#" ? "comment" : "string"; 49 | }; 50 | } 51 | return { 52 | startState: function () { 53 | return {tokenize: tokenBase}; 54 | }, 55 | token: function (stream, state) { 56 | return state.tokenize(stream, state); 57 | } 58 | }; 59 | }); 60 | 61 | CodeMirror.defineMode("tornado", function(config) { 62 | var htmlBase = CodeMirror.getMode(config, "text/html"); 63 | var tornadoInner = CodeMirror.getMode(config, "tornado:inner"); 64 | return CodeMirror.overlayMode(htmlBase, tornadoInner); 65 | }); 66 | 67 | CodeMirror.defineMIME("text/x-tornado", "tornado"); 68 | }); 69 | -------------------------------------------------------------------------------- /static/codemirror/tornado/tornado.min.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"), 7 | require("../../addon/mode/overlay")); 8 | else if (typeof define == "function" && define.amd) // AMD 9 | define(["../../lib/codemirror", "../htmlmixed/htmlmixed", 10 | "../../addon/mode/overlay"], mod); 11 | else // Plain browser env 12 | mod(CodeMirror); 13 | })(function(CodeMirror) { 14 | "use strict"; 15 | 16 | CodeMirror.defineMode("tornado:inner", function() { 17 | var keywords = ["and","as","assert","autoescape","block","break","class","comment","context", 18 | "continue","datetime","def","del","elif","else","end","escape","except", 19 | "exec","extends","false","finally","for","from","global","if","import","in", 20 | "include","is","json_encode","lambda","length","linkify","load","module", 21 | "none","not","or","pass","print","put","raise","raw","return","self","set", 22 | "squeeze","super","true","try","url_escape","while","with","without","xhtml_escape","yield"]; 23 | keywords = new RegExp("^((" + keywords.join(")|(") + "))\\b"); 24 | 25 | function tokenBase (stream, state) { 26 | stream.eatWhile(/[^\{]/); 27 | var ch = stream.next(); 28 | if (ch == "{") { 29 | if (ch = stream.eat(/\{|%|#/)) { 30 | state.tokenize = inTag(ch); 31 | return "tag"; 32 | } 33 | } 34 | } 35 | function inTag (close) { 36 | if (close == "{") { 37 | close = "}"; 38 | } 39 | return function (stream, state) { 40 | var ch = stream.next(); 41 | if ((ch == close) && stream.eat("}")) { 42 | state.tokenize = tokenBase; 43 | return "tag"; 44 | } 45 | if (stream.match(keywords)) { 46 | return "keyword"; 47 | } 48 | return close == "#" ? "comment" : "string"; 49 | }; 50 | } 51 | return { 52 | startState: function () { 53 | return {tokenize: tokenBase}; 54 | }, 55 | token: function (stream, state) { 56 | return state.tokenize(stream, state); 57 | } 58 | }; 59 | }); 60 | 61 | CodeMirror.defineMode("tornado", function(config) { 62 | var htmlBase = CodeMirror.getMode(config, "text/html"); 63 | var tornadoInner = CodeMirror.getMode(config, "tornado:inner"); 64 | return CodeMirror.overlayMode(htmlBase, tornadoInner); 65 | }); 66 | 67 | CodeMirror.defineMIME("text/x-tornado", "tornado"); 68 | }); 69 | -------------------------------------------------------------------------------- /static/codemirror/troff/troff.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) 8 | define(["../../lib/codemirror"], mod); 9 | else 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode('troff', function() { 15 | 16 | var words = {}; 17 | 18 | function tokenBase(stream) { 19 | if (stream.eatSpace()) return null; 20 | 21 | var sol = stream.sol(); 22 | var ch = stream.next(); 23 | 24 | if (ch === '\\') { 25 | if (stream.match('fB') || stream.match('fR') || stream.match('fI') || 26 | stream.match('u') || stream.match('d') || 27 | stream.match('%') || stream.match('&')) { 28 | return 'string'; 29 | } 30 | if (stream.match('m[')) { 31 | stream.skipTo(']'); 32 | stream.next(); 33 | return 'string'; 34 | } 35 | if (stream.match('s+') || stream.match('s-')) { 36 | stream.eatWhile(/[\d-]/); 37 | return 'string'; 38 | } 39 | if (stream.match('\(') || stream.match('*\(')) { 40 | stream.eatWhile(/[\w-]/); 41 | return 'string'; 42 | } 43 | return 'string'; 44 | } 45 | if (sol && (ch === '.' || ch === '\'')) { 46 | if (stream.eat('\\') && stream.eat('\"')) { 47 | stream.skipToEnd(); 48 | return 'comment'; 49 | } 50 | } 51 | if (sol && ch === '.') { 52 | if (stream.match('B ') || stream.match('I ') || stream.match('R ')) { 53 | return 'attribute'; 54 | } 55 | if (stream.match('TH ') || stream.match('SH ') || stream.match('SS ') || stream.match('HP ')) { 56 | stream.skipToEnd(); 57 | return 'quote'; 58 | } 59 | if ((stream.match(/[A-Z]/) && stream.match(/[A-Z]/)) || (stream.match(/[a-z]/) && stream.match(/[a-z]/))) { 60 | return 'attribute'; 61 | } 62 | } 63 | stream.eatWhile(/[\w-]/); 64 | var cur = stream.current(); 65 | return words.hasOwnProperty(cur) ? words[cur] : null; 66 | } 67 | 68 | function tokenize(stream, state) { 69 | return (state.tokens[0] || tokenBase) (stream, state); 70 | }; 71 | 72 | return { 73 | startState: function() {return {tokens:[]};}, 74 | token: function(stream, state) { 75 | return tokenize(stream, state); 76 | } 77 | }; 78 | }); 79 | 80 | CodeMirror.defineMIME('text/troff', 'troff'); 81 | CodeMirror.defineMIME('text/x-troff', 'troff'); 82 | CodeMirror.defineMIME('application/x-troff', 'troff'); 83 | 84 | }); 85 | -------------------------------------------------------------------------------- /static/codemirror/troff/troff.min.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) 8 | define(["../../lib/codemirror"], mod); 9 | else 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode('troff', function() { 15 | 16 | var words = {}; 17 | 18 | function tokenBase(stream) { 19 | if (stream.eatSpace()) return null; 20 | 21 | var sol = stream.sol(); 22 | var ch = stream.next(); 23 | 24 | if (ch === '\\') { 25 | if (stream.match('fB') || stream.match('fR') || stream.match('fI') || 26 | stream.match('u') || stream.match('d') || 27 | stream.match('%') || stream.match('&')) { 28 | return 'string'; 29 | } 30 | if (stream.match('m[')) { 31 | stream.skipTo(']'); 32 | stream.next(); 33 | return 'string'; 34 | } 35 | if (stream.match('s+') || stream.match('s-')) { 36 | stream.eatWhile(/[\d-]/); 37 | return 'string'; 38 | } 39 | if (stream.match('\(') || stream.match('*\(')) { 40 | stream.eatWhile(/[\w-]/); 41 | return 'string'; 42 | } 43 | return 'string'; 44 | } 45 | if (sol && (ch === '.' || ch === '\'')) { 46 | if (stream.eat('\\') && stream.eat('\"')) { 47 | stream.skipToEnd(); 48 | return 'comment'; 49 | } 50 | } 51 | if (sol && ch === '.') { 52 | if (stream.match('B ') || stream.match('I ') || stream.match('R ')) { 53 | return 'attribute'; 54 | } 55 | if (stream.match('TH ') || stream.match('SH ') || stream.match('SS ') || stream.match('HP ')) { 56 | stream.skipToEnd(); 57 | return 'quote'; 58 | } 59 | if ((stream.match(/[A-Z]/) && stream.match(/[A-Z]/)) || (stream.match(/[a-z]/) && stream.match(/[a-z]/))) { 60 | return 'attribute'; 61 | } 62 | } 63 | stream.eatWhile(/[\w-]/); 64 | var cur = stream.current(); 65 | return words.hasOwnProperty(cur) ? words[cur] : null; 66 | } 67 | 68 | function tokenize(stream, state) { 69 | return (state.tokens[0] || tokenBase) (stream, state); 70 | }; 71 | 72 | return { 73 | startState: function() {return {tokens:[]};}, 74 | token: function(stream, state) { 75 | return tokenize(stream, state); 76 | } 77 | }; 78 | }); 79 | 80 | CodeMirror.defineMIME('text/troff', 'troff'); 81 | CodeMirror.defineMIME('text/x-troff', 'troff'); 82 | CodeMirror.defineMIME('application/x-troff', 'troff'); 83 | 84 | }); 85 | -------------------------------------------------------------------------------- /static/codemirror/vue/vue.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function (mod) { 5 | "use strict"; 6 | if (typeof exports === "object" && typeof module === "object") {// CommonJS 7 | mod(require("../../lib/codemirror"), 8 | require("../../addon/mode/overlay"), 9 | require("../xml/xml"), 10 | require("../javascript/javascript"), 11 | require("../coffeescript/coffeescript"), 12 | require("../css/css"), 13 | require("../sass/sass"), 14 | require("../stylus/stylus"), 15 | require("../pug/pug"), 16 | require("../handlebars/handlebars")); 17 | } else if (typeof define === "function" && define.amd) { // AMD 18 | define(["../../lib/codemirror", 19 | "../../addon/mode/overlay", 20 | "../xml/xml", 21 | "../javascript/javascript", 22 | "../coffeescript/coffeescript", 23 | "../css/css", 24 | "../sass/sass", 25 | "../stylus/stylus", 26 | "../pug/pug", 27 | "../handlebars/handlebars"], mod); 28 | } else { // Plain browser env 29 | mod(CodeMirror); 30 | } 31 | })(function (CodeMirror) { 32 | var tagLanguages = { 33 | script: [ 34 | ["lang", /coffee(script)?/, "coffeescript"], 35 | ["type", /^(?:text|application)\/(?:x-)?coffee(?:script)?$/, "coffeescript"], 36 | ["lang", /^babel$/, "javascript"], 37 | ["type", /^text\/babel$/, "javascript"], 38 | ["type", /^text\/ecmascript-\d+$/, "javascript"] 39 | ], 40 | style: [ 41 | ["lang", /^stylus$/i, "stylus"], 42 | ["lang", /^sass$/i, "sass"], 43 | ["lang", /^less$/i, "text/x-less"], 44 | ["lang", /^scss$/i, "text/x-scss"], 45 | ["type", /^(text\/)?(x-)?styl(us)?$/i, "stylus"], 46 | ["type", /^text\/sass/i, "sass"], 47 | ["type", /^(text\/)?(x-)?scss$/i, "text/x-scss"], 48 | ["type", /^(text\/)?(x-)?less$/i, "text/x-less"] 49 | ], 50 | template: [ 51 | ["lang", /^vue-template$/i, "vue"], 52 | ["lang", /^pug$/i, "pug"], 53 | ["lang", /^handlebars$/i, "handlebars"], 54 | ["type", /^(text\/)?(x-)?pug$/i, "pug"], 55 | ["type", /^text\/x-handlebars-template$/i, "handlebars"], 56 | [null, null, "vue-template"] 57 | ] 58 | }; 59 | 60 | CodeMirror.defineMode("vue-template", function (config, parserConfig) { 61 | var mustacheOverlay = { 62 | token: function (stream) { 63 | if (stream.match(/^\{\{.*?\}\}/)) return "meta mustache"; 64 | while (stream.next() && !stream.match("{{", false)) {} 65 | return null; 66 | } 67 | }; 68 | return CodeMirror.overlayMode(CodeMirror.getMode(config, parserConfig.backdrop || "text/html"), mustacheOverlay); 69 | }); 70 | 71 | CodeMirror.defineMode("vue", function (config) { 72 | return CodeMirror.getMode(config, {name: "htmlmixed", tags: tagLanguages}); 73 | }, "htmlmixed", "xml", "javascript", "coffeescript", "css", "sass", "stylus", "pug", "handlebars"); 74 | 75 | CodeMirror.defineMIME("script/x-vue", "vue"); 76 | CodeMirror.defineMIME("text/x-vue", "vue"); 77 | }); 78 | -------------------------------------------------------------------------------- /static/codemirror/vue/vue.min.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function (mod) { 5 | "use strict"; 6 | if (typeof exports === "object" && typeof module === "object") {// CommonJS 7 | mod(require("../../lib/codemirror"), 8 | require("../../addon/mode/overlay"), 9 | require("../xml/xml"), 10 | require("../javascript/javascript"), 11 | require("../coffeescript/coffeescript"), 12 | require("../css/css"), 13 | require("../sass/sass"), 14 | require("../stylus/stylus"), 15 | require("../pug/pug"), 16 | require("../handlebars/handlebars")); 17 | } else if (typeof define === "function" && define.amd) { // AMD 18 | define(["../../lib/codemirror", 19 | "../../addon/mode/overlay", 20 | "../xml/xml", 21 | "../javascript/javascript", 22 | "../coffeescript/coffeescript", 23 | "../css/css", 24 | "../sass/sass", 25 | "../stylus/stylus", 26 | "../pug/pug", 27 | "../handlebars/handlebars"], mod); 28 | } else { // Plain browser env 29 | mod(CodeMirror); 30 | } 31 | })(function (CodeMirror) { 32 | var tagLanguages = { 33 | script: [ 34 | ["lang", /coffee(script)?/, "coffeescript"], 35 | ["type", /^(?:text|application)\/(?:x-)?coffee(?:script)?$/, "coffeescript"], 36 | ["lang", /^babel$/, "javascript"], 37 | ["type", /^text\/babel$/, "javascript"], 38 | ["type", /^text\/ecmascript-\d+$/, "javascript"] 39 | ], 40 | style: [ 41 | ["lang", /^stylus$/i, "stylus"], 42 | ["lang", /^sass$/i, "sass"], 43 | ["lang", /^less$/i, "text/x-less"], 44 | ["lang", /^scss$/i, "text/x-scss"], 45 | ["type", /^(text\/)?(x-)?styl(us)?$/i, "stylus"], 46 | ["type", /^text\/sass/i, "sass"], 47 | ["type", /^(text\/)?(x-)?scss$/i, "text/x-scss"], 48 | ["type", /^(text\/)?(x-)?less$/i, "text/x-less"] 49 | ], 50 | template: [ 51 | ["lang", /^vue-template$/i, "vue"], 52 | ["lang", /^pug$/i, "pug"], 53 | ["lang", /^handlebars$/i, "handlebars"], 54 | ["type", /^(text\/)?(x-)?pug$/i, "pug"], 55 | ["type", /^text\/x-handlebars-template$/i, "handlebars"], 56 | [null, null, "vue-template"] 57 | ] 58 | }; 59 | 60 | CodeMirror.defineMode("vue-template", function (config, parserConfig) { 61 | var mustacheOverlay = { 62 | token: function (stream) { 63 | if (stream.match(/^\{\{.*?\}\}/)) return "meta mustache"; 64 | while (stream.next() && !stream.match("{{", false)) {} 65 | return null; 66 | } 67 | }; 68 | return CodeMirror.overlayMode(CodeMirror.getMode(config, parserConfig.backdrop || "text/html"), mustacheOverlay); 69 | }); 70 | 71 | CodeMirror.defineMode("vue", function (config) { 72 | return CodeMirror.getMode(config, {name: "htmlmixed", tags: tagLanguages}); 73 | }, "htmlmixed", "xml", "javascript", "coffeescript", "css", "sass", "stylus", "pug", "handlebars"); 74 | 75 | CodeMirror.defineMIME("script/x-vue", "vue"); 76 | CodeMirror.defineMIME("text/x-vue", "vue"); 77 | }); 78 | -------------------------------------------------------------------------------- /static/codemirror/yaml-frontmatter/yaml-frontmatter.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function (mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror"), require("../yaml/yaml")) 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror", "../yaml/yaml"], mod) 9 | else // Plain browser env 10 | mod(CodeMirror) 11 | })(function (CodeMirror) { 12 | 13 | var START = 0, FRONTMATTER = 1, BODY = 2 14 | 15 | // a mixed mode for Markdown text with an optional YAML front matter 16 | CodeMirror.defineMode("yaml-frontmatter", function (config, parserConfig) { 17 | var yamlMode = CodeMirror.getMode(config, "yaml") 18 | var innerMode = CodeMirror.getMode(config, parserConfig && parserConfig.base || "gfm") 19 | 20 | function curMode(state) { 21 | return state.state == BODY ? innerMode : yamlMode 22 | } 23 | 24 | return { 25 | startState: function () { 26 | return { 27 | state: START, 28 | inner: CodeMirror.startState(yamlMode) 29 | } 30 | }, 31 | copyState: function (state) { 32 | return { 33 | state: state.state, 34 | inner: CodeMirror.copyState(curMode(state), state.inner) 35 | } 36 | }, 37 | token: function (stream, state) { 38 | if (state.state == START) { 39 | if (stream.match(/---/, false)) { 40 | state.state = FRONTMATTER 41 | return yamlMode.token(stream, state.inner) 42 | } else { 43 | state.state = BODY 44 | state.inner = CodeMirror.startState(innerMode) 45 | return innerMode.token(stream, state.inner) 46 | } 47 | } else if (state.state == FRONTMATTER) { 48 | var end = stream.sol() && stream.match(/---/, false) 49 | var style = yamlMode.token(stream, state.inner) 50 | if (end) { 51 | state.state = BODY 52 | state.inner = CodeMirror.startState(innerMode) 53 | } 54 | return style 55 | } else { 56 | return innerMode.token(stream, state.inner) 57 | } 58 | }, 59 | innerMode: function (state) { 60 | return {mode: curMode(state), state: state.inner} 61 | }, 62 | blankLine: function (state) { 63 | var mode = curMode(state) 64 | if (mode.blankLine) return mode.blankLine(state.inner) 65 | } 66 | } 67 | }) 68 | }); 69 | -------------------------------------------------------------------------------- /static/codemirror/yaml-frontmatter/yaml-frontmatter.min.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function (mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror"), require("../yaml/yaml")) 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror", "../yaml/yaml"], mod) 9 | else // Plain browser env 10 | mod(CodeMirror) 11 | })(function (CodeMirror) { 12 | 13 | var START = 0, FRONTMATTER = 1, BODY = 2 14 | 15 | // a mixed mode for Markdown text with an optional YAML front matter 16 | CodeMirror.defineMode("yaml-frontmatter", function (config, parserConfig) { 17 | var yamlMode = CodeMirror.getMode(config, "yaml") 18 | var innerMode = CodeMirror.getMode(config, parserConfig && parserConfig.base || "gfm") 19 | 20 | function curMode(state) { 21 | return state.state == BODY ? innerMode : yamlMode 22 | } 23 | 24 | return { 25 | startState: function () { 26 | return { 27 | state: START, 28 | inner: CodeMirror.startState(yamlMode) 29 | } 30 | }, 31 | copyState: function (state) { 32 | return { 33 | state: state.state, 34 | inner: CodeMirror.copyState(curMode(state), state.inner) 35 | } 36 | }, 37 | token: function (stream, state) { 38 | if (state.state == START) { 39 | if (stream.match(/---/, false)) { 40 | state.state = FRONTMATTER 41 | return yamlMode.token(stream, state.inner) 42 | } else { 43 | state.state = BODY 44 | state.inner = CodeMirror.startState(innerMode) 45 | return innerMode.token(stream, state.inner) 46 | } 47 | } else if (state.state == FRONTMATTER) { 48 | var end = stream.sol() && stream.match(/---/, false) 49 | var style = yamlMode.token(stream, state.inner) 50 | if (end) { 51 | state.state = BODY 52 | state.inner = CodeMirror.startState(innerMode) 53 | } 54 | return style 55 | } else { 56 | return innerMode.token(stream, state.inner) 57 | } 58 | }, 59 | innerMode: function (state) { 60 | return {mode: curMode(state), state: state.inner} 61 | }, 62 | blankLine: function (state) { 63 | var mode = curMode(state) 64 | if (mode.blankLine) return mode.blankLine(state.inner) 65 | } 66 | } 67 | }) 68 | }); 69 | -------------------------------------------------------------------------------- /static/codemirror/yaml/yaml.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode("yaml", function() { 15 | 16 | var cons = ['true', 'false', 'on', 'off', 'yes', 'no']; 17 | var keywordRegex = new RegExp("\\b(("+cons.join(")|(")+"))$", 'i'); 18 | 19 | return { 20 | token: function(stream, state) { 21 | var ch = stream.peek(); 22 | var esc = state.escaped; 23 | state.escaped = false; 24 | /* comments */ 25 | if (ch == "#" && (stream.pos == 0 || /\s/.test(stream.string.charAt(stream.pos - 1)))) { 26 | stream.skipToEnd(); 27 | return "comment"; 28 | } 29 | 30 | if (stream.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/)) 31 | return "string"; 32 | 33 | if (state.literal && stream.indentation() > state.keyCol) { 34 | stream.skipToEnd(); return "string"; 35 | } else if (state.literal) { state.literal = false; } 36 | if (stream.sol()) { 37 | state.keyCol = 0; 38 | state.pair = false; 39 | state.pairStart = false; 40 | /* document start */ 41 | if(stream.match(/---/)) { return "def"; } 42 | /* document end */ 43 | if (stream.match(/\.\.\./)) { return "def"; } 44 | /* array list item */ 45 | if (stream.match(/\s*-\s+/)) { return 'meta'; } 46 | } 47 | /* inline pairs/lists */ 48 | if (stream.match(/^(\{|\}|\[|\])/)) { 49 | if (ch == '{') 50 | state.inlinePairs++; 51 | else if (ch == '}') 52 | state.inlinePairs--; 53 | else if (ch == '[') 54 | state.inlineList++; 55 | else 56 | state.inlineList--; 57 | return 'meta'; 58 | } 59 | 60 | /* list seperator */ 61 | if (state.inlineList > 0 && !esc && ch == ',') { 62 | stream.next(); 63 | return 'meta'; 64 | } 65 | /* pairs seperator */ 66 | if (state.inlinePairs > 0 && !esc && ch == ',') { 67 | state.keyCol = 0; 68 | state.pair = false; 69 | state.pairStart = false; 70 | stream.next(); 71 | return 'meta'; 72 | } 73 | 74 | /* start of value of a pair */ 75 | if (state.pairStart) { 76 | /* block literals */ 77 | if (stream.match(/^\s*(\||\>)\s*/)) { state.literal = true; return 'meta'; }; 78 | /* references */ 79 | if (stream.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i)) { return 'variable-2'; } 80 | /* numbers */ 81 | if (state.inlinePairs == 0 && stream.match(/^\s*-?[0-9\.\,]+\s?$/)) { return 'number'; } 82 | if (state.inlinePairs > 0 && stream.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/)) { return 'number'; } 83 | /* keywords */ 84 | if (stream.match(keywordRegex)) { return 'keyword'; } 85 | } 86 | 87 | /* pairs (associative arrays) -> key */ 88 | if (!state.pair && stream.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)) { 89 | state.pair = true; 90 | state.keyCol = stream.indentation(); 91 | return "atom"; 92 | } 93 | if (state.pair && stream.match(/^:\s*/)) { state.pairStart = true; return 'meta'; } 94 | 95 | /* nothing found, continue */ 96 | state.pairStart = false; 97 | state.escaped = (ch == '\\'); 98 | stream.next(); 99 | return null; 100 | }, 101 | startState: function() { 102 | return { 103 | pair: false, 104 | pairStart: false, 105 | keyCol: 0, 106 | inlinePairs: 0, 107 | inlineList: 0, 108 | literal: false, 109 | escaped: false 110 | }; 111 | }, 112 | lineComment: "#" 113 | }; 114 | }); 115 | 116 | CodeMirror.defineMIME("text/x-yaml", "yaml"); 117 | CodeMirror.defineMIME("text/yaml", "yaml"); 118 | 119 | }); 120 | -------------------------------------------------------------------------------- /static/codemirror/yaml/yaml.min.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode("yaml", function() { 15 | 16 | var cons = ['true', 'false', 'on', 'off', 'yes', 'no']; 17 | var keywordRegex = new RegExp("\\b(("+cons.join(")|(")+"))$", 'i'); 18 | 19 | return { 20 | token: function(stream, state) { 21 | var ch = stream.peek(); 22 | var esc = state.escaped; 23 | state.escaped = false; 24 | /* comments */ 25 | if (ch == "#" && (stream.pos == 0 || /\s/.test(stream.string.charAt(stream.pos - 1)))) { 26 | stream.skipToEnd(); 27 | return "comment"; 28 | } 29 | 30 | if (stream.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/)) 31 | return "string"; 32 | 33 | if (state.literal && stream.indentation() > state.keyCol) { 34 | stream.skipToEnd(); return "string"; 35 | } else if (state.literal) { state.literal = false; } 36 | if (stream.sol()) { 37 | state.keyCol = 0; 38 | state.pair = false; 39 | state.pairStart = false; 40 | /* document start */ 41 | if(stream.match(/---/)) { return "def"; } 42 | /* document end */ 43 | if (stream.match(/\.\.\./)) { return "def"; } 44 | /* array list item */ 45 | if (stream.match(/\s*-\s+/)) { return 'meta'; } 46 | } 47 | /* inline pairs/lists */ 48 | if (stream.match(/^(\{|\}|\[|\])/)) { 49 | if (ch == '{') 50 | state.inlinePairs++; 51 | else if (ch == '}') 52 | state.inlinePairs--; 53 | else if (ch == '[') 54 | state.inlineList++; 55 | else 56 | state.inlineList--; 57 | return 'meta'; 58 | } 59 | 60 | /* list seperator */ 61 | if (state.inlineList > 0 && !esc && ch == ',') { 62 | stream.next(); 63 | return 'meta'; 64 | } 65 | /* pairs seperator */ 66 | if (state.inlinePairs > 0 && !esc && ch == ',') { 67 | state.keyCol = 0; 68 | state.pair = false; 69 | state.pairStart = false; 70 | stream.next(); 71 | return 'meta'; 72 | } 73 | 74 | /* start of value of a pair */ 75 | if (state.pairStart) { 76 | /* block literals */ 77 | if (stream.match(/^\s*(\||\>)\s*/)) { state.literal = true; return 'meta'; }; 78 | /* references */ 79 | if (stream.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i)) { return 'variable-2'; } 80 | /* numbers */ 81 | if (state.inlinePairs == 0 && stream.match(/^\s*-?[0-9\.\,]+\s?$/)) { return 'number'; } 82 | if (state.inlinePairs > 0 && stream.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/)) { return 'number'; } 83 | /* keywords */ 84 | if (stream.match(keywordRegex)) { return 'keyword'; } 85 | } 86 | 87 | /* pairs (associative arrays) -> key */ 88 | if (!state.pair && stream.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)) { 89 | state.pair = true; 90 | state.keyCol = stream.indentation(); 91 | return "atom"; 92 | } 93 | if (state.pair && stream.match(/^:\s*/)) { state.pairStart = true; return 'meta'; } 94 | 95 | /* nothing found, continue */ 96 | state.pairStart = false; 97 | state.escaped = (ch == '\\'); 98 | stream.next(); 99 | return null; 100 | }, 101 | startState: function() { 102 | return { 103 | pair: false, 104 | pairStart: false, 105 | keyCol: 0, 106 | inlinePairs: 0, 107 | inlineList: 0, 108 | literal: false, 109 | escaped: false 110 | }; 111 | }, 112 | lineComment: "#", 113 | fold: "indent" 114 | }; 115 | }); 116 | 117 | CodeMirror.defineMIME("text/x-yaml", "yaml"); 118 | CodeMirror.defineMIME("text/yaml", "yaml"); 119 | 120 | }); 121 | -------------------------------------------------------------------------------- /static/codemirror/z80/z80.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode('z80', function(_config, parserConfig) { 15 | var ez80 = parserConfig.ez80; 16 | var keywords1, keywords2; 17 | if (ez80) { 18 | keywords1 = /^(exx?|(ld|cp)([di]r?)?|[lp]ea|pop|push|ad[cd]|cpl|daa|dec|inc|neg|sbc|sub|and|bit|[cs]cf|x?or|res|set|r[lr]c?a?|r[lr]d|s[lr]a|srl|djnz|nop|[de]i|halt|im|in([di]mr?|ir?|irx|2r?)|ot(dmr?|[id]rx|imr?)|out(0?|[di]r?|[di]2r?)|tst(io)?|slp)(\.([sl]?i)?[sl])?\b/i; 19 | keywords2 = /^(((call|j[pr]|rst|ret[in]?)(\.([sl]?i)?[sl])?)|(rs|st)mix)\b/i; 20 | } else { 21 | keywords1 = /^(exx?|(ld|cp|in)([di]r?)?|pop|push|ad[cd]|cpl|daa|dec|inc|neg|sbc|sub|and|bit|[cs]cf|x?or|res|set|r[lr]c?a?|r[lr]d|s[lr]a|srl|djnz|nop|rst|[de]i|halt|im|ot[di]r|out[di]?)\b/i; 22 | keywords2 = /^(call|j[pr]|ret[in]?|b_?(call|jump))\b/i; 23 | } 24 | 25 | var variables1 = /^(af?|bc?|c|de?|e|hl?|l|i[xy]?|r|sp)\b/i; 26 | var variables2 = /^(n?[zc]|p[oe]?|m)\b/i; 27 | var errors = /^([hl][xy]|i[xy][hl]|slia|sll)\b/i; 28 | var numbers = /^([\da-f]+h|[0-7]+o|[01]+b|\d+d?)\b/i; 29 | 30 | return { 31 | startState: function() { 32 | return { 33 | context: 0 34 | }; 35 | }, 36 | token: function(stream, state) { 37 | if (!stream.column()) 38 | state.context = 0; 39 | 40 | if (stream.eatSpace()) 41 | return null; 42 | 43 | var w; 44 | 45 | if (stream.eatWhile(/\w/)) { 46 | if (ez80 && stream.eat('.')) { 47 | stream.eatWhile(/\w/); 48 | } 49 | w = stream.current(); 50 | 51 | if (stream.indentation()) { 52 | if ((state.context == 1 || state.context == 4) && variables1.test(w)) { 53 | state.context = 4; 54 | return 'var2'; 55 | } 56 | 57 | if (state.context == 2 && variables2.test(w)) { 58 | state.context = 4; 59 | return 'var3'; 60 | } 61 | 62 | if (keywords1.test(w)) { 63 | state.context = 1; 64 | return 'keyword'; 65 | } else if (keywords2.test(w)) { 66 | state.context = 2; 67 | return 'keyword'; 68 | } else if (state.context == 4 && numbers.test(w)) { 69 | return 'number'; 70 | } 71 | 72 | if (errors.test(w)) 73 | return 'error'; 74 | } else if (stream.match(numbers)) { 75 | return 'number'; 76 | } else { 77 | return null; 78 | } 79 | } else if (stream.eat(';')) { 80 | stream.skipToEnd(); 81 | return 'comment'; 82 | } else if (stream.eat('"')) { 83 | while (w = stream.next()) { 84 | if (w == '"') 85 | break; 86 | 87 | if (w == '\\') 88 | stream.next(); 89 | } 90 | return 'string'; 91 | } else if (stream.eat('\'')) { 92 | if (stream.match(/\\?.'/)) 93 | return 'number'; 94 | } else if (stream.eat('.') || stream.sol() && stream.eat('#')) { 95 | state.context = 5; 96 | 97 | if (stream.eatWhile(/\w/)) 98 | return 'def'; 99 | } else if (stream.eat('$')) { 100 | if (stream.eatWhile(/[\da-f]/i)) 101 | return 'number'; 102 | } else if (stream.eat('%')) { 103 | if (stream.eatWhile(/[01]/)) 104 | return 'number'; 105 | } else { 106 | stream.next(); 107 | } 108 | return null; 109 | } 110 | }; 111 | }); 112 | 113 | CodeMirror.defineMIME("text/x-z80", "z80"); 114 | CodeMirror.defineMIME("text/x-ez80", { name: "z80", ez80: true }); 115 | 116 | }); 117 | -------------------------------------------------------------------------------- /static/codemirror/z80/z80.min.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode('z80', function(_config, parserConfig) { 15 | var ez80 = parserConfig.ez80; 16 | var keywords1, keywords2; 17 | if (ez80) { 18 | keywords1 = /^(exx?|(ld|cp)([di]r?)?|[lp]ea|pop|push|ad[cd]|cpl|daa|dec|inc|neg|sbc|sub|and|bit|[cs]cf|x?or|res|set|r[lr]c?a?|r[lr]d|s[lr]a|srl|djnz|nop|[de]i|halt|im|in([di]mr?|ir?|irx|2r?)|ot(dmr?|[id]rx|imr?)|out(0?|[di]r?|[di]2r?)|tst(io)?|slp)(\.([sl]?i)?[sl])?\b/i; 19 | keywords2 = /^(((call|j[pr]|rst|ret[in]?)(\.([sl]?i)?[sl])?)|(rs|st)mix)\b/i; 20 | } else { 21 | keywords1 = /^(exx?|(ld|cp|in)([di]r?)?|pop|push|ad[cd]|cpl|daa|dec|inc|neg|sbc|sub|and|bit|[cs]cf|x?or|res|set|r[lr]c?a?|r[lr]d|s[lr]a|srl|djnz|nop|rst|[de]i|halt|im|ot[di]r|out[di]?)\b/i; 22 | keywords2 = /^(call|j[pr]|ret[in]?|b_?(call|jump))\b/i; 23 | } 24 | 25 | var variables1 = /^(af?|bc?|c|de?|e|hl?|l|i[xy]?|r|sp)\b/i; 26 | var variables2 = /^(n?[zc]|p[oe]?|m)\b/i; 27 | var errors = /^([hl][xy]|i[xy][hl]|slia|sll)\b/i; 28 | var numbers = /^([\da-f]+h|[0-7]+o|[01]+b|\d+d?)\b/i; 29 | 30 | return { 31 | startState: function() { 32 | return { 33 | context: 0 34 | }; 35 | }, 36 | token: function(stream, state) { 37 | if (!stream.column()) 38 | state.context = 0; 39 | 40 | if (stream.eatSpace()) 41 | return null; 42 | 43 | var w; 44 | 45 | if (stream.eatWhile(/\w/)) { 46 | if (ez80 && stream.eat('.')) { 47 | stream.eatWhile(/\w/); 48 | } 49 | w = stream.current(); 50 | 51 | if (stream.indentation()) { 52 | if ((state.context == 1 || state.context == 4) && variables1.test(w)) { 53 | state.context = 4; 54 | return 'var2'; 55 | } 56 | 57 | if (state.context == 2 && variables2.test(w)) { 58 | state.context = 4; 59 | return 'var3'; 60 | } 61 | 62 | if (keywords1.test(w)) { 63 | state.context = 1; 64 | return 'keyword'; 65 | } else if (keywords2.test(w)) { 66 | state.context = 2; 67 | return 'keyword'; 68 | } else if (state.context == 4 && numbers.test(w)) { 69 | return 'number'; 70 | } 71 | 72 | if (errors.test(w)) 73 | return 'error'; 74 | } else if (stream.match(numbers)) { 75 | return 'number'; 76 | } else { 77 | return null; 78 | } 79 | } else if (stream.eat(';')) { 80 | stream.skipToEnd(); 81 | return 'comment'; 82 | } else if (stream.eat('"')) { 83 | while (w = stream.next()) { 84 | if (w == '"') 85 | break; 86 | 87 | if (w == '\\') 88 | stream.next(); 89 | } 90 | return 'string'; 91 | } else if (stream.eat('\'')) { 92 | if (stream.match(/\\?.'/)) 93 | return 'number'; 94 | } else if (stream.eat('.') || stream.sol() && stream.eat('#')) { 95 | state.context = 5; 96 | 97 | if (stream.eatWhile(/\w/)) 98 | return 'def'; 99 | } else if (stream.eat('$')) { 100 | if (stream.eatWhile(/[\da-f]/i)) 101 | return 'number'; 102 | } else if (stream.eat('%')) { 103 | if (stream.eatWhile(/[01]/)) 104 | return 'number'; 105 | } else { 106 | stream.next(); 107 | } 108 | return null; 109 | } 110 | }; 111 | }); 112 | 113 | CodeMirror.defineMIME("text/x-z80", "z80"); 114 | CodeMirror.defineMIME("text/x-ez80", { name: "z80", ez80: true }); 115 | 116 | }); 117 | -------------------------------------------------------------------------------- /static/encryption-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-papi/pastitude/c294987cdd4a9fb8c3782207047c33ddba6a44d8/static/encryption-icon.png -------------------------------------------------------------------------------- /static/fonts/dejavu-sans/DejaVuSansMono.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-papi/pastitude/c294987cdd4a9fb8c3782207047c33ddba6a44d8/static/fonts/dejavu-sans/DejaVuSansMono.ttf -------------------------------------------------------------------------------- /static/icons/lock.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /storage/redis/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /templates/pastitude.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Pastitude 7 | 8 | 9 | {% if data is defined %} 10 |
    11 |
    12 |
    13 | 14 |
    15 |
    16 |

    Paste is encrypted

    17 |

    Please enter decryption key:

    18 |

    19 | 20 |

    21 | 22 |
    23 | 24 |
    25 |
    26 |
      27 | 28 |
      29 | {% else %} 30 |
      31 |
        32 |
      • 33 | 37 | 45 | 49 |
      • 50 |
      • |
      • 51 |
      • 52 | 56 | 60 | 61 |
      • 62 | 63 |
      • 64 | {# #} 65 | 66 | 67 |
      • 68 |
      69 |
        70 |
      • 71 |
      • |
      • 72 |
      • 73 | File name: 74 |
      • 75 |
      • 76 |
      77 |
      78 | {% endif %} 79 |
      80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /utils.py: -------------------------------------------------------------------------------- 1 | import random 2 | import string 3 | 4 | 5 | def genereate_random_string(length): 6 | return ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(length)) 7 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | 3 | module.exports = { 4 | mode: 'production', 5 | entry: './resources/js/app/app.js', 6 | output: { 7 | filename: 'bundle.min.js', 8 | path: path.resolve(__dirname, 'static') 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /wsgi.py: -------------------------------------------------------------------------------- 1 | from pastitude import app as application 2 | 3 | if __name__ == "__main__": 4 | application.run() 5 | --------------------------------------------------------------------------------