From: Kai Moritz Date: Wed, 24 Apr 2019 14:50:56 +0000 (+0200) Subject: TMP X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=c94cd0b3523211553876970625a37fe279cbcad2;p=juplo-dialect TMP --- diff --git a/src/main/java/de/juplo/thymeleaf/ImportVariablesAttrProcessor.java b/src/main/java/de/juplo/thymeleaf/ImportVariablesAttrProcessor.java index e063a0c..d41b33c 100644 --- a/src/main/java/de/juplo/thymeleaf/ImportVariablesAttrProcessor.java +++ b/src/main/java/de/juplo/thymeleaf/ImportVariablesAttrProcessor.java @@ -16,8 +16,14 @@ import java.util.regex.Pattern; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.thymeleaf.context.IContext; +import org.thymeleaf.context.ITemplateContext; +import org.thymeleaf.engine.AttributeName; +import org.thymeleaf.engine.EngineEventUtils; import org.thymeleaf.exceptions.TemplateProcessingException; +import org.thymeleaf.model.IModel; +import org.thymeleaf.model.IProcessableElementTag; import org.thymeleaf.processor.element.AbstractAttributeModelProcessor; +import org.thymeleaf.processor.element.IElementModelStructureHandler; import org.thymeleaf.standard.expression.IStandardExpression; import org.thymeleaf.standard.expression.IStandardExpressionParser; import org.thymeleaf.standard.expression.StandardExpressions; @@ -68,31 +74,28 @@ public class ImportVariablesAttrProcessor extends AbstractAttributeModelProcesso @Override - public final ProcessorResult processAttribute( - final Arguments arguments, - final Element element, - final String name + protected void doProcess( + final ITemplateContext context, + final IModel model, + final AttributeName attributeName, + final String attributeValue, + final IElementModelStructureHandler handler ) { - Configuration config = arguments.getConfiguration(); - - Configuration configuration = arguments.getConfiguration(); - - String parameter = element.getAttributeValue(name); - try - { - IStandardExpressionParser parser = - StandardExpressions.getExpressionParser(configuration); - IStandardExpression expression = - parser.parseExpression(configuration, arguments, parameter); - parameter = (String)expression.execute(configuration, arguments); - } - catch (TemplateProcessingException e) { } + final IProcessableElementTag element = (IProcessableElementTag) model.get(0); + final String parameter = + EngineEventUtils.computeAttributeExpression( + context, + element, + attributeName, + attributeValue + ) + .execute(context).toString(); if (parameter != null && !parameter.trim().isEmpty()) { LOG.info("ignoring empty parameter"); - return ProcessorResult.OK; + return; } Iterator> it = null;