Daniel15.Data.Entities.Blog.PostModel.Content C# (CSharp) Method

Content() public method

Gets the processed content of this blog post
public Content ( ) : string
return string
        public string Content()
        {
            // Replace "more" comment with marker <span>.
            var content = RawContent.Replace(READ_MORE_COMMENT, READ_MORE_HTML_MARKER);

            // HTML encode anything in <pre> tags
            // TODO: Preprocess this instead of doing it every time? Implement preprocessing once moved to Markdown
            content = _preTag.Replace(content, match =>
            {
                // If "escaped=true" found then just return it as-is
                if (match.Groups["attributes"].Value.Contains(ESCAPED_PRE_ATTRIBUTE))
                    return match.Value.Replace(ESCAPED_PRE_ATTRIBUTE, "");

                return "<pre" + match.Groups["attributes"] + ">" + HtmlEncoder.Default.Encode(match.Groups["content"].Value) + "</pre>";
            });

            return content;
        }