diff --git a/thymeleaf-layout-dialect/source/nz/net/ultraq/thymeleaf/layoutdialect/LayoutDialect.groovy b/thymeleaf-layout-dialect/source/nz/net/ultraq/thymeleaf/layoutdialect/LayoutDialect.groovy
index 6a3915478..52934e209 100644
--- a/thymeleaf-layout-dialect/source/nz/net/ultraq/thymeleaf/layoutdialect/LayoutDialect.groovy
+++ b/thymeleaf-layout-dialect/source/nz/net/ultraq/thymeleaf/layoutdialect/LayoutDialect.groovy
@@ -19,6 +19,7 @@ package nz.net.ultraq.thymeleaf.layoutdialect
import nz.net.ultraq.thymeleaf.layoutdialect.decorators.DecorateProcessor
import nz.net.ultraq.thymeleaf.layoutdialect.decorators.SortingStrategy
import nz.net.ultraq.thymeleaf.layoutdialect.decorators.TitlePatternProcessor
+import nz.net.ultraq.thymeleaf.layoutdialect.decorators.TitleProcessor
import nz.net.ultraq.thymeleaf.layoutdialect.decorators.strategies.AppendingStrategy
import nz.net.ultraq.thymeleaf.layoutdialect.fragments.CollectFragmentProcessor
import nz.net.ultraq.thymeleaf.layoutdialect.fragments.FragmentProcessor
@@ -86,7 +87,8 @@ class LayoutDialect extends AbstractProcessorDialect {
new ReplaceProcessor(TemplateMode.HTML, dialectPrefix),
new FragmentProcessor(TemplateMode.HTML, dialectPrefix),
new CollectFragmentProcessor(TemplateMode.HTML, dialectPrefix),
- new TitlePatternProcessor(TemplateMode.HTML, dialectPrefix, newTitleTokens),
+ new TitlePatternProcessor(TemplateMode.HTML, dialectPrefix),
+ new TitleProcessor(TemplateMode.HTML, dialectPrefix),
// Processors available in the XML template mode
new StandardXmlNsTagProcessor(TemplateMode.XML, dialectPrefix),
diff --git a/thymeleaf-layout-dialect/source/nz/net/ultraq/thymeleaf/layoutdialect/decorators/DecorateProcessor.groovy b/thymeleaf-layout-dialect/source/nz/net/ultraq/thymeleaf/layoutdialect/decorators/DecorateProcessor.groovy
index c3d79d0b9..ccc0a163e 100644
--- a/thymeleaf-layout-dialect/source/nz/net/ultraq/thymeleaf/layoutdialect/decorators/DecorateProcessor.groovy
+++ b/thymeleaf-layout-dialect/source/nz/net/ultraq/thymeleaf/layoutdialect/decorators/DecorateProcessor.groovy
@@ -21,7 +21,6 @@ import nz.net.ultraq.thymeleaf.layoutdialect.decorators.html.HtmlDocumentDecorat
import nz.net.ultraq.thymeleaf.layoutdialect.decorators.xml.XmlDocumentDecorator
import nz.net.ultraq.thymeleaf.layoutdialect.fragments.FragmentFinder
import nz.net.ultraq.thymeleaf.layoutdialect.models.TemplateModelFinder
-import nz.net.ultraq.thymeleaf.layoutdialect.models.TitleExtractor
import org.thymeleaf.context.ITemplateContext
import org.thymeleaf.engine.AttributeName
@@ -72,12 +71,6 @@ class DecorateProcessor extends AbstractAttributeModelProcessor {
/**
* Locates the template to decorate and, once decorated, inserts it into the
* processing chain.
- *
- * @param context
- * @param model
- * @param attributeName
- * @param attributeValue
- * @param structureHandler
*/
@Override
protected void doProcess(ITemplateContext context, IModel model, AttributeName attributeName,
@@ -110,9 +103,9 @@ class DecorateProcessor extends AbstractAttributeModelProcessor {
decorateTemplate = decorateTemplate.cloneModel()
// Extract titles from content and layout templates and save to the template context
- def titleExtractor = new TitleExtractor(context, newTitleTokens)
- titleExtractor.extract(contentTemplate, TitlePatternProcessor.CONTENT_TITLE_KEY)
- titleExtractor.extract(decorateTemplate, TitlePatternProcessor.LAYOUT_TITLE_KEY)
+// def titleExtractor = new TitleExtractor(context, newTitleTokens)
+// titleExtractor.extract(contentTemplate, TitlePatternProcessor.CONTENT_TITLE_KEY)
+// titleExtractor.extract(decorateTemplate, TitlePatternProcessor.LAYOUT_TITLE_KEY)
// Gather all fragment parts from this page to apply to the new document
// after decoration has taken place
@@ -120,9 +113,11 @@ class DecorateProcessor extends AbstractAttributeModelProcessor {
// Choose the decorator to use based on template mode, then apply it
def decorator =
- templateMode == TemplateMode.HTML ? new HtmlDocumentDecorator(context, sortingStrategy, autoHeadMerging) :
- templateMode == TemplateMode.XML ? new XmlDocumentDecorator(context) :
- null
+ templateMode == TemplateMode.HTML ?
+ new HtmlDocumentDecorator(context, sortingStrategy, autoHeadMerging, newTitleTokens) :
+ templateMode == TemplateMode.XML ?
+ new XmlDocumentDecorator(context) :
+ null
if (!decorator) {
throw new IllegalArgumentException(
"Layout dialect cannot be applied to the ${templateMode} template mode, only HTML and XML template modes are currently supported"
diff --git a/thymeleaf-layout-dialect/source/nz/net/ultraq/thymeleaf/layoutdialect/decorators/TitlePatternProcessor.groovy b/thymeleaf-layout-dialect/source/nz/net/ultraq/thymeleaf/layoutdialect/decorators/TitlePatternProcessor.groovy
index 080d6e537..bc482b121 100644
--- a/thymeleaf-layout-dialect/source/nz/net/ultraq/thymeleaf/layoutdialect/decorators/TitlePatternProcessor.groovy
+++ b/thymeleaf-layout-dialect/source/nz/net/ultraq/thymeleaf/layoutdialect/decorators/TitlePatternProcessor.groovy
@@ -16,8 +16,6 @@
package nz.net.ultraq.thymeleaf.layoutdialect.decorators
-import nz.net.ultraq.thymeleaf.expressionprocessor.ExpressionProcessor
-
import org.thymeleaf.context.ITemplateContext
import org.thymeleaf.engine.AttributeName
import org.thymeleaf.model.IProcessableElementTag
@@ -38,44 +36,28 @@ import java.util.regex.Pattern
class TitlePatternProcessor extends AbstractAttributeTagProcessor {
// private static final String TOKEN_CONTENT_TITLE = '$CONTENT_TITLE'
- private static final String TOKEN_LAYOUT_TITLE = '$LAYOUT_TITLE'
+ private static final String TOKEN_LAYOUT_TITLE = '$LAYOUT_TITLE'
private static final Pattern TOKEN_PATTERN = ~/(\$(LAYOUT|CONTENT)_TITLE)/
static final String PROCESSOR_NAME = 'title-pattern'
static final int PROCESSOR_PRECEDENCE = 1
- static final String CONTENT_TITLE_KEY = 'layoutDialectContentTitle'
- static final String LAYOUT_TITLE_KEY = 'layoutDialectLayoutTitle'
- static final String CONTENT_TITLE_KEY_OLD = 'LayoutDialect::ContentTitle'
- static final String LAYOUT_TITLE_KEY_OLD = 'LayoutDialect::LayoutTitle'
-
- final boolean newTitleTokens
+ static final String CONTENT_TITLE_KEY = 'LayoutDialect::ContentTitle'
+ static final String LAYOUT_TITLE_KEY = 'LayoutDialect::LayoutTitle'
/**
* Constructor, sets this processor to work on the 'title-pattern' attribute.
- *
- * @param templateMode
- * @param dialectPrefix
*/
- TitlePatternProcessor(TemplateMode templateMode, String dialectPrefix, boolean newTitleTokens) {
+ TitlePatternProcessor(TemplateMode templateMode, String dialectPrefix) {
super(templateMode, dialectPrefix, null, false, PROCESSOR_NAME, true, PROCESSOR_PRECEDENCE, true)
-
- this.newTitleTokens = newTitleTokens
}
/**
* Process the {@code layout:title-pattern} directive, replaces the title text
* with the titles from the content and layout pages.
- *
- * @param context
- * @param tag
- * @param attributeName
- * @param attributeValue
- * @param structureHandler
*/
@Override
- @SuppressWarnings('AssignmentToStaticFieldFromInstanceMethod')
protected void doProcess(ITemplateContext context, IProcessableElementTag tag,
AttributeName attributeName, String attributeValue, IElementTagStructureHandler structureHandler) {
@@ -86,15 +68,8 @@ class TitlePatternProcessor extends AbstractAttributeTagProcessor {
def modelFactory = context.modelFactory
def titleModel = modelFactory.createModel()
-
- // TODO: Experimental title tokens branch
- if (newTitleTokens) {
- structureHandler.setBody(new ExpressionProcessor(context).processAsString(attributeValue), false)
- return
- }
-
- def contentTitle = context[CONTENT_TITLE_KEY_OLD]
- def layoutTitle = context[LAYOUT_TITLE_KEY_OLD]
+ def contentTitle = context[CONTENT_TITLE_KEY]
+ def layoutTitle = context[LAYOUT_TITLE_KEY]
// Break the title pattern up into tokens to map to their respective models
if (layoutTitle && contentTitle) {
diff --git a/thymeleaf-layout-dialect/source/nz/net/ultraq/thymeleaf/layoutdialect/decorators/TitleProcessor.groovy b/thymeleaf-layout-dialect/source/nz/net/ultraq/thymeleaf/layoutdialect/decorators/TitleProcessor.groovy
new file mode 100644
index 000000000..a628ebeba
--- /dev/null
+++ b/thymeleaf-layout-dialect/source/nz/net/ultraq/thymeleaf/layoutdialect/decorators/TitleProcessor.groovy
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2024, Emanuel Rabina (http://www.ultraq.net.nz/)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package nz.net.ultraq.thymeleaf.layoutdialect.decorators
+
+import nz.net.ultraq.thymeleaf.expressionprocessor.ExpressionProcessor
+
+import org.thymeleaf.context.ITemplateContext
+import org.thymeleaf.engine.AttributeName
+import org.thymeleaf.model.IProcessableElementTag
+import org.thymeleaf.processor.element.AbstractAttributeTagProcessor
+import org.thymeleaf.processor.element.IElementTagStructureHandler
+import org.thymeleaf.templatemode.TemplateMode
+
+/**
+ * A processor for the experimental feature of using standard Thymeleaf
+ * expression syntax when creating the {@code
} element, as opposed to
+ * the special syntax required of {@code layout:title-pattern}.
+ *
+ * @author Emanuel Rabina
+ */
+class TitleProcessor extends AbstractAttributeTagProcessor {
+
+ static final String PROCESSOR_NAME = 'title'
+ static final int PROCESSOR_PRECEDENCE = 1
+
+ static final String CONTENT_TITLE_KEY = 'layoutDialectContentTitle'
+ static final String LAYOUT_TITLE_KEY = 'layoutDialectLayoutTitle'
+
+ /**
+ * Constructor, sets this processor to work on the 'title' attribute.
+ */
+ TitleProcessor(TemplateMode templateMode, String dialectPrefix) {
+
+ super(templateMode, dialectPrefix, null, false, PROCESSOR_NAME, true, PROCESSOR_PRECEDENCE, true)
+ }
+
+ /**
+ * Process the {@code layout:title} directive, replaces the title text using
+ * values extracted from the layout and content templates and emitted with
+ * standard Thymeleaf expression syntax.
+ */
+ @Override
+ protected void doProcess(ITemplateContext context, IProcessableElementTag tag, AttributeName attributeName,
+ String attributeValue, IElementTagStructureHandler structureHandler) {
+
+ // Ensure this attribute is only on the element
+ if (tag.elementCompleteName != 'title') {
+ throw new IllegalArgumentException("${attributeName} processor should only appear in a element")
+ }
+
+ structureHandler.setBody(new ExpressionProcessor(context).processAsString(attributeValue), false)
+ }
+}
diff --git a/thymeleaf-layout-dialect/source/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/HtmlDocumentDecorator.groovy b/thymeleaf-layout-dialect/source/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/HtmlDocumentDecorator.groovy
index c6c929530..d785cb3f6 100644
--- a/thymeleaf-layout-dialect/source/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/HtmlDocumentDecorator.groovy
+++ b/thymeleaf-layout-dialect/source/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/HtmlDocumentDecorator.groovy
@@ -1,12 +1,12 @@
-/*
+/*
* Copyright 2013, Emanuel Rabina (http://www.ultraq.net.nz/)
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,35 +28,27 @@ import org.thymeleaf.model.IOpenElementTag
* A decorator made to work over an HTML document. Decoration for a document
* involves 2 sub-decorators: a special one for the {@code } element, and
* a standard one for the {@code } element.
- *
+ *
* @author Emanuel Rabina
*/
class HtmlDocumentDecorator extends XmlDocumentDecorator {
final SortingStrategy sortingStrategy
final boolean autoHeadMerging
+ final boolean newTitleTokens
/**
* Constructor, builds a decorator with the given configuration.
- *
- * @param context
- * @param sortingStrategy
- * @param autoHeadMerging
*/
- HtmlDocumentDecorator(ITemplateContext context, SortingStrategy sortingStrategy, boolean autoHeadMerging) {
+ HtmlDocumentDecorator(ITemplateContext context, SortingStrategy sortingStrategy, boolean autoHeadMerging,
+ boolean newTitleTokens) {
super(context)
this.sortingStrategy = sortingStrategy
this.autoHeadMerging = autoHeadMerging
+ this.newTitleTokens = newTitleTokens
}
- /**
- * Decorate an entire HTML page.
- *
- * @param targetDocumentModel
- * @param sourceDocumentModel
- * @return Result of the decoration.
- */
@Override
IModel decorate(IModel targetDocumentModel, IModel sourceDocumentModel) {
@@ -67,7 +59,7 @@ class HtmlDocumentDecorator extends XmlDocumentDecorator {
def headModelFinder = { event -> event.isOpeningElementOf('head') }
if (autoHeadMerging) {
def targetHeadModel = resultDocumentModel.findModel(headModelFinder)
- def resultHeadModel = new HtmlHeadDecorator(context, sortingStrategy)
+ def resultHeadModel = new HtmlHeadDecorator(context, sortingStrategy, newTitleTokens)
.decorate(targetHeadModel, sourceDocumentModel.findModel(headModelFinder))
if (resultHeadModel) {
if (targetHeadModel) {
@@ -76,7 +68,7 @@ class HtmlDocumentDecorator extends XmlDocumentDecorator {
else {
resultDocumentModel.insertModelWithWhitespace(resultDocumentModel.findIndexOf { event ->
return (event instanceof IOpenElementTag && event.elementCompleteName == 'body') ||
- (event instanceof ICloseElementTag && event.elementCompleteName == 'html')
+ (event instanceof ICloseElementTag && event.elementCompleteName == 'html')
} - 1, resultHeadModel, modelFactory)
}
}
diff --git a/thymeleaf-layout-dialect/source/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/HtmlHeadDecorator.groovy b/thymeleaf-layout-dialect/source/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/HtmlHeadDecorator.groovy
index 12bf5657c..c186e5e8a 100644
--- a/thymeleaf-layout-dialect/source/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/HtmlHeadDecorator.groovy
+++ b/thymeleaf-layout-dialect/source/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/HtmlHeadDecorator.groovy
@@ -1,12 +1,12 @@
-/*
+/*
* Copyright 2013, Emanuel Rabina (http://www.ultraq.net.nz/)
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,7 +27,7 @@ import groovy.transform.TupleConstructor
/**
* A decorator specific to processing an HTML {@code } element.
- *
+ *
* @author Emanuel Rabina
*/
@TupleConstructor(defaults = false)
@@ -35,14 +35,8 @@ class HtmlHeadDecorator implements Decorator {
final ITemplateContext context
final SortingStrategy sortingStrategy
+ final boolean newTitleTokens
- /**
- * Decorate the {@code } part.
- *
- * @param targetHeadModel
- * @param sourceHeadModel
- * @return Result of the decoration.
- */
@Override
IModel decorate(IModel targetHeadModel, IModel sourceHeadModel) {
@@ -69,7 +63,7 @@ class HtmlHeadDecorator implements Decorator {
def indexOfTitle = resultHeadModel.findIndexOf(titleFinder)
if (indexOfTitle != -1) {
resultHeadModel.removeAllModels(titleFinder)
- def resultTitle = new HtmlTitleDecorator(context).decorate(
+ def resultTitle = new HtmlTitleDecorator(context, newTitleTokens).decorate(
targetHeadModel?.findModel(titleFinder),
sourceHeadModel?.findModel(titleFinder)
)
diff --git a/thymeleaf-layout-dialect/source/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/HtmlTitleDecorator.groovy b/thymeleaf-layout-dialect/source/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/HtmlTitleDecorator.groovy
index b146f5788..6b312506d 100644
--- a/thymeleaf-layout-dialect/source/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/HtmlTitleDecorator.groovy
+++ b/thymeleaf-layout-dialect/source/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/HtmlTitleDecorator.groovy
@@ -19,6 +19,7 @@ package nz.net.ultraq.thymeleaf.layoutdialect.decorators.html
import nz.net.ultraq.thymeleaf.layoutdialect.LayoutDialect
import nz.net.ultraq.thymeleaf.layoutdialect.decorators.Decorator
import nz.net.ultraq.thymeleaf.layoutdialect.decorators.TitlePatternProcessor
+import nz.net.ultraq.thymeleaf.layoutdialect.decorators.TitleProcessor
import nz.net.ultraq.thymeleaf.layoutdialect.models.ElementMerger
import nz.net.ultraq.thymeleaf.layoutdialect.models.ModelBuilder
import nz.net.ultraq.thymeleaf.layoutdialect.models.TitleExtractor
@@ -30,7 +31,8 @@ import groovy.transform.TupleConstructor
/**
* Decorator for the {@code } part of the template to handle the special
- * processing required for the {@code layout:title-pattern} processor.
+ * processing required for the {@code layout:title-pattern} and
+ * {@code layout:title} processors.
*
* @author Emanuel Rabina
*/
@@ -38,18 +40,9 @@ import groovy.transform.TupleConstructor
class HtmlTitleDecorator implements Decorator {
final ITemplateContext context
+ final boolean newTitleTokens
- /**
- * Special decorator for the {@code } part, accumulates the important
- * processing parts for the {@code layout:title-pattern} processor.
- *
- * @param targetTitleModel
- * @param sourceTitleModel
- * @return A new {@code } model that is the result of decorating the
- * {@code }s.
- */
@Override
- @SuppressWarnings('SpaceAroundOperator')
IModel decorate(IModel targetTitleModel, IModel sourceTitleModel) {
def modelBuilder = new ModelBuilder(context)
@@ -59,9 +52,17 @@ class HtmlTitleDecorator implements Decorator {
def titlePatternProcessorRetriever = { titleModel ->
return titleModel?.first()?.getAttribute(layoutDialectPrefix, TitlePatternProcessor.PROCESSOR_NAME)
}
+ def titleProcessorRetriever = { titleModel ->
+ return titleModel?.first()?.getAttribute(layoutDialectPrefix, TitleProcessor.PROCESSOR_NAME)
+ }
def titlePatternProcessor =
titlePatternProcessorRetriever(sourceTitleModel) ?:
- titlePatternProcessorRetriever(targetTitleModel) ?:
+ titlePatternProcessorRetriever(targetTitleModel) ?:
+ null
+ def titleProcessor = newTitleTokens ?
+ titleProcessorRetriever(sourceTitleModel) ?:
+ titleProcessorRetriever(targetTitleModel) ?:
+ null :
null
def resultTitle
@@ -70,13 +71,22 @@ class HtmlTitleDecorator implements Decorator {
// title result parts that we want to use on the pattern.
if (titlePatternProcessor) {
def titleExtractor = new TitleExtractor(context)
- titleExtractor.extract(sourceTitleModel, TitlePatternProcessor.CONTENT_TITLE_KEY_OLD)
- titleExtractor.extract(targetTitleModel, TitlePatternProcessor.LAYOUT_TITLE_KEY_OLD)
+ titleExtractor.extract(sourceTitleModel, TitlePatternProcessor.CONTENT_TITLE_KEY)
+ titleExtractor.extract(targetTitleModel, TitlePatternProcessor.LAYOUT_TITLE_KEY)
resultTitle = modelBuilder.build {
title((titlePatternProcessor.attributeCompleteName): titlePatternProcessor.value)
}
}
+ else if (titleProcessor) {
+ def titleExtractor = new TitleExtractor(context, true)
+ titleExtractor.extract(sourceTitleModel, TitleProcessor.CONTENT_TITLE_KEY)
+ titleExtractor.extract(targetTitleModel, TitleProcessor.LAYOUT_TITLE_KEY)
+
+ resultTitle = modelBuilder.build {
+ title((titleProcessor.attributeCompleteName): titleProcessor.value)
+ }
+ }
else {
resultTitle = new ElementMerger(context).merge(targetTitleModel, sourceTitleModel)
}
diff --git a/thymeleaf-layout-dialect/source/nz/net/ultraq/thymeleaf/layoutdialect/decorators/xml/XmlDocumentDecorator.groovy b/thymeleaf-layout-dialect/source/nz/net/ultraq/thymeleaf/layoutdialect/decorators/xml/XmlDocumentDecorator.groovy
index 5594b32a3..f6a146efc 100644
--- a/thymeleaf-layout-dialect/source/nz/net/ultraq/thymeleaf/layoutdialect/decorators/xml/XmlDocumentDecorator.groovy
+++ b/thymeleaf-layout-dialect/source/nz/net/ultraq/thymeleaf/layoutdialect/decorators/xml/XmlDocumentDecorator.groovy
@@ -1,12 +1,12 @@
-/*
+/*
* Copyright 2013, Emanuel Rabina (http://www.ultraq.net.nz/)
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,7 +31,7 @@ import groovy.transform.TupleConstructor
/**
* A decorator made to work over an XML document.
- *
+ *
* @author Emanuel Rabina
*/
@TupleConstructor(defaults = false)
@@ -39,13 +39,6 @@ class XmlDocumentDecorator implements Decorator {
final ITemplateContext context
- /**
- * Decorates the target XML document with the source one.
- *
- * @param targetDocumentModel
- * @param sourceDocumentModel
- * @return Result of the decoration.
- */
@Override
IModel decorate(IModel targetDocumentModel, IModel sourceDocumentModel) {
diff --git a/thymeleaf-layout-dialect/test/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/HtmlDocumentDecoratorTests.groovy b/thymeleaf-layout-dialect/test/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/HtmlDocumentDecoratorTests.groovy
index 63f960935..7c23183a2 100644
--- a/thymeleaf-layout-dialect/test/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/HtmlDocumentDecoratorTests.groovy
+++ b/thymeleaf-layout-dialect/test/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/HtmlDocumentDecoratorTests.groovy
@@ -59,12 +59,12 @@ class HtmlDocumentDecoratorTests extends Specification {
mockContext.metaClass {
getPrefixForDialect = { Class dialectClass ->
return dialectClass == StandardDialect ? 'th' :
- dialectClass == LayoutDialect ? 'layout' :
- 'mock-prefix'
+ dialectClass == LayoutDialect ? 'layout' :
+ 'mock-prefix'
}
}
- htmlDocumentDecorator = new HtmlDocumentDecorator(mockContext, new AppendingStrategy(), true)
+ htmlDocumentDecorator = new HtmlDocumentDecorator(mockContext, new AppendingStrategy(), true, false)
}
/**
diff --git a/thymeleaf-layout-dialect/test/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/HtmlHeadDecoratorTests.groovy b/thymeleaf-layout-dialect/test/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/HtmlHeadDecoratorTests.groovy
index dc6735677..e9256bc63 100644
--- a/thymeleaf-layout-dialect/test/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/HtmlHeadDecoratorTests.groovy
+++ b/thymeleaf-layout-dialect/test/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/HtmlHeadDecoratorTests.groovy
@@ -60,12 +60,12 @@ class HtmlHeadDecoratorTests extends Specification {
mockContext.metaClass {
getPrefixForDialect = { Class dialectClass ->
return dialectClass == StandardDialect ? 'th' :
- dialectClass == LayoutDialect ? 'layout' :
- 'mock-prefix'
+ dialectClass == LayoutDialect ? 'layout' :
+ 'mock-prefix'
}
}
- htmlHeadDecorator = new HtmlHeadDecorator(mockContext, new AppendingStrategy())
+ htmlHeadDecorator = new HtmlHeadDecorator(mockContext, new AppendingStrategy(), false)
}
def "Doesn't modify source parameters"() {
diff --git a/thymeleaf-layout-dialect/test/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/HtmlTitleDecoratorTests.groovy b/thymeleaf-layout-dialect/test/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/HtmlTitleDecoratorTests.groovy
index 7c53590b4..f09c6231e 100644
--- a/thymeleaf-layout-dialect/test/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/HtmlTitleDecoratorTests.groovy
+++ b/thymeleaf-layout-dialect/test/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/HtmlTitleDecoratorTests.groovy
@@ -58,12 +58,12 @@ class HtmlTitleDecoratorTests extends Specification {
mockContext.metaClass {
getPrefixForDialect = { Class dialectClass ->
return dialectClass == StandardDialect ? 'th' :
- dialectClass == LayoutDialect ? 'layout' :
- 'mock-prefix'
+ dialectClass == LayoutDialect ? 'layout' :
+ 'mock-prefix'
}
}
- htmlTitleDecorator = new HtmlTitleDecorator(mockContext)
+ htmlTitleDecorator = new HtmlTitleDecorator(mockContext, false)
}
def "Doesn't modify source parameters"() {
diff --git a/thymeleaf-layout-dialect/test/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/TitleTokens-DynamicContentThText.thtest b/thymeleaf-layout-dialect/test/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/TitleTokens-DynamicContentThText.thtest
index c5d4b63ca..0eb48bede 100644
--- a/thymeleaf-layout-dialect/test/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/TitleTokens-DynamicContentThText.thtest
+++ b/thymeleaf-layout-dialect/test/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/TitleTokens-DynamicContentThText.thtest
@@ -12,7 +12,7 @@ contentTitle = "My blog"
- Content title
+ Content title
I can use the content title here too!
diff --git a/thymeleaf-layout-dialect/test/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/TitleTokens-StaticContent.thtest b/thymeleaf-layout-dialect/test/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/TitleTokens-StaticContent.thtest
index c9a159f19..8007d2f4f 100644
--- a/thymeleaf-layout-dialect/test/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/TitleTokens-StaticContent.thtest
+++ b/thymeleaf-layout-dialect/test/nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/TitleTokens-StaticContent.thtest
@@ -8,7 +8,7 @@
- Content title
+ Content title
I can use the content title here too!