setBlocks() 공개 메소드

public setBlocks ( Node>.Dictionary blocks ) : void
blocks Node>.Dictionary
리턴 void
예제 #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);
        }
예제 #2
0
        private Node parseExtends()
        {
            Token token = expect(typeof(ExtendsToken))
            ;
            ExtendsToken extendsToken = (ExtendsToken)token;
            String       templateName = extendsToken.getValue().Trim();

            JadeParser jadeParser = createParser(templateName);

            jadeParser.setBlocks(blocks);
            jadeParser.setContexts(contexts);
            extending = jadeParser;

            LiteralNode node = new LiteralNode();

            node.setValue("");
            return(node);
        }