static Block ParseBlock(JToken json) { String type = (string)json["type"]; String label = (string)json["label"]; ParsedText p; switch (type) { case "heading1": p = ParseText(json); return(new Heading(p.text, p.spans, 1, label)); case "heading2": p = ParseText(json); return(new Heading(p.text, p.spans, 2, label)); case "heading3": p = ParseText(json); return(new Heading(p.text, p.spans, 3, label)); case "heading4": p = ParseText(json); return(new Heading(p.text, p.spans, 4, label)); case "heading5": p = ParseText(json); return(new Heading(p.text, p.spans, 5, label)); case "heading6": p = ParseText(json); return(new Heading(p.text, p.spans, 6, label)); case "paragraph": p = ParseText(json); return(new Paragraph(p.text, p.spans, label)); case "preformatted": p = ParseText(json); return(new Preformatted(p.text, p.spans, label)); case "list-item": p = ParseText(json); return(new ListItem(p.text, p.spans, false, label)); case "o-list-item": p = ParseText(json); return(new ListItem(p.text, p.spans, true, label)); case "image": fragments.Image.View view = fragments.Image.View.Parse(json); return(new Image(view, label)); case "embed": fragments.Embed obj = fragments.Embed.Parse(json); return(new Embed(obj, label)); } throw new System.Exception("Unable to parse block " + json); }
public Embed(fragments.Embed obj, String label) : base(label) { this.obj = obj; }