de.neuland.jade4j.Jade4J.Mode Java Examples

The following examples show how to use de.neuland.jade4j.Jade4J.Mode. 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: JadeKrazoConfiguration.java    From krazo with Apache License 2.0 6 votes vote down vote up
@Produces
@ViewEngineConfig
JadeConfiguration produce() {
    loadConfig();
    JadeConfiguration jade = new JadeConfiguration();
    jade.setMode(Mode.valueOf(property(MODE).orElse("XHTML")));
    jade.setCaching(Boolean.valueOf(property(CACHING).orElse("true")));
    jade.setPrettyPrint(Boolean.valueOf(property(PRETTY_PRINT).orElse("false")));
    getExtensions(FILTER_QUALIFIER).entrySet().forEach(filter -> {
        jade.setFilter(filter.getKey(), (Filter) filter.getValue());
    });
    jade.setSharedVariables(getExtensions(HELPER_QUALIFIER));
    String encoding = property(ENCODING).orElse("UTF-8");
    jade.setTemplateLoader(new ServletContextTemplateLoader(servletContext, encoding));
    return jade;
}
 
Example #2
Source File: JadeOzarkConfiguration.java    From ozark with Apache License 2.0 6 votes vote down vote up
@Produces
@ViewEngineConfig
JadeConfiguration produce() {
    loadConfig();
    JadeConfiguration jade = new JadeConfiguration();
    jade.setMode(Mode.valueOf(property(MODE).orElse("XHTML")));
    jade.setCaching(Boolean.valueOf(property(CACHING).orElse("true")));
    jade.setPrettyPrint(Boolean.valueOf(property(PRETTY_PRINT).orElse("false")));
    getExtensions(FILTER_QUALIFIER).entrySet().forEach(filter -> {
        jade.setFilter(filter.getKey(), (Filter) filter.getValue());
    });
    jade.setSharedVariables(getExtensions(HELPER_QUALIFIER));
    String encoding = property(ENCODING).orElse("UTF-8");
    jade.setTemplateLoader(new ServletContextTemplateLoader(servletContext, encoding));
    return jade;
}
 
Example #3
Source File: JadeTemplateEngine.java    From pippo with Apache License 2.0 6 votes vote down vote up
@Override
public void init(Application application) {
    super.init(application);

    Router router = getRouter();
    PippoSettings pippoSettings = getPippoSettings();

    configuration = new JadeConfiguration();
    configuration.setTemplateLoader(new ClassTemplateLoader(JadeTemplateEngine.class, getTemplatePathPrefix()));
    configuration.setMode(Mode.HTML);
    if (pippoSettings.isDev()) {
        configuration.setPrettyPrint(true);
        configuration.setCaching(false); // disable cache
    }

    // set global template variables
    configuration.getSharedVariables().put("contextPath", router.getContextPath());
    configuration.getSharedVariables().put("appPath", router.getApplicationPath());

    // allow custom initialization
    init(application, configuration);
}