My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Featured
Downloads

About

Project is built on Java and jython mashup to extend StringTemplate library functionality (popular among ANTLR community) and bring to it the power of python language, which can turn out to be quite handy. The aim is to build a library that can support and successfully implement interfaces like StringTemplate and StringTemplateGroup as PyTemplate or PyTemplateGroup for further interaction with code in jython, and even reverse inter-operation with common string templates (i.e. accessing a certain StringTemplate from jython code).

Installation

  1. Download and install latest jython
  2. Download StringTemplate .jar (version 3.2.1)
  3. Finally, get the latest pylates.jar and put them all together in shared java classpath

Usage

Many use cases can be taken directly form tests. For example,

...
String pytemplates = "def page():" + newline + indent + "return 'test'"
       + newline + newline;
PyTemplateGroup group = new PyTemplateGroup("test", new StringReader(pytemplates));
StringTemplate st = group.getInstanceOf("page");
System.out.println(st.toString());
Powered by Google Project Hosting