|
Project Information
Members
Featured
Downloads
Wiki pages
Links
|
This project aims to provide a Java-based code syntax formatter for a diverse range of web languages, including:
It allows you to format complex, messy web application code into a more structured format. To achieve this, it uses specialised reader/writer implementations and a custom parser. As a result, this formatter is quite fragile, so use at your own risk! However, it does come with a set of automated test cases, to ensure that it generally outputs suitable code. It is also used in the IAML project extensively as a code cleaner to its generated code. Version 0.3.1 of iacleaner has been released (April 2010). Quick Startiacleaner can be installed through an Eclipse update site, or you can checkout the source from SVN and build a JAR file yourself. File source = new File("script.php");
IACleaner cleaner = new IAInlineCleaner();
String formatted = cleaner.cleanScript(source);
// rewrite the file
FileWriter fh = new FileWriter(source);
fh.write(formatted);
fh.close();As of issue 6 , you can also download a prebuilt JAR and execute it using the command line: $ java -jar iacleaner-0.3.1.jar --help Usage: java -jar iacleaner.jar [args...] --input <file> Use input file, otherwise stdin --output <file> Use output file, otherwise stdout --extension <file> Use specified extension --wordwrap <file> Attempt to wordwrap at the given column index --help Display this help Future WorkIf a web script cannot be handled properly by iacleaner, please submit it to the issue tracker so this can be resolved. It would be nice to use an actual syntax parser (e.g. JavaCC) to implement the formatting, but this is easier said than done. Feel free to contribute ;) Future work may include basic support for code compression. |