package org.molgenis.compute.test.util;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import java.util.Hashtable;
/**
* Created with IntelliJ IDEA. User: georgebyelas Date: 22/08/2012 Time: 12:32
* To change this template use File | Settings | File Templates.
*/
public class TemplateWeaver
{
public String weaveFreemarker(String strTemplate, Hashtable<String, String> values)
{
Configuration cfg = new Configuration();
Template t = null;
StringWriter out = new StringWriter();
try
{
t = new Template("name", new StringReader(strTemplate), cfg);
t.process(values, out);
}
catch (TemplateException e)
{
// e.printStackTrace();
}
catch (IOException e)
{
// e.printStackTrace();
}
return out.toString();
}
}