@Test public void eachAfterIf() { template = new BoonTemplate(new BoonModernTemplateParser()); replace = template.replace("{{#if name}}\n" + "Hello {{name}}!\n" + "How are you {{name}}? more text here\n" + "{{/if}}" + "\n" + "{{#each fruits}}" + " {{this}}\n" + "{{/each}}" , map("name", "Rick", "fruits", list("apples", "pairs", "tangerines"))); String test = "\nHello Rick!\n" + "How are you Rick? more text here\n" + "\n" + " apples\n" + " pairs\n" + " tangerines\n"; equalsOrDie(test, replace); }
@Override public String replace(String template, Object... context) { initContext(context); this.template = template; parser.parse(template); _buf.readForRecycle(); Iterator<Token> tokens = parser.getTokenList().iterator(); while (tokens.hasNext()) { final Token token = tokens.next(); processToken(tokens, token); } return _buf.toString(); }
BoonTemplate implements Template { @Override public String replace(String template, Object... context) { initContext(context); this.template = template; parser.parse(template); _buf.readForRecycle(); Iterator<Token> tokens = parser.getTokenList().iterator(); while (tokens.hasNext()) { final Token token = tokens.next(); processToken(tokens, token); } return _buf.toString(); } }
BoonTemplate implements Template { @Override public String replace(String template, Object... context) { initContext(context); this.template = template; parser.parse(template); _buf.readForRecycle(); Iterator<Token> tokens = parser.getTokenList().iterator(); while (tokens.hasNext()) { final Token token = tokens.next(); processToken(tokens, token); } return _buf.toString(); } BoonTemplate();  BoonTemplate(TemplateParser templateParser);  BoonTemplate(ExpressionContext context, TemplateParser templateParser); }
BoonTemplate implements Template { @Override public String replace(String template, Object... context) { initContext(context); this.template = template; parser.parse(template); _buf.readForRecycle(); Iterator<Token> tokens = parser.getTokenList().iterator(); while (tokens.hasNext()) { final Token token = tokens.next(); processToken(tokens, token); } return _buf.toString(); } BoonTemplate();  BoonTemplate(TemplateParser templateParser);  BoonTemplate(ExpressionContext context, TemplateParser templateParser); @Override String replace(String template, Object... context); @Override String replaceFromResource(String resource, Object... context); @Override String replaceFromFile(String resource, Object... context); @Override String replaceFromURI(String resource, Object... context); String inlcudeFromURI(String resource); void displayTokens(); static Template template(); static Template jstl(); void addFunctions(Class<?> functions); void addFunctions(String prefix, Class<?> functions); }
BoonTemplate implements Template { @Override public String replace(String template, Object... context) { initContext(context); this.template = template; parser.parse(template); _buf.readForRecycle(); Iterator<Token> tokens = parser.getTokenList().iterator(); while (tokens.hasNext()) { final Token token = tokens.next(); processToken(tokens, token); } return _buf.toString(); } BoonTemplate();  BoonTemplate(TemplateParser templateParser);  BoonTemplate(ExpressionContext context, TemplateParser templateParser); @Override String replace(String template, Object... context); @Override String replaceFromResource(String resource, Object... context); @Override String replaceFromFile(String resource, Object... context); @Override String replaceFromURI(String resource, Object... context); String inlcudeFromURI(String resource); void displayTokens(); static Template template(); static Template jstl(); void addFunctions(Class<?> functions); void addFunctions(String prefix, Class<?> functions);  }