Search in sources :

Example 16 with StandardDialect

use of org.thymeleaf.standard.StandardDialect in project thymeleaf-tests by thymeleaf.

the class AggregationTest30 method testContext.

/*
     * This should work in 3.0 because multiple dialects with the same prefix should be possible
     */
@Test
public void testContext() throws Exception {
    final TestExecutor executor = new TestExecutor();
    executor.setDialects(Arrays.asList(new IDialect[] { new StandardDialect(), new Dialect01(), new Dialect02() }));
    executor.execute("classpath:engine21/aggregation");
    Assert.assertTrue(executor.isAllOK());
}
Also used : TestExecutor(org.thymeleaf.testing.templateengine.engine.TestExecutor) Dialect02(org.thymeleaf.engine30.aggregation.dialect.Dialect02) Dialect01(org.thymeleaf.engine30.aggregation.dialect.Dialect01) StandardDialect(org.thymeleaf.standard.StandardDialect) IDialect(org.thymeleaf.dialect.IDialect) Test(org.junit.Test)

Example 17 with StandardDialect

use of org.thymeleaf.standard.StandardDialect in project thymeleaf-tests by thymeleaf.

the class ContextTest30 method testContext.

@Test
public void testContext() throws Exception {
    final TestExecutor executor = new TestExecutor();
    executor.setDialects(Arrays.asList(new IDialect[] { new StandardDialect(), new ContextDialect() }));
    executor.execute("classpath:engine30/context");
    Assert.assertTrue(executor.isAllOK());
}
Also used : TestExecutor(org.thymeleaf.testing.templateengine.engine.TestExecutor) ContextDialect(org.thymeleaf.engine30.context.dialect.ContextDialect) StandardDialect(org.thymeleaf.standard.StandardDialect) IDialect(org.thymeleaf.dialect.IDialect) Test(org.junit.Test)

Example 18 with StandardDialect

use of org.thymeleaf.standard.StandardDialect in project thymeleaf-tests by thymeleaf.

the class ConditionalCommentsTest method testConditionalComments01.

@Test
public void testConditionalComments01() throws Exception {
    final TestExecutor executor = new TestExecutor();
    executor.setDialects(Arrays.asList(new IDialect[] { new StandardDialect(), new ConditionalCommentsDialect() }));
    executor.execute("classpath:engine30/conditionalcomments/conditionalcomments01.thtest");
    Assert.assertTrue(executor.isAllOK());
}
Also used : TestExecutor(org.thymeleaf.testing.templateengine.engine.TestExecutor) StandardDialect(org.thymeleaf.standard.StandardDialect) IDialect(org.thymeleaf.dialect.IDialect) ConditionalCommentsDialect(org.thymeleaf.extras.conditionalcomments.dialect.ConditionalCommentsDialect) Test(org.junit.Test)

Example 19 with StandardDialect

use of org.thymeleaf.standard.StandardDialect in project sling by apache.

the class ThymeleafScriptEngineFactory method setupTemplateEngine.

