public void Process(RenderFieldArgs args) { Assert.ArgumentNotNull(args, "args"); if (!string.IsNullOrEmpty(args.FieldValue)) { args.Result.FirstPart = args.FieldValue; } else { args.Result.FirstPart = args.Item[args.FieldName]; } if (args.FieldTypeKey == "rich text") { WordFieldValue wordFieldValue = WordFieldValue.Parse(args.Result.FirstPart); if (wordFieldValue.BlobId != ID.Null) { args.Result.FirstPart = wordFieldValue.GetHtmlWithStyles(); } } if (args.FieldTypeKey == "markdownfield") { var markdown = new Markdown(); args.Result.FirstPart = markdown.Transform(args.FieldValue); } }
/// <summary> /// Replaces the field value with the value with the token values injected /// </summary> /// <param name="args"></param> public void Process(RenderFieldArgs args) { Assert.ArgumentNotNull((object)args, "args"); string fieldValue = args.FieldValue; if (string.IsNullOrWhiteSpace(args.Result.FirstPart)) { args.Result.FirstPart = string.IsNullOrEmpty(fieldValue) ? args.Item[args.FieldName] : fieldValue; } if (args.FieldTypeKey != "rich text") { return; } try { if (Context.PageMode.IsNormal || Context.PageMode.IsPreview) { args.Result.FirstPart = TokenKeeper.CurrentKeeper.ReplaceRTETokens(args, args.Result.FirstPart); } } catch (MethodAccessException) { args.Result.FirstPart = TokenKeeper.CurrentKeeper.ReplaceRTETokens(args, args.Result.FirstPart); } WordFieldValue wordFieldValue = WordFieldValue.Parse(args.Result.FirstPart); if (wordFieldValue.BlobId == ID.Null) { return; } args.Result.FirstPart = wordFieldValue.GetHtmlWithStyles(); }