org.webpieces.templatingdev.impl.source.TemplateTokenizerTask Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of http-templating-dev-lib Show documentation
Show all versions of http-templating-dev-lib Show documentation
Templating library using groovy as the scripting language
package org.webpieces.templatingdev.impl.source;
import static org.webpieces.templatingdev.impl.source.TemplateToken.ABSOLUTE_ACTION;
import static org.webpieces.templatingdev.impl.source.TemplateToken.ACTION;
import static org.webpieces.templatingdev.impl.source.TemplateToken.COMMENT;
import static org.webpieces.templatingdev.impl.source.TemplateToken.END_TAG;
import static org.webpieces.templatingdev.impl.source.TemplateToken.EOF;
import static org.webpieces.templatingdev.impl.source.TemplateToken.ESCAPE;
import static org.webpieces.templatingdev.impl.source.TemplateToken.EXPR;
import static org.webpieces.templatingdev.impl.source.TemplateToken.FILE_VERIFY;
import static org.webpieces.templatingdev.impl.source.TemplateToken.MESSAGE;
import static org.webpieces.templatingdev.impl.source.TemplateToken.PLAIN;
import static org.webpieces.templatingdev.impl.source.TemplateToken.SCRIPT;
import static org.webpieces.templatingdev.impl.source.TemplateToken.START_END_TAG;
import static org.webpieces.templatingdev.impl.source.TemplateToken.START_TAG;
import java.util.ArrayList;
import java.util.List;
/*
* for discarding extra lines, it is a bit tricky
* case 1: Hi there, my name is ${user.name}$ and my favorite color is ${color}$ (preserve all)
* case 2: Hi there, my name is ${user.name}$\n and this is my story (preserve all)
* case 3: #{if}#\nShow this\n#{/if}\n should rewrite as "Show this\n" so two \n are removed
* case 4: #{if}#Show this#{/if}# should preserve all as "Show this\n"
* case 5: (really breaks stuff) #{form ..}#\n.....#{/form}# In this case, we really don't want to strip anything since
* the