From af3b0b3c26b0d5578285f75cb08971da171c41a5 Mon Sep 17 00:00:00 2001 From: Bauke Date: Fri, 9 Jun 2023 12:53:37 +0200 Subject: [PATCH] Add the description to group pages. --- source/cli/run.rs | 2 +- source/scss/common.scss | 8 ++++++++ source/templates/group.html | 4 ++++ source/templates/mod.rs | 11 +++++++++-- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/source/cli/run.rs b/source/cli/run.rs index 97cd021..5329d31 100644 --- a/source/cli/run.rs +++ b/source/cli/run.rs @@ -118,7 +118,7 @@ pub async fn run() -> Result<()> { .render(&output, &group.name, true) .await?; - GroupTemplate::new(&group.name) + GroupTemplate::new(group.description.clone(), &group.name) .await .render_to_file(&output) .await?; diff --git a/source/scss/common.scss b/source/scss/common.scss index e42bc65..f32797d 100644 --- a/source/scss/common.scss +++ b/source/scss/common.scss @@ -26,6 +26,7 @@ a:visited { } } +blockquote, h1, h2, h3, @@ -36,6 +37,13 @@ li { padding: 0; } +blockquote { + background-color: var(--background-2); + border-left: 2px solid var(--foreground-1); + margin-bottom: var(--medium-spacing); + padding: var(--medium-spacing); +} + details { border: 1px dashed var(--foreground-1); diff --git a/source/templates/group.html b/source/templates/group.html index b85e1f1..c4cbf8a 100644 --- a/source/templates/group.html +++ b/source/templates/group.html @@ -13,6 +13,10 @@

General

+ {% if let Some(description) = group_description %} +
{{ description }}
+ {% endif %} + {{ group_name }} User Count Chart
diff --git a/source/templates/mod.rs b/source/templates/mod.rs index 6dd750d..6ac0e70 100644 --- a/source/templates/mod.rs +++ b/source/templates/mod.rs @@ -86,7 +86,10 @@ pub struct GroupTemplate { /// Extra HTML to insert in the head. pub extra_head_html: String, - /// The group name for this group. + /// The description for this group. + pub group_description: Option, + + /// The name for this group. pub group_name: String, /// The string for the `` element. @@ -98,7 +101,10 @@ pub struct GroupTemplate { impl GroupTemplate { /// Create a new [`GroupTemplate`]. - pub async fn new(group_name: &str) -> Self { + pub async fn new( + group_description: Option<String>, + group_name: &str, + ) -> Self { let extra_body_html = read_to_string("extra-body.html").await; let extra_head_html = read_to_string("extra-head.html").await; @@ -106,6 +112,7 @@ impl GroupTemplate { base_url: get_base_url(), extra_body_html: extra_body_html.unwrap_or_default(), extra_head_html: extra_head_html.unwrap_or_default(), + group_description, group_name: group_name.to_string(), page_title: "Tildes Statistics".to_string(), today: today(),