diff --git a/src/pages.rs b/src/pages.rs index d8f19d99..16297d7e 100644 --- a/src/pages.rs +++ b/src/pages.rs @@ -121,7 +121,7 @@ impl PageData { doc.push_to_body(Element::new(Tag::H1).with_text(&title)); - doc.push_to_body(Element::new(Tag::H2).with_text("Broker status")); + Self::h1(&mut doc, "Broker status"); doc.push_to_body( Element::new(Tag::P) .with_text("Last updated: ") @@ -134,7 +134,7 @@ impl PageData { .with_text(")"), ); - doc.push_to_body(Element::new(Tag::H2).with_text("Repositories")); + Self::h1(&mut doc, "Repositories"); doc.push_to_body(Element::new(Tag::P).with_text("Latest CI run for each repository.")); @@ -226,7 +226,7 @@ impl PageData { } doc.push_to_body(list); - doc.push_to_body(Element::new(Tag::H2).with_text("Recent status")); + Self::h1(&mut doc, "Recent status"); let status = StatusData::from(self).as_json()?; doc.push_to_body( Element::new(Tag::P) @@ -255,6 +255,10 @@ impl PageData { ); } + fn h1(page: &mut HtmlPage, text: &str) { + page.push_to_body(Element::new(Tag::H2).with_text(text)); + } + fn whence_as_html(whence: &Whence) -> Element { match whence { Whence::Branch {