use super::prelude::*;
pub const BLOCK_IFRAME: BlockRule = BlockRule {
name: "block-iframe",
accepts_names: &["iframe"],
accepts_special: false,
accepts_newlines: true,
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 iframe block"; "in-head" => in_head);
assert_eq!(special, false, "iframe doesn't allow special variant");
assert_block_name(&BLOCK_IFRAME, name);
let (url, arguments) = parser.get_head_name_map(&BLOCK_IFRAME, in_head)?;
let element = Element::Iframe {
url: cow!(url),
attributes: arguments.to_hash_map(),
};
ok!(element)
}