08.06
To use the Source Code HTML Formatter simpy do the following:
Include the code2webdisplay.jar file in your classpath
The API can be accessed in a simple way:
ISourceCodeParser parser = new JavaParser(); // This can also be: CPlusPlusParser, CSharpParser
parser.setCSSPath(”http://www.mysite.com/css/default.css”);
String html = parser.codeToHtml(new File(”c:/path/MyClass.java”));
Here is the code for the CSS file. Of course you may change the styles to whatever you like:
root {
display: block;
}
.keyword{
color:rgb(0,0,255);
font-family:’Arial’;
}
.comment{
color:rgb(0,255,0);
font-family:’Arial’;
}
.string{
color:rgb(255,0,0);
font-family:’Arial’;
}
.compiler_def{
color:rgb(0,200,50);
font-family:’Arial’;
}
.normal{
font-family:’Arial’;
}
body {
font-family: ‘Arial’; font-size:13
}
No Comment.
Add Your Comment