Code2Web

back to index

Introduction

Code2Web is Java 1.5+ program designed to convert source code to HTML. It is a batch-style process, so that it can be used in scripts and unattended. It is designed so it can handle a variety of languages. Currently supported languages are:

Basic operation with HTMLConverter is easy : you set the different formatting options using command line arguments that look like --option = value. The source file that you want to process is set using the --input option, and the target file is set using the --output option. You must also provide at least one CSS stylesheet to use via the --skins option.

You can set many more options that affect the appearance of the generated HTML. See the "common options" list in the doccumentation on the left of this page.

Code2Web will exit with errorlevel 0 if everything was ok or with a negative errorlevel otherwise.

Sample Usage

Using code2web from code is extremely easy: As stated above, you must provide at least the input,output and skins options, like this (everything must be typed on a single line)

java -cp . org.code2web.core.Code2Web
    --input=org\code2web\html\ClassResolver.java
    --output=ClassResolver.html
    --skins=Eclipse,styles/eclipse.css
     

Of course, you can set many more different options:

java -cp . org.code2web.core.Code2Web
--input=org\code2web\html\ClassResolver.java
--output=ClassResolver.html
--skins=Eclipse,styles/eclipse.css
--title=ClassResolver.java
--titleLocation=http://www.planetalia.com
--author="Alexander Hristov"
--generateOutline=true
--generateJavadocLinks=true
--javadocs=C:\Archivos de programa\Java\jdk1.5.0_05\docs\api,
http://java.sun.com/j2se/1.5.0/docs/api
--generateNavigationBox=true
--showLineNumbers=true
A sample batch file (test.bat) is included with the distribution.

Sample Output

(Press here to see the actual, full-size html output)

Code2Web screenshot 1