use super::prelude::*;
pub const BLOCK_CHECKBOX: BlockRule = BlockRule {
name: "block-checkbox",
accepts_names: &["checkbox"],
accepts_special: true,
accepts_newlines: false,
parse_fn,
};
fn parse_fn<'r, 't>(
log: &slog::Logger,
parser: &mut Parser<'r, 't>,
name: &'t str,
special: bool,
in_head: bool,
) -> ParseResult<'r, 't, Elements<'t>> {
debug!(
log,
"Parsing checkbox block";
"in-head" => in_head,
"name" => name,
"special" => special,
);
assert_block_name(&BLOCK_CHECKBOX, name);
let arguments = parser.get_head_map(&BLOCK_CHECKBOX, in_head)?;
parser.get_optional_space()?;
let element = Element::CheckBox {
checked: special,
attributes: arguments.to_hash_map(),
};
ok!(element)
}