<{name}> "#), ContentType::Html);
el.after("
", ContentType::Html);
el.remove_and_keep_content();
Ok(())
}),
element!("xeblog-hero", |el| {
let file = el.get_attribute("file").expect("wanted xeblog-hero to contain file");
el.replace(&crate::tmpl::xeblog_hero(file, el.get_attribute("prompt"), el.get_attribute("ai")).0, ContentType::Html);
Ok(())
}),
element!("xeblog-salary-history", |el| {
el.replace(&crate::tmpl::xeblog_salary_history(cfg.clone()).0, ContentType::Html);
Ok(())
}),
element!("xeblog-sticker", |el| {
let name = el.get_attribute("name").expect("wanted xeblog-sticker to contain name");
let mood = el.get_attribute("mood").expect("wanted xeblog-sticker to contain mood");
el.replace(&crate::tmpl::xeblog_sticker(name, mood).0, ContentType::Html);
Ok(())
}),
element!("xeblog-slide", |el| {
let name = el.get_attribute("name").expect("wanted xeblog-slide to contain name");
let essential = el.get_attribute("essential").is_some();
el.replace(&crate::tmpl::xeblog_slide(name, essential).0, ContentType::Html);
Ok(())
}),
element!("xeblog-talk-warning", |el| {
el.replace(&crate::tmpl::xeblog_talk_warning().0, ContentType::Html);
Ok(())
}),
],
..RewriteStrSettings::default()
}).unwrap();
Ok(html)
}
fn iter_nodes<'a, F>(node: &'a AstNode<'a>, f: &F) -> Result<()>
where
F: Fn(&'a AstNode<'a>) -> Result<()>,
{
f(node)?;
for c in node.children() {
iter_nodes(c, f)?;
}
Ok(())
}
fn without_first(string: &str) -> &str {
string
.char_indices()
.nth(1)
.and_then(|(i, _)| string.get(i..))
.unwrap_or("")
}
fn crop_letters(s: &mut String, pos: usize) {
match s.char_indices().nth(pos) {
Some((pos, _)) => {
s.drain(..pos);
}
None => {
s.clear();
}
}
}