public async Task <ActionResult> DataGet([FromRoute][GeneralTimelineName] string timeline, [FromRoute] long post, [FromRoute(Name = "data_index")][Range(0, 100)] long dataIndex) { var timelineId = await _timelineService.GetTimelineIdByNameAsync(timeline); if (!UserHasAllTimelineManagementPermission && !await _timelineService.HasReadPermissionAsync(timelineId, GetOptionalUserId())) { return(ForbidWithCommonResponse()); } return(await DataCacheHelper.GenerateActionResult(this, () => _postService.GetPostDataDigestAsync(timelineId, post, dataIndex), async() => { var data = await _postService.GetPostDataAsync(timelineId, post, dataIndex); if (data.ContentType == MimeTypes.TextMarkdown) { return new ByteData(_markdownProcessor.Process(data.Data, Url, timeline, post), data.ContentType); } return data; } )); }
private IDocumentResult WriteDocument(Document document) { return(_Processor.Process(Context.Option, document)); }
public void ShouldReturnEmptyString() { var proc = new MarkdownProcessor(); Assert.That(proc.Process(null), Is.EqualTo(string.Empty)); }
public void ShouldTransformMarkdownToHtml(string input, string expectedOutput) { var proc = new MarkdownProcessor(); Assert.That(proc.Process(input).StripReturn(), Is.EqualTo(expectedOutput.StripReturn())); }