public async Task <dynamic> RenderAsync(BlockParserContext context, Block block) { return(await context.ShapeFactory.New.Block__Paragraph( new ParagraphBlockViewModel { Text = BlockParserHelper.AddPathBaseToRelativeLinks(context.HttpContext.Request.PathBase, block.Get("text")) } )); }
public async Task <dynamic> RenderAsync(BlockParserContext context, Block block) { return(await context.ShapeFactory.New.Block__List( new ListBlockViewModel { ListItems = block.Has("items") ? (block.Data["items"] as JArray).ToObject <string[]>() : new string[0], Style = block.Get("style") } )); }
public async Task <dynamic> RenderAsync(BlockParserContext context, Block block) { return(await context.ShapeFactory.New.Block__Heading( new HeadingBlockViewModel { Level = block.Has("level") ? int.Parse(block.Get("level")) : 1, Text = block.Get("text") } )); }
public async Task <dynamic> RenderAsync(BlockParserContext context, Block block) { return(await context.ShapeFactory.New.Block__Image( new ImageBlockViewModel { Caption = block.Get("caption"), Stretched = block.Get("stretched", false), Url = GetMediaUrl(context, block) } )); }
private string GetMediaUrl(BlockParserContext context, Block block) { var mediaPath = block.Get("mediaPath"); if (string.IsNullOrEmpty(mediaPath)) { return(block.Get("url")); } return(context.MediaFileStore.MapPathToPublicUrl(mediaPath)); }
public async Task <dynamic> RenderAsync(BlockParserContext context, Block block) { return(await context.ShapeFactory.New.Block__Quote( new QuoteBlockViewModel { Alignment = block.Get("alignment"), Caption = block.Get("caption"), Text = block.Get("text") } )); }
public async Task <dynamic> RenderAsync(BlockParserContext context, Block block) { return(await context.ShapeFactory.New.Block__Embed( new EmbedBlockViewModel { Caption = block.Get("caption"), Service = block.Get("service"), SourceUrl = block.Get("embed") } )); }
public async Task <dynamic> RenderAsync(BlockParserContext context, Block block) { var templateContext = new TemplateContext(); templateContext.SetValue("ContentItem", context.ContentItem); return(await context.ShapeFactory.New.Block__Raw( new RawBlockViewModel { Html = await context.LiquidTemplateManager.RenderAsync(block.Get("html"), HtmlEncoder.Default, templateContext) } )); }
public async Task <dynamic> RenderAsync(BlockParserContext context, Block block) { return(await context.ShapeFactory.New.Block__Delimiter()); }