Skip to content

Commit

Permalink
Merge tag '3.2.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
zhanhb committed Jan 23, 2023
2 parents d467599 + 5e9fb82 commit 23bb0b8
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 33 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@
Changelog
=========

### 3.2.0

- Remove old log warning about `layout:fragment` in the `<head>` section
([#225](https://github.com/ultraq/thymeleaf-layout-dialect/issues/225))


### 3.1.0

- [Java] Add static require `org.apache.groovy` to `module-info`.


### 3.0.0

- Minimum supported version of Java is now Java 8
Expand All @@ -29,6 +37,7 @@ Check the [migration guide](https://ultraq.github.io/thymeleaf-layout-dialect/mi


### 2.5.3

- [Java] A version bump without change anything, for upstream fixes a groovy security issue.


Expand Down
2 changes: 1 addition & 1 deletion thymeleaf-layout-dialect-docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ co-ordinates:

- GroupId: `nz.net.ultraq.thymeleaf`
- ArtifactId: `thymeleaf-layout-dialect`
- Version: `3.1.0`
- Version: `3.2.0`

Check the [project releases](https://github.com/ultraq/thymeleaf-layout-dialect/releases)
for a list of available versions. Each release page also includes a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@
*/
public class FragmentProcessor extends AbstractAttributeTagProcessor {

private static final Logger logger = LoggerFactory.getLogger(FragmentProcessor.class);

private static final AtomicBoolean warned = new AtomicBoolean();

public static final String PROCESSOR_NAME = "fragment";
public static final int PROCESSOR_PRECEDENCE = 1;

Expand Down Expand Up @@ -72,18 +68,6 @@ public FragmentProcessor(TemplateMode templateMode, String dialectPrefix) {
protected void doProcess(
ITemplateContext context, IProcessableElementTag tag,
AttributeName attributeName, String attributeValue, IElementTagStructureHandler structureHandler) {
// Emit a warning if found in the <head> section
if (getTemplateMode() == TemplateMode.HTML) {
for (IProcessableElementTag element : context.getElementStack()) {
if ("head".equals(element.getElementCompleteName())) {
if (warned.compareAndSet(false, true)) {
logger.warn("You don't need to put the layout:fragment/data-layout-fragment attribute into the <head> section - "
+ "the decoration process will automatically copy the <head> section of your content templates into your layout page.");
}
break;
}
}
}

// Locate the fragment that corresponds to this decorator/include fragment
List<IModel> fragments = FragmentExtensions.getFragmentCollection(context).get(attributeValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<footer>
<p>My footer</p>
<p layout:fragment="custom-footer">Custom footer here</p>
</footer>
</footer>
</body>
</html>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ package nz.net.ultraq.thymeleaf.layoutdialect
import nz.net.ultraq.thymeleaf.testing.junit.JUnitTestExecutor

import org.reflections.Reflections
import org.reflections.scanners.ResourcesScanner
import org.thymeleaf.dialect.IDialect
import org.thymeleaf.standard.StandardDialect
import static org.reflections.scanners.Scanners.Resources

/**
* A test executor for just the example Thymeleaf test files in this package.
Expand All @@ -42,7 +42,8 @@ class LayoutDialectExampleExecutor extends JUnitTestExecutor {
*/
static List<String> getThymeleafTestFiles() {

return new Reflections('', new ResourcesScanner())
.getResources(~/Examples.*\.thtest/) as List
return new Reflections('nz.net.ultraq.thymeleaf.layoutdialect', Resources)
.getResources(~/Examples.*\.thtest/)
.asList()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ import nz.net.ultraq.thymeleaf.layoutdialect.decorators.strategies.GroupingStrat
import nz.net.ultraq.thymeleaf.testing.junit.JUnitTestExecutor

import org.reflections.Reflections
import org.reflections.scanners.ResourcesScanner
import org.thymeleaf.dialect.AbstractProcessorDialect
import org.thymeleaf.dialect.IDialect
import org.thymeleaf.processor.IProcessor
import org.thymeleaf.standard.StandardDialect
import org.thymeleaf.standard.processor.StandardXmlNsTagProcessor
import org.thymeleaf.templatemode.TemplateMode
import static org.reflections.scanners.Scanners.Resources

/**
* Special test executor for testing interaction of the layout dialect with
Expand All @@ -50,8 +50,9 @@ class LayoutDialectInteractionTestExecutor extends JUnitTestExecutor {
*/
static List<String> getThymeleafTestFiles() {

return new Reflections('', new ResourcesScanner())
.getResources(~/Interaction.*\.thtest/) as List
return new Reflections('nz.net.ultraq.thymeleaf.layoutdialect', Resources)
.getResources(~/Interaction.*\.thtest/)
.asList()
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import nz.net.ultraq.thymeleaf.layoutdialect.decorators.strategies.AppendingStra
import nz.net.ultraq.thymeleaf.testing.junit.JUnitTestExecutor

import org.reflections.Reflections
import org.reflections.scanners.ResourcesScanner
import org.thymeleaf.dialect.IDialect
import org.thymeleaf.standard.StandardDialect
import static org.reflections.scanners.Scanners.Resources

/**
* A parameterized JUnit test class that is run over every Thymeleaf testing
Expand All @@ -47,8 +47,9 @@ class LayoutDialectTestExecutor extends JUnitTestExecutor {
*/
static List<String> getThymeleafTestFiles() {

def tests = new Reflections('', new ResourcesScanner())
.getResources(~/(?!Examples|GroupingStrategy|Interaction).*\.thtest/) as List
def tests = new Reflections('nz.net.ultraq.thymeleaf.layoutdialect', Resources)
.getResources(~/(?!Examples|GroupingStrategy|Interaction).*\.thtest/)
.asList()
def exclusions = [
'nz/net/ultraq/thymeleaf/layoutdialect/decorators/Decorate-DisabledHead.thtest',
'nz/net/ultraq/thymeleaf/layoutdialect/decorators/html/TitlePattern-AllowOtherProcessors.thtest',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ package nz.net.ultraq.thymeleaf.layoutdialect
import nz.net.ultraq.thymeleaf.testing.junit.JUnitTestExecutor

import org.reflections.Reflections
import org.reflections.scanners.ResourcesScanner
import org.thymeleaf.dialect.IDialect
import org.thymeleaf.standard.StandardDialect
import static org.reflections.scanners.Scanners.Resources

/**
* A parameterized JUnit test class that is run over just the files involved in
Expand All @@ -44,7 +44,8 @@ class LayoutDialectTestExecutorDisabledHeadMerging extends JUnitTestExecutor {
*/
static List<String> getThymeleafTestFiles() {

return new Reflections('', new ResourcesScanner())
.getResources(~/Decorate-DisabledHead\.thtest/) as List
return new Reflections('nz.net.ultraq.thymeleaf.layoutdialect', Resources)
.getResources(~/Decorate-DisabledHead\.thtest/)
.asList()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import nz.net.ultraq.thymeleaf.layoutdialect.decorators.strategies.GroupingStrat
import nz.net.ultraq.thymeleaf.testing.junit.JUnitTestExecutor

import org.reflections.Reflections
import org.reflections.scanners.ResourcesScanner
import org.thymeleaf.dialect.IDialect
import org.thymeleaf.standard.StandardDialect
import static org.reflections.scanners.Scanners.Resources

/**
* A parameterized JUnit test class that is run over just the files involved in
Expand All @@ -46,7 +46,8 @@ class LayoutDialectTestExecutorGrouping extends JUnitTestExecutor {
*/
static List<String> getThymeleafTestFiles() {

return new Reflections('', new ResourcesScanner())
.getResources(~/GroupingStrategy.*\.thtest/) as List
return new Reflections('nz.net.ultraq.thymeleaf.layoutdialect', Resources)
.getResources(~/GroupingStrategy.*\.thtest/)
.asList()
}
}

0 comments on commit 23bb0b8

Please sign in to comment.