private void setupTemplateEngine() {
    logger.info("setting up new template engine");
    templateEngine = null;
    if (configuration == null) {
        logger.info("configuration is null, not setting up new template engine");
        return;
    }
    if (!configuration.useStandardEngineContextFactory() && engineContextFactory == null) {
        logger.info("no engine context factory available, not setting up new template engine");
        return;
    }
    // setup template engine
    final TemplateEngine templateEngine = new TemplateEngine();
    // Template Resolvers
    if (this.templateResolvers != null) {
        final Set<ITemplateResolver> templateResolvers = new HashSet<>(this.templateResolvers);
        templateEngine.setTemplateResolvers(templateResolvers);
    }
    // Message Resolvers
    if (this.messageResolvers != null) {
        final Set<IMessageResolver> messageResolvers = new HashSet<>(this.messageResolvers);
        templateEngine.setMessageResolvers(messageResolvers);
    }
    if (configuration.useStandardMessageResolver()) {
        final IMessageResolver standardMessageResolver = new StandardMessageResolver();
        templateEngine.addMessageResolver(standardMessageResolver);
    }
    // Link Builders
    if (this.linkBuilders != null) {
        final Set<ILinkBuilder> linkBuilders = new HashSet<>(this.linkBuilders);
        templateEngine.setLinkBuilders(linkBuilders);
    }
    if (configuration.useStandardLinkBuilder()) {
        final ILinkBuilder standardLinkBuilder = new StandardLinkBuilder();
        templateEngine.addLinkBuilder(standardLinkBuilder);
    }
    // Dialects
    if (this.dialects != null) {
        final Set<IDialect> dialects = new HashSet<>(this.dialects);
        templateEngine.setDialects(dialects);
    }
    if (configuration.useStandardDialect()) {
        final IDialect standardDialect = new StandardDialect();
        templateEngine.addDialect(standardDialect);
    }
    // Decoupled Template Logic Resolver
    if (!configuration.useStandardDecoupledTemplateLogicResolver()) {
        templateEngine.setDecoupledTemplateLogicResolver(decoupledTemplateLogicResolver);
    }
    // Cache Manager
    if (!configuration.useStandardCacheManager()) {
        templateEngine.setCacheManager(cacheManager);
    }
    // Engine Context Factory
    if (!configuration.useStandardEngineContextFactory()) {
        templateEngine.setEngineContextFactory(engineContextFactory);
    }
    //
    this.templateEngine = templateEngine;
}
Also used : StandardLinkBuilder(org.thymeleaf.linkbuilder.StandardLinkBuilder) ITemplateResolver(org.thymeleaf.templateresolver.ITemplateResolver) IDialect(org.thymeleaf.dialect.IDialect) StandardMessageResolver(org.thymeleaf.messageresolver.StandardMessageResolver) ITemplateEngine(org.thymeleaf.ITemplateEngine) TemplateEngine(org.thymeleaf.TemplateEngine) IMessageResolver(org.thymeleaf.messageresolver.IMessageResolver) ILinkBuilder(org.thymeleaf.linkbuilder.ILinkBuilder) StandardDialect(org.thymeleaf.standard.StandardDialect) HashSet(java.util.HashSet)

Example 20 with StandardDialect

use of org.thymeleaf.standard.StandardDialect in project thymeleaf-tests by thymeleaf.

the class TemplateBoundariesTest method testGTVGHTML5.

@Test
public void testGTVGHTML5() throws Exception {
    final TestExecutor executor = TestExecutorFactory.createTestExecutor();
    executor.setDialects(Arrays.asList(new IDialect[] { new StandardDialect(), new TemplateBoundariesDialect() }));
    executor.setThrottleStep(this.throttleStep);
    executor.execute("classpath:templateengine/gtvg_html5");
    Assert.assertTrue(executor.isAllOK());
}
Also used : TestExecutor(org.thymeleaf.testing.templateengine.engine.TestExecutor) StandardDialect(org.thymeleaf.standard.StandardDialect) IDialect(org.thymeleaf.dialect.IDialect) TemplateBoundariesDialect(org.thymeleaf.templateengine.templateboundaries.dialect.TemplateBoundariesDialect) Test(org.junit.Test)

Aggregations

StandardDialect (org.thymeleaf.standard.StandardDialect)37 IDialect (org.thymeleaf.dialect.IDialect)36 Test (org.junit.Test)34 TestExecutor (org.thymeleaf.testing.templateengine.engine.TestExecutor)34 PrecedenceDialect (org.thymeleaf.templateengine.elementprocessors.dialect.PrecedenceDialect)6 ConditionalCommentsDialect (org.thymeleaf.extras.conditionalcomments.dialect.ConditionalCommentsDialect)4 TemplateBoundariesDialect (org.thymeleaf.templateengine.templateboundaries.dialect.TemplateBoundariesDialect)3 ArrayList (java.util.ArrayList)1 EnumMap (java.util.EnumMap)1 HashSet (java.util.HashSet)1 LinkedHashMap (java.util.LinkedHashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 DialectConfiguration (org.thymeleaf.DialectConfiguration)1 EngineConfiguration (org.thymeleaf.EngineConfiguration)1 IEngineConfiguration (org.thymeleaf.IEngineConfiguration)1 ITemplateEngine (org.thymeleaf.ITemplateEngine)1 TemplateEngine (org.thymeleaf.TemplateEngine)1