Radish alpha
r
rad:z3qg5TKmN83afz2fj9z3fQjU8vaYE
Radicle CI adapter for native CI
Radicle
Git
refactor: make code to create the preamble clearer
Lars Wirzenius committed 1 year ago
commit 3366fc9074fed1c6535dca8f565847c41f061639
parent 5f7eba8
1 file changed +24 -27
modified src/runlog.rs
@@ -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();