mirror of
https://seed.radicle.dev/rad:z3qg5TKmN83afz2fj9z3fQjU8vaYE.git
synced 2026-11-29 06:20:29 +08:00
refactor: make code to create the preamble clearer
Signed-off-by: Lars Wirzenius <liw@liw.fi>
This commit is contained in:
+24
-27
@@ -114,40 +114,37 @@ impl RunLog {
|
||||
doc.push_to_head(Element::new(Tag::Title).with_text(title));
|
||||
doc.push_to_body(Element::new(Tag::H1).with_text(title));
|
||||
|
||||
let mut ul = Element::new(Tag::Ul);
|
||||
ul.push_child(
|
||||
Element::new(Tag::Li)
|
||||
.with_text("Repository id: ")
|
||||
.with_child(Element::new(Tag::Code).with_text(&rid.to_string()))
|
||||
.with_text(" ")
|
||||
.with_text(repo_name),
|
||||
);
|
||||
ul.push_child(
|
||||
Element::new(Tag::Li)
|
||||
.with_text("Commit: ")
|
||||
.with_child(Element::new(Tag::Code).with_text(&commit.to_string())),
|
||||
);
|
||||
if let Some(branch) = &self.branch {
|
||||
ul.push_child(
|
||||
let ul = Element::new(Tag::Ul)
|
||||
.with_child(
|
||||
Element::new(Tag::Li)
|
||||
.with_text("Repository id: ")
|
||||
.with_child(Element::new(Tag::Code).with_text(&rid.to_string()))
|
||||
.with_text(" ")
|
||||
.with_text(repo_name),
|
||||
)
|
||||
.with_child(
|
||||
Element::new(Tag::Li)
|
||||
.with_text("Commit: ")
|
||||
.with_child(Element::new(Tag::Code).with_text(&commit.to_string())),
|
||||
)
|
||||
.with_child(if let Some(branch) = &self.branch {
|
||||
Element::new(Tag::Li)
|
||||
.with_text("Branch: ")
|
||||
.with_child(Element::new(Tag::Code).with_text(branch)),
|
||||
);
|
||||
}
|
||||
if let Some((patch, title)) = &self.patch {
|
||||
ul.push_child(
|
||||
.with_child(Element::new(Tag::Code).with_text(branch))
|
||||
} else if let Some((patch, title)) = &self.patch {
|
||||
Element::new(Tag::Li)
|
||||
.with_text("Patch: ")
|
||||
.with_child(Element::new(Tag::Code).with_text(&patch.to_string()))
|
||||
.with_text(" ")
|
||||
.with_text(title),
|
||||
.with_text(title)
|
||||
} else {
|
||||
Element::new(Tag::Span)
|
||||
})
|
||||
.with_child(
|
||||
Element::new(Tag::Li)
|
||||
.with_text("Result: ")
|
||||
.with_child(Element::new(Tag::B).with_text(self.result())),
|
||||
);
|
||||
}
|
||||
ul.push_child(
|
||||
Element::new(Tag::Li)
|
||||
.with_text("Result: ")
|
||||
.with_child(Element::new(Tag::B).with_text(self.result())),
|
||||
);
|
||||
doc.push_to_body(ul);
|
||||
|
||||
let mut toc = ToC::default();
|
||||
|
||||
Reference in New Issue
Block a user