Ejemplo n.º 1
0
 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"))
     }
                ));
 }
Ejemplo n.º 2
0
 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")
     }
                ));
 }
Ejemplo n.º 3
0
 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")
     }
                ));
 }
Ejemplo n.º 4
0
 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)
     }
                ));
 }
Ejemplo n.º 5
0
        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));
        }
Ejemplo n.º 6
0
 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")
     }
                ));
 }
Ejemplo n.º 7
0
 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")
     }
                ));
 }
Ejemplo n.º 8
0
        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)
            }
                       ));
        }
Ejemplo n.º 9
0
 public async Task <dynamic> RenderAsync(BlockParserContext context, Block block)
 {
     return(await context.ShapeFactory.New.Block__Delimiter());
 }