Skip to content

Commit

Permalink
Merge pull request #1 from danshearmur/master
Browse files Browse the repository at this point in the history
Added syntax highlighting for java
  • Loading branch information
deanpullen committed May 4, 2012
2 parents 9c2faef + a140bc4 commit 41cc659
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 33 deletions.
32 changes: 32 additions & 0 deletions pom.xml
Expand Up @@ -47,6 +47,38 @@
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
<stopKey>sipp2</stopKey>
<stopPort>9999</stopPort>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
<configuration>
<daemon>true</daemon>
<connectors>
<connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
<port>8181</port>
</connector>
</connectors>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
60 changes: 59 additions & 1 deletion src/main/webapp/js/plugins.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/main/webapp/sections/classes.html
Expand Up @@ -16,7 +16,7 @@ <h3 id="beginningComments">Beginning Comments</h3>
<p>This comes under the package name and import statements and just above the class declaration.</p>

<figure class="preCode">Class start</figure>
<textarea class="brush:html">
<textarea class="brush:java">
package com.semantico.example;

import java.util.*;
Expand All @@ -41,7 +41,7 @@ <h3 id="packageAndImportStatements">Package and Import Statements</h3>
<p>The first non-comment line of most Java source files is a package statement. After that, import statements can follow. For example:</p>

<figure class="preCode">Package and Import Statements</figure>
<textarea class="brush:html">
<textarea class="brush:java">
package java.awt;

import java.awt.peer.CanvasPeer;
Expand Down Expand Up @@ -86,4 +86,4 @@ <h3 id="classAndInterfaceDeclarations">Class and Interface Declarations</h3>



</section>
</section>
14 changes: 7 additions & 7 deletions src/main/webapp/sections/naming.html
Expand Up @@ -19,7 +19,7 @@ <h2 id="packages">Packages</h2>
machine, or login names.</p>

<figure class="preCode">Package examples:</figure>
<textarea class="brush:html">
<textarea class="brush:java">
com.sun.eng

com.semantico.ribo.web.controllers
Expand All @@ -35,7 +35,7 @@ <h2 id="classes">Classes</h2>
(unless the abbreviation is much more widely used than the long form, such as URL or HTML).</p>

<figure class="preCode">Class examples:</figure>
<textarea class="brush:html">
<textarea class="brush:java">
class Raster;

class ImageSprite;
Expand All @@ -46,7 +46,7 @@ <h2 id="interfaces">Interfaces</h2>
<p>Interface names should be capitalized like class names.</p>

<figure class="preCode">Interface examples:</figure>
<textarea class="brush:html">
<textarea class="brush:java">
interface RasterDelegate;

interface Storing;
Expand All @@ -58,7 +58,7 @@ <h2 id="methods">Methods</h2>
word capitalized.</p>

<figure class="preCode">Method examples:</figure>
<textarea class="brush:html">
<textarea class="brush:java">
crun();

runFast();
Expand All @@ -81,7 +81,7 @@ <h2 id="variables">Variables</h2>
<p>Common names for temporary variables are i, j, k, m, and n for integers; c, d, and e for characters.</p>

<figure class="preCode">Variable examples:</figure>
<textarea class="brush:html">
<textarea class="brush:java">
int i; // only used for temp. variables

char firstLetter;
Expand All @@ -95,11 +95,11 @@ <h2 id="constants">Constants</h2>
separated by underscores ("_"). (ANSI constants should be avoided, for ease of debugging.)</p>

<figure class="preCode">Constant examples:</figure>
<textarea class="brush:html">
<textarea class="brush:java">
static final int MIN_WIDTH = 4;

static final int MAX_WIDTH = 999;

static final int GET_THE_CPU = 1;
</textarea>
</section>
</section>
6 changes: 3 additions & 3 deletions src/main/webapp/sections/programmingPractices.html
Expand Up @@ -18,7 +18,7 @@ <h3 id="classVariablesMethods">Referring to Class Variables and Methods</h3>
<p>Avoid using an object to access a class (static) variable or method. Use a class name instead. For example:</p>

<figure class="preCode">Examples:</figure>
<textarea class="brush:html">
<textarea class="brush:java">
classMethod(); //OK

AClass.classMethod(); //OK
Expand Down Expand Up @@ -72,7 +72,7 @@ <h3 id="parentheses">Parentheses</h3>
programmers know precedence as well as you do.</p>

