Jade.Parser.JadeParser.setBlocks C# (CSharp) Method

setBlocks() public method

public setBlocks ( Node>.Dictionary blocks ) : void
blocks Node>.Dictionary
return void
        public void setBlocks(Dictionary<String, Node> blocks)
        {
            this.blocks = blocks;
        }

Usage Example

Example #1
0
        private Node parseInclude()
        {
            Token   token        = expect(typeof(Include));
            Include includeToken = (Include)token;
            String  templateName = includeToken.getValue().Trim();

            String extension = Path.GetExtension(templateName);

            if (!"".Equals(extension) && !"jade".Equals(extension))
            {
                FilterNode node = new FilterNode();
                node.setLineNumber(_jadeLexer.getLineno());
                node.setFileName(filename);
                node.setValue(extension);
                try
                {
                    TextReader reader   = templateLoader.getReader(resolvePath(templateName));
                    Node       textNode = new TextNode();
                    textNode.setFileName(filename);
                    textNode.setLineNumber(_jadeLexer.getLineno());
                    textNode.setValue(reader.ReadToEnd());
                    node.setTextBlock(textNode);
                }
                catch (IOException e)
                {
                    throw new JadeParserException(filename, _jadeLexer.getLineno(), templateLoader,
                                                  "the included file [" + templateName + "] could not be opened\n" + e.Message);
                }
                return(node);
            }

            JadeParser jadeParser = createParser(templateName);

            jadeParser.setBlocks(blocks);
            contexts.AddLast(jadeParser);
            Node ast = jadeParser.parse();

            contexts.RemoveLast();

            if (peek() is Indent && ast is BlockNode)
            {
                ((BlockNode)ast).getIncludeBlock().push(block());
            }

            return(ast);
        }
All Usage Examples Of Jade.Parser.JadeParser::setBlocks