示例#1
0
        protected override void PreProcess()
        {
            contextDrop = new SiteContextDrop(Context);

            Template.FileSystem = new Includes(Context.SourceFolder, FileSystem);

            if (Filters != null)
            {
                foreach (var filter in Filters)
                {
                    Template.RegisterFilter(filter.GetType());
                }
            }
            if (Tags != null)
            {
                var registerTagMethod = typeof(Template).GetMethod("RegisterTag", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);

                foreach (var tag in Tags)
                {
                        var registerTagGenericMethod = registerTagMethod.MakeGenericMethod(new[] { tag.GetType() });
                        registerTagGenericMethod.Invoke(null, new[] { tag.Name.ToUnderscoreCase() });
                }
            }
            if(TagFactories!=null)
            {
                foreach (var tagFactory in TagFactories)
                {
                    tagFactory.Initialize(Context);
                    Template.RegisterTagFactory(tagFactory);
                }
            }
        }
示例#2
0
 protected override void PreProcess()
 {
     contextDrop = new SiteContextDrop(Context);
     if (Filters != null)
     {
        foreach (var filter in Filters)
        {
           Template.RegisterFilter(filter.GetType());
        }
     }
 }
示例#3
0
#pragma warning restore 0649

        public void Process(SiteContext siteContext)
        {
            context = siteContext;
            contextDrop = new SiteContextDrop(context);

            var outputDirectory = Path.Combine(context.SourceFolder, "_site");

            foreach (var p in siteContext.Posts)
            {
                ProcessFile(outputDirectory, p, p.Filepath);
            }

            foreach (var p in siteContext.Pages)
            {
                ProcessFile(outputDirectory, p);
            }
        }
示例#4
0
 protected override void PreProcess()
 {
     contextDrop = new SiteContextDrop(Context);
 }
示例#5
0
        private static Hash CreatePageData(SiteContext context)
        {
            var drop = new SiteContextDrop(context);

            return Hash.FromAnonymousObject(new
            {
                site = drop,
                page = new { title = context.Title }
            });
        }
示例#6
0
        private static Hash CreatePageData(SiteContext context, PageContext pageContext)
        {
            var title = string.IsNullOrWhiteSpace(pageContext.Title) ? context.Title : pageContext.Title;

            var drop = new SiteContextDrop(context);

            return Hash.FromAnonymousObject(new
            {
                site = drop,
                page = new { title },
                content = pageContext.Content
            });
        }