From 501622816878fbae771a23449eab6d274e9a147a Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Sun, 29 Dec 2024 19:40:53 +0100 Subject: Switch to latest Poole version Use the latest Poole code currently available at: https://hg.sr.ht/~obensonne/poole Rather than including the code in this repository, expect it to be found in the PATH (e.g., in $prefix/opt/poole/env/bin). As Poole is Python-3-based now, update web/macros.py accordingly. --- web/README | 2 +- web/macros.py | 10 +++++----- web/page.html | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'web') diff --git a/web/README b/web/README index 48e360c..365c7b2 100644 --- a/web/README +++ b/web/README @@ -2,7 +2,7 @@ Web Site Design =============== The Monitoring Plugins web site is generated using -. +. Color scheme ------------ diff --git a/web/macros.py b/web/macros.py index 3ef93e6..9dfadb2 100644 --- a/web/macros.py +++ b/web/macros.py @@ -1,4 +1,5 @@ import email.utils +import math import os.path import time @@ -68,9 +69,8 @@ def hook_postconvert_rss(): desc = 'Announcements published by the Monitoring Plugins Development Team.' date = email.utils.formatdate() rss = _RSS % (title, link, desc, date, date, items) - fp = open(os.path.join(output, 'rss.xml'), 'w') - fp.write(rss.encode('utf-8')) - fp.close() + with open(os.path.join(output, 'rss.xml'), 'w', encoding='utf-8') as fp: + fp.write(rss) # # News @@ -80,7 +80,7 @@ def hook_preconvert_news(): posts_per_page = 10 posts = [p for p in pages if 'date' in p] posts.sort(key=lambda p: p.date, reverse=True) - n_news_pages = len(posts) / posts_per_page + n_news_pages = math.ceil(len(posts) / posts_per_page) if len(posts) % posts_per_page > 0: n_news_pages += 1 for i, chunk in enumerate(next_news_chunk(posts, posts_per_page)): @@ -108,7 +108,7 @@ def make_news_page(posts, current_index): teaser = ['# ' + title] for p in posts: source = list() - author = p.author.encode('ascii', 'xmlcharrefreplace') + author = p.author timestamp = time.strptime(p.date, '%Y-%m-%d') author_date = author + ', ' + time.strftime('%B %-e, %Y', timestamp) teaser.append('## %s' % p.title) diff --git a/web/page.html b/web/page.html index 8999af9..ee36fb2 100644 --- a/web/page.html +++ b/web/page.html @@ -1,4 +1,4 @@ - + @@ -6,7 +6,7 @@ Monitoring Plugins - {{ hx(page.title) }} - + -- cgit v1.2.3-74-g34f1