Search in sources :

Example 1 with TokenParser

use of com.mitchellbosecke.pebble.tokenParser.TokenParser in project Orchid by JavaEden.

the class CorePebbleExtension method getTokenParsers.

@Override
public List<TokenParser> getTokenParsers() {
    List<TokenParser> tokenParsers = new ArrayList<>();
    Set<String> childTabNames = new HashSet<>();
    for (TemplateTag templateTag : templateTags) {
        final String[] tabParams;
        final Class<? extends TemplateTag.Tab> tabClass;
        if (templateTag.getType() == TemplateTag.Type.Tabbed) {
            TemplateTag.Tab tab = templateTag.getNewTab("", "");
            tabParams = tab.parameters();
            tabClass = tab.getClass();
            childTabNames.add(tab.getType());
        } else {
            tabParams = null;
            tabClass = null;
        }
        tokenParsers.add(new PebbleWrapperTemplateTag(contextProvider, templateTag.getName(), templateTag.getType(), templateTag.parameters(), templateTag.getClass(), tabParams, tabClass));
    }
    for (String childTabName : childTabNames) {
        tokenParsers.add(new PebbleWrapperTemplateTagChildTab(contextProvider, childTabName));
    }
    return tokenParsers;
}
Also used : TemplateTag(com.eden.orchid.api.compilers.TemplateTag) ArrayList(java.util.ArrayList) TokenParser(com.mitchellbosecke.pebble.tokenParser.TokenParser) HashSet(java.util.HashSet)

Aggregations

TemplateTag (com.eden.orchid.api.compilers.TemplateTag)1 TokenParser (com.mitchellbosecke.pebble.tokenParser.TokenParser)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1