@@ -0,0 +1,2797 @@
+package de.morphbit.thymeleaf.service.impl;%0A%0Aimport java.util.HashSet;%0Aimport java.util.Set;%0A%0Aimport org.attoparser.dom.Element;%0Aimport org.thymeleaf.standard.StandardDialect;%0A%0Aimport de.morphbit.thymeleaf.dialect.ComponentDialect;%0Aimport de.morphbit.thymeleaf.helper.ResourcePathFinder;%0Aimport de.morphbit.thymeleaf.model.ThymeleafComponent;%0Aimport de.morphbit.thymeleaf.service.IThymeleafComponentParser;%0A%0Apublic class StandardThymeleafComponentParser extends AbstractElementParser%0A        implements IThymeleafComponentParser %7B%0A%0A%09protected static final String NAME_ATTRIBUTE = %22selector%22;%0A%09protected static final String FRAGMENT_ATTRIBUTE = %22fragment%22;%0A%0A%09private final String directory;%0A%09private final String templatePrefix;%0A%09private final String templateSuffix;%0A%0A%09public StandardThymeleafComponentParser(String templatePrefix,%0A%09        String templateSuffix, String directory) %7B%0A%09%09super(ComponentDialect.PREFIX);%0A%09%09this.directory = directory;%0A%09%09this.templatePrefix = templatePrefix;%0A%09%09this.templateSuffix = templateSuffix;%0A%09%7D%0A%0A%09@Override%0A%09public Set%3CThymeleafComponent%3E parse() %7B%0A%09%09Set%3CThymeleafComponent%3E components = new HashSet%3C%3E();%0A%0A%09%09for (String file : new ResourcePathFinder(templatePrefix + directory)%0A%09%09    .findResourceFiles(true)) %7B%0A%09%09%09for (Element element : parseElements(file)) %7B%0A%09%09%09%09if (isThymeleafComponent(element)) %7B%0A%09%09%09%09%09components.add(createComponent(element, file));%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D%0A%0A%09%09return components;%0A%09%7D%0A%0A%09private ThymeleafComponent createComponent(Element element,%0A%09        String htmlFile) %7B%0A%09%09String templateFile = htmlFile;%0A%09%09templateFile = templateFile.replaceAll(%22%5E%22 + this.templatePrefix, %22%22);%0A%09%09templateFile = templateFile%0A%09%09    .replaceAll(this.templateSuffix.replace(%22.%22, %22%5C%5C.%22), %22%22);%0A%0A%09%09String frag = getDynamicAttributeValue(element, StandardDialect.PREFIX,%0A%09%09    FRAGMENT_ATTRIBUTE);%0A%09%09frag = frag.replaceAll(%22%5C%5C(.*%5C%5C)%22, %22%22);%0A%0A%09%09String name = getDynamicAttributeValue(element, this.dialectPrefix,%0A%09%09    NAME_ATTRIBUTE);%0A%09%09if (name == null) %7B%0A%09%09%09name = frag;%0A%09%09%7D%0A%0A%09%09return new ThymeleafComponent(name, templateFile + %22 :: %22 + frag);%0A%09%7D%0A%0A%09private boolean isThymeleafComponent(Element element) %7B%0A%09%09return hasDynamicAttribute(element, StandardDialect.PREFIX,%0A%09%09    FRAGMENT_ATTRIBUTE);%0A%09%7D%0A%0A%09private boolean hasDynamicAttribute(Element element, String prefix,%0A%09        String dynamicAttribute) %7B%0A%09%09return element.hasAttribute(%22data-%22 + prefix + %22-%22 + dynamicAttribute)%0A%09%09        %7C%7C element.hasAttribute(prefix + %22:%22 + dynamicAttribute);%0A%09%7D%0A%0A%09private String getDynamicAttributeValue(Element element, String prefix,%0A%09        String dynamicAttribute) %7B%0A%09%09String value = element%0A%09%09    .getAttributeValue(%22data-%22 + prefix + %22-%22 + dynamicAttribute);%0A%09%09if (value != null) %7B%0A%09%09%09return value;%0A%09%09%7D%0A%09%09return element.getAttributeValue(prefix + %22:%22 + dynamicAttribute);%0A%09%7D%0A%0A%7D%0A

Add StandardThymeleafComponentParser