private ContentFilterResult FilterHtmlForList(IPost post, IProjectSettings settings, bool useTeaser) { var result = new ContentFilterResult(); if (useTeaser) { TeaserResult teaserResult = null; string teaser = null; if (!string.IsNullOrWhiteSpace(post.TeaserOverride)) { if (post.ContentType == "markdown") { teaser = MapImageUrlsToCdn( ConvertMarkdownToHtml(post.TeaserOverride), settings.CdnUrl, settings.LocalMediaVirtualPath); } else { teaser = MapImageUrlsToCdn( post.TeaserOverride, settings.CdnUrl, settings.LocalMediaVirtualPath); } result.FilteredContent = teaser; result.IsFullContent = false; } else if (!string.IsNullOrWhiteSpace(post.AutoTeaser)) // as of 2018-08-20 this gets populated on save { teaser = MapImageUrlsToCdn( post.AutoTeaser, settings.CdnUrl, settings.LocalMediaVirtualPath); result.FilteredContent = teaser; result.IsFullContent = false; } else { // need to generate teaser if (post.ContentType == "markdown") { var html = MapImageUrlsToCdn( ConvertMarkdownToHtml(post.CoalesceContentToDraftContent()), settings.CdnUrl, settings.LocalMediaVirtualPath); teaserResult = _teaserService.GenerateTeaser( settings.TeaserTruncationMode, settings.TeaserTruncationLength, html, post.Id, post.Slug, settings.LanguageCode ); } else { var html = MapImageUrlsToCdn( post.CoalesceContentToDraftContent(), settings.CdnUrl, settings.LocalMediaVirtualPath); teaserResult = _teaserService.GenerateTeaser( settings.TeaserTruncationMode, settings.TeaserTruncationLength, html, post.Id, post.Slug, settings.LanguageCode ); } result.FilteredContent = teaserResult.Content; result.IsFullContent = !teaserResult.DidTruncate; } } else { // using full content if (post.ContentType == "markdown") { result.FilteredContent = MapImageUrlsToCdn( ConvertMarkdownToHtml(post.CoalesceContentToDraftContent()), settings.CdnUrl, settings.LocalMediaVirtualPath); } else { result.FilteredContent = MapImageUrlsToCdn( post.CoalesceContentToDraftContent(), settings.CdnUrl, settings.LocalMediaVirtualPath); } result.IsFullContent = true; } return(result); }