From 178ade5cbed52e5b0cac45610371c06e0bc30cd4 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Wed, 24 Apr 2019 16:43:01 +0200 Subject: [PATCH] TMP --- pom.xml | 6 ++++ .../juplo/thymeleaf/ActiveAttrProcessor.java | 2 +- .../ImportVariablesAttrProcessor.java | 30 +++++++++++-------- .../java/de/juplo/thymeleaf/JuploDialect.java | 4 +-- 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/pom.xml b/pom.xml index c6158b9..c83d646 100644 --- a/pom.xml +++ b/pom.xml @@ -58,6 +58,12 @@ ${simple-mapper.version} + + + org.springframework + spring-context + + junit diff --git a/src/main/java/de/juplo/thymeleaf/ActiveAttrProcessor.java b/src/main/java/de/juplo/thymeleaf/ActiveAttrProcessor.java index 7392bf9..a07241e 100644 --- a/src/main/java/de/juplo/thymeleaf/ActiveAttrProcessor.java +++ b/src/main/java/de/juplo/thymeleaf/ActiveAttrProcessor.java @@ -6,7 +6,7 @@ package de.juplo.thymeleaf; * marked as active. * @author Kai Moritz */ -public class ActiveAttrProcessor extends AbstractSubstituteAttrrocessor +public class ActiveAttrProcessor extends AbstractSubstituteAttrProcessor { public ActiveAttrProcessor(final String prefix) { diff --git a/src/main/java/de/juplo/thymeleaf/ImportVariablesAttrProcessor.java b/src/main/java/de/juplo/thymeleaf/ImportVariablesAttrProcessor.java index aac37a6..e063a0c 100644 --- a/src/main/java/de/juplo/thymeleaf/ImportVariablesAttrProcessor.java +++ b/src/main/java/de/juplo/thymeleaf/ImportVariablesAttrProcessor.java @@ -15,20 +15,13 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.thymeleaf.Arguments; -import org.thymeleaf.Configuration; -import org.thymeleaf.TemplateProcessingParameters; import org.thymeleaf.context.IContext; -import org.thymeleaf.context.VariablesMap; -import org.thymeleaf.dom.Element; -import org.thymeleaf.dom.Node; import org.thymeleaf.exceptions.TemplateProcessingException; -import org.thymeleaf.processor.ProcessorResult; -import org.thymeleaf.processor.attr.AbstractAttrProcessor; -import org.thymeleaf.resourceresolver.IResourceResolver; +import org.thymeleaf.processor.element.AbstractAttributeModelProcessor; import org.thymeleaf.standard.expression.IStandardExpression; import org.thymeleaf.standard.expression.IStandardExpressionParser; import org.thymeleaf.standard.expression.StandardExpressions; +import org.thymeleaf.templatemode.TemplateMode; import org.thymeleaf.templateresolver.ITemplateResolver; import org.thymeleaf.templateresolver.TemplateResolution; @@ -39,7 +32,7 @@ import org.thymeleaf.templateresolver.TemplateResolution; * variables. * @author Kai Moritz */ -public class ImportVariablesAttrProcessor extends AbstractAttrProcessor +public class ImportVariablesAttrProcessor extends AbstractAttributeModelProcessor { private static final Logger LOG = LoggerFactory.getLogger(ImportVariablesAttrProcessor.class); @@ -55,9 +48,22 @@ public class ImportVariablesAttrProcessor extends AbstractAttrProcessor public static final int ATTR_PRECEDENCE = 200; - public ImportVariablesAttrProcessor() + public ImportVariablesAttrProcessor( + final String prefix, + final String attribute, + final String substitute + ) { - super("variables"); + super( + TemplateMode.HTML, + prefix, + null, + false, + attribute, + true, + ATTR_PRECEDENCE, + false + ); } diff --git a/src/main/java/de/juplo/thymeleaf/JuploDialect.java b/src/main/java/de/juplo/thymeleaf/JuploDialect.java index 21cf8ac..d97953b 100644 --- a/src/main/java/de/juplo/thymeleaf/JuploDialect.java +++ b/src/main/java/de/juplo/thymeleaf/JuploDialect.java @@ -39,8 +39,8 @@ public class JuploDialect extends AbstractProcessorDialect public Set getProcessors(String prefix) { final Set processors = new HashSet<>(); - processors.add(new ActiveAttributeProcessor(prefix)); - processors.add(new InactiveAttributeProcessor(prefix)); + processors.add(new ActiveAttrProcessor(prefix)); + processors.add(new InactiveAttrProcessor(prefix)); processors.add(new ImportVariablesAttrProcessor()); return processors; } -- 2.20.1