de.neuland.jade4j.template.TemplateLoader Java Examples

The following examples show how to use de.neuland.jade4j.template.TemplateLoader. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ViewJade.java    From baratine with GNU General Public License v2.0 6 votes vote down vote up
private void init()
{
  TemplateLoader templateLoader = null;

  String templatePath = _config.get("view.jade.templates",
                                    "classpath:/templates");

  if (templatePath.startsWith("classpath:")) {
    String root = templatePath.substring("classpath:".length());

    templateLoader = new ClasspathTemplateLoader(root);
  }
  else {
    templateLoader = new FileTemplateLoader(templatePath, "UTF-8");
  }

  _jadeConfig = new JadeConfiguration();
  _jadeConfig.setTemplateLoader(templateLoader);
}
 
Example #2
Source File: JadeTemplateEngine.java    From jbake with MIT License 5 votes vote down vote up
public JadeTemplateEngine(final JBakeConfiguration config, final ContentStore db) {
    super(config, db);

    TemplateLoader loader = new FileTemplateLoader(config.getTemplateFolder().getPath() + File.separatorChar, config.getTemplateEncoding());
    jadeConfiguration.setTemplateLoader(loader);
    jadeConfiguration.setMode(Jade4J.Mode.XHTML);
    jadeConfiguration.setPrettyPrint(true);
    jadeConfiguration.setFilter(FILTER_CDATA, new CDATAFilter());
    jadeConfiguration.setFilter(FILTER_SCRIPT, new JsFilter());
    jadeConfiguration.setFilter(FILTER_STYLE, new CssFilter());
    jadeConfiguration.getSharedVariables().put("formatter", new FormatHelper());
}