Notes:
This is an implementation of the tinytemplate template engine for
java. Tinytemplate expands templates (XML files with a bit of extra
markup) given a context (expressed via Java calls) to give an output
(an XML file).
For example, expanding
<b tt:name="member">Bob</b>
after having called:
context.replaceText("member", "Susan");
yields:
<b>Susan</b>
For more details, see http://tinytemplate.org/
This distribution contains tinytemplate.jar and a copy of the JDOM jar
(unmodified from the JDOM distribution), which tinytemplate uses
internally (the tinytemplate API is independent of JDOM, although the
use of JDOM may become apparent from time to time, for example in
terms of exactly which exception you get in various error cases).
Javadoc is in the apidocs directory.
I've also included the tinytemplate sources and tests (src and test
directories). The former are the sources from which the jar is built;
the latter may be helpful in understanding or developing tinytemplate.
If you are using tinytemplate for java, we'd love to hear about it.
There's a Wiki at http://tinytemplate.org/ or feel free to contact us
via http://sourceforge.net/projects/wheat (as of this writing, there
isn't a mailing list, so email to Jim Kingdon would work).
------------------------------
Outstanding issues (also see http://tinytemplate.org/ ):
* Entities (with the most obvious example being in HTML).
There are some notes in the javadoc. For now, you need a DOCTYPE
which provides a way to resolve them, but this is suboptimal. The
solution isn't obvious. Related is character sets, as noted at
http://tinytemplate.org/ .
* Exception handling. Right now TinyTemplateException is a subclass
of Exception. Should it be a RuntimeException (on the theory that
it makes sense to catch it in some central location without having
to put "throws TinyTemplateException or throws Exception all the way
up the call chain)? Should it have subclasses for wrapped
exceptions or for various specific conditions?
Changes:
2004-06-03 22:18 kingdon
* README.txt: Various changes to prepare for release.
2004-05-15 22:13 kingdon
* src/org/tinytemplate/Template.java,
test/org/tinytemplate/PassThruTest.java: More banging of my head
against the entity wall. A few little cleanups (e.g. rename
variables).
2004-05-03 22:59 kingdon
* test/org/tinytemplate/PassThruTest.java: Add test for yet another
nasty entity case.
2004-05-03 22:55 kingdon
* src/org/tinytemplate/Template.java,
test/org/tinytemplate/PassThruTest.java: Don't expand entities.
2004-04-14 23:27 kingdon
* test/org/tinytemplate/: PassThruTest.java, TinyTemplateTest.java:
Add some tests for the (sorry) state of affairs with respect to
entities. No code changes yet.
2004-04-07 22:06 kingdon
* src/org/tinytemplate/ChainedContext.java,
src/org/tinytemplate/HideContext.java,
src/org/tinytemplate/SimpleContext.java,
src/org/tinytemplate/Template.java, test/org/tinytemplate/AllTests.java,
test/org/tinytemplate/ExpandElementTest.java,
test/org/tinytemplate/TemplateTest.java: Add the ability to expand
only part of a template, specified by a tt:name.
2004-04-03 22:06 kingdon
* src/org/tinytemplate/Instruction.java,
src/org/tinytemplate/SimpleContext.java,
test/org/tinytemplate/TinyTemplateTest.java: Add include (just
like skip but with the opposite sense for the boolean).
2004-04-03 21:51 kingdon
* .cvsignore, README.txt, build.xml, todo.txt,
src/org/tinytemplate/Instruction.java,
src/org/tinytemplate/SimpleContext.java,
src/org/tinytemplate/Template.java,
src/org/tinytemplate/TinyTemplateException.java,
src/org/tinytemplate/package.html: Add ant, javadoc, and distribution
stuff.
2004-04-03 10:32 kingdon
* test/org/tinytemplate/TinyTemplateTest.java: Add tests for: 1)
repeat plus attribute 2) repeat plus skip
2004-04-03 10:20 kingdon
* test/org/tinytemplate/TinyTemplateTest.java: Add test for replace
and repeat on the same element.
2004-04-03 10:09 kingdon
* src/org/tinytemplate/Template.java,
test/org/tinytemplate/TinyTemplateTest.java: Only substitute
attributes if there is no namespace.
2004-04-03 09:49 kingdon
* src/org/tinytemplate/Template.java,
test/org/tinytemplate/TinyTemplateTest.java: Detect the case in
which the context tries to specify a namespace name in an attribute
name.
2004-04-03 09:29 kingdon
* src/org/tinytemplate/SimpleContext.java,
test/org/tinytemplate/PassThruTest.java,
test/org/tinytemplate/TinyTemplateTest.java: Write tests for
" in attributes and for attributes and namespaces. Two of
the latter, which don't pass yet, are disabled.
2004-03-19 21:53 kingdon
* test/org/tinytemplate/TinyTemplateTest.java: Add namespace and
unknown tests from tinytemplatetest.cpp.
2004-03-19 21:16 kingdon
* src/org/tinytemplate/Template.java,
test/org/tinytemplate/TinyTemplateTest.java: Add ability to read
from InputStream. Add encoding test.
2004-03-17 21:42 kingdon
* src/org/tinytemplate/Template.java,
test/org/tinytemplate/TinyTemplateTest.java: Omit tinytemplate
namespace declarations from the output. Fix template expansion
on the root element itself.
2004-03-17 20:36 kingdon
* src/org/tinytemplate/Instruction.java,
src/org/tinytemplate/SimpleContext.java,
src/org/tinytemplate/Template.java,
test/org/tinytemplate/TemplateTest.java,
test/org/tinytemplate/TinyTemplateTest.java: repeat now takes a
Collection rather than an Iterator. If a repeat tt:name appears
several places, or is nested inside another repeat, we need to
traverse the Collection several times.
2004-03-17 20:07 kingdon
* src/org/tinytemplate/Context.java,
src/org/tinytemplate/SimpleContext.java,
src/org/tinytemplate/Template.java,
test/org/tinytemplate/SimpleContextTest.java,
test/org/tinytemplate/TemplateTest.java,
test/org/tinytemplate/TinyTemplateTest.java: Deal with the case
in which the repeat block gets expanded with instructions from
the outer context.
2004-03-15 22:12 kingdon
* src/org/tinytemplate/Template.java,
test/org/tinytemplate/AllTests.java,
test/org/tinytemplate/TemplateTest.java,
test/org/tinytemplate/TinyTemplateTest.java: Fix the combination
of repeat and span - there was a bug concerning who was supposed
to get rid of the span.
2004-03-15 21:09 kingdon
* src/org/tinytemplate/Template.java,
test/org/tinytemplate/TinyTemplateTest.java: Repeat now works
except for nesting of contexts, and span.
2004-03-15 20:56 kingdon
* src/org/tinytemplate/Template.java: processAttributes now returns
a List, instead of a single element. This is cleaner than using
null to distinguish between 0 and 1 elements returned.
2004-03-15 20:38 kingdon
* src/org/tinytemplate/Template.java: Avoid a few unneccesary
copies by detaching instead of cloning.
2004-03-15 20:05 kingdon
* src/org/tinytemplate/Template.java,
test/org/tinytemplate/TinyTemplateTest.java: Change tiny template
namespace from http://wheatfarm.org/v0/namespaces/tinytemplate
to http://tinytemplate.org/ns/tt
2004-03-14 23:07 kingdon
* src/org/tinytemplate/Template.java,
test/org/tinytemplate/TinyTemplateTest.java: Re-enable the shallow
copy code.
2004-03-14 15:46 kingdon
* src/org/tinytemplate/Template.java: Add commented out code to
avoid unneeded deep copy.
2004-03-14 15:22 kingdon
* test/org/tinytemplate/TinyTemplateTest.java,
src/org/tinytemplate/Template.java: Move the recursion into
expanding child elements into processAttributes, same place that
repeat is expanded.
2004-03-14 14:23 kingdon
* src/org/tinytemplate/Instruction.java,
src/org/tinytemplate/Template.java,
test/org/tinytemplate/PassThruTest.java,
test/org/tinytemplate/TinyTemplateTest.java: Fix bug in which
template expansion wasn't happening inside tt:span. Other minor
fixups.
2004-03-14 13:38 kingdon
* src/org/tinytemplate/Template.java: Now copying content over
to new tree, rather than expanding in place.
2004-03-14 12:34 kingdon
* src/org/tinytemplate/Template.java,
test/org/tinytemplate/TinyTemplateTest.java: No longer mutating
list of attributes; instead copying over the ones we want to
keep.
2004-03-14 12:17 kingdon
* src/org/tinytemplate/Template.java,
test/org/tinytemplate/PassThruTest.java: Have processAttributes
now return the new element (to prepare for the case in which it
mutates the old one not at all). Add some namespace passthru
tests. 2004-03-14 11:41 kingdon *
test/org/tinytemplate/PassThruTest.java: Add pass thru test for
element content.
2004-03-11 22:53 kingdon
* src/org/tinytemplate/Template.java: Context now passed as
parameter throughout, not as field (less confusing when it comes
time to implement repeat). Also, get a bit closer to recursing
on output, rather than recursing on munging the tree. 2004-03-11
22:30 kingdon * src/org/tinytemplate/Template.java: outputter now
a field.
2004-03-11 22:27 kingdon
* src/org/tinytemplate/Template.java,
test/org/tinytemplate/PassThruTest.java: Only clone the root
element, not anything outside it.
2004-03-11 22:21 kingdon
* test/org/tinytemplate/: AllTests.java, PassThruTest.java: Add
tests for ability to pass XML unchanged.
2004-03-11 21:55 kingdon
* src/org/tinytemplate/Template.java: Start of traversing the
tree ourselves - right now this is just a copy-paste (modulo
changes to avoid private fields and such) of
XMLOutputter.output(Document, Writer). First step towards not
having to clone the tree.
2004-03-11 21:12 kingdon
* src/org/tinytemplate/Template.java,
test/org/tinytemplate/TinyTemplateTest.java: Create a new object
with each expansion, to hold data we want to keep during that
expansion.
2004-03-11 20:53 kingdon
* src/org/tinytemplate/AttributeInstruction.java,
src/org/tinytemplate/Context.java,
src/org/tinytemplate/Instruction.java,
src/org/tinytemplate/SimpleContext.java,
src/org/tinytemplate/Template.java,
src/org/tinytemplate/TinyTemplateException.java,
test/org/tinytemplate/AllTests.java,
test/org/tinytemplate/SimpleContextTest.java,
test/org/tinytemplate/TinyTemplateTest.java: Move everything from
org.wheatfarm.tinytemplate package to org.tinytemplate.
2004-03-08 22:57 kingdon * todo.txt: More stuff to do.
2004-03-08 22:56 kingdon
* todo.txt: Add attribute and make some fixes to tt:span.
2004-03-07 16:30 kingdon
* .cvsignore: Add .cvsignore file.
2004-03-07 15:51 kingdon
* .classpath, .project, lib/junit.jar, lib/jdom-b10.jar: First
import of jtinytemplate. If memory serves, all the tests pass
except testSpan. Status as a whole is perhaps halfway done or a
bit less, with include and replace working.
2004-03-07 15:51 kingdon
* .classpath, .project, lib/junit.jar, lib/jdom-b10.jar: Initial
revision
Copyright © 2009 Geeknet, Inc. All rights reserved. Terms of Use