private void CreateArticleData() { ExecuteOnStepProgress(90); ExecuteOnStepMessage(StepInput.HtmlStrings.CreatingArticleData); var projectDescription = StepInput.SDProject.Descriptions.GetElementOrDefault(StepInput.CurrentLanguage) ?? new SDTemplate(string.Empty); var homeData = new ArticleData() { Title = "Home", SubTitle = StepInput.HtmlStrings.Description, Content = CommonMarkConverter.Convert(projectDescription.Transform(Helper.TransformLinkToken)).ToObjectString() }; File.WriteAllText(Path.Combine(StepInput.OutputPath, "data", "articles", "home.json"), homeData.TransformText().MinifyJson()); var articles = StepInput.SDProject.Articles.GetElementOrDefault(StepInput.CurrentLanguage); if (articles != null) { foreach (var article in articles) { AddArticle(article); } } }
private void AddArticle(SDArticle sdArticle) { if (!(sdArticle is SDArticlePlaceholder) && !(sdArticle is SDDocPlaceholder)) { var articleData = new ArticleData { Title = sdArticle.Title, Content = CommonMarkConverter.Convert(sdArticle.Content.Transform(Helper.TransformLinkToken)).ToObjectString() }; File.WriteAllText(Path.Combine(StepInput.OutputPath, "data", "articles", sdArticle.Id + ".json"), articleData.TransformText().MinifyJson()); } foreach (var article in sdArticle.Children) { AddArticle(article); } }