├── .gitignore ├── README.md ├── css ├── codemirror.css ├── images │ ├── browse-icon.png │ ├── changes-icon.png │ ├── directory.png │ ├── dot.png │ ├── file.png │ ├── folder_open.png │ ├── glyphicons-halflings-white.png │ ├── glyphicons-halflings.png │ ├── history-icon.png │ ├── log-arrow.png │ ├── log-inset.png │ ├── refresh-icon.png │ ├── settings-icon.png │ └── spinner.svg ├── jqueryFileTree.css ├── mergely.css ├── style.css └── themes │ ├── ambiance-mobile.css │ ├── ambiance.css │ ├── blackboard.css │ ├── cobalt.css │ ├── eclipse.css │ ├── elegant.css │ ├── erlang-dark.css │ ├── lesser-dark.css │ ├── monokai.css │ ├── neat.css │ ├── night.css │ ├── rubyblue.css │ ├── solarized.css │ ├── twilight.css │ ├── vibrant-ink.css │ └── xq-dark.css ├── index.html ├── lib ├── addon │ └── mode │ │ └── loadmode.js ├── codemirror.js ├── codemirror.min.js ├── jquery-1.9.1.min.js ├── jqueryFileTree.js ├── mergely.js ├── mergely.min.js └── mode │ ├── apl │ ├── apl.js │ └── index.html │ ├── asterisk │ ├── asterisk.js │ └── index.html │ ├── clike │ ├── clike.js │ ├── index.html │ └── scala.html │ ├── clojure │ ├── clojure.js │ └── index.html │ ├── coffeescript │ ├── LICENSE │ ├── coffeescript.js │ └── index.html │ ├── commonlisp │ ├── commonlisp.js │ └── index.html │ ├── css │ ├── css.js │ ├── index.html │ └── test.js │ ├── d │ ├── d.js │ └── index.html │ ├── diff │ ├── diff.js │ └── index.html │ ├── ecl │ ├── ecl.js │ └── index.html │ ├── erlang │ ├── erlang.js │ └── index.html │ ├── gfm │ ├── gfm.js │ ├── index.html │ └── test.js │ ├── go │ ├── go.js │ └── index.html │ ├── groovy │ ├── groovy.js │ └── index.html │ ├── haskell │ ├── haskell.js │ └── index.html │ ├── haxe │ ├── haxe.js │ └── index.html │ ├── htmlembedded │ ├── htmlembedded.js │ └── index.html │ ├── htmlmixed │ ├── htmlmixed.js │ └── index.html │ ├── http │ ├── http.js │ └── index.html │ ├── javascript │ ├── index.html │ ├── javascript.js │ └── typescript.html │ ├── jinja2 │ ├── index.html │ └── jinja2.js │ ├── less │ ├── index.html │ └── less.js │ ├── lua │ ├── index.html │ └── lua.js │ ├── markdown │ ├── index.html │ ├── markdown.js │ └── test.js │ ├── meta.js │ ├── mysql │ ├── index.html │ └── mysql.js │ ├── ntriples │ ├── index.html │ └── ntriples.js │ ├── ocaml │ ├── index.html │ └── ocaml.js │ ├── pascal │ ├── LICENSE │ ├── index.html │ └── pascal.js │ ├── perl │ ├── LICENSE │ ├── index.html │ └── perl.js │ ├── php │ ├── index.html │ └── php.js │ ├── pig │ ├── index.html │ └── pig.js │ ├── plsql │ ├── index.html │ └── plsql.js │ ├── properties │ ├── index.html │ └── properties.js │ ├── python │ ├── LICENSE.txt │ ├── index.html │ └── python.js │ ├── q │ ├── index.html │ └── q.js │ ├── r │ ├── LICENSE │ ├── index.html │ └── r.js │ ├── rpm │ ├── changes │ │ ├── changes.js │ │ └── index.html │ └── spec │ │ ├── index.html │ │ ├── spec.css │ │ └── spec.js │ ├── rst │ ├── index.html │ └── rst.js │ ├── ruby │ ├── LICENSE │ ├── index.html │ └── ruby.js │ ├── rust │ ├── index.html │ └── rust.js │ ├── sass │ ├── index.html │ └── sass.js │ ├── scheme │ ├── index.html │ └── scheme.js │ ├── shell │ ├── index.html │ └── shell.js │ ├── sieve │ ├── LICENSE │ ├── index.html │ └── sieve.js │ ├── smalltalk │ ├── index.html │ └── smalltalk.js │ ├── smarty │ ├── index.html │ └── smarty.js │ ├── sparql │ ├── index.html │ └── sparql.js │ ├── sql │ ├── index.html │ └── sql.js │ ├── stex │ ├── index.html │ ├── stex.js │ └── test.js │ ├── tiddlywiki │ ├── index.html │ ├── tiddlywiki.css │ └── tiddlywiki.js │ ├── tiki │ ├── index.html │ ├── tiki.css │ └── tiki.js │ ├── turtle │ ├── index.html │ └── turtle.js │ ├── vb │ ├── LICENSE.txt │ ├── index.html │ └── vb.js │ ├── vbscript │ ├── index.html │ └── vbscript.js │ ├── velocity │ ├── index.html │ └── velocity.js │ ├── verilog │ ├── index.html │ └── verilog.js │ ├── xml │ ├── index.html │ └── xml.js │ ├── xquery │ ├── LICENSE │ ├── index.html │ ├── test.js │ └── xquery.js │ ├── yaml │ ├── index.html │ └── yaml.js │ └── z80 │ ├── index.html │ └── z80.js ├── package.json ├── release └── svn.app.zip ├── run.sh ├── screenshots ├── changes.png ├── diff.png ├── history.png └── repositories.png └── src ├── app.js ├── router.js ├── settingsProvider.js ├── svn.js └── widget ├── browse.js ├── changeItem.js ├── changeList.js ├── diffViewer.js ├── framebar.js ├── logItem.js ├── logList.js ├── navigation.js ├── popup.js ├── proplist.js ├── repoList.js ├── settings.js ├── statusBar.js └── toolbar.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .idea/ 3 | *.iml -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Changes](https://raw.github.com/moonsspoon/node-svn-webkit/master/screenshots/changes.png) 2 | ![History](https://raw.github.com/moonsspoon/node-svn-webkit/master/screenshots/history.png) 3 | ![Diff](https://raw.github.com/moonsspoon/node-svn-webkit/master/screenshots/diff.png) 4 | ![Repositories](https://raw.github.com/moonsspoon/node-svn-webkit/master/screenshots/repositories.png) 5 | -------------------------------------------------------------------------------- /css/images/browse-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/css/images/browse-icon.png -------------------------------------------------------------------------------- /css/images/changes-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/css/images/changes-icon.png -------------------------------------------------------------------------------- /css/images/directory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/css/images/directory.png -------------------------------------------------------------------------------- /css/images/dot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/css/images/dot.png -------------------------------------------------------------------------------- /css/images/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/css/images/file.png -------------------------------------------------------------------------------- /css/images/folder_open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/css/images/folder_open.png -------------------------------------------------------------------------------- /css/images/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/css/images/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /css/images/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/css/images/glyphicons-halflings.png -------------------------------------------------------------------------------- /css/images/history-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/css/images/history-icon.png -------------------------------------------------------------------------------- /css/images/log-arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/css/images/log-arrow.png -------------------------------------------------------------------------------- /css/images/log-inset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/css/images/log-inset.png -------------------------------------------------------------------------------- /css/images/refresh-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/css/images/refresh-icon.png -------------------------------------------------------------------------------- /css/images/settings-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/css/images/settings-icon.png -------------------------------------------------------------------------------- /css/images/spinner.svg: -------------------------------------------------------------------------------- 1 | 3 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /css/mergely.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2013 by Jamie Peabody, http://www.mergely.com 3 | * All rights reserved. 4 | * Version: 3.2 2013-02-24 5 | */ 6 | /* required */ 7 | .mergely-column textarea { width: 80px; height: 200px; } 8 | .mergely-column { float: left; } 9 | .mergely-margin { float: left; } 10 | .mergely-canvas { float: left; width: 28px; } 11 | 12 | /* resizeable */ 13 | .mergely-resizer { width: 100%; height: 100%; } 14 | 15 | /* style configuration */ 16 | /*.mergely-column { border: 1px solid #ccc; }*/ 17 | .mergely-active { border: 1px solid #a3d1ff; } 18 | 19 | .mergely.a.rhs.start { border-top: 1px solid #a3d1ff; } 20 | .mergely.a.lhs.start.end, 21 | .mergely.a.rhs.end { border-bottom: 1px solid #a3d1ff; } 22 | .mergely.a.rhs { background-color: #ddeeff; } 23 | 24 | .mergely.d.lhs { background-color: #edc0c0; } 25 | .mergely.d.lhs.end, 26 | .mergely.d.rhs.start.end { border-bottom: 1px solid #ff7f7f; } 27 | .mergely.d.rhs.start.end.first { border-bottom: 0; border-top: 1px solid #ff7f7f; } 28 | .mergely.d.lhs.start { border-top: 1px solid #ff7f7f; } 29 | 30 | .mergely.c.lhs, 31 | .mergely.c.rhs { background-color: #fafafa; } 32 | .mergely.c.lhs.start, 33 | .mergely.c.rhs.start { border-top: 1px solid #a3a3a3; } 34 | .mergely.c.lhs.end, 35 | .mergely.c.rhs.end { border-bottom: 1px solid #a3a3a3; } 36 | 37 | .mergely.ch.a.rhs { background-color: #ddeeff; } 38 | .mergely.ch.d.lhs { background-color: #edc0c0; text-decoration: line-through; color: #888; } 39 | -------------------------------------------------------------------------------- /css/themes/ambiance-mobile.css: -------------------------------------------------------------------------------- 1 | .cm-s-ambiance.CodeMirror { 2 | -webkit-box-shadow: none; 3 | -moz-box-shadow: none; 4 | -o-box-shadow: none; 5 | box-shadow: none; 6 | } 7 | -------------------------------------------------------------------------------- /css/themes/blackboard.css: -------------------------------------------------------------------------------- 1 | /* Port of TextMate's Blackboard theme */ 2 | 3 | .cm-s-blackboard.CodeMirror { background: #0C1021; color: #F8F8F8; } 4 | .cm-s-blackboard .CodeMirror-selected { background: #253B76 !important; } 5 | .cm-s-blackboard .CodeMirror-gutters { background: #0C1021; border-right: 0; } 6 | .cm-s-blackboard .CodeMirror-linenumber { color: #888; } 7 | .cm-s-blackboard .CodeMirror-cursor { border-left: 1px solid #A7A7A7 !important; } 8 | 9 | .cm-s-blackboard .cm-keyword { color: #FBDE2D; } 10 | .cm-s-blackboard .cm-atom { color: #D8FA3C; } 11 | .cm-s-blackboard .cm-number { color: #D8FA3C; } 12 | .cm-s-blackboard .cm-def { color: #8DA6CE; } 13 | .cm-s-blackboard .cm-variable { color: #FF6400; } 14 | .cm-s-blackboard .cm-operator { color: #FBDE2D;} 15 | .cm-s-blackboard .cm-comment { color: #AEAEAE; } 16 | .cm-s-blackboard .cm-string { color: #61CE3C; } 17 | .cm-s-blackboard .cm-string-2 { color: #61CE3C; } 18 | .cm-s-blackboard .cm-meta { color: #D8FA3C; } 19 | .cm-s-blackboard .cm-error { background: #9D1E15; color: #F8F8F8; } 20 | .cm-s-blackboard .cm-builtin { color: #8DA6CE; } 21 | .cm-s-blackboard .cm-tag { color: #8DA6CE; } 22 | .cm-s-blackboard .cm-attribute { color: #8DA6CE; } 23 | .cm-s-blackboard .cm-header { color: #FF6400; } 24 | .cm-s-blackboard .cm-hr { color: #AEAEAE; } 25 | .cm-s-blackboard .cm-link { color: #8DA6CE; } 26 | -------------------------------------------------------------------------------- /css/themes/cobalt.css: -------------------------------------------------------------------------------- 1 | .cm-s-cobalt.CodeMirror { background: #002240; color: white; } 2 | .cm-s-cobalt div.CodeMirror-selected { background: #b36539 !important; } 3 | .cm-s-cobalt .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; } 4 | .cm-s-cobalt .CodeMirror-linenumber { color: #d0d0d0; } 5 | .cm-s-cobalt .CodeMirror-cursor { border-left: 1px solid white !important; } 6 | 7 | .cm-s-cobalt span.cm-comment { color: #08f; } 8 | .cm-s-cobalt span.cm-atom { color: #845dc4; } 9 | .cm-s-cobalt span.cm-number, .cm-s-cobalt span.cm-attribute { color: #ff80e1; } 10 | .cm-s-cobalt span.cm-keyword { color: #ffee80; } 11 | .cm-s-cobalt span.cm-string { color: #3ad900; } 12 | .cm-s-cobalt span.cm-meta { color: #ff9d00; } 13 | .cm-s-cobalt span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #9effff; } 14 | .cm-s-cobalt span.cm-variable-3, .cm-s-cobalt span.cm-def { color: white; } 15 | .cm-s-cobalt span.cm-error { color: #9d1e15; } 16 | .cm-s-cobalt span.cm-bracket { color: #d8d8d8; } 17 | .cm-s-cobalt span.cm-builtin, .cm-s-cobalt span.cm-special { color: #ff9e59; } 18 | .cm-s-cobalt span.cm-link { color: #845dc4; } 19 | -------------------------------------------------------------------------------- /css/themes/eclipse.css: -------------------------------------------------------------------------------- 1 | .cm-s-eclipse span.cm-meta {color: #FF1717;} 2 | .cm-s-eclipse span.cm-keyword { line-height: 1em; font-weight: bold; color: #7F0055; } 3 | .cm-s-eclipse span.cm-atom {color: #219;} 4 | .cm-s-eclipse span.cm-number {color: #164;} 5 | .cm-s-eclipse span.cm-def {color: #00f;} 6 | .cm-s-eclipse span.cm-variable {color: black;} 7 | .cm-s-eclipse span.cm-variable-2 {color: #0000C0;} 8 | .cm-s-eclipse span.cm-variable-3 {color: #0000C0;} 9 | .cm-s-eclipse span.cm-property {color: black;} 10 | .cm-s-eclipse span.cm-operator {color: black;} 11 | .cm-s-eclipse span.cm-comment {color: #3F7F5F;} 12 | .cm-s-eclipse span.cm-string {color: #2A00FF;} 13 | .cm-s-eclipse span.cm-string-2 {color: #f50;} 14 | .cm-s-eclipse span.cm-error {color: #f00;} 15 | .cm-s-eclipse span.cm-qualifier {color: #555;} 16 | .cm-s-eclipse span.cm-builtin {color: #30a;} 17 | .cm-s-eclipse span.cm-bracket {color: #cc7;} 18 | .cm-s-eclipse span.cm-tag {color: #170;} 19 | .cm-s-eclipse span.cm-attribute {color: #00c;} 20 | .cm-s-eclipse span.cm-link {color: #219;} 21 | 22 | .cm-s-eclipse .CodeMirror-matchingbracket { 23 | border:1px solid grey; 24 | color:black !important;; 25 | } 26 | -------------------------------------------------------------------------------- /css/themes/elegant.css: -------------------------------------------------------------------------------- 1 | .cm-s-elegant span.cm-number, .cm-s-elegant span.cm-string, .cm-s-elegant span.cm-atom {color: #762;} 2 | .cm-s-elegant span.cm-comment {color: #262; font-style: italic; line-height: 1em;} 3 | .cm-s-elegant span.cm-meta {color: #555; font-style: italic; line-height: 1em;} 4 | .cm-s-elegant span.cm-variable {color: black;} 5 | .cm-s-elegant span.cm-variable-2 {color: #b11;} 6 | .cm-s-elegant span.cm-qualifier {color: #555;} 7 | .cm-s-elegant span.cm-keyword {color: #730;} 8 | .cm-s-elegant span.cm-builtin {color: #30a;} 9 | .cm-s-elegant span.cm-error {background-color: #fdd;} 10 | .cm-s-elegant span.cm-link {color: #762;} 11 | -------------------------------------------------------------------------------- /css/themes/erlang-dark.css: -------------------------------------------------------------------------------- 1 | .cm-s-erlang-dark.CodeMirror { background: #002240; color: white; } 2 | .cm-s-erlang-dark div.CodeMirror-selected { background: #b36539 !important; } 3 | .cm-s-erlang-dark .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; } 4 | .cm-s-erlang-dark .CodeMirror-linenumber { color: #d0d0d0; } 5 | .cm-s-erlang-dark .CodeMirror-cursor { border-left: 1px solid white !important; } 6 | 7 | .cm-s-erlang-dark span.cm-atom { color: #845dc4; } 8 | .cm-s-erlang-dark span.cm-attribute { color: #ff80e1; } 9 | .cm-s-erlang-dark span.cm-bracket { color: #ff9d00; } 10 | .cm-s-erlang-dark span.cm-builtin { color: #eeaaaa; } 11 | .cm-s-erlang-dark span.cm-comment { color: #7777ff; } 12 | .cm-s-erlang-dark span.cm-def { color: #ee77aa; } 13 | .cm-s-erlang-dark span.cm-error { color: #9d1e15; } 14 | .cm-s-erlang-dark span.cm-keyword { color: #ffee80; } 15 | .cm-s-erlang-dark span.cm-meta { color: #50fefe; } 16 | .cm-s-erlang-dark span.cm-number { color: #ffd0d0; } 17 | .cm-s-erlang-dark span.cm-operator { color: #dd1111; } 18 | .cm-s-erlang-dark span.cm-string { color: #3ad900; } 19 | .cm-s-erlang-dark span.cm-tag { color: #9effff; } 20 | .cm-s-erlang-dark span.cm-variable { color: #50fe50; } 21 | .cm-s-erlang-dark span.cm-variable-2 { color: #ee00ee; } 22 | -------------------------------------------------------------------------------- /css/themes/lesser-dark.css: -------------------------------------------------------------------------------- 1 | /* 2 | http://lesscss.org/ dark theme 3 | Ported to CodeMirror by Peter Kroon 4 | */ 5 | .cm-s-lesser-dark { 6 | line-height: 1.3em; 7 | } 8 | .cm-s-lesser-dark { 9 | font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', 'Monaco', Courier, monospace !important; 10 | } 11 | 12 | .cm-s-lesser-dark.CodeMirror { background: #262626; color: #EBEFE7; text-shadow: 0 -1px 1px #262626; } 13 | .cm-s-lesser-dark div.CodeMirror-selected {background: #45443B !important;} /* 33322B*/ 14 | .cm-s-lesser-dark .CodeMirror-cursor { border-left: 1px solid white !important; } 15 | .cm-s-lesser-dark pre { padding: 0 8px; }/*editable code holder*/ 16 | 17 | div.CodeMirror span.CodeMirror-matchingbracket { color: #7EFC7E; }/*65FC65*/ 18 | 19 | .cm-s-lesser-dark .CodeMirror-gutters { background: #262626; border-right:1px solid #aaa; } 20 | .cm-s-lesser-dark .CodeMirror-linenumber { color: #777; } 21 | 22 | .cm-s-lesser-dark span.cm-keyword { color: #599eff; } 23 | .cm-s-lesser-dark span.cm-atom { color: #C2B470; } 24 | .cm-s-lesser-dark span.cm-number { color: #B35E4D; } 25 | .cm-s-lesser-dark span.cm-def {color: white;} 26 | .cm-s-lesser-dark span.cm-variable { color:#D9BF8C; } 27 | .cm-s-lesser-dark span.cm-variable-2 { color: #669199; } 28 | .cm-s-lesser-dark span.cm-variable-3 { color: white; } 29 | .cm-s-lesser-dark span.cm-property {color: #92A75C;} 30 | .cm-s-lesser-dark span.cm-operator {color: #92A75C;} 31 | .cm-s-lesser-dark span.cm-comment { color: #666; } 32 | .cm-s-lesser-dark span.cm-string { color: #BCD279; } 33 | .cm-s-lesser-dark span.cm-string-2 {color: #f50;} 34 | .cm-s-lesser-dark span.cm-meta { color: #738C73; } 35 | .cm-s-lesser-dark span.cm-error { color: #9d1e15; } 36 | .cm-s-lesser-dark span.cm-qualifier {color: #555;} 37 | .cm-s-lesser-dark span.cm-builtin { color: #ff9e59; } 38 | .cm-s-lesser-dark span.cm-bracket { color: #EBEFE7; } 39 | .cm-s-lesser-dark span.cm-tag { color: #669199; } 40 | .cm-s-lesser-dark span.cm-attribute {color: #00c;} 41 | .cm-s-lesser-dark span.cm-header {color: #a0a;} 42 | .cm-s-lesser-dark span.cm-quote {color: #090;} 43 | .cm-s-lesser-dark span.cm-hr {color: #999;} 44 | .cm-s-lesser-dark span.cm-link {color: #00c;} 45 | -------------------------------------------------------------------------------- /css/themes/monokai.css: -------------------------------------------------------------------------------- 1 | /* Based on Sublime Text's Monokai theme */ 2 | 3 | .cm-s-monokai.CodeMirror {background: #272822; color: #f8f8f2;} 4 | .cm-s-monokai div.CodeMirror-selected {background: #49483E !important;} 5 | .cm-s-monokai .CodeMirror-gutters {background: #272822; border-right: 0px;} 6 | .cm-s-monokai .CodeMirror-linenumber {color: #d0d0d0;} 7 | .cm-s-monokai .CodeMirror-cursor {border-left: 1px solid #f8f8f0 !important;} 8 | 9 | .cm-s-monokai span.cm-comment {color: #75715e;} 10 | .cm-s-monokai span.cm-atom {color: #ae81ff;} 11 | .cm-s-monokai span.cm-number {color: #ae81ff;} 12 | 13 | .cm-s-monokai span.cm-property, .cm-s-monokai span.cm-attribute {color: #a6e22e;} 14 | .cm-s-monokai span.cm-keyword {color: #f92672;} 15 | .cm-s-monokai span.cm-string {color: #e6db74;} 16 | 17 | .cm-s-monokai span.cm-variable {color: #a6e22e;} 18 | .cm-s-monokai span.cm-variable-2 {color: #9effff;} 19 | .cm-s-monokai span.cm-def {color: #fd971f;} 20 | .cm-s-monokai span.cm-error {background: #f92672; color: #f8f8f0;} 21 | .cm-s-monokai span.cm-bracket {color: #f8f8f2;} 22 | .cm-s-monokai span.cm-tag {color: #f92672;} 23 | .cm-s-monokai span.cm-link {color: #ae81ff;} 24 | 25 | .cm-s-monokai .CodeMirror-matchingbracket { 26 | text-decoration: underline; 27 | color: white !important; 28 | } 29 | -------------------------------------------------------------------------------- /css/themes/neat.css: -------------------------------------------------------------------------------- 1 | .cm-s-neat span.cm-comment { color: #a86; } 2 | .cm-s-neat span.cm-keyword { line-height: 1em; font-weight: bold; color: blue; } 3 | .cm-s-neat span.cm-string { color: #a22; } 4 | .cm-s-neat span.cm-builtin { line-height: 1em; font-weight: bold; color: #077; } 5 | .cm-s-neat span.cm-special { line-height: 1em; font-weight: bold; color: #0aa; } 6 | .cm-s-neat span.cm-variable { color: black; } 7 | .cm-s-neat span.cm-number, .cm-s-neat span.cm-atom { color: #3a3; } 8 | .cm-s-neat span.cm-meta {color: #555;} 9 | .cm-s-neat span.cm-link { color: #3a3; } 10 | -------------------------------------------------------------------------------- /css/themes/night.css: -------------------------------------------------------------------------------- 1 | /* Loosely based on the Midnight Textmate theme */ 2 | 3 | .cm-s-night.CodeMirror { background: #0a001f; color: #f8f8f8; } 4 | .cm-s-night div.CodeMirror-selected { background: #447 !important; } 5 | .cm-s-night .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; } 6 | .cm-s-night .CodeMirror-linenumber { color: #f8f8f8; } 7 | .cm-s-night .CodeMirror-cursor { border-left: 1px solid white !important; } 8 | 9 | .cm-s-night span.cm-comment { color: #6900a1; } 10 | .cm-s-night span.cm-atom { color: #845dc4; } 11 | .cm-s-night span.cm-number, .cm-s-night span.cm-attribute { color: #ffd500; } 12 | .cm-s-night span.cm-keyword { color: #599eff; } 13 | .cm-s-night span.cm-string { color: #37f14a; } 14 | .cm-s-night span.cm-meta { color: #7678e2; } 15 | .cm-s-night span.cm-variable-2, .cm-s-night span.cm-tag { color: #99b2ff; } 16 | .cm-s-night span.cm-variable-3, .cm-s-night span.cm-def { color: white; } 17 | .cm-s-night span.cm-error { color: #9d1e15; } 18 | .cm-s-night span.cm-bracket { color: #8da6ce; } 19 | .cm-s-night span.cm-comment { color: #6900a1; } 20 | .cm-s-night span.cm-builtin, .cm-s-night span.cm-special { color: #ff9e59; } 21 | .cm-s-night span.cm-link { color: #845dc4; } 22 | -------------------------------------------------------------------------------- /css/themes/rubyblue.css: -------------------------------------------------------------------------------- 1 | .cm-s-rubyblue { font:13px/1.4em Trebuchet, Verdana, sans-serif; } /* - customized editor font - */ 2 | 3 | .cm-s-rubyblue.CodeMirror { background: #112435; color: white; } 4 | .cm-s-rubyblue div.CodeMirror-selected { background: #38566F !important; } 5 | .cm-s-rubyblue .CodeMirror-gutters { background: #1F4661; border-right: 7px solid #3E7087; } 6 | .cm-s-rubyblue .CodeMirror-linenumber { color: white; } 7 | .cm-s-rubyblue .CodeMirror-cursor { border-left: 1px solid white !important; } 8 | 9 | .cm-s-rubyblue span.cm-comment { color: #999; font-style:italic; line-height: 1em; } 10 | .cm-s-rubyblue span.cm-atom { color: #F4C20B; } 11 | .cm-s-rubyblue span.cm-number, .cm-s-rubyblue span.cm-attribute { color: #82C6E0; } 12 | .cm-s-rubyblue span.cm-keyword { color: #F0F; } 13 | .cm-s-rubyblue span.cm-string { color: #F08047; } 14 | .cm-s-rubyblue span.cm-meta { color: #F0F; } 15 | .cm-s-rubyblue span.cm-variable-2, .cm-s-rubyblue span.cm-tag { color: #7BD827; } 16 | .cm-s-rubyblue span.cm-variable-3, .cm-s-rubyblue span.cm-def { color: white; } 17 | .cm-s-rubyblue span.cm-error { color: #AF2018; } 18 | .cm-s-rubyblue span.cm-bracket { color: #F0F; } 19 | .cm-s-rubyblue span.cm-link { color: #F4C20B; } 20 | .cm-s-rubyblue span.CodeMirror-matchingbracket { color:#F0F !important; } 21 | .cm-s-rubyblue span.cm-builtin, .cm-s-rubyblue span.cm-special { color: #FF9D00; } 22 | -------------------------------------------------------------------------------- /css/themes/twilight.css: -------------------------------------------------------------------------------- 1 | .cm-s-twilight.CodeMirror { background: #141414; color: #f7f7f7; } /**/ 2 | .cm-s-twilight .CodeMirror-selected { background: #323232 !important; } /**/ 3 | 4 | .cm-s-twilight .CodeMirror-gutters { background: #222; border-right: 1px solid #aaa; } 5 | .cm-s-twilight .CodeMirror-linenumber { color: #aaa; } 6 | .cm-s-twilight .CodeMirror-cursor { border-left: 1px solid white !important; } 7 | 8 | .cm-s-twilight .cm-keyword { color: #f9ee98; } /**/ 9 | .cm-s-twilight .cm-atom { color: #FC0; } 10 | .cm-s-twilight .cm-number { color: #ca7841; } /**/ 11 | .cm-s-twilight .cm-def { color: #8DA6CE; } 12 | .cm-s-twilight span.cm-variable-2, .cm-s-twilight span.cm-tag { color: #607392; } /**/ 13 | .cm-s-twilight span.cm-variable-3, .cm-s-twilight span.cm-def { color: #607392; } /**/ 14 | .cm-s-twilight .cm-operator { color: #cda869; } /**/ 15 | .cm-s-twilight .cm-comment { color:#777; font-style:italic; font-weight:normal; } /**/ 16 | .cm-s-twilight .cm-string { color:#8f9d6a; font-style:italic; } /**/ 17 | .cm-s-twilight .cm-string-2 { color:#bd6b18 } /*?*/ 18 | .cm-s-twilight .cm-meta { background-color:#141414; color:#f7f7f7; } /*?*/ 19 | .cm-s-twilight .cm-error { border-bottom: 1px solid red; } 20 | .cm-s-twilight .cm-builtin { color: #cda869; } /*?*/ 21 | .cm-s-twilight .cm-tag { color: #997643; } /**/ 22 | .cm-s-twilight .cm-attribute { color: #d6bb6d; } /*?*/ 23 | .cm-s-twilight .cm-header { color: #FF6400; } 24 | .cm-s-twilight .cm-hr { color: #AEAEAE; } 25 | .cm-s-twilight .cm-link { color:#ad9361; font-style:italic; text-decoration:none; } /**/ 26 | 27 | -------------------------------------------------------------------------------- /css/themes/vibrant-ink.css: -------------------------------------------------------------------------------- 1 | /* Taken from the popular Visual Studio Vibrant Ink Schema */ 2 | 3 | .cm-s-vibrant-ink.CodeMirror { background: black; color: white; } 4 | .cm-s-vibrant-ink .CodeMirror-selected { background: #35493c !important; } 5 | 6 | .cm-s-vibrant-ink .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; } 7 | .cm-s-vibrant-ink .CodeMirror-linenumber { color: #d0d0d0; } 8 | .cm-s-vibrant-ink .CodeMirror-cursor { border-left: 1px solid white !important; } 9 | 10 | .cm-s-vibrant-ink .cm-keyword { color: #CC7832; } 11 | .cm-s-vibrant-ink .cm-atom { color: #FC0; } 12 | .cm-s-vibrant-ink .cm-number { color: #FFEE98; } 13 | .cm-s-vibrant-ink .cm-def { color: #8DA6CE; } 14 | .cm-s-vibrant-ink span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #FFC66D } 15 | .cm-s-vibrant-ink span.cm-variable-3, .cm-s-cobalt span.cm-def { color: #FFC66D } 16 | .cm-s-vibrant-ink .cm-operator { color: #888; } 17 | .cm-s-vibrant-ink .cm-comment { color: gray; font-weight: bold; } 18 | .cm-s-vibrant-ink .cm-string { color: #A5C25C } 19 | .cm-s-vibrant-ink .cm-string-2 { color: red } 20 | .cm-s-vibrant-ink .cm-meta { color: #D8FA3C; } 21 | .cm-s-vibrant-ink .cm-error { border-bottom: 1px solid red; } 22 | .cm-s-vibrant-ink .cm-builtin { color: #8DA6CE; } 23 | .cm-s-vibrant-ink .cm-tag { color: #8DA6CE; } 24 | .cm-s-vibrant-ink .cm-attribute { color: #8DA6CE; } 25 | .cm-s-vibrant-ink .cm-header { color: #FF6400; } 26 | .cm-s-vibrant-ink .cm-hr { color: #AEAEAE; } 27 | .cm-s-vibrant-ink .cm-link { color: blue; } 28 | -------------------------------------------------------------------------------- /css/themes/xq-dark.css: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2011 by MarkLogic Corporation 3 | Author: Mike Brevoort 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | */ 23 | .cm-s-xq-dark.CodeMirror { background: #0a001f; color: #f8f8f8; } 24 | .cm-s-xq-dark span.CodeMirror-selected { background: #a8f !important; } 25 | .cm-s-xq-dark .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; } 26 | .cm-s-xq-dark .CodeMirror-linenumber { color: #f8f8f8; } 27 | .cm-s-xq-dark .CodeMirror-cursor { border-left: 1px solid white !important; } 28 | 29 | .cm-s-xq-dark span.cm-keyword {color: #FFBD40;} 30 | .cm-s-xq-dark span.cm-atom {color: #6C8CD5;} 31 | .cm-s-xq-dark span.cm-number {color: #164;} 32 | .cm-s-xq-dark span.cm-def {color: #FFF; text-decoration:underline;} 33 | .cm-s-xq-dark span.cm-variable {color: #FFF;} 34 | .cm-s-xq-dark span.cm-variable-2 {color: #EEE;} 35 | .cm-s-xq-dark span.cm-variable-3 {color: #DDD;} 36 | .cm-s-xq-dark span.cm-property {} 37 | .cm-s-xq-dark span.cm-operator {} 38 | .cm-s-xq-dark span.cm-comment {color: gray;} 39 | .cm-s-xq-dark span.cm-string {color: #9FEE00;} 40 | .cm-s-xq-dark span.cm-meta {color: yellow;} 41 | .cm-s-xq-dark span.cm-error {color: #f00;} 42 | .cm-s-xq-dark span.cm-qualifier {color: #FFF700;} 43 | .cm-s-xq-dark span.cm-builtin {color: #30a;} 44 | .cm-s-xq-dark span.cm-bracket {color: #cc7;} 45 | .cm-s-xq-dark span.cm-tag {color: #FFBD40;} 46 | .cm-s-xq-dark span.cm-attribute {color: #FFF700;} 47 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SVN 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /lib/addon/mode/loadmode.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | if (!CodeMirror.modeURL) CodeMirror.modeURL = "../mode/%N/%N.js"; 3 | 4 | var loading = {}; 5 | function splitCallback(cont, n) { 6 | var countDown = n; 7 | return function() { if (--countDown == 0) cont(); }; 8 | } 9 | function ensureDeps(mode, cont) { 10 | var deps = CodeMirror.modes[mode].dependencies; 11 | if (!deps) return cont(); 12 | var missing = []; 13 | for (var i = 0; i < deps.length; ++i) { 14 | if (!CodeMirror.modes.hasOwnProperty(deps[i])) 15 | missing.push(deps[i]); 16 | } 17 | if (!missing.length) return cont(); 18 | var split = splitCallback(cont, missing.length); 19 | for (var i = 0; i < missing.length; ++i) 20 | CodeMirror.requireMode(missing[i], split); 21 | } 22 | 23 | CodeMirror.requireMode = function(mode, cont) { 24 | if (typeof mode != "string") mode = mode.name; 25 | if (CodeMirror.modes.hasOwnProperty(mode)) return ensureDeps(mode, cont); 26 | if (loading.hasOwnProperty(mode)) return loading[mode].push(cont); 27 | 28 | var script = document.createElement("script"); 29 | script.src = CodeMirror.modeURL.replace(/%N/g, mode); 30 | var others = document.getElementsByTagName("script")[0]; 31 | others.parentNode.insertBefore(script, others); 32 | var list = loading[mode] = [cont]; 33 | var count = 0, poll = setInterval(function() { 34 | if (++count > 100) return clearInterval(poll); 35 | if (CodeMirror.modes.hasOwnProperty(mode)) { 36 | clearInterval(poll); 37 | loading[mode] = null; 38 | ensureDeps(mode, function() { 39 | for (var i = 0; i < list.length; ++i) list[i](); 40 | }); 41 | } 42 | }, 200); 43 | }; 44 | 45 | CodeMirror.autoLoadMode = function(instance, mode) { 46 | if (!CodeMirror.modes.hasOwnProperty(mode)) 47 | CodeMirror.requireMode(mode, function() { 48 | instance.setOption("mode", instance.getOption("mode")); 49 | }); 50 | }; 51 | }()); 52 | -------------------------------------------------------------------------------- /lib/mode/apl/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: APL mode 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 |

CodeMirror: APL mode

17 | 18 |
44 | 45 | 52 | 53 |

Simple mode that tries to handle APL as well as it can.

54 |

It attempts to label functions/operators based upon 55 | monadic/dyadic usage (but this is far from fully fleshed out). 56 | This means there are meaningful classnames so hover states can 57 | have popups etc.

58 | 59 |

MIME types defined: text/apl (APL code)

60 | 61 | 62 | -------------------------------------------------------------------------------- /lib/mode/clike/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: C-like mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

CodeMirror: C-like mode

15 | 16 |
83 | 84 | 91 | 92 |

Simple mode that tries to handle C-like languages as well as it 93 | can. Takes two configuration parameters: keywords, an 94 | object whose property names are the keywords in the language, 95 | and useCPP, which determines whether C preprocessor 96 | directives are recognized.

97 | 98 |

MIME types defined: text/x-csrc 99 | (C code), text/x-c++src (C++ 100 | code), text/x-java (Java 101 | code), text/x-csharp (C#).

102 | 103 | 104 | -------------------------------------------------------------------------------- /lib/mode/clojure/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Clojure mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Clojure mode

14 |
60 | 63 | 64 |

MIME types defined: text/x-clojure.

65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /lib/mode/coffeescript/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2011 Jeff Pickhardt 4 | Modified from the Python CodeMirror mode, Copyright (c) 2010 Timothy Farrell 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. -------------------------------------------------------------------------------- /lib/mode/commonlisp/commonlisp.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("commonlisp", function (config) { 2 | var assumeBody = /^with|^def|^do|^prog|case$|^cond$|bind$|when$|unless$/; 3 | var numLiteral = /^(?:[+\-]?(?:\d+|\d*\.\d+)(?:[efd][+\-]?\d+)?|[+\-]?\d+(?:\/[+\-]?\d+)?|#b[+\-]?[01]+|#o[+\-]?[0-7]+|#x[+\-]?[\da-f]+)/; 4 | var symbol = /[^\s'`,@()\[\]";]/; 5 | var type; 6 | 7 | function readSym(stream) { 8 | var ch; 9 | while (ch = stream.next()) { 10 | if (ch == "\\") stream.next(); 11 | else if (!symbol.test(ch)) { stream.backUp(1); break; } 12 | } 13 | return stream.current(); 14 | } 15 | 16 | function base(stream, state) { 17 | if (stream.eatSpace()) {type = "ws"; return null;} 18 | if (stream.match(numLiteral)) return "number"; 19 | var ch = stream.next(); 20 | if (ch == "\\") ch = stream.next(); 21 | 22 | if (ch == '"') return (state.tokenize = inString)(stream, state); 23 | else if (ch == "(") { type = "open"; return "bracket"; } 24 | else if (ch == ")" || ch == "]") { type = "close"; return "bracket"; } 25 | else if (ch == ";") { stream.skipToEnd(); type = "ws"; return "comment"; } 26 | else if (/['`,@]/.test(ch)) return null; 27 | else if (ch == "|") { 28 | if (stream.skipTo("|")) { stream.next(); return "symbol"; } 29 | else { stream.skipToEnd(); return "error"; } 30 | } else if (ch == "#") { 31 | var ch = stream.next(); 32 | if (ch == "[") { type = "open"; return "bracket"; } 33 | else if (/[+\-=\.']/.test(ch)) return null; 34 | else if (/\d/.test(ch) && stream.match(/^\d*#/)) return null; 35 | else if (ch == "|") return (state.tokenize = inComment)(stream, state); 36 | else if (ch == ":") { readSym(stream); return "meta"; } 37 | else return "error"; 38 | } else { 39 | var name = readSym(stream); 40 | if (name == ".") return null; 41 | type = "symbol"; 42 | if (name == "nil" || name == "t") return "atom"; 43 | if (name.charAt(0) == ":") return "keyword"; 44 | if (name.charAt(0) == "&") return "variable-2"; 45 | return "variable"; 46 | } 47 | } 48 | 49 | function inString(stream, state) { 50 | var escaped = false, next; 51 | while (next = stream.next()) { 52 | if (next == '"' && !escaped) { state.tokenize = base; break; } 53 | escaped = !escaped && next == "\\"; 54 | } 55 | return "string"; 56 | } 57 | 58 | function inComment(stream, state) { 59 | var next, last; 60 | while (next = stream.next()) { 61 | if (next == "#" && last == "|") { state.tokenize = base; break; } 62 | last = next; 63 | } 64 | type = "ws"; 65 | return "comment"; 66 | } 67 | 68 | return { 69 | startState: function () { 70 | return {ctx: {prev: null, start: 0, indentTo: 0}, tokenize: base}; 71 | }, 72 | 73 | token: function (stream, state) { 74 | if (stream.sol() && typeof state.ctx.indentTo != "number") 75 | state.ctx.indentTo = state.ctx.start + 1; 76 | 77 | type = null; 78 | var style = state.tokenize(stream, state); 79 | if (type != "ws") { 80 | if (state.ctx.indentTo == null) { 81 | if (type == "symbol" && assumeBody.test(stream.current())) 82 | state.ctx.indentTo = state.ctx.start + config.indentUnit; 83 | else 84 | state.ctx.indentTo = "next"; 85 | } else if (state.ctx.indentTo == "next") { 86 | state.ctx.indentTo = stream.column(); 87 | } 88 | } 89 | if (type == "open") state.ctx = {prev: state.ctx, start: stream.column(), indentTo: null}; 90 | else if (type == "close") state.ctx = state.ctx.prev || state.ctx; 91 | return style; 92 | }, 93 | 94 | indent: function (state, _textAfter) { 95 | var i = state.ctx.indentTo; 96 | return typeof i == "number" ? i : state.ctx.start + 1; 97 | } 98 | }; 99 | }); 100 | 101 | CodeMirror.defineMIME("text/x-common-lisp", "commonlisp"); 102 | -------------------------------------------------------------------------------- /lib/mode/css/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: CSS mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: CSS mode

14 |
49 | 52 | 53 |

MIME types defined: text/css.

54 | 55 |

Parsing/Highlighting Tests: normal, verbose.

56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /lib/mode/diff/diff.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("diff", function() { 2 | 3 | var TOKEN_NAMES = { 4 | '+': 'positive', 5 | '-': 'negative', 6 | '@': 'meta' 7 | }; 8 | 9 | return { 10 | token: function(stream) { 11 | var tw_pos = stream.string.search(/[\t ]+?$/); 12 | 13 | if (!stream.sol() || tw_pos === 0) { 14 | stream.skipToEnd(); 15 | return ("error " + ( 16 | TOKEN_NAMES[stream.string.charAt(0)] || '')).replace(/ $/, ''); 17 | } 18 | 19 | var token_name = TOKEN_NAMES[stream.peek()] || stream.skipToEnd(); 20 | 21 | if (tw_pos === -1) { 22 | stream.skipToEnd(); 23 | } else { 24 | stream.pos = tw_pos; 25 | } 26 | 27 | return token_name; 28 | } 29 | }; 30 | }); 31 | 32 | CodeMirror.defineMIME("text/x-diff", "diff"); 33 | -------------------------------------------------------------------------------- /lib/mode/ecl/index.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | CodeMirror: ECL mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

CodeMirror: ECL mode

13 |
31 | 34 | 35 |

Based on CodeMirror's clike mode. For more information see HPCC Systems web site.

36 |

MIME types defined: text/x-ecl.

37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /lib/mode/erlang/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Erlang mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |

CodeMirror: Erlang mode

16 | 17 |
52 | 53 | 61 | 62 |

MIME types defined: text/x-erlang.

63 | 64 | 65 | -------------------------------------------------------------------------------- /lib/mode/gfm/gfm.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("gfm", function(config) { 2 | var codeDepth = 0; 3 | function blankLine(state) { 4 | state.code = false; 5 | return null; 6 | } 7 | var gfmOverlay = { 8 | startState: function() { 9 | return { 10 | code: false, 11 | codeBlock: false, 12 | ateSpace: false 13 | }; 14 | }, 15 | copyState: function(s) { 16 | return { 17 | code: s.code, 18 | codeBlock: s.codeBlock, 19 | ateSpace: s.ateSpace 20 | }; 21 | }, 22 | token: function(stream, state) { 23 | // Hack to prevent formatting override inside code blocks (block and inline) 24 | if (state.codeBlock) { 25 | if (stream.match(/^```/)) { 26 | state.codeBlock = false; 27 | return null; 28 | } 29 | stream.skipToEnd(); 30 | return null; 31 | } 32 | if (stream.sol()) { 33 | state.code = false; 34 | } 35 | if (stream.sol() && stream.match(/^```/)) { 36 | stream.skipToEnd(); 37 | state.codeBlock = true; 38 | return null; 39 | } 40 | // If this block is changed, it may need to be updated in Markdown mode 41 | if (stream.peek() === '`') { 42 | stream.next(); 43 | var before = stream.pos; 44 | stream.eatWhile('`'); 45 | var difference = 1 + stream.pos - before; 46 | if (!state.code) { 47 | codeDepth = difference; 48 | state.code = true; 49 | } else { 50 | if (difference === codeDepth) { // Must be exact 51 | state.code = false; 52 | } 53 | } 54 | return null; 55 | } else if (state.code) { 56 | stream.next(); 57 | return null; 58 | } 59 | // Check if space. If so, links can be formatted later on 60 | if (stream.eatSpace()) { 61 | state.ateSpace = true; 62 | return null; 63 | } 64 | if (stream.sol() || state.ateSpace) { 65 | state.ateSpace = false; 66 | if(stream.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?:[a-f0-9]{7,40}\b)/)) { 67 | // User/Project@SHA 68 | // User@SHA 69 | // SHA 70 | return "link"; 71 | } else if (stream.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/)) { 72 | // User/Project#Num 73 | // User#Num 74 | // #Num 75 | return "link"; 76 | } 77 | } 78 | if (stream.match(/^((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/i)) { 79 | // URLs 80 | // Taken from http://daringfireball.net/2010/07/improved_regex_for_matching_urls 81 | // And then (issue #1160) simplified to make it not crash the Chrome Regexp engine 82 | return "link"; 83 | } 84 | stream.next(); 85 | return null; 86 | }, 87 | blankLine: blankLine 88 | }; 89 | CodeMirror.defineMIME("gfmBase", { 90 | name: "markdown", 91 | underscoresBreakWords: false, 92 | fencedCodeBlocks: true 93 | }); 94 | return CodeMirror.overlayMode(CodeMirror.getMode(config, "gfmBase"), gfmOverlay); 95 | }, "markdown"); 96 | -------------------------------------------------------------------------------- /lib/mode/gfm/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: GFM mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |

CodeMirror: GFM mode

24 | 25 |
55 | 56 | 63 | 64 |

Optionally depends on other modes for properly highlighted code blocks.

65 | 66 |

Parsing/Highlighting Tests: normal, verbose.

67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /lib/mode/gfm/test.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var mode = CodeMirror.getMode({tabSize: 4}, "gfm"); 3 | function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } 4 | 5 | MT("emInWordAsterisk", 6 | "foo[em *bar*]hello"); 7 | 8 | MT("emInWordUnderscore", 9 | "foo_bar_hello"); 10 | 11 | MT("emStrongUnderscore", 12 | "[strong __][emstrong _foo__][em _] bar"); 13 | 14 | MT("fencedCodeBlocks", 15 | "[comment ```]", 16 | "[comment foo]", 17 | "", 18 | "[comment ```]", 19 | "bar"); 20 | 21 | MT("fencedCodeBlockModeSwitching", 22 | "[comment ```javascript]", 23 | "[variable foo]", 24 | "", 25 | "[comment ```]", 26 | "bar"); 27 | 28 | MT("SHA", 29 | "foo [link be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2] bar"); 30 | 31 | MT("shortSHA", 32 | "foo [link be6a8cc] bar"); 33 | 34 | MT("tooShortSHA", 35 | "foo be6a8c bar"); 36 | 37 | MT("longSHA", 38 | "foo be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd22 bar"); 39 | 40 | MT("badSHA", 41 | "foo be6a8cc1c1ecfe9489fb51e4869af15a13fc2cg2 bar"); 42 | 43 | MT("userSHA", 44 | "foo [link bar@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2] hello"); 45 | 46 | MT("userProjectSHA", 47 | "foo [link bar/hello@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2] world"); 48 | 49 | MT("num", 50 | "foo [link #1] bar"); 51 | 52 | MT("badNum", 53 | "foo #1bar hello"); 54 | 55 | MT("userNum", 56 | "foo [link bar#1] hello"); 57 | 58 | MT("userProjectNum", 59 | "foo [link bar/hello#1] world"); 60 | 61 | MT("vanillaLink", 62 | "foo [link http://www.example.com/] bar"); 63 | 64 | MT("vanillaLinkPunctuation", 65 | "foo [link http://www.example.com/]. bar"); 66 | 67 | MT("vanillaLinkExtension", 68 | "foo [link http://www.example.com/index.html] bar"); 69 | 70 | MT("notALink", 71 | "[comment ```css]", 72 | "[tag foo] {[property color][operator :][keyword black];}", 73 | "[comment ```][link http://www.example.com/]"); 74 | 75 | MT("notALink", 76 | "[comment ``foo `bar` http://www.example.com/``] hello"); 77 | 78 | MT("notALink", 79 | "[comment `foo]", 80 | "[link http://www.example.com/]", 81 | "[comment `foo]", 82 | "", 83 | "[link http://www.example.com/]"); 84 | })(); 85 | -------------------------------------------------------------------------------- /lib/mode/go/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Go mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |

CodeMirror: Go mode

16 | 17 |
60 | 61 | 71 | 72 |

MIME type: text/x-go

73 | 74 | 75 | -------------------------------------------------------------------------------- /lib/mode/groovy/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Groovy mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

CodeMirror: Groovy mode

15 | 16 |
62 | 63 | 70 | 71 |

MIME types defined: text/x-groovy

72 | 73 | 74 | -------------------------------------------------------------------------------- /lib/mode/haskell/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Haskell mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |

CodeMirror: Haskell mode

16 | 17 |
51 | 52 | 59 | 60 |

MIME types defined: text/x-haskell.

61 | 62 | 63 | -------------------------------------------------------------------------------- /lib/mode/haxe/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Haxe mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Haxe mode

14 | 15 |
79 | 80 | 87 | 88 |

MIME types defined: text/x-haxe.

89 | 90 | 91 | -------------------------------------------------------------------------------- /lib/mode/htmlembedded/htmlembedded.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("htmlembedded", function(config, parserConfig) { 2 | 3 | //config settings 4 | var scriptStartRegex = parserConfig.scriptStartRegex || /^<%/i, 5 | scriptEndRegex = parserConfig.scriptEndRegex || /^%>/i; 6 | 7 | //inner modes 8 | var scriptingMode, htmlMixedMode; 9 | 10 | //tokenizer when in html mode 11 | function htmlDispatch(stream, state) { 12 | if (stream.match(scriptStartRegex, false)) { 13 | state.token=scriptingDispatch; 14 | return scriptingMode.token(stream, state.scriptState); 15 | } 16 | else 17 | return htmlMixedMode.token(stream, state.htmlState); 18 | } 19 | 20 | //tokenizer when in scripting mode 21 | function scriptingDispatch(stream, state) { 22 | if (stream.match(scriptEndRegex, false)) { 23 | state.token=htmlDispatch; 24 | return htmlMixedMode.token(stream, state.htmlState); 25 | } 26 | else 27 | return scriptingMode.token(stream, state.scriptState); 28 | } 29 | 30 | 31 | return { 32 | startState: function() { 33 | scriptingMode = scriptingMode || CodeMirror.getMode(config, parserConfig.scriptingModeSpec); 34 | htmlMixedMode = htmlMixedMode || CodeMirror.getMode(config, "htmlmixed"); 35 | return { 36 | token : parserConfig.startOpen ? scriptingDispatch : htmlDispatch, 37 | htmlState : CodeMirror.startState(htmlMixedMode), 38 | scriptState : CodeMirror.startState(scriptingMode) 39 | }; 40 | }, 41 | 42 | token: function(stream, state) { 43 | return state.token(stream, state); 44 | }, 45 | 46 | indent: function(state, textAfter) { 47 | if (state.token == htmlDispatch) 48 | return htmlMixedMode.indent(state.htmlState, textAfter); 49 | else if (scriptingMode.indent) 50 | return scriptingMode.indent(state.scriptState, textAfter); 51 | }, 52 | 53 | copyState: function(state) { 54 | return { 55 | token : state.token, 56 | htmlState : CodeMirror.copyState(htmlMixedMode, state.htmlState), 57 | scriptState : CodeMirror.copyState(scriptingMode, state.scriptState) 58 | }; 59 | }, 60 | 61 | electricChars: "/{}:", 62 | 63 | innerMode: function(state) { 64 | if (state.token == scriptingDispatch) return {state: state.scriptState, mode: scriptingMode}; 65 | else return {state: state.htmlState, mode: htmlMixedMode}; 66 | } 67 | }; 68 | }, "htmlmixed"); 69 | 70 | CodeMirror.defineMIME("application/x-ejs", { name: "htmlembedded", scriptingModeSpec:"javascript"}); 71 | CodeMirror.defineMIME("application/x-aspx", { name: "htmlembedded", scriptingModeSpec:"text/x-csharp"}); 72 | CodeMirror.defineMIME("application/x-jsp", { name: "htmlembedded", scriptingModeSpec:"text/x-java"}); 73 | CodeMirror.defineMIME("application/x-erb", { name: "htmlembedded", scriptingModeSpec:"ruby"}); 74 | -------------------------------------------------------------------------------- /lib/mode/htmlembedded/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Html Embedded Scripts mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |

CodeMirror: Html Embedded Scripts mode

18 | 19 |
31 | 32 | 42 | 43 |

Mode for html embedded scripts like JSP and ASP.NET. Depends on HtmlMixed which in turn depends on 44 | JavaScript, CSS and XML.
Other dependancies include those of the scriping language chosen.

45 | 46 |

MIME types defined: application/x-aspx (ASP.NET), 47 | application/x-ejs (Embedded Javascript), application/x-jsp (JavaServer Pages)

48 | 49 | 50 | -------------------------------------------------------------------------------- /lib/mode/htmlmixed/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: HTML mixed mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |

CodeMirror: HTML mixed mode

18 |
42 | 54 | 55 |

The HTML mixed mode depends on the XML, JavaScript, and CSS modes.

56 | 57 |

It takes an optional mode configuration 58 | option, scriptTypes, which can be used to add custom 59 | behavior for specific <script type="..."> tags. If 60 | given, it should hold an array of {matches, mode} 61 | objects, where matches is a string or regexp that 62 | matches the script type, and mode is 63 | either null, for script types that should stay in 64 | HTML mode, or a mode 65 | spec corresponding to the mode that should be used for the 66 | script.

67 | 68 |

MIME types defined: text/html 69 | (redefined, only takes effect if you load this parser after the 70 | XML parser).

71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /lib/mode/http/http.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("http", function() { 2 | function failFirstLine(stream, state) { 3 | stream.skipToEnd(); 4 | state.cur = header; 5 | return "error"; 6 | } 7 | 8 | function start(stream, state) { 9 | if (stream.match(/^HTTP\/\d\.\d/)) { 10 | state.cur = responseStatusCode; 11 | return "keyword"; 12 | } else if (stream.match(/^[A-Z]+/) && /[ \t]/.test(stream.peek())) { 13 | state.cur = requestPath; 14 | return "keyword"; 15 | } else { 16 | return failFirstLine(stream, state); 17 | } 18 | } 19 | 20 | function responseStatusCode(stream, state) { 21 | var code = stream.match(/^\d+/); 22 | if (!code) return failFirstLine(stream, state); 23 | 24 | state.cur = responseStatusText; 25 | var status = Number(code[0]); 26 | if (status >= 100 && status < 200) { 27 | return "positive informational"; 28 | } else if (status >= 200 && status < 300) { 29 | return "positive success"; 30 | } else if (status >= 300 && status < 400) { 31 | return "positive redirect"; 32 | } else if (status >= 400 && status < 500) { 33 | return "negative client-error"; 34 | } else if (status >= 500 && status < 600) { 35 | return "negative server-error"; 36 | } else { 37 | return "error"; 38 | } 39 | } 40 | 41 | function responseStatusText(stream, state) { 42 | stream.skipToEnd(); 43 | state.cur = header; 44 | return null; 45 | } 46 | 47 | function requestPath(stream, state) { 48 | stream.eatWhile(/\S/); 49 | state.cur = requestProtocol; 50 | return "string-2"; 51 | } 52 | 53 | function requestProtocol(stream, state) { 54 | if (stream.match(/^HTTP\/\d\.\d$/)) { 55 | state.cur = header; 56 | return "keyword"; 57 | } else { 58 | return failFirstLine(stream, state); 59 | } 60 | } 61 | 62 | function header(stream) { 63 | if (stream.sol() && !stream.eat(/[ \t]/)) { 64 | if (stream.match(/^.*?:/)) { 65 | return "atom"; 66 | } else { 67 | stream.skipToEnd(); 68 | return "error"; 69 | } 70 | } else { 71 | stream.skipToEnd(); 72 | return "string"; 73 | } 74 | } 75 | 76 | function body(stream) { 77 | stream.skipToEnd(); 78 | return null; 79 | } 80 | 81 | return { 82 | token: function(stream, state) { 83 | var cur = state.cur; 84 | if (cur != header && cur != body && stream.eatSpace()) return null; 85 | return cur(stream, state); 86 | }, 87 | 88 | blankLine: function(state) { 89 | state.cur = body; 90 | }, 91 | 92 | startState: function() { 93 | return {cur: start}; 94 | } 95 | }; 96 | }); 97 | 98 | CodeMirror.defineMIME("message/http", "http"); 99 | -------------------------------------------------------------------------------- /lib/mode/http/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: HTTP mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: HTTP mode

14 | 15 |
25 | 26 | 29 | 30 |

MIME types defined: message/http.

31 | 32 | 33 | -------------------------------------------------------------------------------- /lib/mode/javascript/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: JavaScript mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |

CodeMirror: JavaScript mode

16 | 17 |
66 | 67 | 74 | 75 |

76 | JavaScript mode supports a two configuration 77 | options: 78 |

84 |

85 | 86 |

MIME types defined: text/javascript, application/json, text/typescript, application/typescript.

87 | 88 | 89 | -------------------------------------------------------------------------------- /lib/mode/javascript/typescript.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: TypeScript mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: TypeScript mode

14 | 15 |
37 | 38 | 45 | 46 |

This is a specialization of the JavaScript mode.

47 | 48 | 49 | -------------------------------------------------------------------------------- /lib/mode/jinja2/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Jinja2 mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Jinja2 mode

14 |
32 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /lib/mode/jinja2/jinja2.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("jinja2", function() { 2 | var keywords = ["block", "endblock", "for", "endfor", "in", "true", "false", 3 | "loop", "none", "self", "super", "if", "as", "not", "and", 4 | "else", "import", "with", "without", "context"]; 5 | keywords = new RegExp("^((" + keywords.join(")|(") + "))\\b"); 6 | 7 | function tokenBase (stream, state) { 8 | var ch = stream.next(); 9 | if (ch == "{") { 10 | if (ch = stream.eat(/\{|%|#/)) { 11 | stream.eat("-"); 12 | state.tokenize = inTag(ch); 13 | return "tag"; 14 | } 15 | } 16 | } 17 | function inTag (close) { 18 | if (close == "{") { 19 | close = "}"; 20 | } 21 | return function (stream, state) { 22 | var ch = stream.next(); 23 | if ((ch == close || (ch == "-" && stream.eat(close))) 24 | && stream.eat("}")) { 25 | state.tokenize = tokenBase; 26 | return "tag"; 27 | } 28 | if (stream.match(keywords)) { 29 | return "keyword"; 30 | } 31 | return close == "#" ? "comment" : "string"; 32 | }; 33 | } 34 | return { 35 | startState: function () { 36 | return {tokenize: tokenBase}; 37 | }, 38 | token: function (stream, state) { 39 | return state.tokenize(stream, state); 40 | } 41 | }; 42 | }); 43 | -------------------------------------------------------------------------------- /lib/mode/lua/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Lua mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |

CodeMirror: Lua mode

16 |
57 | 64 | 65 |

Loosely based on Franciszek 66 | Wawrzak's CodeMirror 67 | 1 mode. One configuration parameter is 68 | supported, specials, to which you can provide an 69 | array of strings to have those identifiers highlighted with 70 | the lua-special style.

71 |

MIME types defined: text/x-lua.

72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /lib/mode/mysql/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: MySQL mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: MySQL mode

14 |
31 | 37 | 38 |

!! This mode is deprecated in favor of the generic SQL mode (which can be configured to handle MySQL).

39 | 40 |

MIME types defined: text/x-mysql.

41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /lib/mode/ntriples/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: NTriples mode 6 | 7 | 8 | 9 | 10 | 15 | 16 | 17 |

CodeMirror: NTriples mode

18 |
19 | 26 |
27 | 28 | 31 |

MIME types defined: text/n-triples.

32 | 33 | 34 | -------------------------------------------------------------------------------- /lib/mode/ocaml/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: OCaml mode 4 | 5 | 6 | 7 | 8 | 11 | 12 | 13 | 14 | 15 | 16 |

CodeMirror: OCaml mode

17 | 18 | 122 | 123 | 130 | 131 |

MIME types defined: text/x-ocaml.

132 | -------------------------------------------------------------------------------- /lib/mode/ocaml/ocaml.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode('ocaml', function() { 2 | 3 | var words = { 4 | 'true': 'atom', 5 | 'false': 'atom', 6 | 'let': 'keyword', 7 | 'rec': 'keyword', 8 | 'in': 'keyword', 9 | 'of': 'keyword', 10 | 'and': 'keyword', 11 | 'succ': 'keyword', 12 | 'if': 'keyword', 13 | 'then': 'keyword', 14 | 'else': 'keyword', 15 | 'for': 'keyword', 16 | 'to': 'keyword', 17 | 'while': 'keyword', 18 | 'do': 'keyword', 19 | 'done': 'keyword', 20 | 'fun': 'keyword', 21 | 'function': 'keyword', 22 | 'val': 'keyword', 23 | 'type': 'keyword', 24 | 'mutable': 'keyword', 25 | 'match': 'keyword', 26 | 'with': 'keyword', 27 | 'try': 'keyword', 28 | 'raise': 'keyword', 29 | 'begin': 'keyword', 30 | 'end': 'keyword', 31 | 'open': 'builtin', 32 | 'trace': 'builtin', 33 | 'ignore': 'builtin', 34 | 'exit': 'builtin', 35 | 'print_string': 'builtin', 36 | 'print_endline': 'builtin' 37 | }; 38 | 39 | function tokenBase(stream, state) { 40 | var ch = stream.next(); 41 | 42 | if (ch === '"') { 43 | state.tokenize = tokenString; 44 | return state.tokenize(stream, state); 45 | } 46 | if (ch === '(') { 47 | if (stream.eat('*')) { 48 | state.commentLevel++; 49 | state.tokenize = tokenComment; 50 | return state.tokenize(stream, state); 51 | } 52 | } 53 | if (ch === '~') { 54 | stream.eatWhile(/\w/); 55 | return 'variable-2'; 56 | } 57 | if (ch === '`') { 58 | stream.eatWhile(/\w/); 59 | return 'quote'; 60 | } 61 | if (/\d/.test(ch)) { 62 | stream.eatWhile(/[\d]/); 63 | if (stream.eat('.')) { 64 | stream.eatWhile(/[\d]/); 65 | } 66 | return 'number'; 67 | } 68 | if ( /[+\-*&%=<>!?|]/.test(ch)) { 69 | return 'operator'; 70 | } 71 | stream.eatWhile(/\w/); 72 | var cur = stream.current(); 73 | return words[cur] || 'variable'; 74 | } 75 | 76 | function tokenString(stream, state) { 77 | var next, end = false, escaped = false; 78 | while ((next = stream.next()) != null) { 79 | if (next === '"' && !escaped) { 80 | end = true; 81 | break; 82 | } 83 | escaped = !escaped && next === '\\'; 84 | } 85 | if (end && !escaped) { 86 | state.tokenize = tokenBase; 87 | } 88 | return 'string'; 89 | }; 90 | 91 | function tokenComment(stream, state) { 92 | var prev, next; 93 | while(state.commentLevel > 0 && (next = stream.next()) != null) { 94 | if (prev === '(' && next === '*') state.commentLevel++; 95 | if (prev === '*' && next === ')') state.commentLevel--; 96 | prev = next; 97 | } 98 | if (state.commentLevel <= 0) { 99 | state.tokenize = tokenBase; 100 | } 101 | return 'comment'; 102 | } 103 | 104 | return { 105 | startState: function() {return {tokenize: tokenBase, commentLevel: 0};}, 106 | token: function(stream, state) { 107 | if (stream.eatSpace()) return null; 108 | return state.tokenize(stream, state); 109 | } 110 | }; 111 | }); 112 | 113 | CodeMirror.defineMIME('text/x-ocaml', 'ocaml'); 114 | -------------------------------------------------------------------------------- /lib/mode/pascal/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 souceLair 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /lib/mode/pascal/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Pascal mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Pascal mode

14 | 15 |
38 | 39 | 45 | 46 |

MIME types defined: text/x-pascal.

47 | 48 | 49 | -------------------------------------------------------------------------------- /lib/mode/pascal/pascal.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("pascal", function() { 2 | function words(str) { 3 | var obj = {}, words = str.split(" "); 4 | for (var i = 0; i < words.length; ++i) obj[words[i]] = true; 5 | return obj; 6 | } 7 | var keywords = words("and array begin case const div do downto else end file for forward integer " + 8 | "boolean char function goto if in label mod nil not of or packed procedure " + 9 | "program record repeat set string then to type until var while with"); 10 | var atoms = {"null": true}; 11 | 12 | var isOperatorChar = /[+\-*&%=<>!?|\/]/; 13 | 14 | function tokenBase(stream, state) { 15 | var ch = stream.next(); 16 | if (ch == "#" && state.startOfLine) { 17 | stream.skipToEnd(); 18 | return "meta"; 19 | } 20 | if (ch == '"' || ch == "'") { 21 | state.tokenize = tokenString(ch); 22 | return state.tokenize(stream, state); 23 | } 24 | if (ch == "(" && stream.eat("*")) { 25 | state.tokenize = tokenComment; 26 | return tokenComment(stream, state); 27 | } 28 | if (/[\[\]{}\(\),;\:\.]/.test(ch)) { 29 | return null; 30 | } 31 | if (/\d/.test(ch)) { 32 | stream.eatWhile(/[\w\.]/); 33 | return "number"; 34 | } 35 | if (ch == "/") { 36 | if (stream.eat("/")) { 37 | stream.skipToEnd(); 38 | return "comment"; 39 | } 40 | } 41 | if (isOperatorChar.test(ch)) { 42 | stream.eatWhile(isOperatorChar); 43 | return "operator"; 44 | } 45 | stream.eatWhile(/[\w\$_]/); 46 | var cur = stream.current(); 47 | if (keywords.propertyIsEnumerable(cur)) return "keyword"; 48 | if (atoms.propertyIsEnumerable(cur)) return "atom"; 49 | return "variable"; 50 | } 51 | 52 | function tokenString(quote) { 53 | return function(stream, state) { 54 | var escaped = false, next, end = false; 55 | while ((next = stream.next()) != null) { 56 | if (next == quote && !escaped) {end = true; break;} 57 | escaped = !escaped && next == "\\"; 58 | } 59 | if (end || !escaped) state.tokenize = null; 60 | return "string"; 61 | }; 62 | } 63 | 64 | function tokenComment(stream, state) { 65 | var maybeEnd = false, ch; 66 | while (ch = stream.next()) { 67 | if (ch == ")" && maybeEnd) { 68 | state.tokenize = null; 69 | break; 70 | } 71 | maybeEnd = (ch == "*"); 72 | } 73 | return "comment"; 74 | } 75 | 76 | // Interface 77 | 78 | return { 79 | startState: function() { 80 | return {tokenize: null}; 81 | }, 82 | 83 | token: function(stream, state) { 84 | if (stream.eatSpace()) return null; 85 | var style = (state.tokenize || tokenBase)(stream, state); 86 | if (style == "comment" || style == "meta") return style; 87 | return style; 88 | }, 89 | 90 | electricChars: "{}" 91 | }; 92 | }); 93 | 94 | CodeMirror.defineMIME("text/x-pascal", "pascal"); 95 | -------------------------------------------------------------------------------- /lib/mode/perl/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2011 by Sabaca under the MIT license. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /lib/mode/perl/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Perl mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Perl mode

14 | 15 |
53 | 54 | 59 | 60 |

MIME types defined: text/x-perl.

61 | 62 | 63 | -------------------------------------------------------------------------------- /lib/mode/php/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: PHP mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |

CodeMirror: PHP mode

20 | 21 |
32 | 33 | 44 | 45 |

Simple HTML/PHP mode based on 46 | the C-like mode. Depends on XML, 47 | JavaScript, CSS, HTMLMixed, and C-like modes.

48 | 49 |

MIME types defined: application/x-httpd-php (HTML with PHP code), text/x-php (plain, non-wrapped PHP code).

50 | 51 | 52 | -------------------------------------------------------------------------------- /lib/mode/pig/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Pig Latin mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Pig Latin mode

14 | 15 |
27 | 28 | 35 | 36 |

37 | Simple mode that handles Pig Latin language. 38 |

39 | 40 |

MIME type defined: text/x-pig 41 | (PIG code) 42 | 43 | -------------------------------------------------------------------------------- /lib/mode/plsql/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Oracle PL/SQL mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Oracle PL/SQL mode

14 | 15 |
47 | 48 | 55 | 56 |

!! This mode is deprecated in favor of the generic SQL mode (which can be configured to handle PL/SQL).

57 | 58 |

59 | Simple mode that handles Oracle PL/SQL language (and Oracle SQL, of course). 60 |

61 | 62 |

MIME type defined: text/x-plsql 63 | (PLSQL code) 64 | 65 | -------------------------------------------------------------------------------- /lib/mode/properties/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Properties files mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Properties files mode

14 |
33 | 36 | 37 |

MIME types defined: text/x-properties, 38 | text/x-ini.

39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /lib/mode/properties/properties.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("properties", function() { 2 | return { 3 | token: function(stream, state) { 4 | var sol = stream.sol() || state.afterSection; 5 | var eol = stream.eol(); 6 | 7 | state.afterSection = false; 8 | 9 | if (sol) { 10 | if (state.nextMultiline) { 11 | state.inMultiline = true; 12 | state.nextMultiline = false; 13 | } else { 14 | state.position = "def"; 15 | } 16 | } 17 | 18 | if (eol && ! state.nextMultiline) { 19 | state.inMultiline = false; 20 | state.position = "def"; 21 | } 22 | 23 | if (sol) { 24 | while(stream.eatSpace()); 25 | } 26 | 27 | var ch = stream.next(); 28 | 29 | if (sol && (ch === "#" || ch === "!" || ch === ";")) { 30 | state.position = "comment"; 31 | stream.skipToEnd(); 32 | return "comment"; 33 | } else if (sol && ch === "[") { 34 | state.afterSection = true; 35 | stream.skipTo("]"); stream.eat("]"); 36 | return "header"; 37 | } else if (ch === "=" || ch === ":") { 38 | state.position = "quote"; 39 | return null; 40 | } else if (ch === "\\" && state.position === "quote") { 41 | if (stream.next() !== "u") { // u = Unicode sequence \u1234 42 | // Multiline value 43 | state.nextMultiline = true; 44 | } 45 | } 46 | 47 | return state.position; 48 | }, 49 | 50 | startState: function() { 51 | return { 52 | position : "def", // Current position, "def", "quote" or "comment" 53 | nextMultiline : false, // Is the next line multiline value 54 | inMultiline : false, // Is the current line a multiline value 55 | afterSection : false // Did we just open a section 56 | }; 57 | } 58 | 59 | }; 60 | }); 61 | 62 | CodeMirror.defineMIME("text/x-properties", "properties"); 63 | CodeMirror.defineMIME("text/x-ini", "properties"); 64 | -------------------------------------------------------------------------------- /lib/mode/python/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2010 Timothy Farrell 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /lib/mode/r/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011, Ubalo, Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of the Ubalo, Inc nor the names of its 12 | contributors may be used to endorse or promote products derived 13 | from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL UBALO, INC BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /lib/mode/r/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: R mode 6 | 7 | 8 | 9 | 16 | 17 | 18 | 19 |

CodeMirror: R mode

20 |
63 | 66 | 67 |

MIME types defined: text/x-rsrc.

68 | 69 |

Development of the CodeMirror R mode was kindly sponsored 70 | by Ubalo, who hold 71 | the license.

72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /lib/mode/rpm/changes/changes.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("changes", function() { 2 | var headerSeperator = /^-+$/; 3 | 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} - /; 4 | var simpleEmail = /^[\w+.-]+@[\w.-]+/; 5 | 6 | return { 7 | token: function(stream) { 8 | if (stream.sol()) { 9 | if (stream.match(headerSeperator)) { return 'tag'; } 10 | if (stream.match(headerLine)) { return 'tag'; } 11 | } 12 | if (stream.match(simpleEmail)) { return 'string'; } 13 | stream.next(); 14 | return null; 15 | } 16 | }; 17 | }); 18 | 19 | CodeMirror.defineMIME("text/x-rpm-changes", "changes"); 20 | -------------------------------------------------------------------------------- /lib/mode/rpm/changes/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: RPM changes mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: RPM changes mode

14 | 15 |
42 | 50 | 51 |

MIME types defined: text/x-rpm-changes.

52 | 53 | 54 | -------------------------------------------------------------------------------- /lib/mode/rpm/spec/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: RPM spec mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

CodeMirror: RPM spec mode

15 | 16 |
89 | 96 | 97 |

MIME types defined: text/x-rpm-spec.

98 | 99 | 100 | -------------------------------------------------------------------------------- /lib/mode/rpm/spec/spec.css: -------------------------------------------------------------------------------- 1 | .cm-s-default span.cm-preamble {color: #b26818; font-weight: bold;} 2 | .cm-s-default span.cm-macro {color: #b218b2;} 3 | .cm-s-default span.cm-section {color: green; font-weight: bold;} 4 | .cm-s-default span.cm-script {color: red;} 5 | .cm-s-default span.cm-issue {color: yellow;} 6 | -------------------------------------------------------------------------------- /lib/mode/rpm/spec/spec.js: -------------------------------------------------------------------------------- 1 | // Quick and dirty spec file highlighting 2 | 3 | CodeMirror.defineMode("spec", function() { 4 | var arch = /^(i386|i586|i686|x86_64|ppc64|ppc|ia64|s390x|s390|sparc64|sparcv9|sparc|noarch|alphaev6|alpha|hppa|mipsel)/; 5 | 6 | var preamble = /^(Name|Version|Release|License|Summary|Url|Group|Source|BuildArch|BuildRequires|BuildRoot|AutoReqProv|Provides|Requires(\(\w+\))?|Obsoletes|Conflicts|Recommends|Source\d*|Patch\d*|ExclusiveArch|NoSource|Supplements):/; 7 | var section = /^%(debug_package|package|description|prep|build|install|files|clean|changelog|preun|postun|pre|post|triggerin|triggerun|pretrans|posttrans|verifyscript|check|triggerpostun|triggerprein|trigger)/; 8 | var control_flow_complex = /^%(ifnarch|ifarch|if)/; // rpm control flow macros 9 | var control_flow_simple = /^%(else|endif)/; // rpm control flow macros 10 | var operators = /^(\!|\?|\<\=|\<|\>\=|\>|\=\=|\&\&|\|\|)/; // operators in control flow macros 11 | 12 | return { 13 | startState: function () { 14 | return { 15 | controlFlow: false, 16 | macroParameters: false, 17 | section: false 18 | }; 19 | }, 20 | token: function (stream, state) { 21 | var ch = stream.peek(); 22 | if (ch == "#") { stream.skipToEnd(); return "comment"; } 23 | 24 | if (stream.sol()) { 25 | if (stream.match(preamble)) { return "preamble"; } 26 | if (stream.match(section)) { return "section"; } 27 | } 28 | 29 | if (stream.match(/^\$\w+/)) { return "def"; } // Variables like '$RPM_BUILD_ROOT' 30 | if (stream.match(/^\$\{\w+\}/)) { return "def"; } // Variables like '${RPM_BUILD_ROOT}' 31 | 32 | if (stream.match(control_flow_simple)) { return "keyword"; } 33 | if (stream.match(control_flow_complex)) { 34 | state.controlFlow = true; 35 | return "keyword"; 36 | } 37 | if (state.controlFlow) { 38 | if (stream.match(operators)) { return "operator"; } 39 | if (stream.match(/^(\d+)/)) { return "number"; } 40 | if (stream.eol()) { state.controlFlow = false; } 41 | } 42 | 43 | if (stream.match(arch)) { return "number"; } 44 | 45 | // Macros like '%make_install' or '%attr(0775,root,root)' 46 | if (stream.match(/^%[\w]+/)) { 47 | if (stream.match(/^\(/)) { state.macroParameters = true; } 48 | return "macro"; 49 | } 50 | if (state.macroParameters) { 51 | if (stream.match(/^\d+/)) { return "number";} 52 | if (stream.match(/^\)/)) { 53 | state.macroParameters = false; 54 | return "macro"; 55 | } 56 | } 57 | if (stream.match(/^%\{\??[\w \-]+\}/)) { return "macro"; } // Macros like '%{defined fedora}' 58 | 59 | //TODO: Include bash script sub-parser (CodeMirror supports that) 60 | stream.next(); 61 | return null; 62 | } 63 | }; 64 | }); 65 | 66 | CodeMirror.defineMIME("text/x-rpm-spec", "spec"); 67 | -------------------------------------------------------------------------------- /lib/mode/ruby/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011, Ubalo, Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of the Ubalo, Inc. nor the names of its 12 | contributors may be used to endorse or promote products derived 13 | from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL UBALO, INC BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /lib/mode/rust/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Rust mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Rust mode

14 | 15 |
38 | 39 | 45 | 46 |

MIME types defined: text/x-rustsrc.

47 | 48 | 49 | -------------------------------------------------------------------------------- /lib/mode/sass/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Sass mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

CodeMirror: Sass mode

15 |
45 | 51 | 52 |

MIME types defined: text/x-sass.

53 | 54 | 55 | -------------------------------------------------------------------------------- /lib/mode/scheme/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Scheme mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Scheme mode

14 |
58 | 61 | 62 |

MIME types defined: text/x-scheme.

63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /lib/mode/shell/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Shell mode 4 | 5 | 6 | 7 | 8 | 11 | 12 | 13 | 14 | 15 | 16 |

CodeMirror: Shell mode

17 | 18 | 42 | 43 | 50 | 51 |

MIME types defined: text/x-sh.

52 | -------------------------------------------------------------------------------- /lib/mode/shell/shell.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode('shell', function() { 2 | 3 | var words = {}; 4 | function define(style, string) { 5 | var split = string.split(' '); 6 | for(var i = 0; i < split.length; i++) { 7 | words[split[i]] = style; 8 | } 9 | }; 10 | 11 | // Atoms 12 | define('atom', 'true false'); 13 | 14 | // Keywords 15 | define('keyword', 'if then do else elif while until for in esac fi fin ' + 16 | 'fil done exit set unset export function'); 17 | 18 | // Commands 19 | define('builtin', 'ab awk bash beep cat cc cd chown chmod chroot clear cp ' + 20 | 'curl cut diff echo find gawk gcc get git grep kill killall ln ls make ' + 21 | 'mkdir openssl mv nc node npm ping ps restart rm rmdir sed service sh ' + 22 | 'shopt shred source sort sleep ssh start stop su sudo tee telnet top ' + 23 | 'touch vi vim wall wc wget who write yes zsh'); 24 | 25 | function tokenBase(stream, state) { 26 | 27 | var sol = stream.sol(); 28 | var ch = stream.next(); 29 | 30 | if (ch === '\'' || ch === '"' || ch === '`') { 31 | state.tokens.unshift(tokenString(ch)); 32 | return tokenize(stream, state); 33 | } 34 | if (ch === '#') { 35 | if (sol && stream.eat('!')) { 36 | stream.skipToEnd(); 37 | return 'meta'; // 'comment'? 38 | } 39 | stream.skipToEnd(); 40 | return 'comment'; 41 | } 42 | if (ch === '$') { 43 | state.tokens.unshift(tokenDollar); 44 | return tokenize(stream, state); 45 | } 46 | if (ch === '+' || ch === '=') { 47 | return 'operator'; 48 | } 49 | if (ch === '-') { 50 | stream.eat('-'); 51 | stream.eatWhile(/\w/); 52 | return 'attribute'; 53 | } 54 | if (/\d/.test(ch)) { 55 | stream.eatWhile(/\d/); 56 | if(!/\w/.test(stream.peek())) { 57 | return 'number'; 58 | } 59 | } 60 | stream.eatWhile(/\w/); 61 | var cur = stream.current(); 62 | if (stream.peek() === '=' && /\w+/.test(cur)) return 'def'; 63 | return words.hasOwnProperty(cur) ? words[cur] : null; 64 | } 65 | 66 | function tokenString(quote) { 67 | return function(stream, state) { 68 | var next, end = false, escaped = false; 69 | while ((next = stream.next()) != null) { 70 | if (next === quote && !escaped) { 71 | end = true; 72 | break; 73 | } 74 | if (next === '$' && !escaped && quote !== '\'') { 75 | escaped = true; 76 | stream.backUp(1); 77 | state.tokens.unshift(tokenDollar); 78 | break; 79 | } 80 | escaped = !escaped && next === '\\'; 81 | } 82 | if (end || !escaped) { 83 | state.tokens.shift(); 84 | } 85 | return (quote === '`' || quote === ')' ? 'quote' : 'string'); 86 | }; 87 | }; 88 | 89 | var tokenDollar = function(stream, state) { 90 | if (state.tokens.length > 1) stream.eat('$'); 91 | var ch = stream.next(), hungry = /\w/; 92 | if (ch === '{') hungry = /[^}]/; 93 | if (ch === '(') { 94 | state.tokens[0] = tokenString(')'); 95 | return tokenize(stream, state); 96 | } 97 | if (!/\d/.test(ch)) { 98 | stream.eatWhile(hungry); 99 | stream.eat('}'); 100 | } 101 | state.tokens.shift(); 102 | return 'def'; 103 | }; 104 | 105 | function tokenize(stream, state) { 106 | return (state.tokens[0] || tokenBase) (stream, state); 107 | }; 108 | 109 | return { 110 | startState: function() {return {tokens:[]};}, 111 | token: function(stream, state) { 112 | if (stream.eatSpace()) return null; 113 | return tokenize(stream, state); 114 | } 115 | }; 116 | }); 117 | 118 | CodeMirror.defineMIME('text/x-sh', 'shell'); 119 | -------------------------------------------------------------------------------- /lib/mode/sieve/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2012 Thomas Schmid 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /lib/mode/sieve/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Sieve (RFC5228) mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Sieve (RFC5228) mode

14 |
74 | 77 | 78 |

MIME types defined: application/sieve.

79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /lib/mode/smalltalk/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Smalltalk mode 6 | 7 | 8 | 9 | 10 | 11 | 16 | 17 | 18 |

CodeMirror: Smalltalk mode

19 | 20 |
43 | 44 | 52 | 53 |

Simple Smalltalk mode.

54 | 55 |

MIME types defined: text/x-stsrc.

56 | 57 | 58 | -------------------------------------------------------------------------------- /lib/mode/smalltalk/smalltalk.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode('smalltalk', function(config) { 2 | 3 | var specialChars = /[+\-/\\*~<>=@%|&?!.:;^]/; 4 | var keywords = /true|false|nil|self|super|thisContext/; 5 | 6 | var Context = function(tokenizer, parent) { 7 | this.next = tokenizer; 8 | this.parent = parent; 9 | }; 10 | 11 | var Token = function(name, context, eos) { 12 | this.name = name; 13 | this.context = context; 14 | this.eos = eos; 15 | }; 16 | 17 | var State = function() { 18 | this.context = new Context(next, null); 19 | this.expectVariable = true; 20 | this.indentation = 0; 21 | this.userIndentationDelta = 0; 22 | }; 23 | 24 | State.prototype.userIndent = function(indentation) { 25 | this.userIndentationDelta = indentation > 0 ? (indentation / config.indentUnit - this.indentation) : 0; 26 | }; 27 | 28 | var next = function(stream, context, state) { 29 | var token = new Token(null, context, false); 30 | var aChar = stream.next(); 31 | 32 | if (aChar === '"') { 33 | token = nextComment(stream, new Context(nextComment, context)); 34 | 35 | } else if (aChar === '\'') { 36 | token = nextString(stream, new Context(nextString, context)); 37 | 38 | } else if (aChar === '#') { 39 | stream.eatWhile(/[^ .]/); 40 | token.name = 'string-2'; 41 | 42 | } else if (aChar === '$') { 43 | stream.eatWhile(/[^ ]/); 44 | token.name = 'string-2'; 45 | 46 | } else if (aChar === '|' && state.expectVariable) { 47 | token.context = new Context(nextTemporaries, context); 48 | 49 | } else if (/[\[\]{}()]/.test(aChar)) { 50 | token.name = 'bracket'; 51 | token.eos = /[\[{(]/.test(aChar); 52 | 53 | if (aChar === '[') { 54 | state.indentation++; 55 | } else if (aChar === ']') { 56 | state.indentation = Math.max(0, state.indentation - 1); 57 | } 58 | 59 | } else if (specialChars.test(aChar)) { 60 | stream.eatWhile(specialChars); 61 | token.name = 'operator'; 62 | token.eos = aChar !== ';'; // ; cascaded message expression 63 | 64 | } else if (/\d/.test(aChar)) { 65 | stream.eatWhile(/[\w\d]/); 66 | token.name = 'number'; 67 | 68 | } else if (/[\w_]/.test(aChar)) { 69 | stream.eatWhile(/[\w\d_]/); 70 | token.name = state.expectVariable ? (keywords.test(stream.current()) ? 'keyword' : 'variable') : null; 71 | 72 | } else { 73 | token.eos = state.expectVariable; 74 | } 75 | 76 | return token; 77 | }; 78 | 79 | var nextComment = function(stream, context) { 80 | stream.eatWhile(/[^"]/); 81 | return new Token('comment', stream.eat('"') ? context.parent : context, true); 82 | }; 83 | 84 | var nextString = function(stream, context) { 85 | stream.eatWhile(/[^']/); 86 | return new Token('string', stream.eat('\'') ? context.parent : context, false); 87 | }; 88 | 89 | var nextTemporaries = function(stream, context) { 90 | var token = new Token(null, context, false); 91 | var aChar = stream.next(); 92 | 93 | if (aChar === '|') { 94 | token.context = context.parent; 95 | token.eos = true; 96 | 97 | } else { 98 | stream.eatWhile(/[^|]/); 99 | token.name = 'variable'; 100 | } 101 | 102 | return token; 103 | }; 104 | 105 | return { 106 | startState: function() { 107 | return new State; 108 | }, 109 | 110 | token: function(stream, state) { 111 | state.userIndent(stream.indentation()); 112 | 113 | if (stream.eatSpace()) { 114 | return null; 115 | } 116 | 117 | var token = state.context.next(stream, state.context, state); 118 | state.context = token.context; 119 | state.expectVariable = token.eos; 120 | 121 | state.lastToken = token; 122 | return token.name; 123 | }, 124 | 125 | blankLine: function(state) { 126 | state.userIndent(0); 127 | }, 128 | 129 | indent: function(state, textAfter) { 130 | var i = state.context.next === next && textAfter && textAfter.charAt(0) === ']' ? -1 : state.userIndentationDelta; 131 | return (state.indentation + i) * config.indentUnit; 132 | }, 133 | 134 | electricChars: ']' 135 | }; 136 | 137 | }); 138 | 139 | CodeMirror.defineMIME('text/x-stsrc', {name: 'smalltalk'}); -------------------------------------------------------------------------------- /lib/mode/smarty/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Smarty mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Smarty mode

14 | 15 |
36 | 37 | 43 | 44 |
45 | 46 |
67 | 68 | 78 | 79 |

A plain text/Smarty mode which allows for custom delimiter tags (defaults to { and }).

80 | 81 |

MIME types defined: text/x-smarty

82 | 83 | 84 | -------------------------------------------------------------------------------- /lib/mode/sparql/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: SPARQL mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

CodeMirror: SPARQL mode

15 |
31 | 38 | 39 |

MIME types defined: application/x-sparql-query.

40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /lib/mode/sql/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SQL Mode for CodeMirror 6 | 7 | 8 | 9 | 10 | 11 | 17 | 18 | 37 | 38 | 39 |

SQL Mode for CodeMirror

40 |
41 | 55 |
56 |

MIME types defined: 57 | text/x-sql, 58 | text/x-mysql, 59 | text/x-mariadb, 60 | text/x-plsql. 61 |

62 |

63 | Tests: 64 | normal, 65 | verbose. 66 |

67 | 68 | 69 | -------------------------------------------------------------------------------- /lib/mode/stex/test.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var mode = CodeMirror.getMode({tabSize: 4}, "stex"); 3 | function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } 4 | 5 | MT("word", 6 | "foo"); 7 | 8 | MT("twoWords", 9 | "foo bar"); 10 | 11 | MT("beginEndDocument", 12 | "[tag \\begin][bracket {][atom document][bracket }]", 13 | "[tag \\end][bracket {][atom document][bracket }]"); 14 | 15 | MT("beginEndEquation", 16 | "[tag \\begin][bracket {][atom equation][bracket }]", 17 | " E=mc^2", 18 | "[tag \\end][bracket {][atom equation][bracket }]"); 19 | 20 | MT("beginModule", 21 | "[tag \\begin][bracket {][atom module][bracket }[[]]]"); 22 | 23 | MT("beginModuleId", 24 | "[tag \\begin][bracket {][atom module][bracket }[[]id=bbt-size[bracket ]]]"); 25 | 26 | MT("importModule", 27 | "[tag \\importmodule][bracket [[][string b-b-t][bracket ]]{][builtin b-b-t][bracket }]"); 28 | 29 | MT("importModulePath", 30 | "[tag \\importmodule][bracket [[][tag \\KWARCslides][bracket {][string dmath/en/cardinality][bracket }]]{][builtin card][bracket }]"); 31 | 32 | MT("psForPDF", 33 | "[tag \\PSforPDF][bracket [[][atom 1][bracket ]]{]#1[bracket }]"); 34 | 35 | MT("comment", 36 | "[comment % foo]"); 37 | 38 | MT("tagComment", 39 | "[tag \\item][comment % bar]"); 40 | 41 | MT("commentTag", 42 | " [comment % \\item]"); 43 | 44 | MT("commentLineBreak", 45 | "[comment %]", 46 | "foo"); 47 | 48 | MT("tagErrorCurly", 49 | "[tag \\begin][error }][bracket {]"); 50 | 51 | MT("tagErrorSquare", 52 | "[tag \\item][error ]]][bracket {]"); 53 | 54 | MT("commentCurly", 55 | "[comment % }]"); 56 | 57 | MT("tagHash", 58 | "the [tag \\#] key"); 59 | 60 | MT("tagNumber", 61 | "a [tag \\$][atom 5] stetson"); 62 | 63 | MT("tagPercent", 64 | "[atom 100][tag \\%] beef"); 65 | 66 | MT("tagAmpersand", 67 | "L [tag \\&] N"); 68 | 69 | MT("tagUnderscore", 70 | "foo[tag \\_]bar"); 71 | 72 | MT("tagBracketOpen", 73 | "[tag \\emph][bracket {][tag \\{][bracket }]"); 74 | 75 | MT("tagBracketClose", 76 | "[tag \\emph][bracket {][tag \\}][bracket }]"); 77 | 78 | MT("tagLetterNumber", 79 | "section [tag \\S][atom 1]"); 80 | 81 | MT("textTagNumber", 82 | "para [tag \\P][atom 2]"); 83 | 84 | MT("thinspace", 85 | "x[tag \\,]y"); 86 | 87 | MT("thickspace", 88 | "x[tag \\;]y"); 89 | 90 | MT("negativeThinspace", 91 | "x[tag \\!]y"); 92 | 93 | MT("periodNotSentence", 94 | "J.\\ L.\\ is"); 95 | 96 | MT("periodSentence", 97 | "X[tag \\@]. The"); 98 | 99 | MT("italicCorrection", 100 | "[bracket {][tag \\em] If[tag \\/][bracket }] I"); 101 | 102 | MT("tagBracket", 103 | "[tag \\newcommand][bracket {][tag \\pop][bracket }]"); 104 | })(); 105 | -------------------------------------------------------------------------------- /lib/mode/tiddlywiki/tiddlywiki.css: -------------------------------------------------------------------------------- 1 | span.cm-underlined { 2 | text-decoration: underline; 3 | } 4 | span.cm-strikethrough { 5 | text-decoration: line-through; 6 | } 7 | span.cm-brace { 8 | color: #170; 9 | font-weight: bold; 10 | } 11 | span.cm-table { 12 | color: blue; 13 | font-weight: bold; 14 | } 15 | -------------------------------------------------------------------------------- /lib/mode/tiki/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Tiki wiki mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Tiki wiki mode

14 | 15 |
72 | 73 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /lib/mode/tiki/tiki.css: -------------------------------------------------------------------------------- 1 | .cm-tw-syntaxerror { 2 | color: #FFFFFF; 3 | background-color: #990000; 4 | } 5 | 6 | .cm-tw-deleted { 7 | text-decoration: line-through; 8 | } 9 | 10 | .cm-tw-header5 { 11 | font-weight: bold; 12 | } 13 | .cm-tw-listitem:first-child { /*Added first child to fix duplicate padding when highlighting*/ 14 | padding-left: 10px; 15 | } 16 | 17 | .cm-tw-box { 18 | border-top-width: 0px ! important; 19 | border-style: solid; 20 | border-width: 1px; 21 | border-color: inherit; 22 | } 23 | 24 | .cm-tw-underline { 25 | text-decoration: underline; 26 | } -------------------------------------------------------------------------------- /lib/mode/turtle/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Turtle mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Turtle mode

14 |
28 | 35 | 36 |

MIME types defined: text/turtle.

37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /lib/mode/vb/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2012 Codility Limited, 107 Cheapside, London EC2V 6DN, UK 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /lib/mode/vb/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: VB.NET mode 5 | 6 | 7 | 8 | 9 | 10 | 15 | 16 | 17 | 18 |

CodeMirror: VB.NET mode

19 | 80 | 81 | 82 |
83 | 84 |
85 |

86 |   

MIME type defined: text/x-vb.

87 | 88 | 89 | -------------------------------------------------------------------------------- /lib/mode/vbscript/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: VBScript mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: VBScript mode

14 | 15 |
32 | 33 | 38 | 39 |

MIME types defined: text/vbscript.

40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /lib/mode/vbscript/vbscript.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("vbscript", function() { 2 | var regexVBScriptKeyword = /^(?:Call|Case|CDate|Clear|CInt|CLng|Const|CStr|Description|Dim|Do|Each|Else|ElseIf|End|Err|Error|Exit|False|For|Function|If|LCase|Loop|LTrim|Next|Nothing|Now|Number|On|Preserve|Quit|ReDim|Resume|RTrim|Select|Set|Sub|Then|To|Trim|True|UBound|UCase|Until|VbCr|VbCrLf|VbLf|VbTab)$/im; 3 | 4 | return { 5 | token: function(stream) { 6 | if (stream.eatSpace()) return null; 7 | var ch = stream.next(); 8 | if (ch == "'") { 9 | stream.skipToEnd(); 10 | return "comment"; 11 | } 12 | if (ch == '"') { 13 | stream.skipTo('"'); 14 | return "string"; 15 | } 16 | 17 | if (/\w/.test(ch)) { 18 | stream.eatWhile(/\w/); 19 | if (regexVBScriptKeyword.test(stream.current())) return "keyword"; 20 | } 21 | return null; 22 | } 23 | }; 24 | }); 25 | 26 | CodeMirror.defineMIME("text/vbscript", "vbscript"); 27 | -------------------------------------------------------------------------------- /lib/mode/velocity/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Velocity mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

CodeMirror: Velocity mode

15 |
90 | 99 | 100 |

MIME types defined: text/velocity.

101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /lib/mode/xml/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: XML mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: XML mode

14 |
26 | 32 |

The XML mode supports two configuration parameters:

33 |
34 |
htmlMode (boolean)
35 |
This switches the mode to parse HTML instead of XML. This 36 | means attributes do not have to be quoted, and some elements 37 | (such as br) do not require a closing tag.
38 |
alignCDATA (boolean)
39 |
Setting this to true will force the opening tag of CDATA 40 | blocks to not be indented.
41 |
42 | 43 |

MIME types defined: application/xml, text/html.

44 | 45 | 46 | -------------------------------------------------------------------------------- /lib/mode/xquery/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2011 by MarkLogic Corporation 2 | Author: Mike Brevoort 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. -------------------------------------------------------------------------------- /lib/mode/yaml/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: YAML mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: YAML mode

14 |
61 | 64 | 65 |

MIME types defined: text/x-yaml.

66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /lib/mode/yaml/yaml.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("yaml", function() { 2 | 3 | var cons = ['true', 'false', 'on', 'off', 'yes', 'no']; 4 | var keywordRegex = new RegExp("\\b(("+cons.join(")|(")+"))$", 'i'); 5 | 6 | return { 7 | token: function(stream, state) { 8 | var ch = stream.peek(); 9 | var esc = state.escaped; 10 | state.escaped = false; 11 | /* comments */ 12 | if (ch == "#") { stream.skipToEnd(); return "comment"; } 13 | if (state.literal && stream.indentation() > state.keyCol) { 14 | stream.skipToEnd(); return "string"; 15 | } else if (state.literal) { state.literal = false; } 16 | if (stream.sol()) { 17 | state.keyCol = 0; 18 | state.pair = false; 19 | state.pairStart = false; 20 | /* document start */ 21 | if(stream.match(/---/)) { return "def"; } 22 | /* document end */ 23 | if (stream.match(/\.\.\./)) { return "def"; } 24 | /* array list item */ 25 | if (stream.match(/\s*-\s+/)) { return 'meta'; } 26 | } 27 | /* pairs (associative arrays) -> key */ 28 | if (!state.pair && stream.match(/^\s*([a-z0-9\._-])+(?=\s*:)/i)) { 29 | state.pair = true; 30 | state.keyCol = stream.indentation(); 31 | return "atom"; 32 | } 33 | if (state.pair && stream.match(/^:\s*/)) { state.pairStart = true; return 'meta'; } 34 | 35 | /* inline pairs/lists */ 36 | if (stream.match(/^(\{|\}|\[|\])/)) { 37 | if (ch == '{') 38 | state.inlinePairs++; 39 | else if (ch == '}') 40 | state.inlinePairs--; 41 | else if (ch == '[') 42 | state.inlineList++; 43 | else 44 | state.inlineList--; 45 | return 'meta'; 46 | } 47 | 48 | /* list seperator */ 49 | if (state.inlineList > 0 && !esc && ch == ',') { 50 | stream.next(); 51 | return 'meta'; 52 | } 53 | /* pairs seperator */ 54 | if (state.inlinePairs > 0 && !esc && ch == ',') { 55 | state.keyCol = 0; 56 | state.pair = false; 57 | state.pairStart = false; 58 | stream.next(); 59 | return 'meta'; 60 | } 61 | 62 | /* start of value of a pair */ 63 | if (state.pairStart) { 64 | /* block literals */ 65 | if (stream.match(/^\s*(\||\>)\s*/)) { state.literal = true; return 'meta'; }; 66 | /* references */ 67 | if (stream.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i)) { return 'variable-2'; } 68 | /* numbers */ 69 | if (state.inlinePairs == 0 && stream.match(/^\s*-?[0-9\.\,]+\s?$/)) { return 'number'; } 70 | if (state.inlinePairs > 0 && stream.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/)) { return 'number'; } 71 | /* keywords */ 72 | if (stream.match(keywordRegex)) { return 'keyword'; } 73 | } 74 | 75 | /* nothing found, continue */ 76 | state.pairStart = false; 77 | state.escaped = (ch == '\\'); 78 | stream.next(); 79 | return null; 80 | }, 81 | startState: function() { 82 | return { 83 | pair: false, 84 | pairStart: false, 85 | keyCol: 0, 86 | inlinePairs: 0, 87 | inlineList: 0, 88 | literal: false, 89 | escaped: false 90 | }; 91 | } 92 | }; 93 | }); 94 | 95 | CodeMirror.defineMIME("text/x-yaml", "yaml"); 96 | -------------------------------------------------------------------------------- /lib/mode/z80/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Z80 assembly mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Z80 assembly mode

14 | 15 |
30 | 31 | 36 | 37 |

MIME type defined: text/x-z80.

38 | 39 | 40 | -------------------------------------------------------------------------------- /lib/mode/z80/z80.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode('z80', function() 2 | { 3 | var 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; 4 | var keywords2 = /^(call|j[pr]|ret[in]?)\b/i; 5 | var keywords3 = /^b_?(call|jump)\b/i; 6 | var variables1 = /^(af?|bc?|c|de?|e|hl?|l|i[xy]?|r|sp)\b/i; 7 | var variables2 = /^(n?[zc]|p[oe]?|m)\b/i; 8 | var errors = /^([hl][xy]|i[xy][hl]|slia|sll)\b/i; 9 | var numbers = /^([\da-f]+h|[0-7]+o|[01]+b|\d+)\b/i; 10 | 11 | return {startState: function() 12 | { 13 | return {context: 0}; 14 | }, token: function(stream, state) 15 | { 16 | if (!stream.column()) 17 | state.context = 0; 18 | 19 | if (stream.eatSpace()) 20 | return null; 21 | 22 | var w; 23 | 24 | if (stream.eatWhile(/\w/)) 25 | { 26 | w = stream.current(); 27 | 28 | if (stream.indentation()) 29 | { 30 | if (state.context == 1 && variables1.test(w)) 31 | return 'variable-2'; 32 | 33 | if (state.context == 2 && variables2.test(w)) 34 | return 'variable-3'; 35 | 36 | if (keywords1.test(w)) 37 | { 38 | state.context = 1; 39 | return 'keyword'; 40 | } 41 | else if (keywords2.test(w)) 42 | { 43 | state.context = 2; 44 | return 'keyword'; 45 | } 46 | else if (keywords3.test(w)) 47 | { 48 | state.context = 3; 49 | return 'keyword'; 50 | } 51 | 52 | if (errors.test(w)) 53 | return 'error'; 54 | } 55 | else if (numbers.test(w)) 56 | { 57 | return 'number'; 58 | } 59 | else 60 | { 61 | return null; 62 | } 63 | } 64 | else if (stream.eat(';')) 65 | { 66 | stream.skipToEnd(); 67 | return 'comment'; 68 | } 69 | else if (stream.eat('"')) 70 | { 71 | while (w = stream.next()) 72 | { 73 | if (w == '"') 74 | break; 75 | 76 | if (w == '\\') 77 | stream.next(); 78 | } 79 | 80 | return 'string'; 81 | } 82 | else if (stream.eat('\'')) 83 | { 84 | if (stream.match(/\\?.'/)) 85 | return 'number'; 86 | } 87 | else if (stream.eat('.') || stream.sol() && stream.eat('#')) 88 | { 89 | state.context = 4; 90 | 91 | if (stream.eatWhile(/\w/)) 92 | return 'def'; 93 | } 94 | else if (stream.eat('$')) 95 | { 96 | if (stream.eatWhile(/[\da-f]/i)) 97 | return 'number'; 98 | } 99 | else if (stream.eat('%')) 100 | { 101 | if (stream.eatWhile(/[01]/)) 102 | return 'number'; 103 | } 104 | else 105 | { 106 | stream.next(); 107 | } 108 | 109 | return null; 110 | }}; 111 | }); 112 | 113 | CodeMirror.defineMIME("text/x-z80", "z80"); 114 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-svn-webkit", 3 | "description": "Simple svn client", 4 | "version": "0.1.0", 5 | "main": "index.html", 6 | "window": { 7 | "toolbar": false, 8 | "frame": true, 9 | "width": 1000, 10 | "height": 800 11 | }, 12 | "dependencies": { 13 | "buffer-encoding": "0.0.1", 14 | "bufferhelper": "^0.2.0", 15 | "date-utils": "*", 16 | "underscore": "*" 17 | } 18 | } -------------------------------------------------------------------------------- /release/svn.app.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/release/svn.app.zip -------------------------------------------------------------------------------- /run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | open -n -a node-webkit ./ -------------------------------------------------------------------------------- /screenshots/changes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/screenshots/changes.png -------------------------------------------------------------------------------- /screenshots/diff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/screenshots/diff.png -------------------------------------------------------------------------------- /screenshots/history.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/screenshots/history.png -------------------------------------------------------------------------------- /screenshots/repositories.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/screenshots/repositories.png -------------------------------------------------------------------------------- /src/router.js: -------------------------------------------------------------------------------- 1 | var EventEmitter = require("events").EventEmitter; 2 | var util = require('util'); 3 | var _ = require("underscore"); 4 | 5 | var Router = function (app) { 6 | var _this = this; 7 | this.app = app; 8 | this.doPushHistory = true; 9 | }; 10 | 11 | util.inherits(Router, EventEmitter); 12 | 13 | var current = -1; 14 | var historyStack = []; 15 | var historySize = 10; 16 | 17 | Router.prototype._pushHistory = function (func, args) { 18 | if (this.doPushHistory) { //simple protection when going back/forward 19 | historyStack.push({ 20 | func: func, 21 | args: args || [] 22 | }); 23 | 24 | //trim to historySize 25 | if (current < historySize - 1) { 26 | current += 1; 27 | historyStack = historyStack.slice(0, current + 1); //clear forwards 28 | } else { 29 | historyStack = _.last(historyStack, historySize); 30 | } 31 | } 32 | this.emit("statechange", current > 0, current < historyStack.length - 1); 33 | }; 34 | 35 | Router.prototype._execHistory = function (cur) { 36 | this.doPushHistory = false; 37 | var item = historyStack[cur]; 38 | item.func.apply(this, item.args); 39 | this.doPushHistory = true; 40 | }; 41 | 42 | Router.prototype.back = function () { 43 | if (current > 0) { 44 | current -= 1; 45 | this._execHistory(current); 46 | } 47 | }; 48 | 49 | Router.prototype.forward = function () { 50 | if (current !== historyStack.length - 1) { 51 | current += 1; 52 | this._execHistory(current); 53 | } 54 | }; 55 | 56 | Router.prototype.showRepo = function (repo) { 57 | this.app.setRepo(repo); 58 | this._pushHistory(this.showRepo, [repo]); 59 | }; 60 | 61 | Router.prototype.showRepositories = function () { 62 | this.app.hideMenu(); 63 | this.app.showRepositories(); 64 | this._pushHistory(this.showRepositories); 65 | }; 66 | 67 | Router.prototype.newRepository = function () { 68 | this.app.hideMenu(); 69 | this.app.showNewRepository(); 70 | this._pushHistory(this.newRepository); 71 | }; 72 | 73 | Router.prototype.openRepository = function (repo) { 74 | this.showHistory(); 75 | this._pushHistory(this.openRepository, [repo]); 76 | }; 77 | 78 | Router.prototype.editRepository = function (repo) { 79 | this.app.hideMenu(); 80 | this.app.editRepository(repo); 81 | this._pushHistory(this.editRepository, [repo]); 82 | }; 83 | 84 | Router.prototype.showHistory = function (path, revision) { 85 | this.app.showMenu(); 86 | this.app.showHistory(path, revision); 87 | this._pushHistory(this.showHistory, [path, revision]); 88 | this.emit("route:history"); 89 | }; 90 | 91 | Router.prototype.showDiffExternal = function (path, revision) { 92 | this.app.showMenu(); 93 | this.app.showDiffExternal(path, revision); 94 | this._pushHistory(this.showDiffExternal, [path, revision]); 95 | this.emit("route:history"); 96 | }; 97 | 98 | Router.prototype.showChanges = function () { 99 | this.app.showMenu(); 100 | this.app.showChanges(); 101 | this._pushHistory(this.showChanges); 102 | this.emit("route:changes"); 103 | }; 104 | 105 | Router.prototype.showDiffLocal = function (path) { 106 | this.app.showMenu(); 107 | this.app.showDiffLocal(path); 108 | this._pushHistory(this.showDiffLocal, [path]); 109 | this.emit("route:changes"); 110 | }; 111 | 112 | Router.prototype.showSettings = function () { 113 | this.app.hideMenu(); 114 | this.app.showSettings(); 115 | this._pushHistory(this.showSettings); 116 | }; 117 | 118 | Router.prototype.showBrowse = function () { 119 | this.app.showMenu(); 120 | this.app.showBrowse(); 121 | this._pushHistory(this.showBrowse); 122 | this.emit("route:browse"); 123 | }; 124 | 125 | Router.prototype.setChangeList = function (changes) { 126 | this.emit("changes", changes); 127 | }; 128 | 129 | module.exports = function (app) { 130 | return new Router(app); 131 | }; -------------------------------------------------------------------------------- /src/settingsProvider.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | require('date-utils'); 3 | var util = require('util'); 4 | 5 | var SettingsProvider = function () { }; 6 | 7 | SettingsProvider.prototype.getValue = function (key, def) { 8 | var val = window.localStorage[key]; 9 | return val !== undefined ? JSON.parse(val) : def; 10 | }; 11 | 12 | SettingsProvider.prototype.setValue = function (key, value) { 13 | return (window.localStorage[key] = JSON.stringify(value)); 14 | }; 15 | 16 | module.exports = new SettingsProvider(); -------------------------------------------------------------------------------- /src/widget/browse.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | require('date-utils'); 3 | var EventEmitter = require("events").EventEmitter; 4 | var util = require('util'); 5 | var Popup = require("./popup"); 6 | var PropList = require("./proplist"); 7 | var pathUtil = require("path"); 8 | 9 | var Browse = function (svn) { 10 | this.svn = svn; 11 | var _this = this; 12 | this.domNode = $("
"); 13 | 14 | var tree = $('
'); 15 | 16 | tree.fileTree({ root: svn.repoRoot }, function (path) { 17 | }, function (path, evt) { 18 | _this.handlePathContextMenu(path, evt); 19 | }); 20 | 21 | this.domNode.append(tree); 22 | }; 23 | 24 | util.inherits(Browse, EventEmitter); 25 | 26 | Browse.prototype.handlePathContextMenu = function (path, evt) { 27 | var _this = this; 28 | var menu = new gui.Menu(); 29 | 30 | menu.append(new gui.MenuItem({ 31 | label: 'Show History', 32 | click: function () { 33 | var relPath = path.replace(_this.svn.repoRoot, ""); 34 | global.App.router.showHistory(relPath); 35 | } 36 | })); 37 | 38 | menu.append(new gui.MenuItem({ 39 | label: 'Show Properties', 40 | click: function () { 41 | _this.svn.getProperties(path, function(err, props) { 42 | if (!err) { 43 | var propList = new PropList(props); 44 | new Popup("Properties", null, function (doSave) { 45 | if (doSave) { 46 | var newProps = propList.getProperties(); 47 | for (var prop in newProps) { 48 | _this.svn.setProperty(path, prop, newProps[prop]); 49 | } 50 | for (prop in props) { 51 | if (!newProps[prop]) { 52 | _this.svn.setProperty(path, prop, null); 53 | } 54 | } 55 | } 56 | propList.domNode.remove(); 57 | }, { 58 | okMessage: "Save", 59 | html: propList.domNode 60 | }); 61 | } 62 | }); 63 | } 64 | })); 65 | 66 | menu.append(new gui.MenuItem({ 67 | type: "separator" 68 | })); 69 | 70 | menu.append(new gui.MenuItem({ 71 | label: 'Reveal File', 72 | click: function () { 73 | // Open a file in file explorer. 74 | gui.Shell.showItemInFolder(path); 75 | } 76 | })); 77 | 78 | menu.append(new gui.MenuItem({ 79 | label: 'Edit File', 80 | click: function () { 81 | // Open a text file with default text editor. 82 | gui.Shell.openItem(path); 83 | } 84 | })); 85 | 86 | menu.popup(evt.clientX, evt.clientY); 87 | }; 88 | 89 | module.exports = function (svn) { 90 | return new Browse(svn); 91 | }; -------------------------------------------------------------------------------- /src/widget/changeItem.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | require('date-utils'); 3 | var EventEmitter = require("events").EventEmitter; 4 | var util = require('util'); 5 | 6 | var ChangeItem = function (change) { 7 | var status = change.status, path = change.path, checkBox, _this = this; 8 | this.domNode = $("
  • "); 9 | checkBox = this.checkBox = $(""); 10 | this.domNode.append(this.checkBox); 11 | this.domNode.append($("" + status + "")[0]); 12 | this.domNode.append($("" + path + "")); 13 | 14 | checkBox.on('click', function (evt) { 15 | evt.stopPropagation(); 16 | }); 17 | 18 | this.path = path; 19 | 20 | this.domNode.on('click', function (evt) { 21 | _this.handleChangeClick(evt, path); 22 | }); 23 | 24 | this.domNode.on('contextmenu', function (evt) { 25 | _this.handleContextMenu(evt, change); 26 | }); 27 | }; 28 | 29 | util.inherits(ChangeItem, EventEmitter); 30 | 31 | ChangeItem.prototype.handleChangeClick = function (evt, path) { 32 | this.emit("changeClick", path); 33 | }; 34 | 35 | ChangeItem.prototype.handleContextMenu = function (evt, change) { 36 | this.emit("contextMenu", evt, change); 37 | }; 38 | 39 | ChangeItem.prototype.setChecked = function (checked) { 40 | this.checkBox[0].checked = checked; 41 | }; 42 | 43 | ChangeItem.prototype.getChecked = function (checked) { 44 | return this.checkBox[0].checked; 45 | }; 46 | 47 | module.exports = function (change) { 48 | return new ChangeItem(change); 49 | }; -------------------------------------------------------------------------------- /src/widget/diffViewer.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | require('date-utils'); 3 | var EventEmitter = require("events").EventEmitter; 4 | var util = require('util'); 5 | var SettingsProvider = require('../settingsProvider.js'); 6 | var path = require('path'); 7 | 8 | var modeMap = { 9 | 'apl': 'apl', 10 | 'ast': 'asterisk', 11 | 'c': 'clike', 12 | 'cpp': 'clike', 13 | 'java': 'clike', 14 | 'cs': 'clike', 15 | 'scaler': 'clike', 16 | 'clj': 'clojure', 17 | 'coffee': 'coffeescript', 18 | 'lisp': 'commonlisp', 19 | 'css': 'css', 20 | 'd': 'd', 21 | 'diff': 'diff', 22 | 'ecl': 'ecl', 23 | 'erlang': 'erlang', 24 | 'gfm': 'gfm', 25 | 'go': 'go', 26 | 'groovy': 'groovy', 27 | 'haskell': 'haskell', 28 | 'asp': 'htmlembedded', 29 | 'html': 'htmlembedded', 30 | 'htm': 'htmlembedded', 31 | 'jsp': 'htmlmixed', 32 | 'http': 'http', 33 | 'js': 'javascript', 34 | 'json': 'javascript', 35 | 'ts': 'javascript', 36 | 'jinja': 'jinja2', 37 | 'less': 'less', 38 | 'lua': 'lua', 39 | 'md': 'markdown', 40 | 'nt': 'ntriples', 41 | 'ocaml': 'ocaml', 42 | 'pascal': 'pascal', 43 | 'ext': 'perl', 44 | 'php': 'php', 45 | 'properties': 'clike', 46 | 'py': 'python', 47 | 'r': 'r', 48 | 'rst': 'rst', 49 | 'rb': 'ruby', 50 | 'rust': 'rust', 51 | 'sass': 'sass', 52 | 'scheme': 'scheme', 53 | 'sh': 'shell', 54 | 'sql': 'sql', 55 | 'vb': 'vb', 56 | 'vbs': 'vbscript', 57 | 'xml': 'xml', 58 | 'xquery': 'xquery', 59 | 'yaml': 'yaml', 60 | 'z80': 'z80' 61 | }; 62 | 63 | 64 | var DiffViewer = function () { 65 | this.domNode = $("
    "); 66 | }; 67 | 68 | util.inherits(DiffViewer, EventEmitter); 69 | 70 | DiffViewer.prototype.show = function (ext, file1, file2, editable) { 71 | var mergely = $("
    "); 72 | this.domNode.append(mergely); 73 | 74 | mergely.mergely({ 75 | rhs_cmsettings: { 76 | readOnly: true //editable !== false 77 | }, 78 | cmsettings: { 79 | readOnly: true, 80 | lineWrapping: false, 81 | autoresize: false, 82 | theme: SettingsProvider.getValue("editorTheme", "default"), 83 | modeURL: "./lib/mode/%N/%N.js", 84 | mode: modeMap[ext] 85 | }, 86 | resize: function () { 87 | var w = $(mergely).parent().width(); 88 | var h = $(mergely).parent().height(); 89 | var content_width = w / 2.0 - 2 * 8 - 8; 90 | var content_height = h; 91 | var self = $(mergely); 92 | self.find('.mergely-column').css({ 'width': content_width + 'px' }); 93 | self.find('.mergely-column, .mergely-canvas, .mergely-margin, .mergely-column textarea, .CodeMirror-scroll, .CodeMirror').css({ 'height': content_height + 'px' }); 94 | self.find('.mergely-canvas').css({ 'height': content_height + 'px' }); 95 | self.find('.mergely-column textarea').css({ 'width': content_width + 'px' }); 96 | self.css({ 'width': w + 'px', 'height': h + 'px' }); 97 | if (self.css('display') == 'none') { 98 | if (this.fadein !== false) self.fadeIn(this.fadein); 99 | else self.show(); 100 | if (this.loaded) this.loaded(); 101 | } 102 | if (this.resized) this.resized(); 103 | } 104 | }); 105 | 106 | mergely.mergely('lhs', file1); 107 | mergely.mergely('rhs', file2); 108 | }; 109 | 110 | 111 | 112 | 113 | module.exports = function () { 114 | return new DiffViewer(); 115 | }; -------------------------------------------------------------------------------- /src/widget/framebar.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | var util = require('util'); 3 | var EventEmitter = require("events").EventEmitter; 4 | require('date-utils'); 5 | 6 | var FrameBar = function () { 7 | var _this = this, 8 | win = gui.Window.get(), 9 | container = $('
    '), 10 | tools = $('
    ') 11 | .appendTo(container), 12 | close = $('
    X
    ') 13 | .on('click', function () { 14 | win.close(); 15 | }) 16 | .appendTo(tools); 17 | min = $('
    _
    ') 18 | .on('click', function () { 19 | win.minimize(); 20 | }) 21 | .appendTo(tools), 22 | max = $('
    +
    ') 23 | .on('click', function () { 24 | win.maximize(); 25 | }) 26 | .appendTo(tools); 27 | 28 | switch (process.platform) { 29 | case "win32": 30 | container.addClass("windows"); 31 | break; 32 | case "darwin": 33 | container.addClass("osx"); 34 | break; 35 | case "linux": 36 | container.addClass("linux"); 37 | break; 38 | } 39 | 40 | this.domNode = container; 41 | }; 42 | 43 | util.inherits(FrameBar, EventEmitter); 44 | 45 | module.exports = function (svn) { 46 | return new FrameBar(svn); 47 | }; -------------------------------------------------------------------------------- /src/widget/logItem.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | require('date-utils'); 3 | var EventEmitter = require("events").EventEmitter; 4 | var util = require('util'); 5 | 6 | var LogItem = function (log, isWorkingRev) { 7 | this.expanded = false; 8 | var _this = this, 9 | template = _.template("
    <%= author %>
    " + 10 | "
    <%= date.toFormat('H:MIP') %>
    " + 11 | "
    <%= revision %>
    " + 12 | "
    <%= message %>
    "), 13 | item = $("
  • " + template(log) + "
  • "), 14 | changeList = $("
    "); 15 | 16 | log.changes.forEach(function (change) { 17 | var status = change.status, 18 | path = change.path, 19 | changeNode = $("
    " + status + "" + path + "
    "); 20 | 21 | changeNode.on('click', function (evt) { 22 | evt.stopPropagation(); 23 | _this.handleChangeClick(path, log.revision); 24 | }); 25 | 26 | changeNode.on('contextmenu', function (evt) { 27 | evt.stopPropagation(); 28 | _this.handleChangeContextMenu(evt, path); 29 | }); 30 | 31 | changeList.append(changeNode); 32 | }); 33 | 34 | if (isWorkingRev) { 35 | item.addClass("working-revision"); 36 | } 37 | 38 | item.append(changeList); 39 | 40 | _this.changeListNode = changeList; 41 | 42 | item.on('click', function (evt) { 43 | evt.stopPropagation(); 44 | _this.handleClick(evt, log, item); 45 | }); 46 | 47 | this.domNode = item; 48 | }; 49 | 50 | util.inherits(LogItem, EventEmitter); 51 | 52 | LogItem.prototype.handleChangeContextMenu = function (evt, path) { 53 | var menu = new gui.Menu(); 54 | 55 | menu.append(new gui.MenuItem({ 56 | label: 'Show History', 57 | click: function () { 58 | global.App.router.showHistory(path); 59 | } 60 | })); 61 | 62 | menu.popup(evt.clientX, evt.clientY); 63 | }; 64 | 65 | LogItem.prototype.handleClick = function (evt, log, item) { 66 | if (this.expanded) { 67 | this.changeListNode.slideUp(); 68 | } else { 69 | this.changeListNode.slideDown(); 70 | } 71 | this.expanded = !this.expanded; 72 | }; 73 | 74 | LogItem.prototype.handleChangeClick = function (path, revision) { 75 | global.App.router.showDiffExternal(path, revision); 76 | }; 77 | 78 | module.exports = function (log, isWorkingRev) { 79 | return new LogItem(log, isWorkingRev); 80 | }; -------------------------------------------------------------------------------- /src/widget/logList.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'), 2 | EventEmitter = require("events").EventEmitter, 3 | util = require('util'), 4 | LogItem = require('./logItem.js'), 5 | SettingsProvider = require('../settingsProvider.js'); 6 | 7 | require('date-utils'); 8 | 9 | var LogList = function (svn, path) { 10 | var _this = this; 11 | this.svn = svn; 12 | this.domNode = $("
    "); 13 | this.refreshButton = $(''); 14 | // this.domNode.append(this.refreshButton); 15 | this.logContainer = $("
    "); 16 | this.domNode.append(this.logContainer); 17 | this.fetchLogs(path); 18 | this.path = path; 19 | 20 | this.refreshButton[0].onclick = function () { 21 | _this.refresh(); 22 | }; 23 | }; 24 | 25 | util.inherits(LogList, EventEmitter); 26 | 27 | LogList.prototype.refresh = function () { 28 | this.logContainer.empty(); 29 | this.fetchLogs(this.path); 30 | }; 31 | 32 | LogList.prototype.fetchLogs = function (path) { 33 | var _this = this; 34 | _this.domNode.addClass('loading'); 35 | this.svn.log(path, SettingsProvider.getValue('logLimit', 15), function (err, logs) { 36 | _this.domNode.removeClass('loading'); 37 | if (!err) { 38 | _this.showLogs(logs); 39 | } 40 | }); 41 | }; 42 | 43 | LogList.prototype.showLogs = function (logs) { 44 | var listWrapper = this.logContainer, 45 | currentList, 46 | prevDate, 47 | _this = this, 48 | workingRev = this.svn.info.lastchangedrev; 49 | 50 | logs.forEach(function (log) { 51 | //create date slitter 52 | if (!prevDate || prevDate.toYMD().localeCompare(log.date.toYMD()) > 0) { 53 | dateSplitter = $("
    "); 54 | dateSplitter.addClass("date-splitter"); 55 | dateSplitter.html(log.date.toFormat("MMMM D, YYYY")); 56 | listWrapper.append(dateSplitter); 57 | currentList = $("
      "); 58 | listWrapper.append(currentList); 59 | } 60 | 61 | prevDate = log.date; 62 | 63 | //create log item 64 | var logItem = new LogItem(log, log.revision === workingRev); 65 | currentList.append(logItem.domNode); 66 | logItem.on("changeClick", function (path) { 67 | _this.handleChangeClick(path, log.revision); 68 | }); 69 | logItem.domNode.on('contextmenu', function (evt) { 70 | _this.showLogItemContextMenu(evt, log); 71 | }); 72 | }); 73 | 74 | }; 75 | 76 | LogList.prototype.showLogItemContextMenu = function (evt, log) { 77 | var menu = new gui.Menu(), 78 | rev = log.revision, 79 | _this = this; 80 | 81 | menu.append(new gui.MenuItem({ 82 | label: 'Revert Changes From Revision ' + rev, 83 | click: function () { 84 | _this.handleRevert(rev); 85 | } 86 | })); 87 | 88 | menu.append(new gui.MenuItem({ 89 | label: 'Update to Revision ' + rev, 90 | click: function () { 91 | _this.handleUpdate(rev); 92 | } 93 | })); 94 | 95 | menu.popup(evt.clientX, evt.clientY); 96 | }; 97 | 98 | LogList.prototype.handleUpdate = function (rev) { 99 | var _this = this; 100 | this.svn.update(function (err, text) { 101 | console.log(text); 102 | _this.refresh(); 103 | }, rev); 104 | }; 105 | 106 | LogList.prototype.handleRevert = function (rev) { 107 | this.svn.revertRevision("", rev, function (err, text) { 108 | window.confirm("err:" + err + "\n\n text:" + text); 109 | }); 110 | }; 111 | 112 | LogList.prototype.handleChangeClick = function (path, revision) { 113 | this.emit("changeClick", path, revision); 114 | }; 115 | 116 | module.exports = function (svn, path) { 117 | return new LogList(svn, path); 118 | }; -------------------------------------------------------------------------------- /src/widget/navigation.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | var util = require('util'); 3 | var EventEmitter = require("events").EventEmitter; 4 | require('date-utils'); 5 | 6 | var Navigation = function () { 7 | var _this = this, 8 | items = ["History", "Changes", "Browse"], 9 | container = this.container = $('