rework branches a bit to support saving
This commit is contained in:
parent
6c110b61a2
commit
582447e02b
8 changed files with 99 additions and 59 deletions
|
@ -31,17 +31,21 @@ pub fn branch_to_html(s: &mut String, treehouse: &mut Treehouse, file_id: FileId
|
|||
);
|
||||
|
||||
let class = if has_children { "branch" } else { "leaf" };
|
||||
let component = if let Content::Link(_) = attributes.content {
|
||||
"th-b-linked"
|
||||
} else {
|
||||
"th-b"
|
||||
};
|
||||
|
||||
let linked_branch = if let Content::Link(link) = &attributes.content {
|
||||
format!(
|
||||
" is=\"th-linked-branch\" data-th-link=\"{}\"",
|
||||
EscapeHtml(link)
|
||||
)
|
||||
format!(" data-th-link=\"{}\"", EscapeHtml(link))
|
||||
} else {
|
||||
String::new()
|
||||
};
|
||||
|
||||
write!(
|
||||
s,
|
||||
"<li class=\"{class}\" id=\"{}\"{linked_branch}>",
|
||||
"<li is=\"{component}\" class=\"{class}\" id=\"{}\"{linked_branch}>",
|
||||
EscapeAttribute(&id)
|
||||
)
|
||||
.unwrap();
|
||||
|
|
|
@ -6,7 +6,6 @@ use codespan_reporting::{
|
|||
files::SimpleFiles,
|
||||
term::termcolor::{ColorChoice, StandardStream},
|
||||
};
|
||||
use log::debug;
|
||||
use ulid::Ulid;
|
||||
|
||||
pub type Files = SimpleFiles<String, String>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue