public IEnumerable<NewsData> GetAll()
        {
            var newsList = new List<NewsData>();
            newsList.AddRange(GetAllWithoutContent());

            var fileProvider = _hostingEnvironment.WebRootFileProvider;
            var directoryContents = fileProvider.GetDirectoryContents(_newsPath).Where(x => x.Name.EndsWith("_content.md"));

            foreach (var news in newsList)
            {
                var contentFileForNews = directoryContents.Single(x => x.Name == $"{news.Id}_content.md");
                string htmlContent = GetHtmlContentFromMarkdownFile(contentFileForNews);

                news.Content = htmlContent;
            }

            return newsList;
        }
Ejemplo n.º 2
0
        public static List<string> ParseMpdnChangelog(List<string> changelog)
        {
            var lines = new List<string> {"<h1>Changelog</h1>", "<div id='changelog'><ol>"};

            lines.AddRange(
                changelog.Select(line => string.IsNullOrWhiteSpace(line) ? null : string.Format("<li>{0}</li>", line)));
            lines.Add("</ol></div>");
            return lines;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Generates all documents.
        /// </summary>
        /// <returns>The generation errors.</returns>
        public GenerationError[] GenerateAll()
        {
            // Register bundles if pdf generation is not skipped
            if (!this.SkipPdf)
                this.RegisterHtmlToXLibraries();

            // Run generation for each configuration
            List<GenerationError> errors = new List<GenerationError>();
            foreach (Configuration configuration in this.IndexConfiguration.Configurations)
            {
                // Generate the documentation
                errors.AddRange(this.Generate(configuration));
            }

            // Generate the index html file if any index template is set
            if (!string.IsNullOrWhiteSpace(this.IndexConfiguration.Template))
            {
                errors.AddRange(this.GenerateIndex(this.IndexConfiguration));
            }

            // Report processing successful
            return errors.ToArray();
        }