Function gutenberg_post_parser::parser::block[]

pub fn block(i: Input) -> IResult<Input, Node, u32>

Recognize a block.

Examples

extern crate gutenberg_post_parser;

use gutenberg_post_parser::{ast::Node, parser::block};

let input = &b"<!-- wp:ns/foo {\"abc\": \"xyz\"} --><!-- /wp:ns/foo -->"[..];
let output = Ok(
    (
        // The remaining data.
        &b""[..],

        // The Abstract Syntax Tree.
        Node::Block {
            name: (&b"ns"[..], &b"foo"[..]),
            attributes: Some(&b"{\"abc\": \"xyz\"}"[..]),
            children: vec![]
        }
    )
);

assert_eq!(block(input), output);