public void test() { loadInParser("large_body_text_without_pipes.jade"); tagNode = (TagNode) root.pollNode(); Assert.AreEqual(tagNode.getName(), ("p")); textNode = (TextNode) tagNode.getTextNode(); Assert.IsNotNull(textNode.getValue()); Assert.AreEqual(textNode.getValue(), ("Hello World!\nHere comes the Message!")); Assert.AreEqual(textNode.hasNodes(), (false)); tagNode = (TagNode) root.pollNode(); Assert.AreEqual(tagNode.getName(), ("div")); block = tagNode.getBlock(); Assert.IsNotNull(block); tagNode = (TagNode) block.pollNode(); Assert.AreEqual(tagNode.getName(), ("h1")); textNode = (TextNode) tagNode.getTextNode(); Assert.IsNotNull(textNode.getValue()); Assert.AreEqual(textNode.getValue(), ("Hello World!\nHere comes the second Message!")); Assert.AreEqual(textNode.hasNodes(), (false)); tagNode = (TagNode) block.pollNode(); Assert.AreEqual(tagNode.getName(), ("h2")); textNode = (TextNode) tagNode.getTextNode(); Assert.IsNotNull(textNode.getValue()); Assert.AreEqual(textNode.getValue(), ("Hello World!\nHere comes the third Message!")); Assert.AreEqual(textNode.hasNodes(), (false)); Assert.AreEqual(block.hasNodes(), (false)); Assert.AreEqual(root.hasNodes(), (false)); }
public void test() { loadInParser("include_1.jade"); tagNode = (TagNode) root.pollNode(); Assert.AreEqual(tagNode.getName(), ("p")); textNode = (TextNode) tagNode.getTextNode(); Assert.AreEqual(textNode.getValue(), ("Before Include")); includeNode = (BlockNode) root.pollNode(); tagNode = (TagNode) includeNode.pollNode(); Assert.AreEqual(tagNode.getName(), ("span")); textNode = (TextNode) tagNode.getTextNode(); Assert.AreEqual(textNode.getValue(), ("Hello Include")); yieldNode = (BlockNode) includeNode.pollNode(); Assert.IsNotNull(yieldNode); /*var blockNode = (BlockNode) yieldNode.pollNode(); tagNode = (TagNode)blockNode.pollNode(); Assert.AreEqual(blockNode.getName(), ("p")); textNode = (TextNode) tagNode.getTextNode(); Assert.AreEqual(textNode.getValue(), ("After Include")); Assert.AreEqual(yieldNode.hasNodes(), (false)); Assert.AreEqual(includeNode.hasNodes(), (false)); Assert.AreEqual(root.hasNodes(), (false)); */ }
public override void execute(IndentWriter writer, JadeModel model, JadeTemplate template) //throws JadeCompilerException { var filter = model.getFilter(getValue()); String result = textBlock.getValue(); if (filter != null) { result = filter.convert(result, attributes, model); } try { result = Utils.interpolate(result, model, false); } catch (ExpressionException e) { throw new JadeCompilerException(this, template.getTemplateLoader(), e); } writer.append(result); }
public void shouldReturnABlockWithTokens2() { loadInParser("complex_indent_outdent_file.jade"); block = (BlockNode) root; Assert.IsNotNull(block.getNodes()); head = block.pollNode(); body = block.pollNode(); Assert.AreEqual(head.getValue(), ("head")); Assert.AreEqual(body.getValue(), ("body")); Assert.AreEqual(block.hasNodes(), (false)); block = ((TagNode) head).getBlock(); Assert.AreEqual(block.pollNode().getValue(), ("meta")); Assert.AreEqual(block.pollNode().getValue(), ("meta")); Assert.AreEqual(block.hasNodes(), (false)); block = ((TagNode) body).getBlock(); Assert.AreEqual(block.pollNode().getValue(), ("div0")); div1 = block.pollNode(); Assert.AreEqual(div1.getValue(), ("div1")); div2 = block.pollNode(); Assert.AreEqual(div2.getValue(), ("div2")); div3 = block.pollNode(); Assert.AreEqual(div3.getValue(), ("div3")); div4 = block.pollNode(); Assert.AreEqual(div4.getValue(), ("div4")); div5 = block.pollNode(); Assert.AreEqual(div5.getValue(), ("div5")); Assert.AreEqual(block.hasNodes(), (false)); // =============================================== block = ((TagNode) div1).getBlock(); Assert.AreEqual(block.pollNode().getValue(), ("span")); Assert.AreEqual(block.pollNode().getValue(), ("span")); Assert.AreEqual(block.hasNodes(), (false)); // =============================================== block = ((TagNode) div2).getBlock(); ul1 = block.pollNode(); Assert.AreEqual(ul1.getValue(), ("ul1")); ul2 = block.pollNode(); Assert.AreEqual(ul2.getValue(), ("ul2")); Assert.AreEqual(block.hasNodes(), (false)); // =============================================== block = ((TagNode) div3).getBlock(); Assert.AreEqual(block.pollNode().getValue(), ("span")); Assert.AreEqual(block.hasNodes(), (false)); // =============================================== block = ((TagNode) div4).getBlock(); Assert.AreEqual(block.pollNode().getValue(), ("h1")); Assert.AreEqual(block.hasNodes(), (false)); // =============================================== block = ((TagNode) div5).getBlock(); div6 = block.pollNode(); Assert.AreEqual(div6.getValue(), ("div6")); div7 = block.pollNode(); Assert.AreEqual(div7.getValue(), ("div7")); Assert.AreEqual(block.hasNodes(), (false)); // =============================================== block = ((TagNode) div6).getBlock(); div8 = block.pollNode(); Assert.AreEqual(div8.getValue(), ("div8")); Assert.AreEqual(block.hasNodes(), (false)); // =============================================== block = ((TagNode) div8).getBlock(); span = block.pollNode(); Assert.AreEqual(span.getValue(), ("span")); Assert.AreEqual(block.hasNodes(), (false)); // =============================================== block = ((TagNode) span).getBlock(); em = block.pollNode(); Assert.AreEqual(em.getValue(), ("em")); Assert.AreEqual(block.hasNodes(), (false)); // =============================================== block = ((TagNode) div7).getBlock(); Assert.AreEqual(block.pollNode().getValue(), ("span")); Assert.AreEqual(block.hasNodes(), (false)); }
//throws ExpressionException private bool checkCondition(JadeModel model, Node caseConditionNode) { return ExpressionHandler.evaluateBooleanExpression(value + " == " + caseConditionNode.getValue(), model).Value; }
private bool checkCondition(JadeModel model, Node caseConditionNode) //throws ExpressionException { return(ExpressionHandler.evaluateBooleanExpression(value + " == " + caseConditionNode.getValue(), model).Value); }