Auto-configure for Thymeleaf conditionalcomments
Add auto-configuration for thymeleaf-extras-conditionalcomments which allows parsing of conditional comments for IE. Example: <!--[if lt IE 8]> <link rel="stylesheet" th:href="@{/styleIE.css}" type="text/css"/> <![endif]--> Without this dialect all Thymeleaf attributes are ignored inside the comment. Fixes gh-2113
This commit is contained in:
parent
5c27cba86b
commit
3b858edfa9
|
@ -375,6 +375,11 @@
|
||||||
<artifactId>thymeleaf-extras-data-attribute</artifactId>
|
<artifactId>thymeleaf-extras-data-attribute</artifactId>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.thymeleaf.extras</groupId>
|
||||||
|
<artifactId>thymeleaf-extras-conditionalcomments</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.thymeleaf.extras</groupId>
|
<groupId>org.thymeleaf.extras</groupId>
|
||||||
<artifactId>thymeleaf-extras-springsecurity3</artifactId>
|
<artifactId>thymeleaf-extras-springsecurity3</artifactId>
|
||||||
|
|
|
@ -41,6 +41,7 @@ import org.springframework.core.io.Resource;
|
||||||
import org.springframework.core.io.ResourceLoader;
|
import org.springframework.core.io.ResourceLoader;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.thymeleaf.dialect.IDialect;
|
import org.thymeleaf.dialect.IDialect;
|
||||||
|
import org.thymeleaf.extras.conditionalcomments.dialect.ConditionalCommentsDialect;
|
||||||
import org.thymeleaf.extras.springsecurity3.dialect.SpringSecurityDialect;
|
import org.thymeleaf.extras.springsecurity3.dialect.SpringSecurityDialect;
|
||||||
import org.thymeleaf.spring4.SpringTemplateEngine;
|
import org.thymeleaf.spring4.SpringTemplateEngine;
|
||||||
import org.thymeleaf.spring4.resourceresolver.SpringResourceResourceResolver;
|
import org.thymeleaf.spring4.resourceresolver.SpringResourceResourceResolver;
|
||||||
|
@ -163,6 +164,18 @@ public class ThymeleafAutoConfiguration {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@ConditionalOnClass(ConditionalCommentsDialect.class)
|
||||||
|
protected static class ThymeleafConditionalCommentsDialectConfiguration {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnMissingBean
|
||||||
|
public ConditionalCommentsDialect conditionalCommentsDialect() {
|
||||||
|
return new ConditionalCommentsDialect();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@ConditionalOnClass({ Servlet.class })
|
@ConditionalOnClass({ Servlet.class })
|
||||||
@ConditionalOnWebApplication
|
@ConditionalOnWebApplication
|
||||||
|
|
|
@ -127,6 +127,7 @@
|
||||||
<sun-mail.version>${javax-mail.version}</sun-mail.version>
|
<sun-mail.version>${javax-mail.version}</sun-mail.version>
|
||||||
<thymeleaf.version>2.1.3.RELEASE</thymeleaf.version>
|
<thymeleaf.version>2.1.3.RELEASE</thymeleaf.version>
|
||||||
<thymeleaf-extras-springsecurity3.version>2.1.1.RELEASE</thymeleaf-extras-springsecurity3.version>
|
<thymeleaf-extras-springsecurity3.version>2.1.1.RELEASE</thymeleaf-extras-springsecurity3.version>
|
||||||
|
<thymeleaf-extras-conditionalcomments.version>2.1.1.RELEASE</thymeleaf-extras-conditionalcomments.version>
|
||||||
<thymeleaf-layout-dialect.version>1.2.7</thymeleaf-layout-dialect.version>
|
<thymeleaf-layout-dialect.version>1.2.7</thymeleaf-layout-dialect.version>
|
||||||
<thymeleaf-extras-data-attribute.version>1.3</thymeleaf-extras-data-attribute.version>
|
<thymeleaf-extras-data-attribute.version>1.3</thymeleaf-extras-data-attribute.version>
|
||||||
<tomcat.version>8.0.15</tomcat.version>
|
<tomcat.version>8.0.15</tomcat.version>
|
||||||
|
@ -1404,6 +1405,11 @@
|
||||||
<artifactId>thymeleaf-spring4</artifactId>
|
<artifactId>thymeleaf-spring4</artifactId>
|
||||||
<version>${thymeleaf.version}</version>
|
<version>${thymeleaf.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.thymeleaf.extras</groupId>
|
||||||
|
<artifactId>thymeleaf-extras-conditionalcomments</artifactId>
|
||||||
|
<version>${thymeleaf-extras-conditionalcomments.version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.thymeleaf.extras</groupId>
|
<groupId>org.thymeleaf.extras</groupId>
|
||||||
<artifactId>thymeleaf-extras-springsecurity3</artifactId>
|
<artifactId>thymeleaf-extras-springsecurity3</artifactId>
|
||||||
|
|
Loading…
Reference in New Issue