a funny gag
This commit is contained in:
parent
1225f6d313
commit
7ed058a9db
|
@ -41,14 +41,9 @@
|
|||
+ *where?*
|
||||
|
||||
% id = "01H89RFHCQW4NN6PW6V6RFCVH3"
|
||||
content.link = "about-treehouse/uh"
|
||||
+ ***WHERE???***
|
||||
|
||||
% id = "01H89RFHCQ83APVW034YC40K5P"
|
||||
+ here, actually.
|
||||
|
||||
% id = "01H89RFHCQ0SYWSQZDYHRXKAR0"
|
||||
- I lied. I didn't build this tech to support infinite nesting, as that would require infinite disk space. which I don't have.
|
||||
|
||||
% id = "01H89RFHCQPAMNSN81SRVH2TZ5"
|
||||
- always evolving and shaping and shifting
|
||||
|
||||
|
|
3
content/about-treehouse/uh.tree
Normal file
3
content/about-treehouse/uh.tree
Normal file
|
@ -0,0 +1,3 @@
|
|||
% content.link = "about-treehouse/uh"
|
||||
do_not_persist = true
|
||||
+ …
|
|
@ -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)?;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -17,8 +17,9 @@ class Branch extends HTMLLIElement {
|
|||
this.details = this.childNodes[0];
|
||||
this.innerUL = this.details.childNodes[1];
|
||||
|
||||
let doPersist = !this.hasAttribute("data-th-do-not-persist");
|
||||
let isOpen = branchIsOpen(this.id);
|
||||
if (isOpen !== undefined) {
|
||||
if (doPersist && isOpen !== undefined) {
|
||||
this.details.open = isOpen;
|
||||
}
|
||||
this.details.addEventListener("toggle", _ => {
|
||||
|
|
Loading…
Reference in a new issue