commit 6833e75d98a2e3fd2e27a96f56ab736dfb7cf155
parent 208951957b47aa884bc886a358d81566abbfd9d9
Author: alex wennerberg <alex@alexwennerberg.com>
Date: Sun, 27 Mar 2022 11:24:25 -0700
cleanup
Diffstat:
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/templates/gmi.rs b/src/templates/gmi.rs
@@ -26,11 +26,12 @@ impl Lists {
impl List {
pub fn to_gmi(&self) -> Vec<String> {
// TODO paginate
+ let page_count = self.thread_topics.len() / PAGE_SIZE + 1;
self.thread_topics
.chunks(PAGE_SIZE)
.enumerate()
.map(|(n, thread_topics)| {
- let mut threads = format!("## {}\n", self.config.name);
+ let mut threads = format!("## {}\n{}\n", self.config.name, self.config.description);
for thread in thread_topics {
threads.push_str(
// TODO reuse with html templates?
@@ -63,6 +64,9 @@ impl List {
.unwrap(),
);
}
+ if n + 1 <= page_count {
+ threads.push_str(&format!("\n=> index-{}.gmi next", n + 1));
+ }
threads
})
.collect()
diff --git a/src/templates/mod.rs b/src/templates/mod.rs
@@ -3,4 +3,4 @@ pub mod html;
pub mod util;
pub mod xml;
-const PAGE_SIZE: usize = 10;
+const PAGE_SIZE: usize = 20;