public bool ProcessMarkdownPage(IHttpRequest httpReq, MarkdownPage markdownPage, object dto, IHttpResponse httpRes) { httpRes.AddHeaderLastModified(markdownPage.GetLastModified()); var renderInTemplate = true; var renderHtml = true; string format; if (httpReq != null && (format = httpReq.QueryString["format"]) != null) { renderHtml = !(format.StartsWithIgnoreCase("markdown") || format.StartsWithIgnoreCase("text") || format.StartsWithIgnoreCase("plain")); renderInTemplate = !httpReq.GetFormatModifier().StartsWithIgnoreCase("bare"); } if (!renderHtml) { httpRes.ContentType = ContentType.PlainText; } var markup = RenderDynamicPage(markdownPage, markdownPage.Name, dto, renderHtml, renderInTemplate); var markupBytes = markup.ToUtf8Bytes(); httpRes.OutputStream.Write(markupBytes, 0, markupBytes.Length); return(true); }
public bool ProcessMarkdownPage(IRequest httpReq, MarkdownPage markdownPage, object dto, Stream outputStream) { var httpRes = httpReq.Response; httpRes.AddHeaderLastModified(markdownPage.GetLastModified()); var renderInTemplate = true; var renderHtml = true; string format; if ((format = httpReq.QueryString[Keywords.Format]) != null) { renderHtml = !(format.StartsWithIgnoreCase("markdown") || format.StartsWithIgnoreCase("text") || format.StartsWithIgnoreCase("plain")); renderInTemplate = !httpReq.GetFormatModifier().StartsWithIgnoreCase(Keywords.Bare); } if (!renderHtml) { httpRes.ContentType = MimeTypes.PlainText; } var template = httpReq.GetTemplate(); var markup = RenderDynamicPage(markdownPage, markdownPage.Name, dto, renderHtml, renderInTemplate, template); var markupBytes = markup.ToUtf8Bytes(); outputStream.Write(markupBytes, 0, markupBytes.Length); return(true); }