💾 Archived View for lists.flounder.online › patches › threads › 20210320204652.5797-3-johann@qwertqw… captured on 2022-04-28 at 19:24:49. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
From: johann@qwertqwefsday.eu
Date: Sat, 20 Mar 2021 21:46:51 +0100
Message-Id: 20210320204652.5797-3-johann@qwertqwefsday.eu
To: <~aw/patches@lists.sr.ht>
In-Reply-To: 20210320204652.5797-1-johann@qwertqwefsday.eu
Cc: "Johann150" <johann@qwertqwefsday.eu>
--------------------------------------
From: Johann150 <johann@qwertqwefsday.eu>
---
src/main.rs | 10 ++++++++++
templates/index.html | 2 +-
templates/repo-navbar.html | 2 +-
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/main.rs b/src/main.rs
index 167ba95..6d40372 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -449,6 +449,16 @@ mod filters {
.to_str()
.ok_or(askama::Error::Fmt(std::fmt::Error))
}
+
+ pub fn description(repo: &Repository) -> askama::Result<String> {
+ Ok(fs::read_to_string(repo.path().join("description"))
+ .unwrap_or_default()
+ // only use first line
+ .lines()
+ .next()
+ .unwrap_or_default()
+ .to_string())
+ }
}
#[async_std::main]
diff --git a/templates/index.html b/templates/index.html
index c27ce87..8027812 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -7,7 +7,7 @@
{% for repo in repos %}
<tr>
<td class="repo-link"><a href="{{repo|repo_name|urlencode_strict}}">{{repo|repo_name}}</a></td>
- <td class="repo-description">a cool repository</td>
+ <td class="repo-description">{{repo|description}}</td>
<td class="repo-last-updated">updated 2021-02-01</td>
</tr>
{% endfor %}
diff --git a/templates/repo-navbar.html b/templates/repo-navbar.html
index e902449..ddc875a 100644
--- a/templates/repo-navbar.html
+++ b/templates/repo-navbar.html
@@ -1,5 +1,5 @@
<h1><a href="/">index</a>/{{repo|repo_name}}</h1>
-<div>My cool repo</div>
+<div>{{repo|description}}</div>
<div class="clone-url">git clone git.alexwennerberg.com/repo </div>
<div class="navbar"><a href="/{{repo|repo_name|urlencode_strict}}">README</a> | <a href="/{{repo|repo_name|urlencode_strict}}/tree">tree</a> | <a href="/{{repo|repo_name|urlencode_strict}}/log">log</a> | <a href="/{{repo|repo_name|urlencode_strict}}/refs">refs</a></div>
<hr class='thin'>
--
2.20.1