
Snippetory is a simple, Java based template engine. Java based means, that all logic is written in Java. There's no embedded scripting language. This makes templates short and readable - focused on being a template! In many cases it is possible to write templates that can be used like output files. I.e. view html templates in a browser and test the javaScript, compile Java templates and so on.
Snipettory has a second important trait: an integrated repository for organizing and reusing the template code in a formerly unexperienced manner. Logic and presentation are separated by an opaque abstraction layer. So, let's start with the omnipresent 'Hello World':
Repo.parse("Hello {v:who}").set("who", "World").render(System.out);
Why use Snippetory?
- It's simple!
At least if you're already fine with java or one of the alternative languages for the jvm. If you worked for years on another technology and would have to learn java to work with Snippetory.
- It's not primitive.
Even though there are a number of simple template engines around, they tend to get stuck when things get a little more complicated because the abstraction layer is simple, too. All the escaping and formatting is done out of context. Or to be honest, in many cases escaping is omitted.
- It's a repository
It can be used some data belonging to your output. For instance in our pre-localized email template, we can store the subject. Or having many outputs in one file, maybe if one wants get SQL statements out of source. When ever there is a bunch of texts to handle Snippetory may help.
- It's general
Snippetory is not bound to any output format. It has build-in support for HTML, other XML, formatted, human readable plain text, fixed field length and limited code generation support. I would even say it's best of bread in being general.
- It's a text handling platform
There are many things one can replace while still taking advantage of others.
However, when getting into it, it looses quite a bit of it's simplicity. But it
enables a number of uses I never thought of.
- It java based
On first sight omitting an own scripting language looks like a disadvantage. It's so
inflexible, in XY I can change without so much more without changing java.
Mh, what exactly means: Without changing java??? If this is important how cute is
Assembler? One can do so much without changing any java. Of course, to replace a JSP
page you need some java AND a template. However the combination gains the full power
of java. I wrote a web reporting solution. And it wouldn't have worked without that
feature.
A simple programm for different templates
HTML is well supported
Even for plain text there are lots of usefull features
Project Admins: