コード例 #1
0
ファイル: ViewLoader.cs プロジェクト: emiaj/spark
        private void LoadInternal(string viewPath)
        {
            if (string.IsNullOrEmpty(viewPath))
            {
                return;
            }

            var newEntry = this.BindEntry(viewPath);

            var context = new VisitorContext
            {
                ViewFolder = this.ViewFolder,
                Prefix = this.Prefix,
                ExtensionFactory = this.ExtensionFactory,
                PartialFileNames = this.FindPartialFiles(viewPath),
                Bindings = this.FindBindings(viewPath),
                ParseSectionTagAsSegment = this.ParseSectionTagAsSegment
            };
            newEntry.Chunks = this.SyntaxProvider.GetChunks(context, viewPath);

            var fileReferenceVisitor = new FileReferenceVisitor();
            fileReferenceVisitor.Accept(newEntry.Chunks);

            foreach (var useFile in fileReferenceVisitor.References)
            {
                var referencePath = this.ResolveReference(viewPath, useFile.Name);

                if (!string.IsNullOrEmpty(referencePath))
                {
                    useFile.FileContext = this.BindEntry(referencePath).FileContext;
                }
            }
        }
コード例 #2
0
ファイル: ViewLoader.cs プロジェクト: smoothdeveloper/spark
        void LoadInternal(string viewPath)
        {
            if (string.IsNullOrEmpty(viewPath))
                return;

            var newEntry = BindEntry(viewPath);

            var context = new VisitorContext
                                         {
                                             ViewFolder = ViewFolder,
                                             Prefix = Prefix,
                                             ExtensionFactory = ExtensionFactory,
                                             PartialFileNames = FindPartialFiles(viewPath)
                                         };
            newEntry.Chunks = SyntaxProvider.GetChunks(context, viewPath);

            var fileReferenceVisitor = new FileReferenceVisitor();
            fileReferenceVisitor.Accept(newEntry.Chunks);

            foreach (var useFile in fileReferenceVisitor.References)
            {
                var referencePath = ResolveReference(viewPath, useFile.Name);

                if (!string.IsNullOrEmpty(referencePath))
                {
                    useFile.FileContext = BindEntry(referencePath).FileContext;
                }
            }
        }