<figure class="preCode">Examples:</figure>
<textarea class="brush:html">
<textarea class="brush:java">
if (a == b && c == d) // AVOID!
if ((a == b) && (c == d)) // RIGHT
</textarea>
Expand All @@ -88,4 +88,4 @@ <h3 id="expressionsConditional">Expressions before `?' in the Conditional Operat
(x >= 0) ? x : -x;
</textarea>

</section>
</section>
28 changes: 14 additions & 14 deletions src/main/webapp/sections/statements.html
Expand Up @@ -14,7 +14,7 @@ <h3 id="simpleStatements">Simple Statements</h3>
<p>Each line should contain at most one statement:</p>

<figure class="preCode">Basic:</figure>
<textarea class="brush:html">
<textarea class="brush:java">
argv++; // Correct
argc--; // Correct
argv++; argc--; // AVOID!
Expand All @@ -38,7 +38,7 @@ <h3 id="returnStatements">Return Statements</h3>
<p>A return statement with a value should not use parentheses unless they make the return value more obvious in some way:</p>

<figure class="preCode">Return:</figure>
<textarea class="brush:html">
<textarea class="brush:java">
return;

return myDisk.size();
Expand All @@ -52,7 +52,7 @@ <h3 id="ifStatements">If, if-else, if else-if else Statements</h3>
<p>Note the space before the parentheses and the braces.</p>

<figure class="preCode">If/Else:</figure>
<textarea class="brush:html">
<textarea class="brush:java">
if (condition) {
statements;
}
Expand All @@ -75,7 +75,7 @@ <h3 id="ifStatements">If, if-else, if else-if else Statements</h3>
<p>You <b>MUST</b> always use braces, do not do:</p>

<figure class="preCode">Bad:</figure>
<textarea class="brush:html">
<textarea class="brush:java">
if (condition) //AVOID! THIS OMITS THE BRACES {}!
statement;
</textarea>
Expand All @@ -86,7 +86,7 @@ <h3 id="forStatements">For Statements</h3>
<p>A standard "for" statement should have either this form:</p>

<figure class="preCode">For:</figure>
<textarea class="brush:html">
<textarea class="brush:java">
for (initialization; condition; update) {
statements;
}
Expand All @@ -95,7 +95,7 @@ <h3 id="forStatements">For Statements</h3>
<p>Or the new enhanced (Java 5) for-each form:</p>

<figure class="preCode">New(ish) for:</figure>
<textarea class="brush:html">
<textarea class="brush:java">
for (Object object : collection[Object]) {
statements;
}
Expand All @@ -105,7 +105,7 @@ <h3 id="forStatements">For Statements</h3>
should have the following form:</p>

<figure class="preCode">Empty for:</figure>
<textarea class="brush:html">
<textarea class="brush:java">
for (initialization; condition; update);
</textarea>

Expand All @@ -119,7 +119,7 @@ <h3 id="whileStatements">While Statements</h3>
<p>A "while" statement should have the following form:</p>

<figure class="preCode">While:</figure>
<textarea class="brush:html">
<textarea class="brush:java">
while (condition) {
statements;
}
Expand All @@ -128,7 +128,7 @@ <h3 id="whileStatements">While Statements</h3>
<p>An empty while statement should have the following form:</p>

<figure class="preCode">Empty While:</figure>
<textarea class="brush:html">
<textarea class="brush:java">
while (condition);
</textarea>

Expand All @@ -137,7 +137,7 @@ <h3 id="doWhileStatements">Do-while Statements</h3>
<p>A do-while statement should have the following form, note the while is on the same line as the ending brace:</p>

<figure class="preCode">Do-while:</figure>
<textarea class="brush:html">
<textarea class="brush:java">
do {
statements;
} while (condition);
Expand All @@ -148,7 +148,7 @@ <h3 id="switchStatements">Switch Statements</h3>
<p>A switch statement should have the following form:</p>

<figure class="preCode">Switch:</figure>
<textarea class="brush:html">
<textarea class="brush:java">
switch (condition) {
case ABC:
statements;
Expand Down Expand Up @@ -177,7 +177,7 @@ <h3 id="tryCatchStatements">Try-catch Statements</h3>
<p>Note the catch on the same line as the closing try brace.</p>

<figure class="preCode">Try-catch:</figure>
<textarea class="brush:html">
<textarea class="brush:java">
try {
statements;
} catch (ExceptionClass e) {
Expand All @@ -189,7 +189,7 @@ <h3 id="tryCatchStatements">Try-catch Statements</h3>
<p>The finally executes regardless of whether or not the try block has completed successfully.</p>

<figure class="preCode">Try-catch-finally:</figure>
<textarea class="brush:html">
<textarea class="brush:java">
try {
statements;
} catch (ExceptionClass e) {
Expand All @@ -198,4 +198,4 @@ <h3 id="tryCatchStatements">Try-catch Statements</h3>
statements;
}
</textarea>
</section>
</section>
10 changes: 5 additions & 5 deletions src/main/webapp/sections/whiteSpace.html
Expand Up @@ -38,7 +38,7 @@ <h3 id="blankSpaces">Blank Spaces</h3>
<ui>
<li>A keyword followed by a parenthesis should be separated by a space. Example:
<p></p>
<textarea class="brush:html">
<textarea class="brush:java">
while (true) {
...
}
Expand All @@ -55,7 +55,7 @@ <h3 id="blankSpaces">Blank Spaces</h3>
<li>All binary operators except . should be separated from their operands by spaces. Blank spaces should never
separate unary operators such as unary minus, increment ("++"), and decrement ("--") from their operands. Example:
<p></p>
<textarea class="brush:html">
<textarea class="brush:java">
a += c + d;
a = (a + b) / (c * d);

Expand All @@ -69,15 +69,15 @@ <h3 id="blankSpaces">Blank Spaces</h3>
<li>
The expressions in a for statement should be separated by blank spaces. Example:
<p></p>
<textarea class="brush:html">
<textarea class="brush:java">
for (expr1; expr2; expr3)
</textarea>
<p></p>
</li>
<li>
Casts should be followed by a blank space. Examples:
<p></p>
<textarea class="brush:html">
<textarea class="brush:java">
myMethod((byte) aNum, (Object) x);
myMethod((int) (cp + 5), ((int) (i + 3)) + 1);
</textarea>
Expand All @@ -87,4 +87,4 @@ <h3 id="blankSpaces">Blank Spaces</h3>



</section>
</section>

0 comments on commit 41cc659

Please sign in to comment.