Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

syntax fix

  • Loading branch information...
commit 456a07a5f4cea4021eedf0a4356e0614752d6074 1 parent abd394f
@Pomax authored
View
4 docs/tutorial/more-mario.html
@@ -745,7 +745,7 @@
}
void mousePressed(int mx, int my, int mb) {
- swapForLevel("Level Two");
+ if(mb == RIGHT) swapForLevel("Level Two");
}
}
@@ -776,7 +776,7 @@
}
void mousePressed(int mx, int my, int mb) {
- swapForLevel("Level One");
+ if(mb == RIGHT) swapForLevel("Level One");
}
}
View
4 docs/tutorial/style.css
@@ -89,6 +89,10 @@ code:after { content: "]"; }
color: darkgreen;
}
+.constant {
+ color: lightSeaGreen;
+}
+
navigation ol {
display: table;
border: 1px solid black;
View
32 docs/tutorial/syntaxHighlight.js
@@ -1,6 +1,19 @@
(function(){
- document.addEventListener("DOMContentLoaded",function(){
+ // our list of highlightable syntax - Processing/Java
+ var keywords = ["abstract","continue","for","new","switch",
+ "assert","default","goto","package","synchronized",
+ "boolean","do","if","private","this",
+ "break","double","implements","protected","throw",
+ "byte","else","import","public","throws",
+ "case","enum","instanceof","return","transient",
+ "catch","extends","int","short","try",
+ "char","final","interface","static","void",
+ "class","finally","long","strictfp","volatile",
+ "const*","float","native","super","while"];
+
+ // make magic happen on DOMContentLoaded
+ document.addEventListener("DOMContentLoaded", function() {
// replace textareas with <pre> elements
$("textarea").each(function(){
// 1: don't convert if told not to
@@ -39,18 +52,6 @@
});
},false);
- // our list of highlightable syntax - Processing/Java
- keywords = ["abstract","continue","for","new","switch",
- "assert","default","goto","package","synchronized",
- "boolean","do","if","private","this",
- "break","double","implements","protected","throw",
- "byte","else","import","public","throws",
- "case","enum","instanceof","return","transient",
- "catch","extends","int","short","try",
- "char","final","interface","static","void",
- "class","finally","long","strictfp","volatile",
- "const*","float","native","super","while"];
-
function syntax_highlight(line) {
// 1: process line comments
var parts = line.split("//");
@@ -72,8 +73,11 @@
// 4: process numerals
line = line.replace(/([\d,.]+)/g,"<span class=\"number\">$1</span>");
+
+ // 5: colour constants
+ line = line.replace(/(\b[A-Z]+\b)/g,"<span class=\"constant\">$1</span>");
- // 5: enable all classes
+ // 6: enable all classes
line = line.replace(/clss=/g,"class=");
return line + comment;
}
Please sign in to comment.
Something went wrong with that request. Please try again.