private Node parseFilter() { Token token = expect(Filter.class); Filter filterToken = (Filter) token; AttributeList attr = (AttributeList) accept(AttributeList.class); lexer.setPipeless(true); Node tNode = parseTextBlock(); lexer.setPipeless(false); FilterNode node = new FilterNode(); node.setValue(filterToken.getValue()); node.setLineNumber(line()); node.setFileName(filename); if(tNode!=null) node.setTextBlock(tNode); else{ node.setTextBlock(new BlockNode()); } if (attr != null) { node.setAttributes(convertToNodeAttributes(attr)); } return node; }
@Override public void execute(IndentWriter writer, JadeModel model, JadeTemplate template) throws JadeCompilerException { Filter filter = model.getFilter(getValue()); ArrayList<String> values = new ArrayList<String>(); LinkedList<Node> nodes = textBlock.getNodes(); for (Node node : nodes) { values.add(node.getValue()); } String result = StringUtils.join(values, "\n"); if (filter != null) { result = filter.convert(result, attributes, model); } try { result = Utils.interpolate(result, model, false,template.getExpressionHandler()); } catch (ExpressionException e) { throw new JadeCompilerException(this, template.getTemplateLoader(), e); } writer.append(result); }
private Node parseASTFilter() { Token token = expect(Filter.class); Filter filterToken = (Filter) token; AttributeList attr = (AttributeList) accept(AttributeList.class); token = expect(Colon.class); FilterNode node = new FilterNode(); node.setValue(filterToken.getValue()); node.setBlock(block()); node.setLineNumber(line()); node.setFileName(filename); node.setAttributes(convertToNodeAttributes(attr)); return node; }
if (includeToken.getFilter() != null) { Reader reader = templateLoader.getReader(path); FilterNode node = new FilterNode(); node.setValue(includeToken.getFilter()); node.setLineNumber(line()); node.setFileName(filename); TextNode text = new TextNode(); text.setValue(IOUtils.toString(reader)); block.setNodes(nodes); if (block != null) node.setTextBlock(block); else { node.setTextBlock(new BlockNode());
private Node parseASTFilter() { Token token = expect(Filter.class); Filter filterToken = (Filter) token; AttributeList attr = (AttributeList) accept(AttributeList.class); token = expect(Colon.class); FilterNode node = new FilterNode(); node.setValue(filterToken.getValue()); node.setBlock(block()); node.setLineNumber(line()); node.setFileName(filename); node.setAttributes(convertToNodeAttributes(attr)); return node; }
@Override public void execute(IndentWriter writer, JadeModel model, JadeTemplate template) throws JadeCompilerException { Filter filter = model.getFilter(getValue()); ArrayList<String> values = new ArrayList<String>(); LinkedList<Node> nodes = textBlock.getNodes(); for (Node node : nodes) { values.add(node.getValue()); } String result = StringUtils.join(values, "\n"); if (filter != null) { result = filter.convert(result, attributes, model); } try { result = Utils.interpolate(result, model, false,template.getExpressionHandler()); } catch (ExpressionException e) { throw new JadeCompilerException(this, template.getTemplateLoader(), e); } writer.append(result); }
private Node parseFilter() { Token token = expect(Filter.class); Filter filterToken = (Filter) token; AttributeList attr = (AttributeList) accept(AttributeList.class); lexer.setPipeless(true); Node tNode = parseTextBlock(); lexer.setPipeless(false); FilterNode node = new FilterNode(); node.setValue(filterToken.getValue()); node.setLineNumber(line()); node.setFileName(filename); if(tNode!=null) node.setTextBlock(tNode); else{ node.setTextBlock(new BlockNode()); } if (attr != null) { node.setAttributes(convertToNodeAttributes(attr)); } return node; }
if (includeToken.getFilter() != null) { Reader reader = templateLoader.getReader(path); FilterNode node = new FilterNode(); node.setValue(includeToken.getFilter()); node.setLineNumber(line()); node.setFileName(filename); TextNode text = new TextNode(); text.setValue(IOUtils.toString(reader)); block.setNodes(nodes); if (block != null) node.setTextBlock(block); else { node.setTextBlock(new BlockNode());