Skip to content

Commit 3f15cb8

Browse files
committed
Python now supported as a language
Also minor fixes to Ruby's usage
1 parent eca4f8e commit 3f15cb8

8 files changed

Lines changed: 49 additions & 46 deletions

File tree

CodeMirror-3.12/lib/codemirror-compressed.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ You can run ICEcoder either online or locally, on Linux, Windows or Mac based pl
1010

1111
###Features you'd expect
1212
* Context aware code highlighting
13-
* Supports HTML, CSS, LESS, JavaScript, CoffeeScript, PHP & Ruby, Markdown & more
13+
* Supports HTML, CSS, LESS, JavaScript, CoffeeScript, PHP, Python, Ruby, Markdown & more
1414
* Smart tab key system (selected text indents line)
1515
* File manager
1616
* Find & replace/replace all

editor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<!--
1212
codemirror-compressed.js
1313
incls: codemirror
14-
modes: clike, coffeescript, css, htmlmixed, javascript, less, markdown, php, ruby & xml
14+
modes: clike, coffeescript, css, htmlmixed, javascript, less, markdown, php, python, ruby & xml
1515
utils: closetag, foldcode, xml-fold, brace-fold, show-hint, javascript-hint, html-hint, searchcursor, match-highlighter
1616
//-->
1717
<script src="<?php echo $ICEcoder["codeMirrorDir"]; ?>/lib/codemirror-compressed.js"></script>
@@ -219,7 +219,7 @@ function createNewCMInstance(num) {
219219
);
220220

