OddTruth v1.0

A simple and powerful Java template mechanism.

This is a simple Java source preprocessor that allows pleasant and convenient generation of HTML (and other textual output).

OddTruth defines these simple rules:

  1. Java code goes right through: the file starts in a Java context.
    This means an OddTruth program is a Java program: you can do anything you want.
  2. Hash (#) at the beginning of a line denotes template text: it is wrapped in 'out.print (...)'
    This is an unobtrusive syntax for outputting HTML and the like.
  3. In template text, '{...}' is a Java expression: it is wrapped in 'out.oddPrint(...)'
    You often want to embed the results of expressions.
  4. In template text, '{.ID(...,...)}' is a method call on 'out': it becomes 'out.ID(...,...)'
    This lets you do different escaping mechanisms in a clean, powerful way.
  5. In template text, Java backslash escape sequences are allowed.
    Often you want to output weird characters (i.e. high Unicode characters) - this lets you do it using a syntax you're familiar with, along with providing a natural means to escape magic characters (like '{').
  6. Hash-quote (#") at the beginning of a line generates a String, instead of printing to out. Strings on subsequent lines are automatically concatenated.
    Sometimes it's convenient to store the results of a template in a String -- this provides a natural mechanism for doing just that.

News

January 16th/2007 - public release

OddTruth has been around for a long time, but I've never actually released it until now.

Obtaining OddTruth

OddTruth is a single Java source file, which can be downloaded here. It was deliberately kept contained, so that it would be easy to insert into arbitrary software projects.

OddTruth uses Cloptus for command line parsing.

download OddTruth now...

Documentation

All documentation for OddTruth is in the source code. You can build JavaDocs from OddTruth.java, and it should be pretty good.

License

OddTruth is copyright ©2007 by me, Shawn Vincent. OddTruth is hereby placed in the public domain. I'd be thrilled to hear about it if you use it, but it is by no means necessary.

I will gladly accept additions to OddTruth. If you have a fun extension, and you're getting bored of re-patching the source every time a new version comes out, send me your patch, and I'll incorporate it. These patches, of course, will be placed under the same license as the rest of the product. Credit to the author will be inserted in the source file.

In Summary

I hope you enjoy OddTruth. If you have any comments or requests for enhancements, mail me, and I'll see what I can do. Bugs, of course, will be fixed as soon as possible.


To Shawn Vincent's home page -- To www.svincent.com

Comments, criticisms, Carloads of Crazy Cats? Mail me!

www.svincent.com