public EmailTemplateData?Convert(MarkdownFile file) { var helper = new MarkdownFileHelper(file, _logger); var subject = helper.GetRequiredString("subject"); var from = helper.GetOptionalString("from"); var isEnabled = helper.GetOptionalBoolean("enabled") ?? true; var cc = helper.GetOptionalStringList("cc"); var bcc = helper.GetOptionalStringList("bcc"); if (!helper.IsValid) { return(null); } var result = new EmailTemplateData( file.Name, from, cc, bcc, subject, isEnabled, ContentsType.Markdown, file.Markdown); return(result); }
public PostData?Convert(MarkdownFile file) { var helper = new MarkdownFileHelper(file, _logger); var title = helper.GetRequiredString("title"); var author = helper.GetRequiredString("author"); var email = helper.GetOptionalString("email"); var publishedOn = helper.GetRequiredDate("date"); var isPublished = helper.GetOptionalBoolean("published") ?? true; var isListed = helper.GetOptionalBoolean("listed") ?? true; var metaAuthor = helper.GetOptionalString("meta-author"); var metaDescription = helper.GetOptionalString("meta-description"); var metaKeywords = helper.GetOptionalString("meta-keywords"); if (!helper.IsValid) { return(null); } var metaData = new PageMetaData( metaAuthor ?? author, metaDescription, metaKeywords); var result = new PostData( file.Name, title, author, email, publishedOn, isPublished, isListed, file.Markdown, metaData); return(result); }
public StaticPageData?Convert(MarkdownFile file) { var helper = new MarkdownFileHelper(file, _logger); var title = helper.GetRequiredString("title"); var uriSegment = helper.GetRequiredString("uri-segment"); var isPublished = helper.GetOptionalBoolean("published") ?? true; var menuIcon = helper.GetOptionalString("menu-icon"); var menuText = helper.GetOptionalString("menu-text"); var menuSequence = helper.GetOptionalInt32("menu-sequence"); var metaAuthor = helper.GetOptionalString("meta-author"); var metaDescription = helper.GetOptionalString("meta-description"); var metaKeywords = helper.GetOptionalString("meta-keywords"); if (!helper.IsValid) { return(null); } var metaData = new PageMetaData( metaAuthor, metaDescription, metaKeywords); var result = new StaticPageData( file.Name, title, uriSegment, isPublished, menuSequence, menuIcon, menuText, file.Markdown, metaData); return(result); }