a funny gag

This commit is contained in:
りき萌 2023-08-22 22:32:40 +02:00
parent 1225f6d313
commit 7ed058a9db
6 changed files with 22 additions and 8 deletions

View file

@ -154,6 +154,11 @@ impl Generator {
}
};
std::fs::create_dir_all(
target_path
.parent()
.expect("there should be a parent directory to generate files into"),
)?;
std::fs::write(target_path, templated_html)?;
}
}

View file

@ -37,9 +37,15 @@ pub fn branch_to_html(
String::new()
};
let do_not_persist = if branch.attributes.do_not_persist {
" data-th-do-not-persist=\"\""
} else {
""
};
write!(
s,
"<li is=\"{component}\" class=\"{class}\" id=\"{}\"{linked_branch}>",
"<li is=\"{component}\" class=\"{class}\" id=\"{}\"{linked_branch}{do_not_persist}>",
EscapeAttribute(&branch.html_id)
)
.unwrap();

View file

@ -13,6 +13,10 @@ pub struct Attributes {
/// Controls how the block should be presented.
#[serde(default)]
pub content: Content,
/// Do not persist the branch in localStorage.
#[serde(default)]
pub do_not_persist: bool,
}
/// Controls for block content presentation.