Esempio n. 1
0
        public Content(Templates templates)
        {
            Dependencies.AddRange(nameof(Data), nameof(DirectoryMetadata));

            InputModules = new ModuleList
            {
                new ReadFiles(Config.FromSetting <IEnumerable <string> >(WebKeys.ContentFiles))
            };

            ProcessModules = new ModuleList
            {
                // Concat all documents from externally declared dependencies (exclude explicit dependencies above like "Data")
                new ConcatDocuments(Config.FromContext <IEnumerable <IDocument> >(ctx => ctx.Outputs.FromPipelines(ctx.Pipeline.GetAllDependencies(ctx).Except(Dependencies).ToArray()))),

                // Apply directory metadata
                new ApplyDirectoryMetadata(),

                // Process front matter and sidecar files
                new ProcessMetadata(),

                // Filter out excluded documents
                new FilterDocuments(Config.FromDocument(doc => !doc.GetBool(WebKeys.Excluded))),

                // Filter out archive documents (they'll get processed by the Archives pipeline)
                new FilterDocuments(Config.FromDocument(doc => !Archives.IsArchive(doc))),

                new EnumerateValues(),
                new AddTitle(),
                new SetDestination(".html"),
                new ExecuteIf(Config.FromSetting(WebKeys.OptimizeContentFileNames, true))
                {
                    new OptimizeFileName()
                },
                new RenderProcessTemplates(templates),
                new GenerateExcerpt(), // Note that if the document was .cshtml the except might contain Razor instructions or might not work at all
                new GatherHeadings(),
                new OrderDocuments(),
                new CreateTree().WithNesting(true, true)
            };

            PostProcessModules = new ModuleList
            {
                new FlattenTree(),
                new FilterDocuments(Config.FromDocument(doc => !doc.GetBool(Keys.TreePlaceholder))), // Don't render placeholder pages
                new RenderPostProcessTemplates(templates)
            };

            OutputModules = new ModuleList
            {
                new FilterDocuments(Config.FromDocument(WebKeys.ShouldOutput, true)),
                new WriteFiles()
            };
        }
Esempio n. 2
0
        public Content()
        {
            InputModules = new ModuleList
            {
                new ReadFiles("**/{!_,}*.{html,cshtml,md}")
            };

            ProcessModules = new ModuleList
            {
                new ProcessIncludes(),
                new ExtractFrontMatter(new ParseYaml()),
                new FilterDocuments(Config.FromDocument(doc => !Archives.IsArchive(doc))),
                new EnumerateValues(),
                new AddTitle(),
                new SetDestination(".html"),
                new ExecuteIf(Config.FromDocument(doc => doc.MediaTypeEquals(MediaTypes.Markdown)))
                {
                    new RenderMarkdown().UseExtensions()
                },
                new ExecuteIf(Config.FromDocument(doc => !doc.ContainsKey(HtmlKeys.Excerpt)))
                {
                    new GenerateExcerpt() // Note that if the document was .cshtml the except might contain Razor instructions or might not work at all
                },
                new OrderDocuments(),
                new CreateTree().WithNesting(true, true)
            };

            PostProcessModules = new ModuleList
            {
                new FlattenTree(),
                new FilterDocuments(Config.FromDocument(doc => !doc.GetBool(Keys.TreePlaceholder))), // Don't render placeholder pages
            };
            PostProcessModules.Add(GetRenderModules());

            OutputModules = new ModuleList
            {
                new WriteFiles()
            };
        }