221221
window['cM'+num].on("gutterClick", function(thisCM, line, gutter, clickEvent) {
222-
["JavaScript","CoffeeScript","PHP","Ruby"].indexOf(top.ICEcoder.caretLocType) > -1
222+
["JavaScript","CoffeeScript","PHP","Python","Ruby"].indexOf(top.ICEcoder.caretLocType) > -1
223223
? codeFoldBrace(window['cM'+num], line) : codeFoldTag(window['cM'+num], line);
224224
window['cM'+num].setGutterMarker(line, "CodeMirror-linenumbers", document.createTextNode("+ "+(line+1)));
225225
setTimeout(function() {

images/file-folder-icons.png

811 Bytes
Loading

lib/file-control.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
finfo_close($finfoMIME);
2929
} else {
3030
$fileExt = pathinfo($file, PATHINFO_EXTENSION);
31-
if (array_search($fileExt,array("coffee","css","htm","html","js","less","md","php","rb","ruby","txt","xml"))!==false) {$finfo = "text";};
31+
if (array_search($fileExt,array("coffee","css","htm","html","js","less","md","php","py","rb","ruby","txt","xml"))!==false) {$finfo = "text";};
3232
if (array_search($fileExt,array("gif","jpg","jpeg","png"))!==false) {$finfo = "image";};
3333
}
3434
if (strpos($finfo,"text")===0 || strpos($finfo,"empty")!==false) {

lib/files.css

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ body {margin: 0; overflow: auto}
5858
.fileManager LI.ext-md:before {background-position: -160px 0}
5959
.fileManager LI.ext-php:before {background-position: -176px 0}
6060
.fileManager LI.ext-png:before {background-position: -192px 0}
61-
.fileManager LI.ext-rb:before, .fileManager LI.ext-ruby:before {background-position: -208px 0}
62-
.fileManager LI.ext-txt:before {background-position: -224px 0}
63-
.fileManager LI.ext-zip:before {background-position: -240px 0}
61+
.fileManager LI.ext-py:before {background-position: -208px 0}
62+
.fileManager LI.ext-rb:before, .fileManager LI.ext-ruby:before {background-position: -224px 0}
63+
.fileManager LI.ext-txt:before {background-position: -240px 0}
64+
.fileManager LI.ext-zip:before {background-position: -256px 0}

lib/ice-coder.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ var ICEcoder = {
157157
contentCleanUp: function() {
158158
var fileName, cM, content;
159159

160-
// If it's not a JS, CoffeeScript Ruby, CSS or LESS file, replace our temp /textarea value
160+
// If it's not a JS, CoffeeScript, CSS or LESS file, replace our temp /textarea value
161161
fileName = ICEcoder.openFiles[ICEcoder.selectedTab-1];
162-
if (["js","coffee","rb","css","less"].indexOf(fileName.split(".")[1])<0) {
162+
if (["js","coffee","css","less"].indexOf(fileName.split(".")[1])<0) {
163163
cM = ICEcoder.getcMInstance();
164164
content = cM.getValue();
165165
content = content.replace(/<ICEcoder:\/:textarea>/g,'<\/textarea>');
@@ -216,6 +216,7 @@ var ICEcoder = {
216216
fileName.indexOf('.js')>0 ? cM.setOption("mode","javascript")
217217
: fileName.indexOf('.coffee')>0 ? cM.setOption("mode","coffeescript")
218218
: fileName.indexOf('.rb')>0 ? cM.setOption("mode","ruby")
219+
: fileName.indexOf('.py')>0 ? cM.setOption("mode","python")
219220
: fileName.indexOf('.css')>0 ? cM.setOption("mode","css")
220221
: fileName.indexOf('.less')>0 ? cM.setOption("mode","less")
221222
: fileName.indexOf('.md')>0 ? cM.setOption("mode","markdown")
@@ -234,9 +235,9 @@ var ICEcoder = {
234235
lCLen = lineContent.length;
235236
adjustCursor = 2;
236237

237-
if (["JavaScript","CoffeeScript","PHP","Ruby","CSS"].indexOf(ICEcoder.caretLocType)>-1) {
238+
if (["JavaScript","CoffeeScript","PHP","Python","Ruby","CSS"].indexOf(ICEcoder.caretLocType)>-1) {
238239
if (cM.somethingSelected()) {
239-
if (ICEcoder.caretLocType=="Ruby") {
240+
if (ICEcoder.caretLocType=="Ruby"||ICEcoder.caretLocType=="Python") {
240241
startLine = cM.getCursor(true).line;
241242
endLine = cM.getCursor().line;
242243
for (var i=startLine; i<=endLine; i++) {
@@ -1049,7 +1050,7 @@ var ICEcoder = {
10491050
ICEcoder.nestDisplay.innerHTML = "";
10501051
if ("undefined" != typeof ICEcoder.openFiles[ICEcoder.selectedTab-1]) {
10511052
fileName = ICEcoder.openFiles[ICEcoder.selectedTab-1];
1052-
if (["js","coffee","rb","css","less"].indexOf(fileName.split(".")[1])<0 &&
1053+
if (["js","coffee","css","less"].indexOf(fileName.split(".")[1])<0 &&
10531054
(nestCheck.indexOf("include(")==-1)&&(nestCheck.indexOf("include_once(")==-1)&&
10541055
(nestCheck.indexOf("<html")>-1||nestCheck.indexOf("<body")>-1)) {
10551056

@@ -1078,7 +1079,7 @@ var ICEcoder = {
10781079
cM = ICEcoder.getcMInstance();
10791080
nestOK = true;
10801081
fileName = ICEcoder.openFiles[ICEcoder.selectedTab-1];
1081-
if (cM && fileName && ["js","coffee","rb","css","less"].indexOf(fileName.split(".")[1])==-1) {
1082+
if (cM && fileName && ["js","coffee","css","less"].indexOf(fileName.split(".")[1])==-1) {
10821083
nestOK = cM.getTokenAt({line:cM.lineCount(),ch:cM.lineInfo(cM.lineCount()-1).text.length}).className != "error" ? true : false;
10831084
}
10841085
ICEcoder.nestValid.style.background = nestOK ? "#0b0" : "#f00";
@@ -1127,6 +1128,7 @@ var ICEcoder = {
11271128
fileName = ICEcoder.openFiles[ICEcoder.selectedTab-1];
11281129
if (fileName.indexOf(".js")>0) {caretLocType="JavaScript"}
11291130
else if (fileName.indexOf(".coffee")>0) {caretLocType="CoffeeScript"}
1131+
else if (fileName.indexOf(".py")>0) {caretLocType="Python"}
11301132
else if (fileName.indexOf(".rb")>0) {caretLocType="Ruby"}
11311133
else if (fileName.indexOf(".css")>0) {caretLocType="CSS"}
11321134
else if (fileName.indexOf(".less")>0) {caretLocType="LESS"}

0 commit comments

Comments
 (0)