diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2024-12-29 19:40:53 +0100 |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2024-12-29 19:40:53 +0100 |
commit | 501622816878fbae771a23449eab6d274e9a147a (patch) | |
tree | 52694fad76d9a05956d41e803a151232c88f5fa5 /web | |
parent | 7471d8fd266fa7c23c9562cabab2e370b303d476 (diff) | |
download | site-501622816878fbae771a23449eab6d274e9a147a.tar.gz |
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.
Diffstat (limited to 'web')
-rw-r--r-- | web/README | 2 | ||||
-rw-r--r-- | web/macros.py | 10 | ||||
-rw-r--r-- | web/page.html | 4 |
3 files changed, 8 insertions, 8 deletions
@@ -2,7 +2,7 @@ Web Site Design | |||
2 | =============== | 2 | =============== |
3 | 3 | ||
4 | The Monitoring Plugins web site is generated using | 4 | The Monitoring Plugins web site is generated using |
5 | <https://bitbucket.org/obensonne/poole>. | 5 | <https://hg.sr.ht/~obensonne/poole>. |
6 | 6 | ||
7 | Color scheme | 7 | Color scheme |
8 | ------------ | 8 | ------------ |
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 @@ | |||
1 | import email.utils | 1 | import email.utils |
2 | import math | ||
2 | import os.path | 3 | import os.path |
3 | import time | 4 | import time |
4 | 5 | ||
@@ -68,9 +69,8 @@ def hook_postconvert_rss(): | |||
68 | desc = 'Announcements published by the Monitoring Plugins Development Team.' | 69 | desc = 'Announcements published by the Monitoring Plugins Development Team.' |
69 | date = email.utils.formatdate() | 70 | date = email.utils.formatdate() |
70 | rss = _RSS % (title, link, desc, date, date, items) | 71 | rss = _RSS % (title, link, desc, date, date, items) |
71 | fp = open(os.path.join(output, 'rss.xml'), 'w') | 72 | with open(os.path.join(output, 'rss.xml'), 'w', encoding='utf-8') as fp: |
72 | fp.write(rss.encode('utf-8')) | 73 | fp.write(rss) |
73 | fp.close() | ||
74 | 74 | ||
75 | # | 75 | # |
76 | # News | 76 | # News |
@@ -80,7 +80,7 @@ def hook_preconvert_news(): | |||
80 | posts_per_page = 10 | 80 | posts_per_page = 10 |
81 | posts = [p for p in pages if 'date' in p] | 81 | posts = [p for p in pages if 'date' in p] |
82 | posts.sort(key=lambda p: p.date, reverse=True) | 82 | posts.sort(key=lambda p: p.date, reverse=True) |
83 | n_news_pages = len(posts) / posts_per_page | 83 | n_news_pages = math.ceil(len(posts) / posts_per_page) |
84 | if len(posts) % posts_per_page > 0: | 84 | if len(posts) % posts_per_page > 0: |
85 | n_news_pages += 1 | 85 | n_news_pages += 1 |
86 | for i, chunk in enumerate(next_news_chunk(posts, posts_per_page)): | 86 | for i, chunk in enumerate(next_news_chunk(posts, posts_per_page)): |
@@ -108,7 +108,7 @@ def make_news_page(posts, current_index): | |||
108 | teaser = ['# ' + title] | 108 | teaser = ['# ' + title] |
109 | for p in posts: | 109 | for p in posts: |
110 | source = list() | 110 | source = list() |
111 | author = p.author.encode('ascii', 'xmlcharrefreplace') | 111 | author = p.author |
112 | timestamp = time.strptime(p.date, '%Y-%m-%d') | 112 | timestamp = time.strptime(p.date, '%Y-%m-%d') |
113 | author_date = author + ', ' + time.strftime('%B %-e, %Y', timestamp) | 113 | author_date = author + ', ' + time.strftime('%B %-e, %Y', timestamp) |
114 | teaser.append('## %s' % p.title) | 114 | 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 @@ | |||
1 | <?xml version="1.0" encoding="{{ __encoding__ }}"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" | 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" |
3 | "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | 3 | "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
4 | 4 | ||
@@ -6,7 +6,7 @@ | |||
6 | 6 | ||
7 | <head> | 7 | <head> |
8 | <title>Monitoring Plugins - {{ hx(page.title) }}</title> | 8 | <title>Monitoring Plugins - {{ hx(page.title) }}</title> |
9 | <meta http-equiv="Content-Type" content="text/html; charset={{ __encoding__ }}" /> | 9 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
10 | <meta name="description" content="{{ hx(page.description) }}" /> | 10 | <meta name="description" content="{{ hx(page.description) }}" /> |
11 | <meta name="keywords" content="{{ hx(page.keywords) }}" /> | 11 | <meta name="keywords" content="{{ hx(page.keywords) }}" /> |
12 | <meta name="viewport" content="width=device-width, initial-scale=1" /> | 12 | <meta name="viewport" content="width=device-width, initial-scale=1" /> |